	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_free_std_msg_buffer            ## -- Begin function free_std_msg_buffer
	.p2align	4, 0x90
_free_std_msg_buffer:                   ## @free_std_msg_buffer
	.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, %r14
	movq	%rdi, %r12
	xorl	%edi, %edi
	cmpl	$0, (%rsi)
	jne	LBB0_4
## %bb.1:
	movq	8(%r14), %rax
	movq	_MSG_BUFFER_USED_MAGIC@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_4
## %bb.2:
	movq	(%r12), %rax
	movq	_MSG_CHUNK_USED_MAGIC@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_4
## %bb.3:
	xorl	%edi, %edi
	cmpq	%r12, 16(%r14)
	sete	%dil
LBB0_4:
	callq	_assert
	movq	%r12, %rdi
	movq	%r14, %rsi
	callq	_get_buffer_no
	movl	%eax, %r15d
	movslq	8(%r12), %rbx
	movq	_verbosity@GOTPCREL(%rip), %rax
	cmpl	$3, (%rax)
	jl	LBB0_6
## %bb.5:
	movq	_stderr@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	movl	%r15d, %edx
	callq	_fprintf
LBB0_6:
	movslq	%r15d, %rax
	addq	%rax, %rbx
	movq	16(%r12), %rax
	xorl	%edi, %edi
	cmpq	$0, (%rax,%rbx,8)
	sete	%dil
	callq	_assert
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movq	16(%r12), %rax
	movslq	%ebx, %r15
	movq	(%rax,%r15,8), %rdi
	leaq	1(%rdi), %rcx
	movq	%rcx, (%rax,%r15,8)
	shrq	$63, %rdi
	xorl	$1, %edi
                                        ## kill: def $edi killed $edi killed $rdi
	callq	_assert
	movl	%r15d, %ebx
	sarl	%ebx
	cmpl	$1, %r15d
	ja	LBB0_7
## %bb.8:
	movq	_MSG_BUFFER_FREE_MAGIC@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 8(%r14)
	movl	$-1073741824, (%r14)            ## imm = 0xC0000000
	movq	32(%r12), %rax
	incl	(%rax)
	movl	40(%r12), %ecx
	movq	_total_used_buffers_size@GOTPCREL(%rip), %rdx
	subl	%ecx, (%rdx)
	movq	_total_used_buffers@GOTPCREL(%rip), %rcx
	decl	(%rcx)
	movq	16(%r12), %rcx
	cmpq	$0, 8(%rcx)
	jne	LBB0_11
## %bb.9:
	movl	(%rax), %eax
	shll	$2, %eax
	movl	24(%r12), %ecx
	leal	(%rcx,%rcx,4), %ecx
	cmpl	%ecx, %eax
	jl	LBB0_11
## %bb.10:
	movq	%r12, %rdi
	callq	_free_msg_buffers_chunk
LBB0_11:
	movl	$1, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MSG_BUFFER_USED_MAGIC,8,3      ## @MSG_BUFFER_USED_MAGIC
	.comm	_MSG_CHUNK_USED_MAGIC,8,3       ## @MSG_CHUNK_USED_MAGIC
	.comm	_verbosity,4,2                  ## @verbosity
	.comm	_stderr,4,2                     ## @stderr
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"free_msg_buffer(%d)\n"

	.comm	_MSG_BUFFER_FREE_MAGIC,8,3      ## @MSG_BUFFER_FREE_MAGIC
	.comm	_total_used_buffers_size,4,2    ## @total_used_buffers_size
	.comm	_total_used_buffers,4,2         ## @total_used_buffers
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_free_std_msg_buffer            ; -- Begin function free_std_msg_buffer
	.p2align	2
_free_std_msg_buffer:                   ; @free_std_msg_buffer
	.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
	ldr	w8, [x1]
	cbnz	w8, LBB0_4
; %bb.1:
	ldr	x8, [x20, #8]
Lloh0:
	adrp	x9, _MSG_BUFFER_USED_MAGIC@GOTPAGE
Lloh1:
	ldr	x9, [x9, _MSG_BUFFER_USED_MAGIC@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_4
; %bb.2:
	ldr	x8, [x19]
Lloh3:
	adrp	x9, _MSG_CHUNK_USED_MAGIC@GOTPAGE
Lloh4:
	ldr	x9, [x9, _MSG_CHUNK_USED_MAGIC@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_4
; %bb.3:
	ldr	x8, [x20, #16]
	cmp	x8, x19
	cset	w0, eq
	b	LBB0_5
LBB0_4:
	mov	w0, #0
LBB0_5:
	bl	_assert
	mov	x0, x19
	mov	x1, x20
	bl	_get_buffer_no
	mov	x21, x0
	ldr	w22, [x19, #8]
Lloh6:
	adrp	x8, _verbosity@GOTPAGE
Lloh7:
	ldr	x8, [x8, _verbosity@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	cmp	w8, #3
	b.lt	LBB0_7
; %bb.6:
Lloh9:
	adrp	x8, _stderr@GOTPAGE
Lloh10:
	ldr	x8, [x8, _stderr@GOTPAGEOFF]
Lloh11:
	ldr	w0, [x8]
Lloh12:
	adrp	x1, l_.str@PAGE
Lloh13:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x21
	bl	_fprintf
LBB0_7:
	add	w21, w22, w21
	ldr	x8, [x19, #16]
	ldr	x8, [x8, w21, sxtw #3]
	cmp	x8, #0
	cset	w0, eq
	bl	_assert
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x19, #16]
	sbfiz	x9, x21, #3, #32
	ldr	x10, [x8, x9]
	add	x11, x10, #1
	str	x11, [x8, x9]
	lsr	x8, x10, #63
	eor	w0, w8, #0x1
	bl	_assert
	asr	w8, w21, #1
	cmp	w21, #1
	mov	x21, x8
	b.hi	LBB0_8
; %bb.9:
Lloh14:
	adrp	x8, _MSG_BUFFER_FREE_MAGIC@GOTPAGE
Lloh15:
	ldr	x8, [x8, _MSG_BUFFER_FREE_MAGIC@GOTPAGEOFF]
Lloh16:
	ldr	x8, [x8]
	str	x8, [x20, #8]
	mov	w8, #-1073741824
	str	w8, [x20]
	ldr	x8, [x19, #32]
	ldr	w9, [x8]
	add	w9, w9, #1
	str	w9, [x8]
	ldr	w9, [x19, #40]
Lloh17:
	adrp	x10, _total_used_buffers_size@GOTPAGE
Lloh18:
	ldr	x10, [x10, _total_used_buffers_size@GOTPAGEOFF]
	ldr	w11, [x10]
	sub	w9, w11, w9
Lloh19:
	adrp	x11, _total_used_buffers@GOTPAGE
Lloh20:
	ldr	x11, [x11, _total_used_buffers@GOTPAGEOFF]
	str	w9, [x10]
	ldr	w9, [x11]
	sub	w9, w9, #1
	str	w9, [x11]
	ldr	x9, [x19, #16]
	ldr	x9, [x9, #8]
	cbnz	x9, LBB0_12
; %bb.10:
	ldr	w8, [x8]
	ldr	w9, [x19, #24]
	add	w9, w9, w9, lsl #2
	cmp	w9, w8, lsl #2
	b.gt	LBB0_12
; %bb.11:
	mov	x0, x19
	bl	_free_msg_buffers_chunk
LBB0_12:
	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	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.comm	_MSG_BUFFER_USED_MAGIC,8,3      ; @MSG_BUFFER_USED_MAGIC
	.comm	_MSG_CHUNK_USED_MAGIC,8,3       ; @MSG_CHUNK_USED_MAGIC
	.comm	_verbosity,4,2                  ; @verbosity
	.comm	_stderr,4,2                     ; @stderr
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"free_msg_buffer(%d)\n"

	.comm	_MSG_BUFFER_FREE_MAGIC,8,3      ; @MSG_BUFFER_FREE_MAGIC
	.comm	_total_used_buffers_size,4,2    ; @total_used_buffers_size
	.comm	_total_used_buffers,4,2         ; @total_used_buffers
.subsections_via_symbols
