	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function komeda_fb_afbc_size_check
_komeda_fb_afbc_size_check:             ## @komeda_fb_afbc_size_check
	.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	%rsi, %rax
	movq	%rdi, %rbx
	movq	56(%rdi), %r15
	movq	(%rdx), %rcx
	movl	(%rcx), %esi
	movq	%rax, %rdi
	callq	_drm_gem_object_lookup
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%rax, %r14
	movl	24(%rbx), %eax
	movq	_AFBC_FORMAT_MOD_BLOCK_SIZE_MASK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	andl	%eax, %edx
	cmpl	$128, %edx
	je	LBB0_3
## %bb.4:
	cmpl	$129, %edx
	jne	LBB0_6
## %bb.5:
	movl	$16, %r12d
	movl	$16, %ecx
	jmp	LBB0_7
LBB0_1:
	leaq	L_.str(%rip), %rdi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_DRM_DEBUG_KMS
	movq	_ENOENT@GOTPCREL(%rip), %rax
	jmp	LBB0_12
LBB0_3:
	movl	$32, %ecx
	movl	$8, %r12d
	jmp	LBB0_7
LBB0_6:
	leaq	L_.str.1(%rip), %rsi
	movl	$1, %edi
	callq	_WARN
	movl	24(%rbx), %eax
	xorl	%r12d, %r12d
	xorl	%ecx, %ecx
LBB0_7:
	movq	_AFBC_FORMAT_MOD_TILED@GOTPCREL(%rip), %rdx
	andl	(%rdx), %eax
	movq	_AFBC_TH_LAYOUT_ALIGNMENT@GOTPCREL(%rip), %rax
	movl	$1, %esi
	cmovnel	(%rax), %esi
	movq	_AFBC_TH_BODY_START_ALIGNMENT@GOTPCREL(%rip), %rax
	cmoveq	_AFBC_BODY_START_ALIGNMENT@GOTPCREL(%rip), %rax
	imull	%esi, %r12d
	imull	%ecx, %esi
	movl	(%rax), %r13d
	movl	28(%rbx), %edi
	callq	_ALIGN
	movl	%eax, (%rbx)
	movl	32(%rbx), %edi
	movl	%r12d, %esi
	callq	_ALIGN
	movl	%eax, %ecx
	movl	%eax, 4(%rbx)
	movq	40(%rbx), %rax
	movl	(%rax), %eax
	cltd
	idivl	%r13d
	testl	%edx, %edx
	je	LBB0_9
## %bb.8:
	leaq	L_.str.2(%rip), %rdi
	xorl	%eax, %eax
	callq	_DRM_DEBUG_KMS
	jmp	LBB0_11
LBB0_9:
	imull	(%rbx), %ecx
	movq	_AFBC_SUPERBLK_PIXELS@GOTPCREL(%rip), %rsi
	movl	%ecx, %eax
	cltd
	idivl	(%rsi)
	movl	%eax, %r12d
	movq	_AFBC_HEADER_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	imull	%r12d, %edi
	movl	%r13d, %esi
	callq	_ALIGN
	movl	%eax, 8(%rbx)
	movl	24(%rbx), %esi
	movq	%r15, %rdi
	callq	_komeda_get_afbc_format_bpp
                                        ## kill: def $eax killed $eax def $rax
	movq	_AFBC_SUPERBLK_PIXELS@GOTPCREL(%rip), %rcx
	imull	(%rcx), %eax
	leal	7(%rax), %edi
	testl	%eax, %eax
	cmovnsl	%eax, %edi
	movslq	8(%rbx), %r15
	sarl	$3, %edi
	movq	_AFBC_SUPERBLK_ALIGNMENT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_ALIGN
	imull	%r12d, %eax
	cltq
	addq	%r15, %rax
	movq	%rax, 16(%rbx)
	movq	40(%rbx), %rcx
	movslq	(%rcx), %rdx
	addq	%rax, %rdx
	movq	(%r14), %rsi
	cmpq	%rsi, %rdx
	jle	LBB0_14
## %bb.10:
	leaq	L_.str.3(%rip), %rdi
	xorl	%eax, %eax
	callq	_DRM_DEBUG_KMS
LBB0_11:
	movq	%r14, %rdi
	callq	_drm_gem_object_put_unlocked
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
LBB0_12:
	subl	(%rax), %ebx
LBB0_13:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_14:
	movq	48(%rbx), %rax
	movq	%r14, (%rax)
	xorl	%ebx, %ebx
	jmp	LBB0_13
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to lookup GEM object\n"

	.comm	_ENOENT,4,2                     ## @ENOENT
	.comm	_AFBC_FORMAT_MOD_BLOCK_SIZE_MASK,4,2 ## @AFBC_FORMAT_MOD_BLOCK_SIZE_MASK
L_.str.1:                               ## @.str.1
	.asciz	"Invalid AFBC_FORMAT_MOD_BLOCK_SIZE: %lld.\n"

	.comm	_AFBC_FORMAT_MOD_TILED,4,2      ## @AFBC_FORMAT_MOD_TILED
	.comm	_AFBC_TH_LAYOUT_ALIGNMENT,4,2   ## @AFBC_TH_LAYOUT_ALIGNMENT
	.comm	_AFBC_TH_BODY_START_ALIGNMENT,4,2 ## @AFBC_TH_BODY_START_ALIGNMENT
	.comm	_AFBC_BODY_START_ALIGNMENT,4,2  ## @AFBC_BODY_START_ALIGNMENT
L_.str.2:                               ## @.str.2
	.asciz	"afbc offset alignment check failed.\n"

	.comm	_AFBC_SUPERBLK_PIXELS,4,2       ## @AFBC_SUPERBLK_PIXELS
	.comm	_AFBC_HEADER_SIZE,4,2           ## @AFBC_HEADER_SIZE
	.comm	_AFBC_SUPERBLK_ALIGNMENT,4,2    ## @AFBC_SUPERBLK_ALIGNMENT
L_.str.3:                               ## @.str.3
	.asciz	"afbc size check failed, obj_size: 0x%zx. min_size 0x%llx.\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.no_dead_strip	_komeda_fb_afbc_size_check
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function komeda_fb_afbc_size_check
_komeda_fb_afbc_size_check:             ; @komeda_fb_afbc_size_check
	.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	x8, x1
	mov	x20, x0
	ldr	x21, [x0, #56]
	ldr	x9, [x2]
	ldr	w1, [x9]
	mov	x0, x8
	bl	_drm_gem_object_lookup
	cbz	x0, LBB0_4
; %bb.1:
	mov	x19, x0
	ldr	w8, [x20, #24]
Lloh0:
	adrp	x9, _AFBC_FORMAT_MOD_BLOCK_SIZE_MASK@GOTPAGE
Lloh1:
	ldr	x9, [x9, _AFBC_FORMAT_MOD_BLOCK_SIZE_MASK@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	and	w2, w9, w8
	cmp	w2, #128
	b.eq	LBB0_5
; %bb.2:
	cmp	w2, #129
	b.ne	LBB0_6
; %bb.3:
	mov	w10, #16
	mov	w9, #16
	b	LBB0_7
LBB0_4:
Lloh3:
	adrp	x0, l_.str@PAGE
Lloh4:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DRM_DEBUG_KMS
Lloh5:
	adrp	x8, _ENOENT@GOTPAGE
Lloh6:
	ldr	x8, [x8, _ENOENT@GOTPAGEOFF]
	b	LBB0_12
LBB0_5:
	mov	w9, #32
	mov	w10, #8
	b	LBB0_7
LBB0_6:
Lloh7:
	adrp	x1, l_.str.1@PAGE
Lloh8:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	w0, #1
	bl	_WARN
	mov	w10, #0
	mov	w9, #0
	ldr	w8, [x20, #24]
LBB0_7:
Lloh9:
	adrp	x11, _AFBC_FORMAT_MOD_TILED@GOTPAGE
Lloh10:
	ldr	x11, [x11, _AFBC_FORMAT_MOD_TILED@GOTPAGEOFF]
Lloh11:
	ldr	w11, [x11]
Lloh12:
	adrp	x12, _AFBC_TH_LAYOUT_ALIGNMENT@GOTPAGE
Lloh13:
	ldr	x12, [x12, _AFBC_TH_LAYOUT_ALIGNMENT@GOTPAGEOFF]
Lloh14:
	ldr	w12, [x12]
	tst	w11, w8
	csinc	w8, w12, wzr, ne
	mul	w23, w8, w10
Lloh15:
	adrp	x10, _AFBC_BODY_START_ALIGNMENT@GOTPAGE
Lloh16:
	ldr	x10, [x10, _AFBC_BODY_START_ALIGNMENT@GOTPAGEOFF]
	mul	w1, w8, w9
Lloh17:
	adrp	x8, _AFBC_TH_BODY_START_ALIGNMENT@GOTPAGE
Lloh18:
	ldr	x8, [x8, _AFBC_TH_BODY_START_ALIGNMENT@GOTPAGEOFF]
	csel	x8, x10, x8, eq
	ldr	w22, [x8]
	ldr	w0, [x20, #28]
	bl	_ALIGN
	str	w0, [x20]
	ldr	w0, [x20, #32]
	mov	x1, x23
	bl	_ALIGN
	str	w0, [x20, #4]
	ldr	x8, [x20, #40]
	ldr	w8, [x8]
	sdiv	w9, w8, w22
	msub	w8, w9, w22, w8
	cbz	w8, LBB0_9
; %bb.8:
Lloh19:
	adrp	x0, l_.str.2@PAGE
Lloh20:
	add	x0, x0, l_.str.2@PAGEOFF
	b	LBB0_11
LBB0_9:
	ldr	w8, [x20]
	mul	w8, w8, w0
Lloh21:
	adrp	x23, _AFBC_SUPERBLK_PIXELS@GOTPAGE
Lloh22:
	ldr	x23, [x23, _AFBC_SUPERBLK_PIXELS@GOTPAGEOFF]
	ldr	w9, [x23]
	sdiv	w24, w8, w9
Lloh23:
	adrp	x8, _AFBC_HEADER_SIZE@GOTPAGE
Lloh24:
	ldr	x8, [x8, _AFBC_HEADER_SIZE@GOTPAGEOFF]
Lloh25:
	ldr	w8, [x8]
	mul	w0, w8, w24
	mov	x1, x22
	bl	_ALIGN
	str	w0, [x20, #8]
	ldr	w1, [x20, #24]
	mov	x0, x21
	bl	_komeda_get_afbc_format_bpp
	ldrsw	x21, [x20, #8]
	ldr	w8, [x23]
	mul	w8, w8, w0
	add	w9, w8, #7
	cmp	w8, #0
	csel	w8, w9, w8, lt
	asr	w0, w8, #3
Lloh26:
	adrp	x8, _AFBC_SUPERBLK_ALIGNMENT@GOTPAGE
Lloh27:
	ldr	x8, [x8, _AFBC_SUPERBLK_ALIGNMENT@GOTPAGEOFF]
Lloh28:
	ldr	w1, [x8]
	bl	_ALIGN
	mul	w8, w0, w24
	add	x9, x21, w8, sxtw
	str	x9, [x20, #16]
	ldr	x8, [x20, #40]
	ldrsw	x10, [x8]
	ldr	x8, [x19]
	add	x9, x10, x9
	cmp	x9, x8
	b.le	LBB0_14
; %bb.10:
	stp	x8, x9, [sp]
Lloh29:
	adrp	x0, l_.str.3@PAGE
Lloh30:
	add	x0, x0, l_.str.3@PAGEOFF
LBB0_11:
	bl	_DRM_DEBUG_KMS
	mov	x0, x19
	bl	_drm_gem_object_put_unlocked
Lloh31:
	adrp	x8, _EINVAL@GOTPAGE
Lloh32:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_12:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_13:
	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
LBB0_14:
	mov	w0, #0
	ldr	x8, [x20, #48]
	str	x19, [x8]
	b	LBB0_13
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpAdd	Lloh29, Lloh30
	.loh AdrpLdrGot	Lloh31, Lloh32
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to lookup GEM object\n"

	.comm	_ENOENT,4,2                     ; @ENOENT
	.comm	_AFBC_FORMAT_MOD_BLOCK_SIZE_MASK,4,2 ; @AFBC_FORMAT_MOD_BLOCK_SIZE_MASK
l_.str.1:                               ; @.str.1
	.asciz	"Invalid AFBC_FORMAT_MOD_BLOCK_SIZE: %lld.\n"

	.comm	_AFBC_FORMAT_MOD_TILED,4,2      ; @AFBC_FORMAT_MOD_TILED
	.comm	_AFBC_TH_LAYOUT_ALIGNMENT,4,2   ; @AFBC_TH_LAYOUT_ALIGNMENT
	.comm	_AFBC_TH_BODY_START_ALIGNMENT,4,2 ; @AFBC_TH_BODY_START_ALIGNMENT
	.comm	_AFBC_BODY_START_ALIGNMENT,4,2  ; @AFBC_BODY_START_ALIGNMENT
l_.str.2:                               ; @.str.2
	.asciz	"afbc offset alignment check failed.\n"

	.comm	_AFBC_SUPERBLK_PIXELS,4,2       ; @AFBC_SUPERBLK_PIXELS
	.comm	_AFBC_HEADER_SIZE,4,2           ; @AFBC_HEADER_SIZE
	.comm	_AFBC_SUPERBLK_ALIGNMENT,4,2    ; @AFBC_SUPERBLK_ALIGNMENT
l_.str.3:                               ; @.str.3
	.asciz	"afbc size check failed, obj_size: 0x%zx. min_size 0x%llx.\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.no_dead_strip	_komeda_fb_afbc_size_check
.subsections_via_symbols
