	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_saa7146_vmalloc_build_pgtable  ## -- Begin function saa7146_vmalloc_build_pgtable
	.p2align	4, 0x90
_saa7146_vmalloc_build_pgtable:         ## @saa7146_vmalloc_build_pgtable
	.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	%rdx, %r15
	movq	%rdi, %r14
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	leaq	(%rsi,%rcx), %rax
	decq	%rax
	movq	%rax, %rdx
	orq	%rcx, %rdx
	shrq	$32, %rdx
	je	LBB0_1
## %bb.2:
	cqto
	idivq	%rcx
	movq	%rax, %r12
	jmp	LBB0_3
LBB0_1:
                                        ## kill: def $eax killed $eax killed $rax
	xorl	%edx, %edx
	divl	%ecx
	movl	%eax, %r12d
LBB0_3:
	movq	%rsi, %rdi
	callq	_vmalloc_32
	testq	%rax, %rax
	je	LBB0_12
## %bb.4:
	movq	%rax, %rbx
	movq	%rax, %rdi
	movl	%r12d, %esi
	callq	_vmalloc_to_sg
	movq	%rax, 8(%r15)
	testq	%rax, %rax
	je	LBB0_11
## %bb.5:
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	_saa7146_pgtable_alloc
	testq	%rax, %rax
	jne	LBB0_10
## %bb.6:
	movl	%r12d, (%r15)
	movq	8(%r15), %rsi
	movq	_PCI_DMA_FROMDEVICE@GOTPCREL(%rip), %r13
	movl	(%r13), %ecx
	movq	%r14, %rdi
	movl	%r12d, %edx
	callq	_pci_map_sg
	testl	%eax, %eax
	je	LBB0_9
## %bb.7:
	movq	8(%r15), %rdx
	movq	%r14, %rdi
	movq	%r15, %rsi
	movl	%eax, %ecx
	callq	_saa7146_pgtable_build_single
	testq	%rax, %rax
	je	LBB0_13
## %bb.8:
	movq	8(%r15), %rsi
	movl	(%r15), %edx
	movl	(%r13), %ecx
	movq	%r14, %rdi
	callq	_pci_unmap_sg
LBB0_9:
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	_saa7146_pgtable_free
LBB0_10:
	movq	8(%r15), %rdi
	callq	_kfree
	movq	$0, 8(%r15)
LBB0_11:
	movq	%rbx, %rdi
	callq	_vfree
LBB0_12:
	xorl	%ebx, %ebx
LBB0_13:
	movq	%rbx, %rax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PAGE_SIZE,8,3                  ## @PAGE_SIZE
	.comm	_PCI_DMA_FROMDEVICE,4,2         ## @PCI_DMA_FROMDEVICE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_saa7146_vmalloc_build_pgtable  ; -- Begin function saa7146_vmalloc_build_pgtable
	.p2align	2
_saa7146_vmalloc_build_pgtable:         ; @saa7146_vmalloc_build_pgtable
	.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, x2
	mov	x22, x1
	mov	x21, x0
Lloh0:
	adrp	x8, _PAGE_SIZE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _PAGE_SIZE@GOTPAGEOFF]
Lloh2:
	ldr	x23, [x8]
	mov	x0, x1
	bl	_vmalloc_32
	mov	x19, x0
	cbz	x0, LBB0_9
; %bb.1:
	add	x8, x22, x23
	sub	x8, x8, #1
	sdiv	x22, x8, x23
	mov	x0, x19
	mov	x1, x22
	bl	_vmalloc_to_sg
	str	x0, [x20, #8]
	cbz	x0, LBB0_8
; %bb.2:
	mov	x0, x21
	mov	x1, x20
	bl	_saa7146_pgtable_alloc
	cbnz	x0, LBB0_7
; %bb.3:
	str	w22, [x20]
	ldr	x1, [x20, #8]
Lloh3:
	adrp	x23, _PCI_DMA_FROMDEVICE@GOTPAGE
Lloh4:
	ldr	x23, [x23, _PCI_DMA_FROMDEVICE@GOTPAGEOFF]
	ldr	w3, [x23]
	mov	x0, x21
	mov	x2, x22
	bl	_pci_map_sg
	cbz	w0, LBB0_6
; %bb.4:
	mov	x3, x0
	ldr	x2, [x20, #8]
	mov	x0, x21
	mov	x1, x20
	bl	_saa7146_pgtable_build_single
	cbz	x0, LBB0_9
; %bb.5:
	ldr	x1, [x20, #8]
	ldr	w2, [x20]
	ldr	w3, [x23]
	mov	x0, x21
	bl	_pci_unmap_sg
LBB0_6:
	mov	x0, x21
	mov	x1, x20
	bl	_saa7146_pgtable_free
LBB0_7:
	ldr	x0, [x20, #8]
	bl	_kfree
	str	xzr, [x20, #8]
LBB0_8:
	mov	x0, x19
	bl	_vfree
	mov	x19, #0
LBB0_9:
	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 AdrpLdrGot	Lloh3, Lloh4
	.cfi_endproc
                                        ; -- End function
	.comm	_PAGE_SIZE,8,3                  ; @PAGE_SIZE
	.comm	_PCI_DMA_FROMDEVICE,4,2         ; @PCI_DMA_FROMDEVICE
.subsections_via_symbols
