	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_sem_destroy                    ## -- Begin function sem_destroy
	.p2align	4, 0x90
_sem_destroy:                           ## @sem_destroy
	.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	_EINVAL@GOTPCREL(%rip), %r12
	testq	%rdi, %rdi
	je	LBB0_8
## %bb.1:
	movq	%rdi, %rbx
	movq	(%rdi), %r14
	testq	%r14, %r14
	je	LBB0_8
## %bb.2:
	leaq	8(%r14), %r15
	movq	%r15, %rdi
	callq	_pthread_mutex_lock
	testl	%eax, %eax
	jne	LBB0_13
## %bb.3:
	cmpq	$0, (%r14)
	js	LBB0_9
## %bb.4:
	movl	12(%r14), %edi
	callq	_pte_osSemaphoreDelete
	movq	_PTE_OS_OK@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_10
## %bb.5:
	movq	$0, (%rbx)
	movq	_SEM_VALUE_MAX@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, (%r14)
	movq	%r15, %rdi
	callq	_pthread_mutex_unlock
	movq	_EBUSY@GOTPCREL(%rip), %rbx
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movl	$1, %edi
	callq	_pte_osThreadSleep
	movq	%r15, %rdi
	callq	_pthread_mutex_destroy
	cmpl	(%rbx), %eax
	je	LBB0_6
	jmp	LBB0_14
LBB0_8:
	xorl	%r14d, %r14d
LBB0_12:
	movl	(%r12), %eax
	testl	%eax, %eax
	je	LBB0_14
LBB0_13:
	movq	_errno@GOTPCREL(%rip), %rcx
	movl	%eax, (%rcx)
	movl	$-1, %eax
	jmp	LBB0_15
LBB0_14:
	movq	%r14, %rdi
	callq	_free
	xorl	%eax, %eax
LBB0_15:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_9:
	movq	_EBUSY@GOTPCREL(%rip), %r12
	jmp	LBB0_11
LBB0_10:
	movq	_EINVAL@GOTPCREL(%rip), %r12
LBB0_11:
	movq	%r15, %rdi
	callq	_pthread_mutex_unlock
	jmp	LBB0_12
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_PTE_OS_OK,8,3                  ## @PTE_OS_OK
	.comm	_SEM_VALUE_MAX,8,3              ## @SEM_VALUE_MAX
	.comm	_errno,4,2                      ## @errno
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_sem_destroy                    ; -- Begin function sem_destroy
	.p2align	2
_sem_destroy:                           ; @sem_destroy
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	cbz	x0, LBB0_7
; %bb.1:
	mov	x21, x0
	ldr	x19, [x0]
	cbz	x19, LBB0_8
; %bb.2:
	add	x20, x19, #8
	mov	x0, x20
	bl	_pthread_mutex_lock
	cbnz	w0, LBB0_9
; %bb.3:
	ldr	x8, [x19]
Lloh0:
	adrp	x22, _EBUSY@GOTPAGE
Lloh1:
	ldr	x22, [x22, _EBUSY@GOTPAGEOFF]
	tbnz	x8, #63, LBB0_11
; %bb.4:
	ldr	w0, [x19, #12]
	bl	_pte_osSemaphoreDelete
Lloh2:
	adrp	x8, _PTE_OS_OK@GOTPAGE
Lloh3:
	ldr	x8, [x8, _PTE_OS_OK@GOTPAGEOFF]
Lloh4:
	ldr	x8, [x8]
	cmp	x0, x8
	b.ne	LBB0_10
; %bb.5:
	str	xzr, [x21]
Lloh5:
	adrp	x8, _SEM_VALUE_MAX@GOTPAGE
Lloh6:
	ldr	x8, [x8, _SEM_VALUE_MAX@GOTPAGEOFF]
Lloh7:
	ldr	x8, [x8]
	str	x8, [x19]
	mov	x0, x20
	bl	_pthread_mutex_unlock
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	mov	w0, #1
	bl	_pte_osThreadSleep
	mov	x0, x20
	bl	_pthread_mutex_destroy
	ldr	w8, [x22]
	cmp	w0, w8
	b.eq	LBB0_6
	b	LBB0_12
LBB0_7:
	mov	x19, #0
LBB0_8:
Lloh8:
	adrp	x22, _EINVAL@GOTPAGE
Lloh9:
	ldr	x22, [x22, _EINVAL@GOTPAGEOFF]
Lloh10:
	ldr	w0, [x22]
	cbz	w0, LBB0_12
LBB0_9:
Lloh11:
	adrp	x8, _errno@GOTPAGE
Lloh12:
	ldr	x8, [x8, _errno@GOTPAGEOFF]
Lloh13:
	str	w0, [x8]
	mov	w0, #-1
	b	LBB0_13
LBB0_10:
Lloh14:
	adrp	x22, _EINVAL@GOTPAGE
Lloh15:
	ldr	x22, [x22, _EINVAL@GOTPAGEOFF]
LBB0_11:
	mov	x0, x20
	bl	_pthread_mutex_unlock
	ldr	w0, [x22]
	cbnz	w0, LBB0_9
LBB0_12:
	mov	x0, x19
	bl	_free
	mov	w0, #0
LBB0_13:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotStr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_PTE_OS_OK,8,3                  ; @PTE_OS_OK
	.comm	_SEM_VALUE_MAX,8,3              ; @SEM_VALUE_MAX
	.comm	_errno,4,2                      ; @errno
.subsections_via_symbols
