	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	__thr_free                      ## -- Begin function _thr_free
	.p2align	4, 0x90
__thr_free:                             ## @_thr_free
	.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, %rbx
	movq	%rdi, %r14
	leaq	L_.str(%rip), %rdi
	callq	_DBG_MSG
	testq	%r14, %r14
	je	LBB0_1
## %bb.2:
	movq	_tcb_lock@GOTPCREL(%rip), %r15
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	_THR_LOCK_ACQUIRE
	movq	(%rbx), %rdi
	callq	__tcb_dtor
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	_THR_LOCK_RELEASE
	movq	$0, (%rbx)
	movq	_free_thread_count@GOTPCREL(%rip), %r12
	movq	(%r12), %rax
	movq	_MAX_CACHED_THREADS@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jge	LBB0_3
## %bb.4:
	movq	_free_thread_lock@GOTPCREL(%rip), %r15
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	_THR_LOCK_ACQUIRE
	movq	_tle@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_free_threadq@GOTPCREL(%rip), %rdi
	movq	%rbx, %rsi
	callq	_TAILQ_INSERT_TAIL
	incq	(%r12)
	movq	%r14, %rdi
	movq	%r15, %rsi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_THR_LOCK_RELEASE               ## TAILCALL
LBB0_1:
	movq	(%rbx), %rdi
	callq	__tcb_dtor
	movq	$0, (%rbx)
LBB0_3:
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	_thr_destroy
	movq	_total_threads@GOTPCREL(%rip), %rdi
	movl	$-1, %esi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_atomic_fetchadd_int            ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Freeing thread %p\n"

	.comm	_tcb_lock,4,2                   ## @tcb_lock
	.comm	_free_thread_count,8,3          ## @free_thread_count
	.comm	_MAX_CACHED_THREADS,8,3         ## @MAX_CACHED_THREADS
	.comm	_total_threads,4,2              ## @total_threads
	.comm	_free_thread_lock,4,2           ## @free_thread_lock
	.comm	_free_threadq,4,2               ## @free_threadq
	.comm	_tle,4,2                        ## @tle
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	__thr_free                      ; -- Begin function _thr_free
	.p2align	2
__thr_free:                             ; @_thr_free
	.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
	mov	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DBG_MSG
	cbz	x19, LBB0_3
; %bb.1:
Lloh2:
	adrp	x21, _tcb_lock@GOTPAGE
Lloh3:
	ldr	x21, [x21, _tcb_lock@GOTPAGEOFF]
	mov	x0, x19
	mov	x1, x21
	bl	_THR_LOCK_ACQUIRE
	ldr	x0, [x20]
	bl	__tcb_dtor
	mov	x0, x19
	mov	x1, x21
	bl	_THR_LOCK_RELEASE
Lloh4:
	adrp	x22, _free_thread_count@GOTPAGE
Lloh5:
	ldr	x22, [x22, _free_thread_count@GOTPAGEOFF]
	str	xzr, [x20]
	ldr	x8, [x22]
Lloh6:
	adrp	x9, _MAX_CACHED_THREADS@GOTPAGE
Lloh7:
	ldr	x9, [x9, _MAX_CACHED_THREADS@GOTPAGEOFF]
Lloh8:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ge	LBB0_4
; %bb.2:
Lloh9:
	adrp	x21, _free_thread_lock@GOTPAGE
Lloh10:
	ldr	x21, [x21, _free_thread_lock@GOTPAGEOFF]
	mov	x0, x19
	mov	x1, x21
	bl	_THR_LOCK_ACQUIRE
Lloh11:
	adrp	x8, _tle@GOTPAGE
Lloh12:
	ldr	x8, [x8, _tle@GOTPAGEOFF]
Lloh13:
	ldr	w2, [x8]
Lloh14:
	adrp	x0, _free_threadq@GOTPAGE
Lloh15:
	ldr	x0, [x0, _free_threadq@GOTPAGEOFF]
	mov	x1, x20
	bl	_TAILQ_INSERT_TAIL
	ldr	x8, [x22]
	add	x8, x8, #1
	str	x8, [x22]
	mov	x0, x19
	mov	x1, x21
	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
	b	_THR_LOCK_RELEASE
LBB0_3:
	ldr	x0, [x20]
	bl	__tcb_dtor
	str	xzr, [x20]
LBB0_4:
	mov	x0, x19
	mov	x1, x20
	bl	_thr_destroy
Lloh16:
	adrp	x0, _total_threads@GOTPAGE
Lloh17:
	ldr	x0, [x0, _total_threads@GOTPAGEOFF]
	mov	w1, #-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
	b	_atomic_fetchadd_int
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Freeing thread %p\n"

	.comm	_tcb_lock,4,2                   ; @tcb_lock
	.comm	_free_thread_count,8,3          ; @free_thread_count
	.comm	_MAX_CACHED_THREADS,8,3         ; @MAX_CACHED_THREADS
	.comm	_total_threads,4,2              ; @total_threads
	.comm	_free_thread_lock,4,2           ; @free_thread_lock
	.comm	_free_threadq,4,2               ; @free_threadq
	.comm	_tle,4,2                        ; @tle
.subsections_via_symbols
