	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_btmemr_malloc                  ## -- Begin function btmemr_malloc
	.p2align	4, 0x90
_btmemr_malloc:                         ## @btmemr_malloc
	.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	%r13
	pushq	%r12
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	testq	%rdi, %rdi
	je	LBB0_25
## %bb.1:
	movq	%rdi, %r13
	movq	_MEM_ALIGNMENT@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	movq	%rdi, %rax
	orq	%rcx, %rax
	shrq	$32, %rax
	je	LBB0_2
## %bb.3:
	movq	%r13, %rax
	cqto
	idivq	%rcx
	testq	%rdx, %rdx
	jne	LBB0_5
	jmp	LBB0_9
LBB0_2:
	movl	%r13d, %eax
	xorl	%edx, %edx
	divl	%ecx
                                        ## kill: def $edx killed $edx def $rdx
	testq	%rdx, %rdx
	je	LBB0_9
LBB0_5:
	movq	_SIZEOF_STRUCT_MEM@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	leaq	(%rsi,%r13), %rax
	movq	%rax, %rdx
	orq	%rsi, %rdx
	shrq	$32, %rdx
	je	LBB0_6
## %bb.7:
	cqto
	idivq	%rsi
	jmp	LBB0_8
LBB0_6:
                                        ## kill: def $eax killed $eax killed $rax
	xorl	%edx, %edx
	divl	%esi
                                        ## kill: def $edx killed $edx def $rdx
LBB0_8:
	addq	%r13, %rcx
	subq	%rdx, %rcx
	movq	%rcx, %r13
LBB0_9:
	movq	_MEM_SIZE@GOTPCREL(%rip), %r12
	cmpq	(%r12), %r13
	jg	LBB0_25
## %bb.10:
	callq	__CPU_ISR_Disable
	movq	_ram_free@GOTPCREL(%rip), %r8
	movq	(%r8), %r9
	movq	_ram_block@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	movq	%r9, %rsi
	subq	%rdx, %rsi
	movq	(%r12), %rdi
	cmpq	%rdi, %rsi
	jge	LBB0_24
## %bb.11:
	movq	_SIZEOF_STRUCT_MEM@GOTPCREL(%rip), %r15
	movq	(%r15), %r11
	leaq	(%r11,%r13), %r10
	jmp	LBB0_12
	.p2align	4, 0x90
LBB0_23:                                ##   in Loop: Header=BB0_12 Depth=1
	movq	%rbx, %rsi
	cmpq	%rdi, %rbx
	jge	LBB0_24
LBB0_12:                                ## =>This Inner Loop Header: Depth=1
	cmpl	$0, 8(%rdx,%rsi)
	movq	(%rdx,%rsi), %rbx
	jne	LBB0_23
## %bb.13:                              ##   in Loop: Header=BB0_12 Depth=1
	leaq	(%r11,%rsi), %rcx
	movq	%rbx, %rax
	subq	%rcx, %rax
	cmpq	%r10, %rax
	jl	LBB0_23
## %bb.14:
	leaq	(%rdx,%rsi), %r14
	addq	%r13, %rcx
	movq	%rsi, 16(%rdx,%rcx)
	movq	%rbx, (%rdx,%rcx)
	movq	%rcx, (%rdx,%rsi)
	cmpq	(%r12), %rcx
	je	LBB0_16
## %bb.15:
	movq	(%rdx,%rcx), %rax
	movq	%rcx, 16(%rdx,%rax)
LBB0_16:
	movl	$0, 8(%rdx,%rcx)
	movl	$1, 8(%r14)
	cmpq	%r14, %r9
	jne	LBB0_22
## %bb.17:
	cmpl	$0, 8(%r9)
	je	LBB0_22
## %bb.18:
	movq	_ram_end@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	%r9, %rax
	je	LBB0_22
	.p2align	4, 0x90
LBB0_19:                                ## =>This Inner Loop Header: Depth=1
	movq	(%r9), %rcx
	leaq	(%rdx,%rcx), %r9
	cmpl	$0, 8(%rdx,%rcx)
	je	LBB0_21
## %bb.20:                              ##   in Loop: Header=BB0_19 Depth=1
	cmpq	%r9, %rax
	jne	LBB0_19
LBB0_21:
	movq	%r9, (%r8)
LBB0_22:
	callq	__CPU_ISR_Restore
	addq	(%r15), %r14
	jmp	LBB0_26
LBB0_24:
	callq	__CPU_ISR_Restore
LBB0_25:
	xorl	%r14d, %r14d
LBB0_26:
	movq	%r14, %rax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MEM_ALIGNMENT,8,3              ## @MEM_ALIGNMENT
	.comm	_SIZEOF_STRUCT_MEM,8,3          ## @SIZEOF_STRUCT_MEM
	.comm	_MEM_SIZE,8,3                   ## @MEM_SIZE
	.comm	_ram_free,8,3                   ## @ram_free
	.comm	_ram_block,8,3                  ## @ram_block
	.comm	_ram_end,8,3                    ## @ram_end
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_btmemr_malloc                  ; -- Begin function btmemr_malloc
	.p2align	2
_btmemr_malloc:                         ; @btmemr_malloc
	.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
	cbz	x0, LBB0_19
; %bb.1:
	mov	x19, x0
Lloh0:
	adrp	x8, _MEM_ALIGNMENT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MEM_ALIGNMENT@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	sdiv	x9, x0, x8
	msub	x9, x9, x8, x0
	cbz	x9, LBB0_3
; %bb.2:
Lloh3:
	adrp	x9, _SIZEOF_STRUCT_MEM@GOTPAGE
Lloh4:
	ldr	x9, [x9, _SIZEOF_STRUCT_MEM@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	add	x10, x9, x19
	neg	x11, x10
	sdiv	x10, x10, x9
	madd	x9, x10, x9, x11
	add	x8, x8, x19
	add	x19, x8, x9
LBB0_3:
Lloh6:
	adrp	x22, _MEM_SIZE@GOTPAGE
Lloh7:
	ldr	x22, [x22, _MEM_SIZE@GOTPAGEOFF]
	ldr	x8, [x22]
	cmp	x19, x8
	b.gt	LBB0_18
; %bb.4:
	bl	__CPU_ISR_Disable
Lloh8:
	adrp	x8, _ram_free@GOTPAGE
Lloh9:
	ldr	x8, [x8, _ram_free@GOTPAGEOFF]
	ldr	x9, [x8]
Lloh10:
	adrp	x10, _ram_block@GOTPAGE
Lloh11:
	ldr	x10, [x10, _ram_block@GOTPAGEOFF]
Lloh12:
	ldr	x10, [x10]
	ldr	x12, [x22]
	sub	x11, x9, x10
	cmp	x11, x12
	b.ge	LBB0_17
; %bb.5:
Lloh13:
	adrp	x20, _SIZEOF_STRUCT_MEM@GOTPAGE
Lloh14:
	ldr	x20, [x20, _SIZEOF_STRUCT_MEM@GOTPAGEOFF]
	ldr	x13, [x20]
	add	x14, x13, x19
	b	LBB0_7
LBB0_6:                                 ;   in Loop: Header=BB0_7 Depth=1
	mov	x11, x15
	cmp	x15, x12
	b.ge	LBB0_17
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	add	x21, x10, x11
	ldr	w16, [x21, #8]
	ldr	x15, [x21]
	cbnz	w16, LBB0_6
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	add	x16, x13, x11
	sub	x17, x15, x16
	cmp	x17, x14
	b.lt	LBB0_6
; %bb.9:
	add	x13, x16, x19
	add	x12, x10, x13
	str	x11, [x12, #16]
	str	x15, [x12]
	str	x13, [x10, x11]
	ldr	x11, [x22]
	cmp	x13, x11
	b.eq	LBB0_11
; %bb.10:
	ldr	x11, [x10, x13]
	add	x11, x10, x11
	str	x13, [x11, #16]
LBB0_11:
	str	wzr, [x12, #8]
	mov	w11, #1
	str	w11, [x21, #8]
	cmp	x9, x21
	b.ne	LBB0_16
; %bb.12:
	ldr	w11, [x9, #8]
	cbz	w11, LBB0_16
; %bb.13:
Lloh15:
	adrp	x11, _ram_end@GOTPAGE
Lloh16:
	ldr	x11, [x11, _ram_end@GOTPAGEOFF]
Lloh17:
	ldr	x11, [x11]
	cmp	x11, x9
	b.eq	LBB0_16
LBB0_14:                                ; =>This Inner Loop Header: Depth=1
	ldr	x9, [x9]
	add	x9, x10, x9
	ldr	w12, [x9, #8]
	cmp	w12, #0
	ccmp	x11, x9, #4, ne
	b.ne	LBB0_14
; %bb.15:
	str	x9, [x8]
LBB0_16:
	bl	__CPU_ISR_Restore
	ldr	x8, [x20]
	add	x0, x21, x8
	b	LBB0_19
LBB0_17:
	bl	__CPU_ISR_Restore
LBB0_18:
	mov	x0, #0
LBB0_19:
	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 AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_MEM_ALIGNMENT,8,3              ; @MEM_ALIGNMENT
	.comm	_SIZEOF_STRUCT_MEM,8,3          ; @SIZEOF_STRUCT_MEM
	.comm	_MEM_SIZE,8,3                   ; @MEM_SIZE
	.comm	_ram_free,8,3                   ; @ram_free
	.comm	_ram_block,8,3                  ; @ram_block
	.comm	_ram_end,8,3                    ; @ram_end
.subsections_via_symbols
