	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_btmemr_realloc                 ## -- Begin function btmemr_realloc
	.p2align	4, 0x90
_btmemr_realloc:                        ## @btmemr_realloc
	.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
	movl	%esi, %ebx
	movq	%rdi, %r14
	movq	_MEM_ALIGNMENT@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	%esi, %eax
	cltd
	idivl	%ecx
	testl	%edx, %edx
	je	LBB0_2
## %bb.1:
	movq	_SIZEOF_STRUCT_MEM@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	%ebx, %eax
	cltd
	idivl	%ecx
	addl	%ebx, %ecx
	subl	%edx, %ecx
	movl	%ecx, %ebx
LBB0_2:
	movq	_MEM_SIZE@GOTPCREL(%rip), %r15
	cmpl	(%r15), %ebx
	jle	LBB0_4
## %bb.3:
	xorl	%r14d, %r14d
	jmp	LBB0_12
LBB0_4:
	movq	_ram_block@GOTPCREL(%rip), %r12
	cmpq	%r14, (%r12)
	ja	LBB0_6
## %bb.5:
	movq	_ram_end@GOTPCREL(%rip), %rax
	cmpq	(%rax), %r14
	jae	LBB0_6
## %bb.7:
	callq	__CPU_ISR_Disable
	movq	_SIZEOF_STRUCT_MEM@GOTPCREL(%rip), %rax
	movslq	(%rax), %rdi
	movq	%rdi, %rax
	shlq	$2, %rax
	movq	%r14, %rcx
	subq	%rax, %rcx
	movq	(%r12), %r10
	movq	%rcx, %rsi
	subq	%r10, %rsi
	shrq	$2, %rsi
	movl	(%rcx), %r8d
	leal	(%rdi,%rsi), %r9d
	movl	%r8d, %edx
	subl	%r9d, %edx
	addl	%ebx, %edi
	movq	_MIN_SIZE@GOTPCREL(%rip), %rax
	addl	(%rax), %edi
	cmpl	%edx, %edi
	jge	LBB0_11
## %bb.8:
	addl	%ebx, %r9d
	movslq	%r9d, %rax
	leaq	(%r10,%rax,4), %rdi
	movq	$0, 8(%r10,%rax,4)
	movl	%r8d, (%r10,%rax,4)
	movl	%esi, 4(%r10,%rax,4)
	movl	%eax, (%rcx)
	movslq	(%r10,%rax,4), %rcx
	cmpl	(%r15), %ecx
	je	LBB0_10
## %bb.9:
	movl	%r9d, 4(%r10,%rcx,4)
LBB0_10:
	callq	_plug_holes
LBB0_11:
	callq	__CPU_ISR_Restore
	jmp	LBB0_12
LBB0_6:
	leaq	L_.str(%rip), %rdi
	callq	_ERROR
LBB0_12:
	movq	%r14, %rax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MEM_ALIGNMENT,4,2              ## @MEM_ALIGNMENT
	.comm	_SIZEOF_STRUCT_MEM,4,2          ## @SIZEOF_STRUCT_MEM
	.comm	_MEM_SIZE,4,2                   ## @MEM_SIZE
	.comm	_ram_block,8,3                  ## @ram_block
	.comm	_ram_end,8,3                    ## @ram_end
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"memr_realloc: illegal memory.\n"

	.comm	_MIN_SIZE,4,2                   ## @MIN_SIZE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_btmemr_realloc                 ; -- Begin function btmemr_realloc
	.p2align	2
_btmemr_realloc:                        ; @btmemr_realloc
	.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	x8, _MEM_ALIGNMENT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MEM_ALIGNMENT@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	sdiv	w9, w1, w8
	msub	w9, w9, w8, w1
	cbz	w9, LBB0_2
; %bb.1:
Lloh3:
	adrp	x9, _SIZEOF_STRUCT_MEM@GOTPAGE
Lloh4:
	ldr	x9, [x9, _SIZEOF_STRUCT_MEM@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	add	w9, w9, w20
	neg	w10, w9
	sdiv	w9, w9, w8
	madd	w9, w9, w8, w10
	add	w8, w8, w20
	add	w20, w8, w9
LBB0_2:
Lloh6:
	adrp	x21, _MEM_SIZE@GOTPAGE
Lloh7:
	ldr	x21, [x21, _MEM_SIZE@GOTPAGEOFF]
	ldr	w8, [x21]
	cmp	w20, w8
	b.le	LBB0_4
; %bb.3:
	mov	x19, #0
	b	LBB0_11
LBB0_4:
Lloh8:
	adrp	x22, _ram_block@GOTPAGE
Lloh9:
	ldr	x22, [x22, _ram_block@GOTPAGEOFF]
	ldr	x8, [x22]
Lloh10:
	adrp	x9, _ram_end@GOTPAGE
Lloh11:
	ldr	x9, [x9, _ram_end@GOTPAGEOFF]
Lloh12:
	ldr	x9, [x9]
	cmp	x8, x19
	ccmp	x19, x9, #2, ls
	b.lo	LBB0_6
; %bb.5:
Lloh13:
	adrp	x0, l_.str@PAGE
Lloh14:
	add	x0, x0, l_.str@PAGEOFF
	bl	_ERROR
	b	LBB0_11
LBB0_6:
	bl	__CPU_ISR_Disable
Lloh15:
	adrp	x8, _SIZEOF_STRUCT_MEM@GOTPAGE
Lloh16:
	ldr	x8, [x8, _SIZEOF_STRUCT_MEM@GOTPAGEOFF]
Lloh17:
	ldrsw	x13, [x8]
	sub	x9, x19, x13, lsl #2
	ldr	x8, [x22]
	sub	x10, x9, x8
	lsr	x10, x10, #2
	ldr	w11, [x9]
	add	w12, w13, w10
	sub	w14, w11, w12
Lloh18:
	adrp	x15, _MIN_SIZE@GOTPAGE
Lloh19:
	ldr	x15, [x15, _MIN_SIZE@GOTPAGEOFF]
Lloh20:
	ldr	w15, [x15]
	add	w13, w13, w20
	add	w13, w13, w15
	cmp	w13, w14
	b.ge	LBB0_10
; %bb.7:
	add	w12, w12, w20
	add	x0, x8, w12, sxtw #2
	str	xzr, [x0, #8]
	stp	w11, w10, [x0]
	str	w12, [x9]
	ldrsw	x9, [x0]
	ldr	w10, [x21]
	cmp	w9, w10
	b.eq	LBB0_9
; %bb.8:
	add	x8, x8, x9, lsl #2
	str	w12, [x8, #4]
LBB0_9:
	bl	_plug_holes
LBB0_10:
	bl	__CPU_ISR_Restore
LBB0_11:
	mov	x0, x19
	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 AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_MEM_ALIGNMENT,4,2              ; @MEM_ALIGNMENT
	.comm	_SIZEOF_STRUCT_MEM,4,2          ; @SIZEOF_STRUCT_MEM
	.comm	_MEM_SIZE,4,2                   ; @MEM_SIZE
	.comm	_ram_block,8,3                  ; @ram_block
	.comm	_ram_end,8,3                    ; @ram_end
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"memr_realloc: illegal memory.\n"

	.comm	_MIN_SIZE,4,2                   ; @MIN_SIZE
.subsections_via_symbols
