1 thread data $i = align 4 {w 42}
2 data $fmti = align 1 {b "i%d==%d\n", b 0}
4 thread data $x = {w 1, w 2, w 3, w 4}
5 data $fmtx = align 1 {b "*(x+%d)==%d\n", b 0}
12 call $pthread_create(l %pthr, l 0, l $thread, l 0)
14 call $pthread_join(l %t, l %rval)
15 %i0 =w loadw thread $i
16 call $printf(l $fmti, ..., w 0, w %i0)
18 call $printf(l $fmti, ..., w 1, w %i1)
22 call $printf(l $fmtx, ..., w 0, w %x0)
23 %a4 =l call $xaddroff4()
25 call $printf(l $fmtx, ..., w 4, w %x4)
26 %a8 =l call $xaddroff(l 8)
28 call $printf(l $fmtx, ..., w 8, w %x8)
29 %xc =l call $xvalcnt(l 3)
30 call $printf(l $fmtx, ..., w 12, w %xc)
34 function l $thread(l %arg) {
36 %i3 =l add thread $i, 3
38 %ret =l loadsw thread $i
47 function l $xaddroff4() {
49 %a =l add 4, thread $x
53 function l $xaddroff(l %off) {
55 %a =l add thread $x, %off
59 function w $xvalcnt(l %cnt) {
62 %a =l add thread $x, %o