	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	__libc_sem_timedwait_compat     ## -- Begin function _libc_sem_timedwait_compat
	.p2align	4, 0x90
__libc_sem_timedwait_compat:            ## @_libc_sem_timedwait_compat
	.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
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r14
	movq	%rdi, %rbx
	callq	_sem_check_validity
	movl	$-1, %r15d
	testq	%rax, %rax
	jne	LBB0_12
## %bb.1:
	movq	(%rbx), %rax
	cmpq	$0, (%rax)
	je	LBB0_3
## %bb.2:
	movl	$1, %edi
	callq	__pthread_cancel_enter
	movq	(%rbx), %rax
	movl	16(%rax), %edi
	callq	_ksem_wait
	movl	%eax, %r15d
	xorl	%edi, %edi
	cmpl	$-1, %eax
	sete	%dil
	callq	__pthread_cancel_leave
	jmp	LBB0_12
LBB0_3:
	xorl	%r15d, %r15d
	xorl	%eax, %eax
	callq	__pthread_testcancel
	movq	_sem_cancel_handler@GOTPCREL(%rip), %r12
	.p2align	4, 0x90
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%rbx), %rdi
	movl	8(%rdi), %esi
	testl	%esi, %esi
	jle	LBB0_7
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=1
	addq	$8, %rdi
	leal	-1(%rsi), %edx
                                        ## kill: def $esi killed $esi killed $rsi
	callq	_atomic_cmpset_acq_int
	testq	%rax, %rax
	je	LBB0_4
	jmp	LBB0_6
LBB0_7:                                 ##   in Loop: Header=BB0_4 Depth=1
	testl	%r15d, %r15d
	jne	LBB0_8
## %bb.9:                               ##   in Loop: Header=BB0_4 Depth=1
	testq	%r14, %r14
	je	LBB0_13
## %bb.10:                              ##   in Loop: Header=BB0_4 Depth=1
	cmpl	$1000000000, (%r14)             ## imm = 0x3B9ACA00
	jae	LBB0_11
LBB0_13:                                ##   in Loop: Header=BB0_4 Depth=1
	addq	$12, %rdi
	movl	$1, %esi
	callq	_atomic_add_int
	movl	(%r12), %edi
	movq	%rbx, %rsi
	callq	_pthread_cleanup_push
	movl	$1, %edi
	callq	__pthread_cancel_enter
	movq	(%rbx), %rdi
	addq	$8, %rdi
	xorl	%esi, %esi
	movq	%r14, %rdx
	callq	__umtx_wait_uint
	movl	%eax, %r15d
	xorl	%edi, %edi
	callq	__pthread_cancel_leave
	xorl	%edi, %edi
	callq	_pthread_cleanup_pop
	movq	(%rbx), %rdi
	addq	$12, %rdi
	movl	$-1, %esi
	callq	_atomic_add_int
	jmp	LBB0_4
LBB0_6:
	xorl	%r15d, %r15d
LBB0_12:
	movl	%r15d, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	xorl	%eax, %eax
	callq	__pthread_testcancel
	jmp	LBB0_12
LBB0_11:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	_errno@GOTPCREL(%rip), %rcx
	movl	%eax, (%rcx)
	movl	$-1, %r15d
	jmp	LBB0_12
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_errno,4,2                      ## @errno
	.comm	_sem_cancel_handler,4,2         ## @sem_cancel_handler
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	__libc_sem_timedwait_compat     ; -- Begin function _libc_sem_timedwait_compat
	.p2align	2
__libc_sem_timedwait_compat:            ; @_libc_sem_timedwait_compat
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x20, x1
	mov	x19, x0
	bl	_sem_check_validity
	cbz	x0, LBB0_2
LBB0_1:
	mov	w21, #-1
	b	LBB0_12
LBB0_2:
	ldr	x8, [x19]
	ldr	x8, [x8]
	cbz	x8, LBB0_4
; %bb.3:
	mov	w0, #1
	bl	__pthread_cancel_enter
	ldr	x8, [x19]
	ldr	w0, [x8, #16]
	bl	_ksem_wait
	mov	x21, x0
	cmn	w0, #1
	cset	w0, eq
	bl	__pthread_cancel_leave
	b	LBB0_12
LBB0_4:
	bl	__pthread_testcancel
	mov	w21, #0
Lloh0:
	adrp	x22, _sem_cancel_handler@GOTPAGE
Lloh1:
	ldr	x22, [x22, _sem_cancel_handler@GOTPAGEOFF]
	mov	w23, #51712
	movk	w23, #15258, lsl #16
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x19]
	mov	x0, x8
	ldr	w1, [x0, #8]!
	subs	w2, w1, #1
	b.lt	LBB0_7
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	bl	_atomic_cmpset_acq_int
	cbz	x0, LBB0_5
	b	LBB0_11
LBB0_7:                                 ;   in Loop: Header=BB0_5 Depth=1
	cbnz	w21, LBB0_13
; %bb.8:                                ;   in Loop: Header=BB0_5 Depth=1
	cbz	x20, LBB0_10
; %bb.9:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	w9, [x20]
	cmp	w9, w23
	b.hs	LBB0_14
LBB0_10:                                ;   in Loop: Header=BB0_5 Depth=1
	add	x0, x8, #12
	mov	w1, #1
	bl	_atomic_add_int
	ldr	w0, [x22]
	mov	x1, x19
	bl	_pthread_cleanup_push
	mov	w0, #1
	bl	__pthread_cancel_enter
	ldr	x8, [x19]
	add	x0, x8, #8
	mov	w1, #0
	mov	x2, x20
	bl	__umtx_wait_uint
	mov	x21, x0
	mov	w0, #0
	bl	__pthread_cancel_leave
	mov	w0, #0
	bl	_pthread_cleanup_pop
	ldr	x8, [x19]
	add	x0, x8, #12
	mov	w1, #-1
	bl	_atomic_add_int
	b	LBB0_5
LBB0_11:
	mov	w21, #0
LBB0_12:
	mov	x0, x21
	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
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_13:
	bl	__pthread_testcancel
	b	LBB0_12
LBB0_14:
Lloh2:
	adrp	x8, _EINVAL@GOTPAGE
Lloh3:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
Lloh5:
	adrp	x9, _errno@GOTPAGE
Lloh6:
	ldr	x9, [x9, _errno@GOTPAGEOFF]
Lloh7:
	str	w8, [x9]
	b	LBB0_1
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotStr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_errno,4,2                      ; @errno
	.comm	_sem_cancel_handler,4,2         ; @sem_cancel_handler
.subsections_via_symbols
