	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function testwait
_testwait:                              ## @testwait
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r14
	movl	%edi, %ebx
	movq	_CLOCK_REALTIME@GOTPCREL(%rip), %r15
	movl	(%r15), %edi
	leaq	-40(%rbp), %rsi
	callq	_clock_gettime
	testq	%rax, %rax
	js	LBB0_1
## %bb.3:
	movl	%ebx, %edi
	callq	_ksem_wait
	testq	%rax, %rax
	js	LBB0_4
## %bb.5:
	movl	(%r15), %edi
	leaq	-32(%rbp), %rsi
	callq	_clock_gettime
	testq	%rax, %rax
	js	LBB0_1
## %bb.6:
	leaq	-40(%rbp), %rsi
	leaq	-32(%rbp), %rdi
	movq	%rdi, %rdx
	callq	_timespecsub
	movslq	-32(%rbp), %rax
	imulq	$1125899907, %rax, %rax         ## imm = 0x431BDE83
	movq	%rax, %rcx
	shrq	$63, %rcx
	sarq	$50, %rax
	imull	$1000, -28(%rbp), %edx          ## imm = 0x3E8
	addl	%ecx, %eax
	addl	%eax, %edx
	movl	%edx, (%r14)
	xorl	%eax, %eax
	jmp	LBB0_7
LBB0_1:
	leaq	L_.str(%rip), %rdi
	jmp	LBB0_2
LBB0_4:
	leaq	L_.str.1(%rip), %rdi
LBB0_2:
	callq	_fail_errno
	movl	$-1, %eax
LBB0_7:
	addq	$24, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_CLOCK_REALTIME,4,2             ## @CLOCK_REALTIME
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"clock_gettime(CLOCK_REALTIME)"

L_.str.1:                               ## @.str.1
	.asciz	"ksem_wait"

	.no_dead_strip	_testwait
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function testwait
_testwait:                              ; @testwait
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	mov	x19, x1
	mov	x20, x0
Lloh0:
	adrp	x21, _CLOCK_REALTIME@GOTPAGE
Lloh1:
	ldr	x21, [x21, _CLOCK_REALTIME@GOTPAGEOFF]
	ldr	w0, [x21]
	add	x1, sp, #8
	bl	_clock_gettime
	tbnz	x0, #63, LBB0_4
; %bb.1:
	mov	x0, x20
	bl	_ksem_wait
	tbnz	x0, #63, LBB0_5
; %bb.2:
	ldr	w0, [x21]
	mov	x1, sp
	bl	_clock_gettime
	tbnz	x0, #63, LBB0_4
; %bb.3:
	mov	x0, sp
	add	x1, sp, #8
	mov	x2, sp
	bl	_timespecsub
	mov	w0, #0
	mov	w8, #56963
	movk	w8, #17179, lsl #16
	ldp	w9, w10, [sp]
                                        ; kill: def $w9 killed $w9 def $x9
	sxtw	x9, w9
	mul	x8, x9, x8
	lsr	x9, x8, #63
	asr	x8, x8, #50
	add	w8, w8, w9
	mov	w9, #1000
	madd	w8, w10, w9, w8
	str	w8, [x19]
	b	LBB0_7
LBB0_4:
Lloh2:
	adrp	x0, l_.str@PAGE
Lloh3:
	add	x0, x0, l_.str@PAGEOFF
	b	LBB0_6
LBB0_5:
Lloh4:
	adrp	x0, l_.str.1@PAGE
Lloh5:
	add	x0, x0, l_.str.1@PAGEOFF
LBB0_6:
	bl	_fail_errno
	mov	w0, #-1
LBB0_7:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_CLOCK_REALTIME,4,2             ; @CLOCK_REALTIME
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"clock_gettime(CLOCK_REALTIME)"

l_.str.1:                               ; @.str.1
	.asciz	"ksem_wait"

	.no_dead_strip	_testwait
.subsections_via_symbols
