	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_sem_timedwait                  ## -- Begin function sem_timedwait
	.p2align	4, 0x90
_sem_timedwait:                         ## @sem_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	%r12
	pushq	%rbx
	subq	$32, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %rbx
	movq	%rdi, %r15
	movq	(%rdi), %r12
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	callq	_pthread_testcancel
	testq	%rbx, %rbx
	je	LBB0_2
## %bb.1:
	movq	%rbx, %rdi
	callq	_pte_relmillisecs
	movl	%eax, -40(%rbp)
	leaq	-40(%rbp), %r14
LBB0_2:
	leaq	8(%r12), %rbx
	movq	%rbx, %rdi
	callq	_pthread_mutex_lock
	movl	%eax, -36(%rbp)
	testl	%eax, %eax
	je	LBB0_3
LBB0_9:
	movq	_errno@GOTPCREL(%rip), %rcx
	movl	%eax, (%rcx)
	movl	$-1, %eax
LBB0_10:
	addq	$32, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_3:
	cmpq	$0, (%r15)
	je	LBB0_8
## %bb.4:
	movl	(%r12), %r15d
	leal	-1(%r15), %eax
	movl	%eax, (%r12)
	movq	%rbx, %rdi
	callq	_pthread_mutex_unlock
	testl	%r15d, %r15d
	jg	LBB0_6
## %bb.5:
	movq	%r12, -48(%rbp)
	leaq	-36(%rbp), %rax
	movq	%rax, -56(%rbp)
	movq	_pte_sem_timedwait_cleanup@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	-56(%rbp), %rsi
	callq	_pthread_cleanup_push
	movl	4(%r12), %edi
	movq	%r14, %rsi
	callq	_pte_cancellable_wait
	movl	%eax, -36(%rbp)
	movl	%eax, %edi
	callq	_pthread_cleanup_pop
LBB0_6:
	movl	-36(%rbp), %eax
	testl	%eax, %eax
	jne	LBB0_9
## %bb.7:
	xorl	%eax, %eax
	jmp	LBB0_10
LBB0_8:
	movq	%rbx, %rdi
	callq	_pthread_mutex_unlock
	movq	_EINVAL@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	jmp	LBB0_9
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,8,3                     ## @EINVAL
	.comm	_errno,4,2                      ## @errno
	.comm	_pte_sem_timedwait_cleanup,4,2  ## @pte_sem_timedwait_cleanup
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_sem_timedwait                  ; -- Begin function sem_timedwait
	.p2align	2
_sem_timedwait:                         ; @sem_timedwait
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	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
	mov	x19, x1
	mov	x20, x0
	ldr	x22, [x0]
	bl	_pthread_testcancel
	cbz	x19, LBB0_2
; %bb.1:
	mov	x0, x19
	bl	_pte_relmillisecs
	str	w0, [sp, #24]
	add	x19, sp, #24
LBB0_2:
	add	x21, x22, #8
	mov	x0, x21
	bl	_pthread_mutex_lock
	str	w0, [sp, #28]
	cbz	w0, LBB0_6
LBB0_3:
Lloh0:
	adrp	x8, _errno@GOTPAGE
Lloh1:
	ldr	x8, [x8, _errno@GOTPAGEOFF]
Lloh2:
	str	w0, [x8]
LBB0_4:
	mov	w0, #-1
LBB0_5:
	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
	add	sp, sp, #80
	ret
LBB0_6:
	ldr	x8, [x20]
	cbz	x8, LBB0_9
; %bb.7:
	ldr	w20, [x22]
	sub	w8, w20, #1
	str	w8, [x22]
	mov	x0, x21
	bl	_pthread_mutex_unlock
	cmp	w20, #0
	b.le	LBB0_10
; %bb.8:
	ldr	w0, [sp, #28]
	cbnz	w0, LBB0_3
	b	LBB0_5
LBB0_9:
	mov	x0, x21
	bl	_pthread_mutex_unlock
Lloh3:
	adrp	x8, _EINVAL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh5:
	ldr	x8, [x8]
Lloh6:
	adrp	x9, _errno@GOTPAGE
Lloh7:
	ldr	x9, [x9, _errno@GOTPAGEOFF]
Lloh8:
	str	w8, [x9]
	b	LBB0_4
LBB0_10:
	add	x8, sp, #28
	stp	x8, x22, [sp, #8]
Lloh9:
	adrp	x8, _pte_sem_timedwait_cleanup@GOTPAGE
Lloh10:
	ldr	x8, [x8, _pte_sem_timedwait_cleanup@GOTPAGEOFF]
Lloh11:
	ldr	w0, [x8]
	add	x1, sp, #8
	bl	_pthread_cleanup_push
	ldr	w0, [x22, #4]
	mov	x1, x19
	bl	_pte_cancellable_wait
	str	w0, [sp, #28]
	bl	_pthread_cleanup_pop
	ldr	w0, [sp, #28]
	cbnz	w0, LBB0_3
	b	LBB0_5
	.loh AdrpLdrGotStr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotStr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,8,3                     ; @EINVAL
	.comm	_errno,4,2                      ; @errno
	.comm	_pte_sem_timedwait_cleanup,4,2  ; @pte_sem_timedwait_cleanup
.subsections_via_symbols
