	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mem_realloc                    ## -- Begin function mem_realloc
	.p2align	4, 0x90
_mem_realloc:                           ## @mem_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	%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
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movq	_MEM_ALIGNMENT@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	movq	%rsi, %rax
	orq	%rcx, %rax
	shrq	$32, %rax
	je	LBB0_1
## %bb.2:
	movq	%rbx, %rax
	cqto
	idivq	%rcx
	testq	%rdx, %rdx
	jne	LBB0_4
	jmp	LBB0_8
LBB0_1:
	movl	%ebx, %eax
	xorl	%edx, %edx
	divl	%ecx
                                        ## kill: def $edx killed $edx def $rdx
	testq	%rdx, %rdx
	je	LBB0_8
LBB0_4:
	movq	_SIZEOF_STRUCT_MEM@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	addq	%rbx, %rax
	movq	%rax, %rdx
	orq	%rcx, %rdx
	shrq	$32, %rdx
	je	LBB0_5
## %bb.6:
	cqto
	idivq	%rcx
	jmp	LBB0_7
LBB0_5:
                                        ## kill: def $eax killed $eax killed $rax
	xorl	%edx, %edx
	divl	%ecx
                                        ## kill: def $edx killed $edx def $rdx
LBB0_7:
	addq	%rbx, %rcx
	subq	%rdx, %rcx
	movq	%rcx, %rbx
LBB0_8:
	movq	_MEM_SIZE@GOTPCREL(%rip), %r12
	cmpq	(%r12), %rbx
	jle	LBB0_10
## %bb.9:
	xorl	%r14d, %r14d
	jmp	LBB0_18
LBB0_10:
	movq	_mem_sem@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_LWP_SemWait
	movq	_ram@GOTPCREL(%rip), %r15
	cmpq	%r14, (%r15)
	setbe	%al
	movq	_ram_end@GOTPCREL(%rip), %r13
	cmpq	(%r13), %r14
	setb	%cl
	andb	%al, %cl
	movzbl	%cl, %esi
	leaq	L_.str(%rip), %rdi
	callq	_LWIP_ASSERT
	movq	(%r15), %r10
	cmpq	%r14, %r10
	ja	LBB0_12
## %bb.11:
	cmpq	(%r13), %r14
	jae	LBB0_12
## %bb.13:
	movq	_SIZEOF_STRUCT_MEM@GOTPCREL(%rip), %rcx
	movslq	(%rcx), %rdi
	leaq	(,%rdi,4), %rdx
	movq	%r14, %r9
	subq	%rdx, %r9
	movq	%r9, %rsi
	subq	%r10, %rsi
	sarq	$2, %rsi
	movq	(%r9), %r8
	leaq	(%rsi,%rdi), %rdx
	movq	%r8, %rcx
	subq	%rdx, %rcx
	addq	%rbx, %rdi
	movq	_MIN_SIZE@GOTPCREL(%rip), %rax
	addq	(%rax), %rdi
	cmpq	%rcx, %rdi
	jge	LBB0_17
## %bb.14:
	addq	%rbx, %rdx
	leaq	(%r10,%rdx,4), %rdi
	movq	$0, 16(%r10,%rdx,4)
	movq	%r8, (%r10,%rdx,4)
	movq	%rsi, 8(%r10,%rdx,4)
	movq	%rdx, (%r9)
	movq	(%r10,%rdx,4), %rcx
	cmpq	(%r12), %rcx
	je	LBB0_16
## %bb.15:
	movq	%rdx, 8(%r10,%rcx,4)
LBB0_16:
	callq	_plug_holes
LBB0_17:
	movq	_mem_sem@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_LWP_SemPost
	jmp	LBB0_18
LBB0_12:
	movq	_MEM_DEBUG@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	orl	$3, %edi
	leaq	L_.str.1(%rip), %rsi
	callq	_LWIP_DEBUGF
LBB0_18:
	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,4,2          ## @SIZEOF_STRUCT_MEM
	.comm	_MEM_SIZE,8,3                   ## @MEM_SIZE
	.comm	_mem_sem,4,2                    ## @mem_sem
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"mem_realloc: legal memory"

	.comm	_ram,8,3                        ## @ram
	.comm	_ram_end,8,3                    ## @ram_end
	.comm	_MEM_DEBUG,4,2                  ## @MEM_DEBUG
L_.str.1:                               ## @.str.1
	.asciz	"mem_realloc: illegal memory\n"

	.comm	_MIN_SIZE,8,3                   ## @MIN_SIZE
	.comm	_lwip_stats,4,2                 ## @lwip_stats
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mem_realloc                    ; -- Begin function mem_realloc
	.p2align	2
_mem_realloc:                           ; @mem_realloc
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x8, _MEM_ALIGNMENT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MEM_ALIGNMENT@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	sdiv	x9, x1, x8
	msub	x9, x9, x8, x1
	cbz	x9, LBB0_2
; %bb.1:
Lloh3:
	adrp	x9, _SIZEOF_STRUCT_MEM@GOTPAGE
Lloh4:
	ldr	x9, [x9, _SIZEOF_STRUCT_MEM@GOTPAGEOFF]
Lloh5:
	ldrsw	x9, [x9]
	add	x9, x9, x20
	neg	x10, x9
	sdiv	x9, x9, x8
	madd	x9, x9, x8, x10
	add	x8, x8, x20
	add	x20, x8, x9
LBB0_2:
Lloh6:
	adrp	x22, _MEM_SIZE@GOTPAGE
Lloh7:
	ldr	x22, [x22, _MEM_SIZE@GOTPAGEOFF]
	ldr	x8, [x22]
	cmp	x20, x8
	b.le	LBB0_4
; %bb.3:
	mov	x19, #0
	b	LBB0_12
LBB0_4:
Lloh8:
	adrp	x21, _mem_sem@GOTPAGE
Lloh9:
	ldr	x21, [x21, _mem_sem@GOTPAGEOFF]
	ldr	w0, [x21]
	bl	_LWP_SemWait
Lloh10:
	adrp	x24, _ram@GOTPAGE
Lloh11:
	ldr	x24, [x24, _ram@GOTPAGEOFF]
	ldr	x8, [x24]
	cmp	x8, x19
Lloh12:
	adrp	x23, _ram_end@GOTPAGE
Lloh13:
	ldr	x23, [x23, _ram_end@GOTPAGEOFF]
	ldr	x8, [x23]
	ccmp	x19, x8, #2, ls
	cset	w1, lo
Lloh14:
	adrp	x0, l_.str@PAGE
Lloh15:
	add	x0, x0, l_.str@PAGEOFF
	bl	_LWIP_ASSERT
	ldr	x8, [x24]
	cmp	x8, x19
	b.hi	LBB0_11
; %bb.5:
	ldr	x9, [x23]
	cmp	x19, x9
	b.hs	LBB0_11
; %bb.6:
Lloh16:
	adrp	x9, _SIZEOF_STRUCT_MEM@GOTPAGE
Lloh17:
	ldr	x9, [x9, _SIZEOF_STRUCT_MEM@GOTPAGEOFF]
Lloh18:
	ldrsw	x13, [x9]
	sub	x9, x19, x13, lsl #2
	sub	x10, x9, x8
	asr	x10, x10, #2
	ldr	x11, [x9]
	add	x12, x10, x13
	sub	x14, x11, x12
Lloh19:
	adrp	x15, _MIN_SIZE@GOTPAGE
Lloh20:
	ldr	x15, [x15, _MIN_SIZE@GOTPAGEOFF]
Lloh21:
	ldr	x15, [x15]
	add	x13, x20, x13
	add	x13, x13, x15
	cmp	x13, x14
	b.ge	LBB0_10
; %bb.7:
	add	x12, x12, x20
	add	x0, x8, x12, lsl #2
	stp	x10, xzr, [x0, #8]
	str	x11, [x0]
	str	x12, [x9]
	ldr	x9, [x0]
	ldr	x10, [x22]
	cmp	x9, x10
	b.eq	LBB0_9
; %bb.8:
	add	x8, x8, x9, lsl #2
	str	x12, [x8, #8]
LBB0_9:
	bl	_plug_holes
LBB0_10:
	ldr	w0, [x21]
	bl	_LWP_SemPost
	b	LBB0_12
LBB0_11:
Lloh22:
	adrp	x8, _MEM_DEBUG@GOTPAGE
Lloh23:
	ldr	x8, [x8, _MEM_DEBUG@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
	orr	w0, w8, #0x3
Lloh25:
	adrp	x1, l_.str.1@PAGE
Lloh26:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_LWIP_DEBUGF
LBB0_12:
	mov	x0, x19
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.comm	_MEM_ALIGNMENT,8,3              ; @MEM_ALIGNMENT
	.comm	_SIZEOF_STRUCT_MEM,4,2          ; @SIZEOF_STRUCT_MEM
	.comm	_MEM_SIZE,8,3                   ; @MEM_SIZE
	.comm	_mem_sem,4,2                    ; @mem_sem
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"mem_realloc: legal memory"

	.comm	_ram,8,3                        ; @ram
	.comm	_ram_end,8,3                    ; @ram_end
	.comm	_MEM_DEBUG,4,2                  ; @MEM_DEBUG
l_.str.1:                               ; @.str.1
	.asciz	"mem_realloc: illegal memory\n"

	.comm	_MIN_SIZE,8,3                   ; @MIN_SIZE
	.comm	_lwip_stats,4,2                 ; @lwip_stats
.subsections_via_symbols
