	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_memr_realloc                   ## -- Begin function memr_realloc
	.p2align	4, 0x90
_memr_realloc:                          ## @memr_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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
                                        ## kill: def $esi killed $esi def $rsi
	movq	%rdi, %rbx
	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	%esi, %eax
	cltd
	idivl	%ecx
	addl	%esi, %ecx
	subl	%edx, %ecx
	movl	%ecx, %esi
LBB0_2:
	movq	_UIP_MEM_SIZE@GOTPCREL(%rip), %r8
	cmpl	(%r8), %esi
	jle	LBB0_4
## %bb.3:
	xorl	%ebx, %ebx
	jmp	LBB0_11
LBB0_4:
	movq	_ram_block@GOTPCREL(%rip), %rax
	movq	(%rax), %r15
	cmpq	%rbx, %r15
	ja	LBB0_6
## %bb.5:
	movq	_ram_end@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rbx
	jae	LBB0_6
## %bb.7:
	movq	_SIZEOF_STRUCT_MEM@GOTPCREL(%rip), %rax
	movslq	(%rax), %r11
	movq	%r11, %rdx
	shlq	$2, %rdx
	movq	%rbx, %r14
	subq	%rdx, %r14
	movq	%r14, %rdx
	subq	%r15, %rdx
	shrq	$2, %rdx
	movl	(%r14), %r10d
	leal	(%r11,%rdx), %r9d
	movl	%r10d, %edi
	subl	%r9d, %edi
	leal	(%r11,%rsi), %eax
	movq	_MIN_SIZE@GOTPCREL(%rip), %rcx
	addl	(%rcx), %eax
	cmpl	%edi, %eax
	jge	LBB0_11
## %bb.8:
	addl	%esi, %r9d
	movslq	%r9d, %rax
	leaq	(%r15,%rax,4), %rdi
	movq	$0, 8(%r15,%rax,4)
	movl	%r10d, (%r15,%rax,4)
	movl	%edx, 4(%r15,%rax,4)
	movl	%eax, (%r14)
	movslq	(%r15,%rax,4), %rax
	cmpl	(%r8), %eax
	je	LBB0_10
## %bb.9:
	movl	%r9d, 4(%r15,%rax,4)
LBB0_10:
	callq	_plug_holes
	jmp	LBB0_11
LBB0_6:
	leaq	L_.str(%rip), %rdi
	callq	_UIP_ERROR
LBB0_11:
	movq	%rbx, %rax
	addq	$8, %rsp
	popq	%rbx
	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	_UIP_MEM_SIZE,4,2               ## @UIP_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	_memr_realloc                   ; -- Begin function memr_realloc
	.p2align	2
_memr_realloc:                          ; @memr_realloc
	.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
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, w1
	neg	w10, w9
	sdiv	w9, w9, w8
	madd	w9, w9, w8, w10
	add	w8, w8, w1
	add	w1, w8, w9
LBB0_2:
Lloh6:
	adrp	x8, _UIP_MEM_SIZE@GOTPAGE
Lloh7:
	ldr	x8, [x8, _UIP_MEM_SIZE@GOTPAGEOFF]
	ldr	w9, [x8]
	cmp	w1, w9
	b.le	LBB0_4
; %bb.3:
	mov	x19, #0
	b	LBB0_10
LBB0_4:
Lloh8:
	adrp	x9, _ram_block@GOTPAGE
Lloh9:
	ldr	x9, [x9, _ram_block@GOTPAGEOFF]
Lloh10:
	ldr	x9, [x9]
Lloh11:
	adrp	x10, _ram_end@GOTPAGE
Lloh12:
	ldr	x10, [x10, _ram_end@GOTPAGEOFF]
Lloh13:
	ldr	x10, [x10]
	cmp	x9, x19
	ccmp	x19, x10, #2, ls
	b.lo	LBB0_6
; %bb.5:
Lloh14:
	adrp	x0, l_.str@PAGE
Lloh15:
	add	x0, x0, l_.str@PAGEOFF
	bl	_UIP_ERROR
	b	LBB0_10
LBB0_6:
Lloh16:
	adrp	x10, _SIZEOF_STRUCT_MEM@GOTPAGE
Lloh17:
	ldr	x10, [x10, _SIZEOF_STRUCT_MEM@GOTPAGEOFF]
Lloh18:
	ldrsw	x14, [x10]
	sub	x10, x19, x14, lsl #2
	sub	x11, x10, x9
	lsr	x11, x11, #2
	ldr	w13, [x10]
	add	w12, w14, w11
	sub	w15, w13, w12
Lloh19:
	adrp	x16, _MIN_SIZE@GOTPAGE
Lloh20:
	ldr	x16, [x16, _MIN_SIZE@GOTPAGEOFF]
Lloh21:
	ldr	w16, [x16]
	add	w14, w14, w1
	add	w14, w14, w16
	cmp	w14, w15
	b.ge	LBB0_10
; %bb.7:
	add	w12, w12, w1
	add	x0, x9, w12, sxtw #2
	str	xzr, [x0, #8]
	stp	w13, w11, [x0]
	str	w12, [x10]
	ldrsw	x10, [x0]
	ldr	w8, [x8]
	cmp	w10, w8
	b.eq	LBB0_9
; %bb.8:
	add	x8, x9, x10, lsl #2
	str	w12, [x8, #4]
LBB0_9:
	bl	_plug_holes
LBB0_10:
	mov	x0, x19
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
	.comm	_MEM_ALIGNMENT,4,2              ; @MEM_ALIGNMENT
	.comm	_SIZEOF_STRUCT_MEM,4,2          ; @SIZEOF_STRUCT_MEM
	.comm	_UIP_MEM_SIZE,4,2               ; @UIP_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
