	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function iwl_alloc_fw_paging_mem
_iwl_alloc_fw_paging_mem:               ## @iwl_alloc_fw_paging_mem
	.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	%rdi, -48(%rbp)                 ## 8-byte Spill
	movq	8(%rdi), %rax
	xorl	%r15d, %r15d
	cmpq	$0, 8(%rax)
	je	LBB0_1
LBB0_9:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_1:
	movq	%rsi, %rbx
	movq	_BLOCK_2_EXP_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_BIT
	movq	_PAGING_BLOCK_SIZE@GOTPCREL(%rip), %rcx
	xorl	%edi, %edi
	cmpl	(%rcx), %eax
	setne	%dil
	callq	_BUILD_BUG_ON
	movl	(%rbx), %eax
	movq	_FW_PAGING_SIZE@GOTPCREL(%rip), %rcx
	cltd
	idivl	(%rcx)
	movl	%eax, %ebx
	movq	_NUM_OF_PAGE_PER_GROUP@GOTPCREL(%rip), %r14
	movl	(%r14), %esi
	movl	%eax, %edi
	callq	_DIV_ROUND_UP
                                        ## kill: def $eax killed $eax def $rax
	movq	-48(%rbp), %r12                 ## 8-byte Reload
	movl	%eax, (%r12)
	leal	-1(%rax), %ecx
	imull	(%r14), %ecx
	subl	%ecx, %ebx
	movl	%ebx, 4(%r12)
	leaq	L_.str(%rip), %rsi
	xorl	%r15d, %r15d
	movq	%r12, %rdi
	movl	%eax, %edx
	movl	%ebx, %ecx
	xorl	%eax, %eax
	callq	_IWL_DEBUG_FW
	cmpl	$0, (%r12)
	js	LBB0_9
## %bb.2:
	movq	$-1, %r13
	xorl	%r14d, %r14d
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movq	_PAGING_BLOCK_SIZE@GOTPCREL(%rip), %rax
	cmpq	$-1, %r13
	jne	LBB0_5
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	_FW_PAGING_SIZE@GOTPCREL(%rip), %rax
LBB0_5:                                 ##   in Loop: Header=BB0_3 Depth=1
	movl	(%rax), %ebx
	movl	%ebx, %edi
	callq	_get_order
	movl	%eax, %r12d
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	%r12d, %esi
	callq	_alloc_pages
	testq	%rax, %rax
	movq	-48(%rbp), %r15                 ## 8-byte Reload
	je	LBB0_8
## %bb.6:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	8(%r15), %rcx
	movq	%rax, 8(%rcx,%r14)
	movl	%ebx, (%rcx,%r14)
	movq	16(%r15), %rcx
	movl	(%rcx), %edi
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ebx
	movl	%r12d, %ecx
	shll	%cl, %ebx
	movq	_DMA_BIDIRECTIONAL@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r8d
	movq	%rax, %rsi
	xorl	%edx, %edx
	movl	%ebx, %ecx
	callq	_dma_map_page
	movl	%eax, %ebx
	movq	16(%r15), %rax
	movl	(%rax), %edi
	movl	%ebx, %esi
	callq	_dma_mapping_error
	testq	%rax, %rax
	jne	LBB0_8
## %bb.7:                               ##   in Loop: Header=BB0_3 Depth=1
	incq	%r13
	movq	8(%r15), %rax
	movl	%ebx, 4(%rax,%r14)
	leaq	L_.str.2(%rip), %rsi
	leaq	L_.str.1(%rip), %rax
	cmoveq	%rax, %rsi
	movq	%r15, %rbx
	xorl	%r15d, %r15d
	movq	%rbx, %rdi
	movl	%r12d, %edx
	xorl	%eax, %eax
	callq	_IWL_DEBUG_FW
	movslq	(%rbx), %rax
	addq	$16, %r14
	cmpq	%rax, %r13
	jl	LBB0_3
	jmp	LBB0_9
LBB0_8:
	movq	%r15, %rdi
	callq	_iwl_free_fw_paging
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
	jmp	LBB0_9
	.cfi_endproc
                                        ## -- End function
	.comm	_BLOCK_2_EXP_SIZE,4,2           ## @BLOCK_2_EXP_SIZE
	.comm	_PAGING_BLOCK_SIZE,4,2          ## @PAGING_BLOCK_SIZE
	.comm	_FW_PAGING_SIZE,4,2             ## @FW_PAGING_SIZE
	.comm	_NUM_OF_PAGE_PER_GROUP,4,2      ## @NUM_OF_PAGE_PER_GROUP
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Paging: allocating mem for %d paging blocks, each block holds 8 pages, last block holds %d pages\n"

	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
	.comm	_DMA_BIDIRECTIONAL,4,2          ## @DMA_BIDIRECTIONAL
L_.str.1:                               ## @.str.1
	.asciz	"Paging: allocated 4K(CSS) bytes (order %d) for firmware paging.\n"

L_.str.2:                               ## @.str.2
	.asciz	"Paging: allocated 32K bytes (order %d) for firmware paging.\n"

	.no_dead_strip	_iwl_alloc_fw_paging_mem
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function iwl_alloc_fw_paging_mem
_iwl_alloc_fw_paging_mem:               ; @iwl_alloc_fw_paging_mem
	.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
	ldr	x8, [x0, #8]
	ldr	x8, [x8, #8]
	cbz	x8, LBB0_3
LBB0_1:
	mov	w0, #0
LBB0_2:
	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
LBB0_3:
	mov	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x8, _BLOCK_2_EXP_SIZE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _BLOCK_2_EXP_SIZE@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
	bl	_BIT
Lloh3:
	adrp	x8, _PAGING_BLOCK_SIZE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _PAGING_BLOCK_SIZE@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	cmp	w0, w8
	cset	w0, ne
	bl	_BUILD_BUG_ON
Lloh6:
	adrp	x9, _FW_PAGING_SIZE@GOTPAGE
Lloh7:
	ldr	x9, [x9, _FW_PAGING_SIZE@GOTPAGEOFF]
	ldr	w8, [x20]
Lloh8:
	ldr	w9, [x9]
	sdiv	w20, w8, w9
Lloh9:
	adrp	x21, _NUM_OF_PAGE_PER_GROUP@GOTPAGE
Lloh10:
	ldr	x21, [x21, _NUM_OF_PAGE_PER_GROUP@GOTPAGEOFF]
	ldr	w1, [x21]
	mov	x0, x20
	bl	_DIV_ROUND_UP
	mov	x2, x0
	str	w0, [x19]
	ldr	w8, [x21]
	sub	w9, w0, #1
	msub	w8, w8, w9, w20
	str	w8, [x19, #4]
	str	x8, [sp]
Lloh11:
	adrp	x1, l_.str@PAGE
Lloh12:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	bl	_IWL_DEBUG_FW
	ldr	w8, [x19]
	tbnz	w8, #31, LBB0_1
; %bb.4:
	mov	x24, #0
	mov	x25, #-1
Lloh13:
	adrp	x26, _GFP_KERNEL@GOTPAGE
Lloh14:
	ldr	x26, [x26, _GFP_KERNEL@GOTPAGEOFF]
Lloh15:
	adrp	x27, _PAGE_SIZE@GOTPAGE
Lloh16:
	ldr	x27, [x27, _PAGE_SIZE@GOTPAGEOFF]
Lloh17:
	adrp	x28, _DMA_BIDIRECTIONAL@GOTPAGE
Lloh18:
	ldr	x28, [x28, _DMA_BIDIRECTIONAL@GOTPAGEOFF]
Lloh19:
	adrp	x22, l_.str.2@PAGE
Lloh20:
	add	x22, x22, l_.str.2@PAGEOFF
Lloh21:
	adrp	x23, l_.str.1@PAGE
Lloh22:
	add	x23, x23, l_.str.1@PAGEOFF
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	cmn	x25, #1
Lloh23:
	adrp	x8, _PAGING_BLOCK_SIZE@GOTPAGE
Lloh24:
	ldr	x8, [x8, _PAGING_BLOCK_SIZE@GOTPAGEOFF]
Lloh25:
	adrp	x9, _FW_PAGING_SIZE@GOTPAGE
Lloh26:
	ldr	x9, [x9, _FW_PAGING_SIZE@GOTPAGEOFF]
	csel	x8, x9, x8, eq
	ldr	w21, [x8]
	mov	x0, x21
	bl	_get_order
	mov	x20, x0
	ldr	w0, [x26]
	mov	x1, x20
	bl	_alloc_pages
	cbz	x0, LBB0_8
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	x1, x0
	ldp	x8, x9, [x19, #8]
	add	x8, x8, x24
	str	x0, [x8, #8]
	str	w21, [x8]
	ldr	w0, [x9]
	ldr	w8, [x27]
	lsl	w3, w8, w20
	ldr	w4, [x28]
	mov	w2, #0
	bl	_dma_map_page
	mov	x21, x0
	ldr	x8, [x19, #16]
	ldr	w0, [x8]
	mov	x1, x21
	bl	_dma_mapping_error
	cbnz	x0, LBB0_8
; %bb.7:                                ;   in Loop: Header=BB0_5 Depth=1
	adds	x25, x25, #1
	ldr	x8, [x19, #8]
	add	x8, x8, x24
	str	w21, [x8, #4]
	csel	x1, x23, x22, hs
	mov	x0, x19
	mov	x2, x20
	bl	_IWL_DEBUG_FW
	ldrsw	x8, [x19]
	add	x24, x24, #16
	cmp	x25, x8
	b.lt	LBB0_5
	b	LBB0_1
LBB0_8:
	mov	x0, x19
	bl	_iwl_free_fw_paging
Lloh27:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh28:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh29:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_2
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.cfi_endproc
                                        ; -- End function
	.comm	_BLOCK_2_EXP_SIZE,4,2           ; @BLOCK_2_EXP_SIZE
	.comm	_PAGING_BLOCK_SIZE,4,2          ; @PAGING_BLOCK_SIZE
	.comm	_FW_PAGING_SIZE,4,2             ; @FW_PAGING_SIZE
	.comm	_NUM_OF_PAGE_PER_GROUP,4,2      ; @NUM_OF_PAGE_PER_GROUP
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Paging: allocating mem for %d paging blocks, each block holds 8 pages, last block holds %d pages\n"

	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
	.comm	_DMA_BIDIRECTIONAL,4,2          ; @DMA_BIDIRECTIONAL
l_.str.1:                               ; @.str.1
	.asciz	"Paging: allocated 4K(CSS) bytes (order %d) for firmware paging.\n"

l_.str.2:                               ; @.str.2
	.asciz	"Paging: allocated 32K bytes (order %d) for firmware paging.\n"

	.no_dead_strip	_iwl_alloc_fw_paging_mem
.subsections_via_symbols
