	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function fpga_mgr_buf_load
_fpga_mgr_buf_load:                     ## @fpga_mgr_buf_load
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rcx, %rbx
	movq	%rdx, %r15
	movq	%rsi, %r12
	movq	%rdi, %r13
	movq	(%rdi), %rax
	cmpq	$0, (%rax)
	je	LBB0_1
## %bb.20:
	movq	%r13, %rdi
	movq	%r12, %rsi
	movq	%r15, %rdx
	movq	%rbx, %rcx
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_fpga_mgr_buf_load_mapped       ## TAILCALL
LBB0_1:
	leaq	(%r15,%rbx), %rdi
	movq	_PAGE_SIZE@GOTPCREL(%rip), %r14
	movq	(%r14), %rsi
	callq	_DIV_ROUND_UP
	movq	%rax, %rsi
	movq	(%r14), %rcx
	movq	%r15, %rax
	orq	%rcx, %rax
	shrq	$32, %rax
	movq	%r12, -80(%rbp)                 ## 8-byte Spill
	je	LBB0_2
## %bb.3:
	movq	%r15, %rax
	xorl	%edx, %edx
	divq	%rcx
	jmp	LBB0_4
LBB0_2:
	movl	%r15d, %eax
	xorl	%edx, %edx
	divl	%ecx
                                        ## kill: def $eax killed $eax def $rax
LBB0_4:
	subq	%rax, %rsi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rsi, %r12
	movl	%r12d, %edi
	movl	$8, %esi
	callq	_kmalloc_array
	testq	%rax, %rax
	je	LBB0_5
## %bb.7:
	movq	%rax, %r14
	movq	%r15, %rdi
	callq	_offset_in_page
	testl	%r12d, %r12d
	jle	LBB0_8
## %bb.9:
	movq	%rbx, -64(%rbp)                 ## 8-byte Spill
	movq	%r13, -72(%rbp)                 ## 8-byte Spill
	movq	%r15, %rbx
	subq	%rax, %rbx
	movq	%r12, -56(%rbp)                 ## 8-byte Spill
	movl	%r12d, %r13d
	xorl	%r12d, %r12d
	.p2align	4, 0x90
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	movq	%rbx, %rdi
	callq	_is_vmalloc_addr
	movq	%rbx, %rdi
	testq	%rax, %rax
	je	LBB0_12
## %bb.11:                              ##   in Loop: Header=BB0_10 Depth=1
	callq	_vmalloc_to_page
	jmp	LBB0_13
	.p2align	4, 0x90
LBB0_12:                                ##   in Loop: Header=BB0_10 Depth=1
	callq	_kmap_to_page
LBB0_13:                                ##   in Loop: Header=BB0_10 Depth=1
	movq	%rax, (%r14,%r12,8)
	testq	%rax, %rax
	je	LBB0_14
## %bb.15:                              ##   in Loop: Header=BB0_10 Depth=1
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	addq	(%rax), %rbx
	incq	%r12
	cmpq	%r13, %r12
	jne	LBB0_10
## %bb.16:
	movq	-72(%rbp), %r13                 ## 8-byte Reload
	movq	-64(%rbp), %rbx                 ## 8-byte Reload
	movq	-56(%rbp), %r12                 ## 8-byte Reload
	jmp	LBB0_17
LBB0_5:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_6
LBB0_8:
	xorl	%r12d, %r12d
LBB0_17:
	movq	%r15, %rdi
	callq	_offset_in_page
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r9d
	leaq	-48(%rbp), %rdi
	movq	%r14, %rsi
	movl	%r12d, %edx
	movq	%rax, %rcx
	movq	%rbx, %r8
	callq	_sg_alloc_table_from_pages
	movl	%eax, %ebx
	movq	%r14, %rdi
	callq	_kfree
	testl	%ebx, %ebx
	jne	LBB0_19
## %bb.18:
	leaq	-48(%rbp), %r14
	movq	%r13, %rdi
	movq	-80(%rbp), %rsi                 ## 8-byte Reload
	movq	%r14, %rdx
	callq	_fpga_mgr_buf_load_sg
	movl	%eax, %ebx
	movq	%r14, %rdi
	callq	_sg_free_table
	jmp	LBB0_19
LBB0_14:
	movq	%r14, %rdi
	callq	_kfree
	movq	_EFAULT@GOTPCREL(%rip), %rax
LBB0_6:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_19:
	movl	%ebx, %eax
	addq	$40, %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	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_EFAULT,4,2                     ## @EFAULT
	.no_dead_strip	_fpga_mgr_buf_load
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function fpga_mgr_buf_load
_fpga_mgr_buf_load:                     ; @fpga_mgr_buf_load
	.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, x3
	mov	x22, x2
	mov	x19, x1
	mov	x20, x0
	ldr	x8, [x0]
	ldr	x8, [x8]
	cbz	x8, LBB0_2
; %bb.1:
	mov	x0, x20
	mov	x1, x19
	mov	x2, x22
	mov	x3, x21
	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
	b	_fpga_mgr_buf_load_mapped
LBB0_2:
	add	x0, x22, x21
Lloh0:
	adrp	x27, _PAGE_SIZE@GOTPAGE
Lloh1:
	ldr	x27, [x27, _PAGE_SIZE@GOTPAGEOFF]
	ldr	x1, [x27]
	bl	_DIV_ROUND_UP
	ldr	x8, [x27]
	udiv	x8, x22, x8
	sub	x24, x0, x8
Lloh2:
	adrp	x25, _GFP_KERNEL@GOTPAGE
Lloh3:
	ldr	x25, [x25, _GFP_KERNEL@GOTPAGEOFF]
	ldr	w2, [x25]
	mov	x0, x24
	mov	w1, #8
	bl	_kmalloc_array
	cbz	x0, LBB0_10
; %bb.3:
	mov	x23, x0
	mov	x0, x22
	bl	_offset_in_page
	cmp	w24, #1
	b.lt	LBB0_11
; %bb.4:
	mov	x28, #0
	sub	x25, x22, x0
	and	x26, x24, #0xffffffff
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x25
	bl	_is_vmalloc_addr
	cbz	x0, LBB0_7
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	x0, x25
	bl	_vmalloc_to_page
	str	x0, [x23, x28, lsl #3]
	cbnz	x0, LBB0_8
	b	LBB0_14
LBB0_7:                                 ;   in Loop: Header=BB0_5 Depth=1
	mov	x0, x25
	bl	_kmap_to_page
	str	x0, [x23, x28, lsl #3]
	cbz	x0, LBB0_14
LBB0_8:                                 ;   in Loop: Header=BB0_5 Depth=1
	ldr	x8, [x27]
	add	x25, x25, x8
	add	x28, x28, #1
	cmp	x28, x26
	b.ne	LBB0_5
; %bb.9:
Lloh4:
	adrp	x25, _GFP_KERNEL@GOTPAGE
Lloh5:
	ldr	x25, [x25, _GFP_KERNEL@GOTPAGEOFF]
	b	LBB0_12
LBB0_10:
Lloh6:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh7:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_15
LBB0_11:
	mov	w24, #0
LBB0_12:
	mov	x0, x22
	bl	_offset_in_page
	mov	x3, x0
	ldr	w5, [x25]
	add	x0, sp, #8
	mov	x1, x23
	mov	x2, x24
	mov	x4, x21
	bl	_sg_alloc_table_from_pages
	mov	x21, x0
	mov	x0, x23
	bl	_kfree
	cbnz	w21, LBB0_16
; %bb.13:
	add	x2, sp, #8
	mov	x0, x20
	mov	x1, x19
	bl	_fpga_mgr_buf_load_sg
	mov	x21, x0
	add	x0, sp, #8
	bl	_sg_free_table
	b	LBB0_16
LBB0_14:
	mov	x0, x23
	bl	_kfree
Lloh8:
	adrp	x8, _EFAULT@GOTPAGE
Lloh9:
	ldr	x8, [x8, _EFAULT@GOTPAGEOFF]
LBB0_15:
	ldr	w8, [x8]
	neg	w21, w8
LBB0_16:
	mov	x0, x21
	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 AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.cfi_endproc
                                        ; -- End function
	.comm	_PAGE_SIZE,8,3                  ; @PAGE_SIZE
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_EFAULT,4,2                     ; @EFAULT
	.no_dead_strip	_fpga_mgr_buf_load
.subsections_via_symbols
