	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	__thr_detach                    ## -- Begin function _thr_detach
	.p2align	4, 0x90
__thr_detach:                           ## @_thr_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	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rdi, %rbx
	xorl	%eax, %eax
	callq	__get_curthread
	testq	%rbx, %rbx
	je	LBB0_1
## %bb.2:
	movq	%rax, %r14
	movq	%rax, %rdi
	movq	%rbx, %rsi
	movl	$1, %edx
	callq	__thr_find_thread
	testl	%eax, %eax
	jne	LBB0_7
## %bb.3:
	movl	(%rbx), %eax
	movq	_THR_FLAGS_DETACHED@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%eax, %ecx
	jne	LBB0_5
## %bb.4:
	cmpq	$0, 8(%rbx)
	je	LBB0_6
LBB0_5:
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	_THR_THREAD_UNLOCK
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
LBB0_7:
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
LBB0_6:
	orl	%eax, %ecx
	movl	%ecx, (%rbx)
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	__thr_try_gc
	xorl	%eax, %eax
	jmp	LBB0_7
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_THR_FLAGS_DETACHED,4,2         ## @THR_FLAGS_DETACHED
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	__thr_detach                    ; -- Begin function _thr_detach
	.p2align	2
__thr_detach:                           ; @_thr_detach
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
	bl	__get_curthread
	cbz	x19, LBB0_5
; %bb.1:
	mov	x20, x0
	mov	x1, x19
	mov	w2, #1
	bl	__thr_find_thread
	cbnz	w0, LBB0_6
; %bb.2:
	ldr	w8, [x19]
Lloh0:
	adrp	x9, _THR_FLAGS_DETACHED@GOTPAGE
Lloh1:
	ldr	x9, [x9, _THR_FLAGS_DETACHED@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	tst	w9, w8
	b.ne	LBB0_4
; %bb.3:
	ldr	x10, [x19, #8]
	cbz	x10, LBB0_7
LBB0_4:
	mov	x0, x20
	mov	x1, x19
	bl	_THR_THREAD_UNLOCK
LBB0_5:
Lloh3:
	adrp	x8, _EINVAL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh5:
	ldr	w0, [x8]
LBB0_6:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
LBB0_7:
	orr	w8, w9, w8
	str	w8, [x19]
	mov	x0, x20
	mov	x1, x19
	bl	__thr_try_gc
	mov	w0, #0
	b	LBB0_6
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_THR_FLAGS_DETACHED,4,2         ; @THR_FLAGS_DETACHED
.subsections_via_symbols
