	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function IFX_MEI_DFEMemoryAlloc
_IFX_MEI_DFEMemoryAlloc:                ## @IFX_MEI_DFEMemoryAlloc
	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r15
	movq	%rdi, %rbx
	movq	(%rdi), %rax
	movq	(%rax), %r14
	leaq	L_.str(%rip), %rdi
	callq	_IFX_MEI_DMSG
	testq	%r15, %r15
	movq	%rbx, -48(%rbp)                 ## 8-byte Spill
	jle	LBB0_20
## %bb.1:
	movq	_MAX_BAR_REGISTERS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jle	LBB0_20
## %bb.2:
	addq	$16, %r14
	xorl	%ebx, %ebx
	movq	_XDATA_REGISTER@GOTPCREL(%rip), %r13
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r13), %ecx
	cmpq	%rcx, %rbx
	je	LBB0_15
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	decl	%eax
	movq	%r15, %r12
	cmpq	%rax, %rbx
	je	LBB0_6
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	_SDRAM_SEGMENT_SIZE@GOTPCREL(%rip), %rax
	movq	(%rax), %r12
LBB0_6:                                 ##   in Loop: Header=BB0_3 Depth=1
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r12d, %edi
	callq	_kmalloc
	testq	%rax, %rax
	je	LBB0_7
## %bb.9:                               ##   in Loop: Header=BB0_3 Depth=1
	testl	$1023, %eax                     ## imm = 0x3FF
	je	LBB0_10
## %bb.11:                              ##   in Loop: Header=BB0_3 Depth=1
	movq	%r15, -56(%rbp)                 ## 8-byte Spill
	movq	%r13, %r15
	movq	%rax, %rdi
	callq	_kfree
	leal	1024(%r12), %r13d
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r13d, %edi
	callq	_kmalloc
	testq	%rax, %rax
	je	LBB0_12
## %bb.13:                              ##   in Loop: Header=BB0_3 Depth=1
	movq	%rax, %rcx
	addq	$1023, %rcx                     ## imm = 0x3FF
	andq	$-1024, %rcx                    ## imm = 0xFC00
	movq	%r15, %r13
	movq	-56(%rbp), %r15                 ## 8-byte Reload
	jmp	LBB0_14
LBB0_10:                                ##   in Loop: Header=BB0_3 Depth=1
	movq	%rax, %rcx
LBB0_14:                                ##   in Loop: Header=BB0_3 Depth=1
	movq	%rcx, -16(%r14)
	movq	%rax, -8(%r14)
	movl	%r12d, (%r14)
	movslq	%r12d, %rax
	subq	%rax, %r15
	movq	_MAX_BAR_REGISTERS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
LBB0_15:                                ##   in Loop: Header=BB0_3 Depth=1
	incq	%rbx
	testq	%r15, %r15
	jle	LBB0_17
## %bb.16:                              ##   in Loop: Header=BB0_3 Depth=1
	addq	$24, %r14
	movslq	%eax, %rcx
	cmpq	%rcx, %rbx
	jl	LBB0_3
LBB0_17:
	testq	%r15, %r15
	jg	LBB0_18
	jmp	LBB0_22
LBB0_20:
	testq	%r15, %r15
	jle	LBB0_21
LBB0_18:
	leaq	L_.str.2(%rip), %rdi
	xorl	%eax, %eax
	callq	_IFX_MEI_EMSG
	movq	_EFBIG@GOTPCREL(%rip), %rax
	jmp	LBB0_19
LBB0_21:
	xorl	%ebx, %ebx
	jmp	LBB0_22
LBB0_7:
	leaq	L_.str.1(%rip), %rdi
	movl	%ebx, %esi
	movl	%r12d, %edx
	jmp	LBB0_8
LBB0_12:
	leaq	L_.str.1(%rip), %rdi
	movl	%ebx, %esi
	movl	%r13d, %edx
LBB0_8:
	xorl	%eax, %eax
	callq	_IFX_MEI_EMSG
	movq	_ENOMEM@GOTPCREL(%rip), %rax
LBB0_19:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	movq	_FREE_ALL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_IFX_MEI_DFEMemoryFree
LBB0_22:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SDRAM_SEGMENT_SIZE,8,3         ## @SDRAM_SEGMENT_SIZE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"image_size = %ld\n"

	.comm	_MAX_BAR_REGISTERS,4,2          ## @MAX_BAR_REGISTERS
	.comm	_XDATA_REGISTER,4,2             ## @XDATA_REGISTER
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
L_.str.1:                               ## @.str.1
	.asciz	"%d: kmalloc %d bytes memory fail!\n"

	.comm	_ENOMEM,4,2                     ## @ENOMEM
L_.str.2:                               ## @.str.2
	.asciz	"Image size is too large!\n"

	.comm	_EFBIG,4,2                      ## @EFBIG
	.comm	_FREE_ALL,4,2                   ## @FREE_ALL
	.no_dead_strip	_IFX_MEI_DFEMemoryAlloc
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function IFX_MEI_DFEMemoryAlloc
_IFX_MEI_DFEMemoryAlloc:                ; @IFX_MEI_DFEMemoryAlloc
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x21, x1
	mov	x19, x0
	ldr	x8, [x0]
	ldr	x22, [x8]
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_IFX_MEI_DMSG
	cmp	x21, #1
	b.lt	LBB0_13
; %bb.1:
Lloh2:
	adrp	x24, _MAX_BAR_REGISTERS@GOTPAGE
Lloh3:
	ldr	x24, [x24, _MAX_BAR_REGISTERS@GOTPAGEOFF]
	ldr	w8, [x24]
	cmp	w8, #1
	b.lt	LBB0_13
; %bb.2:
	mov	x20, #0
	add	x25, x22, #8
Lloh4:
	adrp	x26, _XDATA_REGISTER@GOTPAGE
Lloh5:
	ldr	x26, [x26, _XDATA_REGISTER@GOTPAGEOFF]
Lloh6:
	adrp	x27, _SDRAM_SEGMENT_SIZE@GOTPAGE
Lloh7:
	ldr	x27, [x27, _SDRAM_SEGMENT_SIZE@GOTPAGEOFF]
Lloh8:
	adrp	x28, _GFP_KERNEL@GOTPAGE
Lloh9:
	ldr	x28, [x28, _GFP_KERNEL@GOTPAGEOFF]
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w9, [x26]
	cmp	x20, x9
	b.eq	LBB0_10
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	sub	w8, w8, #1
	ldr	x9, [x27]
	cmp	x20, x8
	csel	x22, x21, x9, eq
	ldr	w1, [x28]
	mov	x0, x22
	bl	_kmalloc
	cbz	x0, LBB0_16
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	tst	x0, #0x3ff
	b.eq	LBB0_8
; %bb.6:                                ;   in Loop: Header=BB0_3 Depth=1
	bl	_kfree
	add	w23, w22, #1024
	ldr	w1, [x28]
	mov	x0, x23
	bl	_kmalloc
	cbz	x0, LBB0_17
; %bb.7:                                ;   in Loop: Header=BB0_3 Depth=1
	add	x8, x0, #1023
	and	x8, x8, #0xfffffffffffffc00
	b	LBB0_9
LBB0_8:                                 ;   in Loop: Header=BB0_3 Depth=1
	mov	x8, x0
LBB0_9:                                 ;   in Loop: Header=BB0_3 Depth=1
	stp	x8, x0, [x25, #-8]
	str	w22, [x25, #8]
	sub	x21, x21, w22, sxtw
	ldr	w8, [x24]
LBB0_10:                                ;   in Loop: Header=BB0_3 Depth=1
	add	x20, x20, #1
	cmp	x21, #1
	b.lt	LBB0_12
; %bb.11:                               ;   in Loop: Header=BB0_3 Depth=1
	sxtw	x9, w8
	add	x25, x25, #24
	cmp	x20, x9
	b.lt	LBB0_3
LBB0_12:
	cmp	x21, #0
	b.gt	LBB0_14
	b	LBB0_20
LBB0_13:
	cmp	x21, #1
	b.lt	LBB0_15
LBB0_14:
Lloh10:
	adrp	x0, l_.str.2@PAGE
Lloh11:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_IFX_MEI_EMSG
Lloh12:
	adrp	x8, _EFBIG@GOTPAGE
Lloh13:
	ldr	x8, [x8, _EFBIG@GOTPAGEOFF]
	b	LBB0_19
LBB0_15:
	mov	w20, #0
	b	LBB0_20
LBB0_16:
	str	x22, [sp, #8]
	b	LBB0_18
LBB0_17:
	str	x23, [sp, #8]
LBB0_18:
	str	x20, [sp]
Lloh14:
	adrp	x0, l_.str.1@PAGE
Lloh15:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_IFX_MEI_EMSG
Lloh16:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh17:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
LBB0_19:
	ldr	w8, [x8]
	neg	w20, w8
Lloh18:
	adrp	x8, _FREE_ALL@GOTPAGE
Lloh19:
	ldr	x8, [x8, _FREE_ALL@GOTPAGEOFF]
Lloh20:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_IFX_MEI_DFEMemoryFree
LBB0_20:
	mov	x0, x20
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_SDRAM_SEGMENT_SIZE,8,3         ; @SDRAM_SEGMENT_SIZE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"image_size = %ld\n"

	.comm	_MAX_BAR_REGISTERS,4,2          ; @MAX_BAR_REGISTERS
	.comm	_XDATA_REGISTER,4,2             ; @XDATA_REGISTER
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
l_.str.1:                               ; @.str.1
	.asciz	"%d: kmalloc %d bytes memory fail!\n"

	.comm	_ENOMEM,4,2                     ; @ENOMEM
l_.str.2:                               ; @.str.2
	.asciz	"Image size is too large!\n"

	.comm	_EFBIG,4,2                      ; @EFBIG
	.comm	_FREE_ALL,4,2                   ; @FREE_ALL
	.no_dead_strip	_IFX_MEI_DFEMemoryAlloc
.subsections_via_symbols
