	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_pthread_detach                 ## -- Begin function pthread_detach
	.p2align	4, 0x90
_pthread_detach:                        ## @pthread_detach
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	movq	_PTE_FALSE@GOTPCREL(%rip), %rax
	movb	(%rax), %r15b
	movq	_pte_thread_reuse_lock@GOTPCREL(%rip), %r12
	movl	(%r12), %edi
	callq	_pte_osMutexLock
	testq	%r14, %r14
	je	LBB0_8
## %bb.1:
	movq	_PTHREAD_CREATE_DETACHED@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rax
	cmpq	8(%r14), %rax
	jne	LBB0_3
## %bb.2:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	jmp	LBB0_9
LBB0_3:
	leaq	28(%r14), %r13
	movq	%r13, %rdi
	callq	_pthread_mutex_lock
	testq	%rax, %rax
	je	LBB0_4
LBB0_8:
	movq	_ESRCH@GOTPCREL(%rip), %rax
LBB0_9:
	movl	(%rax), %ebx
LBB0_10:
	movl	(%r12), %edi
	callq	_pte_osMutexUnlock
	testl	%ebx, %ebx
	jne	LBB0_13
## %bb.11:
	testb	%r15b, %r15b
	je	LBB0_13
## %bb.12:
	movl	24(%r14), %edi
	callq	_pte_osThreadWaitForEnd
	movq	%r14, %rdi
	callq	_pte_threadDestroy
LBB0_13:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	movq	16(%r14), %rax
	movq	_PThreadStateLast@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_5
## %bb.6:
	movq	8(%r14), %rax
	cmpq	(%rbx), %rax
	movq	_PTE_TRUE@GOTPCREL(%rip), %rax
	movzbl	%r15b, %ecx
	movzbl	(%rax), %r15d
	cmovel	%ecx, %r15d
	jmp	LBB0_7
LBB0_5:
	movq	(%rbx), %rax
	movq	%rax, 8(%r14)
LBB0_7:
	movq	%r13, %rdi
	callq	_pthread_mutex_unlock
	xorl	%ebx, %ebx
	jmp	LBB0_10
	.cfi_endproc
                                        ## -- End function
	.comm	_PTE_FALSE,1,0                  ## @PTE_FALSE
	.comm	_pte_thread_reuse_lock,4,2      ## @pte_thread_reuse_lock
	.comm	_ESRCH,4,2                      ## @ESRCH
	.comm	_PTHREAD_CREATE_DETACHED,8,3    ## @PTHREAD_CREATE_DETACHED
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_PThreadStateLast,8,3           ## @PThreadStateLast
	.comm	_PTE_TRUE,1,0                   ## @PTE_TRUE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_pthread_detach                 ; -- Begin function pthread_detach
	.p2align	2
_pthread_detach:                        ; @pthread_detach
	.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	x19, x0
Lloh0:
	adrp	x8, _PTE_FALSE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _PTE_FALSE@GOTPAGEOFF]
	ldrb	w21, [x8]
Lloh2:
	adrp	x22, _pte_thread_reuse_lock@GOTPAGE
Lloh3:
	ldr	x22, [x22, _pte_thread_reuse_lock@GOTPAGEOFF]
	ldr	w0, [x22]
	bl	_pte_osMutexLock
	cbz	x19, LBB0_4
; %bb.1:
Lloh4:
	adrp	x23, _PTHREAD_CREATE_DETACHED@GOTPAGE
Lloh5:
	ldr	x23, [x23, _PTHREAD_CREATE_DETACHED@GOTPAGEOFF]
	ldr	x8, [x23]
	ldr	x9, [x19, #8]
	cmp	x8, x9
	b.ne	LBB0_3
; %bb.2:
Lloh6:
	adrp	x8, _EINVAL@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_5
LBB0_3:
	add	x20, x19, #28
	mov	x0, x20
	bl	_pthread_mutex_lock
	cbz	x0, LBB0_9
LBB0_4:
Lloh8:
	adrp	x8, _ESRCH@GOTPAGE
Lloh9:
	ldr	x8, [x8, _ESRCH@GOTPAGEOFF]
LBB0_5:
	ldr	w20, [x8]
LBB0_6:
	ldr	w0, [x22]
	bl	_pte_osMutexUnlock
	cmp	w20, #0
	and	w8, w21, #0xff
	ccmp	w8, #0, #4, eq
	b.eq	LBB0_8
; %bb.7:
	ldr	w0, [x19, #24]
	bl	_pte_osThreadWaitForEnd
	mov	x0, x19
	bl	_pte_threadDestroy
LBB0_8:
	mov	x0, x20
	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_9:
	ldr	x8, [x19, #16]
Lloh10:
	adrp	x9, _PThreadStateLast@GOTPAGE
Lloh11:
	ldr	x9, [x9, _PThreadStateLast@GOTPAGEOFF]
Lloh12:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_11
; %bb.10:
	ldr	x8, [x19, #8]
	ldr	x9, [x23]
Lloh13:
	adrp	x10, _PTE_TRUE@GOTPAGE
Lloh14:
	ldr	x10, [x10, _PTE_TRUE@GOTPAGEOFF]
	ldrb	w10, [x10]
	cmp	x8, x9
	csel	w21, w21, w10, eq
	b	LBB0_12
LBB0_11:
	ldr	x8, [x23]
	str	x8, [x19, #8]
LBB0_12:
	mov	x0, x20
	bl	_pthread_mutex_unlock
	mov	w20, #0
	b	LBB0_6
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_PTE_FALSE,1,0                  ; @PTE_FALSE
	.comm	_pte_thread_reuse_lock,4,2      ; @pte_thread_reuse_lock
	.comm	_ESRCH,4,2                      ; @ESRCH
	.comm	_PTHREAD_CREATE_DETACHED,8,3    ; @PTHREAD_CREATE_DETACHED
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_PThreadStateLast,8,3           ; @PThreadStateLast
	.comm	_PTE_TRUE,1,0                   ; @PTE_TRUE
.subsections_via_symbols
