	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function pte_thread_detach_common
_pte_thread_detach_common:              ## @pte_thread_detach_common
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	_pte_processInitialized@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_8
## %bb.1:
	movl	%edi, %r14d
	movq	_pte_selfThreadKey@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	callq	_pthread_getspecific
	testq	%rax, %rax
	je	LBB0_8
## %bb.2:
	movq	%rax, %r15
	movq	%rax, %rdi
	callq	_pte_callUserDestroyRoutines
	movq	%r15, %rbx
	addq	$8, %rbx
	movq	%rbx, %rdi
	callq	_pthread_mutex_lock
	movq	_PThreadStateLast@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 12(%r15)
	movq	%rbx, %rdi
	callq	_pthread_mutex_unlock
	movq	(%r15), %rax
	movq	_PTHREAD_CREATE_DETACHED@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_6
## %bb.3:
	movq	%r15, %rdi
	testb	%r14b, %r14b
	je	LBB0_5
## %bb.4:
	callq	_pte_threadExitAndDestroy
	jmp	LBB0_8
LBB0_6:
	testb	%r14b, %r14b
	je	LBB0_8
## %bb.7:
	xorl	%eax, %eax
	callq	_pte_osThreadExit
	jmp	LBB0_8
LBB0_5:
	callq	_pte_threadDestroy
LBB0_8:
	movl	$1, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_pte_processInitialized,8,3     ## @pte_processInitialized
	.comm	_pte_selfThreadKey,8,3          ## @pte_selfThreadKey
	.comm	_PThreadStateLast,4,2           ## @PThreadStateLast
	.comm	_PTHREAD_CREATE_DETACHED,8,3    ## @PTHREAD_CREATE_DETACHED
	.no_dead_strip	_pte_thread_detach_common
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function pte_thread_detach_common
_pte_thread_detach_common:              ; @pte_thread_detach_common
	.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
Lloh0:
	adrp	x8, _pte_processInitialized@GOTPAGE
Lloh1:
	ldr	x8, [x8, _pte_processInitialized@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	cbz	x8, LBB0_8
; %bb.1:
	mov	x19, x0
Lloh3:
	adrp	x8, _pte_selfThreadKey@GOTPAGE
Lloh4:
	ldr	x8, [x8, _pte_selfThreadKey@GOTPAGEOFF]
Lloh5:
	ldr	x0, [x8]
	bl	_pthread_getspecific
	cbz	x0, LBB0_8
; %bb.2:
	mov	x20, x0
	bl	_pte_callUserDestroyRoutines
	add	x21, x20, #8
	mov	x0, x21
	bl	_pthread_mutex_lock
Lloh6:
	adrp	x8, _PThreadStateLast@GOTPAGE
Lloh7:
	ldr	x8, [x8, _PThreadStateLast@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	str	w8, [x20, #12]
	mov	x0, x21
	bl	_pthread_mutex_unlock
	ldr	x8, [x20]
Lloh9:
	adrp	x9, _PTHREAD_CREATE_DETACHED@GOTPAGE
Lloh10:
	ldr	x9, [x9, _PTHREAD_CREATE_DETACHED@GOTPAGEOFF]
Lloh11:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_5
; %bb.3:
	mov	x0, x20
	cbz	w19, LBB0_7
; %bb.4:
	bl	_pte_threadExitAndDestroy
	b	LBB0_8
LBB0_5:
	cbz	w19, LBB0_8
; %bb.6:
	bl	_pte_osThreadExit
	b	LBB0_8
LBB0_7:
	bl	_pte_threadDestroy
LBB0_8:
	mov	w0, #1
	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 AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_pte_processInitialized,8,3     ; @pte_processInitialized
	.comm	_pte_selfThreadKey,8,3          ; @pte_selfThreadKey
	.comm	_PThreadStateLast,4,2           ; @PThreadStateLast
	.comm	_PTHREAD_CREATE_DETACHED,8,3    ; @PTHREAD_CREATE_DETACHED
	.no_dead_strip	_pte_thread_detach_common
.subsections_via_symbols
