1.set	noreorder
2.global	__clone
3.type	__clone,@function
4__clone:
5	# Save function pointer and argument pointer on new thread stack
6	and	$5, $5, -16	# aligning stack to double word
7	subu	$5, $5, 16
8	sw	$4, 0($5)	# save function pointer
9	sw	$7, 4($5)	# save argument pointer
10
11	# Shuffle (fn,sp,fl,arg,ptid,tls,ctid) to (fl,sp,ptid,tls,ctid)
12	# sys_clone(u64 flags, u64 ustack_base, u64 parent_tidptr, u64 child_tidptr, u64 tls)
13	move	$4, $6
14	move	$6, $8
15	move	$7, $9
16	move	$8, $10
17	li	$2, 6055
18	syscall
19	beq	$7, $0, 1f
20	nop
21	jr	$ra
22	subu	$2, $0, $2
231:	beq	$2, $0, 1f
24	nop
25	jr	$ra
26	nop
271:	lw	$25, 0($sp)	# function pointer
28	lw	$4, 4($sp)	# argument pointer
29	jr	$25		# call the user's function
30	nop
31