	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function guest_afu_read_err_buffer
_guest_afu_read_err_buffer:             ## @guest_afu_read_err_buffer
	.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	%rcx, %r15
	movl	%edx, %r13d
	movq	%rsi, %r14
	movq	%rdi, %rbx
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_get_zeroed_page
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%rax, %r12
	movq	(%rbx), %rax
	movl	(%rax), %ebx
	andl	$7, %r13d
	movq	%r12, %rdi
	callq	_virt_to_phys
	movl	%ebx, %edi
	movl	%r13d, %esi
	movl	%eax, %edx
	movq	%r15, %rcx
	callq	_cxl_h_get_afu_err
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_4
## %bb.3:
	movq	_ERR_BUFF_MAX_COPY_SIZE@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	%r13d, %ecx
	movq	%rax, %rdx
	subq	%rcx, %rdx
	cmpq	%r15, %rax
	cmovaeq	%r15, %rdx
	movq	%r14, %rdi
	movq	%r12, %rsi
	callq	_memcpy
LBB0_4:
	movl	%r12d, %edi
	callq	_free_page
	jmp	LBB0_5
LBB0_1:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_5:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_ERR_BUFF_MAX_COPY_SIZE,8,3     ## @ERR_BUFF_MAX_COPY_SIZE
	.no_dead_strip	_guest_afu_read_err_buffer
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function guest_afu_read_err_buffer
_guest_afu_read_err_buffer:             ; @guest_afu_read_err_buffer
	.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	x21, x3
	mov	x22, x2
	mov	x20, x1
	mov	x23, x0
Lloh0:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
	bl	_get_zeroed_page
	cbz	x0, LBB0_4
; %bb.1:
	mov	x19, x0
	ldr	x8, [x23]
	ldr	w24, [x8]
	and	w23, w22, #0x7
	bl	_virt_to_phys
	mov	x2, x0
	mov	x0, x24
	mov	x1, x23
	mov	x3, x21
	bl	_cxl_h_get_afu_err
	mov	x22, x0
	cbnz	w0, LBB0_3
; %bb.2:
Lloh3:
	adrp	x8, _ERR_BUFF_MAX_COPY_SIZE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _ERR_BUFF_MAX_COPY_SIZE@GOTPAGEOFF]
Lloh5:
	ldr	x8, [x8]
	sub	x9, x8, w23, uxtw
	cmp	x8, x21
	csel	x2, x9, x21, lo
	mov	x0, x20
	mov	x1, x19
	bl	_memcpy
LBB0_3:
	mov	x0, x19
	bl	_free_page
	b	LBB0_5
LBB0_4:
Lloh6:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh7:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_5:
	mov	x0, x22
	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 AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_ERR_BUFF_MAX_COPY_SIZE,8,3     ; @ERR_BUFF_MAX_COPY_SIZE
	.no_dead_strip	_guest_afu_read_err_buffer
.subsections_via_symbols
