	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function timedwait
_timedwait:                             ## @timedwait
	.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	%r13
	pushq	%r12
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, %r15d
	movq	%rdx, %r14
	movl	%esi, %ebx
	movl	%edi, %r12d
	movq	_CLOCK_REALTIME@GOTPCREL(%rip), %r13
	movl	(%r13), %edi
	leaq	-56(%rbp), %rsi
	callq	_clock_gettime
	testq	%rax, %rax
	js	LBB0_7
## %bb.1:
	movslq	%ebx, %rax
	imulq	$274877907, %rax, %rcx          ## imm = 0x10624DD3
	movq	%rcx, %rdx
	shrq	$63, %rdx
	sarq	$38, %rcx
	addl	%edx, %ecx
	movl	%ecx, -48(%rbp)
	imull	$1000, %ecx, %ecx               ## imm = 0x3E8
	subl	%ecx, %eax
	imull	$1000000, %eax, %eax            ## imm = 0xF4240
	movl	%eax, -44(%rbp)
	leaq	-56(%rbp), %rsi
	leaq	-48(%rbp), %rbx
	movq	%rbx, %rdi
	movq	%rbx, %rdx
	callq	_timespecadd
	movl	%r12d, %edi
	movq	%rbx, %rsi
	callq	_ksem_timedwait
	testq	%rax, %rax
	js	LBB0_4
## %bb.2:
	testl	%r15d, %r15d
	je	LBB0_5
## %bb.3:
	leaq	L_.str.2(%rip), %rdi
	callq	_fail_err
	jmp	LBB0_10
LBB0_4:
	movq	_errno@GOTPCREL(%rip), %rax
	cmpl	%r15d, (%rax)
	jne	LBB0_8
LBB0_5:
	movl	(%r13), %edi
	leaq	-48(%rbp), %rsi
	callq	_clock_gettime
	testq	%rax, %rax
	js	LBB0_7
## %bb.6:
	leaq	-56(%rbp), %rsi
	leaq	-48(%rbp), %rdi
	movq	%rdi, %rdx
	callq	_timespecsub
	movslq	-44(%rbp), %rax
	imulq	$1125899907, %rax, %rax         ## imm = 0x431BDE83
	movq	%rax, %rcx
	shrq	$63, %rcx
	sarq	$50, %rax
	imull	$1000, -48(%rbp), %edx          ## imm = 0x3E8
	addl	%ecx, %eax
	addl	%eax, %edx
	movl	%edx, (%r14)
	xorl	%eax, %eax
	jmp	LBB0_11
LBB0_7:
	leaq	L_.str(%rip), %rdi
	jmp	LBB0_9
LBB0_8:
	leaq	L_.str.1(%rip), %rdi
LBB0_9:
	callq	_fail_errno
LBB0_10:
	movl	$-1, %eax
LBB0_11:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	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)"

	.comm	_errno,4,2                      ## @errno
L_.str.1:                               ## @.str.1
	.asciz	"ksem_timedwait"

L_.str.2:                               ## @.str.2
	.asciz	"ksem_timedwait() didn't fail"

	.no_dead_strip	_timedwait
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function timedwait
_timedwait:                             ; @timedwait
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x20, x3
	mov	x19, x2
	mov	x22, x1
	mov	x21, x0
Lloh0:
	adrp	x24, _CLOCK_REALTIME@GOTPAGE
Lloh1:
	ldr	x24, [x24, _CLOCK_REALTIME@GOTPAGEOFF]
	ldr	w0, [x24]
	add	x1, sp, #8
	bl	_clock_gettime
	tbnz	x0, #63, LBB0_7
; %bb.1:
	mov	w23, #16960
	movk	w23, #15, lsl #16
	mov	w8, #19923
	movk	w8, #4194, lsl #16
	smull	x8, w22, w8
	lsr	x9, x8, #63
	asr	x8, x8, #38
	add	w8, w8, w9
	mov	w9, #1000
	msub	w9, w8, w9, w22
	mul	w9, w9, w23
	stp	w8, w9, [sp]
	mov	x0, sp
	add	x1, sp, #8
	mov	x2, sp
	bl	_timespecadd
	mov	x1, sp
	mov	x0, x21
	bl	_ksem_timedwait
	tbnz	x0, #63, LBB0_4
; %bb.2:
	cbz	w20, LBB0_5
; %bb.3:
Lloh2:
	adrp	x0, l_.str.2@PAGE
Lloh3:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_fail_err
	b	LBB0_10
LBB0_4:
Lloh4:
	adrp	x8, _errno@GOTPAGE
Lloh5:
	ldr	x8, [x8, _errno@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	cmp	w8, w20
	b.ne	LBB0_8
LBB0_5:
	ldr	w0, [x24]
	mov	x1, sp
	bl	_clock_gettime
	tbnz	x0, #63, LBB0_7
; %bb.6:
	mov	x0, sp
	add	x1, sp, #8
	mov	x2, sp
	bl	_timespecsub
	mov	w0, #0
	ldp	w9, w8, [sp]
	sdiv	w8, w8, w23
	mov	w10, #1000
	madd	w8, w9, w10, w8
	str	w8, [x19]
	b	LBB0_11
LBB0_7:
Lloh7:
	adrp	x0, l_.str@PAGE
Lloh8:
	add	x0, x0, l_.str@PAGEOFF
	b	LBB0_9
LBB0_8:
Lloh9:
	adrp	x0, l_.str.1@PAGE
Lloh10:
	add	x0, x0, l_.str.1@PAGEOFF
LBB0_9:
	bl	_fail_errno
LBB0_10:
	mov	w0, #-1
LBB0_11:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_CLOCK_REALTIME,4,2             ; @CLOCK_REALTIME
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"clock_gettime(CLOCK_REALTIME)"

	.comm	_errno,4,2                      ; @errno
l_.str.1:                               ; @.str.1
	.asciz	"ksem_timedwait"

l_.str.2:                               ; @.str.2
	.asciz	"ksem_timedwait() didn't fail"

	.no_dead_strip	_timedwait
.subsections_via_symbols
