	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function amdgpu_atombios_allocate_fb_scratch
_amdgpu_atombios_allocate_fb_scratch:   ## @amdgpu_atombios_allocate_fb_scratch
	.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, %r14
	movq	8(%rdi), %r15
	movq	_DATA@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_VRAM_UsageByFirmware@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_GetIndexIntoMasterTable
	leaq	-48(%rbp), %r9
	movq	%r15, %rdi
	movl	%eax, %esi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	callq	_amdgpu_atom_parse_data_header
	testq	%rax, %rax
	je	LBB0_3
## %bb.1:
	movq	8(%r15), %r13
	movq	-48(%rbp), %rbx
	movq	(%rbx,%r13), %rax
	movl	(%rax), %edi
	callq	_le32_to_cpu
	movl	%eax, %r12d
	movq	(%rbx,%r13), %rax
	movl	4(%rax), %edi
	callq	_le16_to_cpu
	leaq	L_.str(%rip), %rdi
	movl	%r12d, %esi
	movl	%eax, %edx
	callq	_DRM_DEBUG
	movq	(%rbx,%r13), %rcx
	movl	(%rcx), %eax
	movl	4(%rcx), %edi
	movq	_ATOM_VRAM_OPERATION_FLAGS_MASK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	movl	%edx, %esi
	andl	%eax, %esi
	movq	_ATOM_VRAM_BLOCK_SRIOV_MSG_SHARE_RESERVATION@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ebx
	movq	_ATOM_VRAM_OPERATION_FLAGS_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	shll	%cl, %ebx
	cmpl	%ebx, %esi
	jne	LBB0_5
## %bb.2:
	notl	%edx
	andl	%edx, %eax
	shll	$10, %eax
	movl	%eax, (%r14)
	shll	$10, %edi
	movl	%edi, 4(%r14)
LBB0_3:
	movl	$0, (%r15)
LBB0_4:
	movl	$20480, %ebx                    ## imm = 0x5000
	jmp	LBB0_7
LBB0_5:
	callq	_le16_to_cpu
	movl	$0, (%r15)
	testl	%eax, %eax
	je	LBB0_4
## %bb.6:
	movl	%eax, %ebx
	shll	$10, %ebx
LBB0_7:
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%ebx, %edi
	callq	_kzalloc
	movl	%eax, 4(%r15)
	testl	%eax, %eax
	je	LBB0_8
## %bb.9:
	movl	%ebx, (%r15)
	xorl	%eax, %eax
	jmp	LBB0_10
LBB0_8:
	movq	_ENOMEM@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_10:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_DATA,4,2                       ## @DATA
	.comm	_VRAM_UsageByFirmware,4,2       ## @VRAM_UsageByFirmware
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"atom firmware requested %08x %dkb\n"

	.comm	_ATOM_VRAM_OPERATION_FLAGS_MASK,4,2 ## @ATOM_VRAM_OPERATION_FLAGS_MASK
	.comm	_ATOM_VRAM_BLOCK_SRIOV_MSG_SHARE_RESERVATION,4,2 ## @ATOM_VRAM_BLOCK_SRIOV_MSG_SHARE_RESERVATION
	.comm	_ATOM_VRAM_OPERATION_FLAGS_SHIFT,4,2 ## @ATOM_VRAM_OPERATION_FLAGS_SHIFT
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.no_dead_strip	_amdgpu_atombios_allocate_fb_scratch
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function amdgpu_atombios_allocate_fb_scratch
_amdgpu_atombios_allocate_fb_scratch:   ; @amdgpu_atombios_allocate_fb_scratch
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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, x0
	ldr	x19, [x0, #8]
Lloh0:
	adrp	x8, _DATA@GOTPAGE
Lloh1:
	ldr	x8, [x8, _DATA@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
Lloh3:
	adrp	x8, _VRAM_UsageByFirmware@GOTPAGE
Lloh4:
	ldr	x8, [x8, _VRAM_UsageByFirmware@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	bl	_GetIndexIntoMasterTable
	mov	x1, x0
	add	x5, sp, #8
	mov	x0, x19
	mov	x2, #0
	mov	x3, #0
	mov	x4, #0
	bl	_amdgpu_atom_parse_data_header
	cbz	x0, LBB0_3
; %bb.1:
	ldr	x22, [x19, #8]
	ldr	x23, [sp, #8]
	ldr	x8, [x23, x22]
	ldr	w0, [x8]
	bl	_le32_to_cpu
	mov	x21, x0
	ldr	x8, [x23, x22]
	ldr	w0, [x8, #4]
	bl	_le16_to_cpu
	mov	x2, x0
Lloh6:
	adrp	x0, l_.str@PAGE
Lloh7:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x21
	bl	_DRM_DEBUG
	ldr	x9, [x23, x22]
	ldp	w8, w0, [x9]
Lloh8:
	adrp	x9, _ATOM_VRAM_OPERATION_FLAGS_MASK@GOTPAGE
Lloh9:
	ldr	x9, [x9, _ATOM_VRAM_OPERATION_FLAGS_MASK@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	and	w10, w9, w8
Lloh11:
	adrp	x11, _ATOM_VRAM_BLOCK_SRIOV_MSG_SHARE_RESERVATION@GOTPAGE
Lloh12:
	ldr	x11, [x11, _ATOM_VRAM_BLOCK_SRIOV_MSG_SHARE_RESERVATION@GOTPAGEOFF]
Lloh13:
	ldr	w11, [x11]
Lloh14:
	adrp	x12, _ATOM_VRAM_OPERATION_FLAGS_SHIFT@GOTPAGE
Lloh15:
	ldr	x12, [x12, _ATOM_VRAM_OPERATION_FLAGS_SHIFT@GOTPAGEOFF]
Lloh16:
	ldr	w12, [x12]
	lsl	w11, w11, w12
	cmp	w10, w11
	b.ne	LBB0_5
; %bb.2:
	bic	w8, w8, w9
	lsl	w8, w8, #10
	lsl	w9, w0, #10
	stp	w8, w9, [x20]
LBB0_3:
	str	wzr, [x19]
LBB0_4:
	mov	w20, #20480
	b	LBB0_7
LBB0_5:
	bl	_le16_to_cpu
	str	wzr, [x19]
	cbz	w0, LBB0_4
; %bb.6:
	lsl	w20, w0, #10
LBB0_7:
Lloh17:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh18:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh19:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_kzalloc
	str	w0, [x19, #4]
	cbz	w0, LBB0_9
; %bb.8:
	mov	w0, #0
	str	w20, [x19]
	b	LBB0_10
LBB0_9:
Lloh20:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh21:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_10:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.comm	_DATA,4,2                       ; @DATA
	.comm	_VRAM_UsageByFirmware,4,2       ; @VRAM_UsageByFirmware
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"atom firmware requested %08x %dkb\n"

	.comm	_ATOM_VRAM_OPERATION_FLAGS_MASK,4,2 ; @ATOM_VRAM_OPERATION_FLAGS_MASK
	.comm	_ATOM_VRAM_BLOCK_SRIOV_MSG_SHARE_RESERVATION,4,2 ; @ATOM_VRAM_BLOCK_SRIOV_MSG_SHARE_RESERVATION
	.comm	_ATOM_VRAM_OPERATION_FLAGS_SHIFT,4,2 ; @ATOM_VRAM_OPERATION_FLAGS_SHIFT
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.no_dead_strip	_amdgpu_atombios_allocate_fb_scratch
.subsections_via_symbols
