	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function aspeed_video_set_resolution
_aspeed_video_set_resolution:           ## @aspeed_video_set_resolution
	.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, %rbx
	movl	52(%rdi), %r14d
	imull	48(%rdi), %r14d
	movl	%r14d, %esi
	callq	_aspeed_video_calc_compressed_size
	movl	48(%rbx), %edx
	movq	_VE_CAP_WINDOW@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	cmpl	$1680, %edx                     ## imm = 0x690
	jne	LBB0_2
## %bb.1:
	movl	$113246208, %edx                ## imm = 0x6C00000
	orl	52(%rbx), %edx
	movq	%rbx, %rdi
	callq	_aspeed_video_write
	movl	52(%rbx), %eax
	leal	(%rax,%rax,2), %ecx
	shll	$4, %ecx
	addl	%ecx, %r14d
	jmp	LBB0_3
LBB0_2:
	shll	$16, %edx
	orl	52(%rbx), %edx
	movq	%rbx, %rdi
	callq	_aspeed_video_write
	movl	52(%rbx), %eax
LBB0_3:
	movq	_VE_COMP_WINDOW@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	movl	48(%rbx), %edx
	shll	$16, %edx
	orl	%eax, %edx
	movq	%rbx, %rdi
	callq	_aspeed_video_write
	movq	_VE_SRC_SCANLINE_OFFSET@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	48(%rbx), %edx
	shll	$2, %edx
	movq	%rbx, %rdi
	callq	_aspeed_video_write
	movq	_DIRECT_FETCH_THRESHOLD@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r14d
	jae	LBB0_4
## %bb.5:
	movq	_VE_TGS_0@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	movq	_VE_TGS_FIRST@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	40(%rbx), %rsi
	decq	%rsi
	callq	_FIELD_PREP
	movl	%eax, %r12d
	movq	_VE_TGS_LAST@GOTPCREL(%rip), %r13
	movl	(%r13), %edi
	movq	32(%rbx), %rsi
	callq	_FIELD_PREP
	orl	%eax, %r12d
	movq	%rbx, %rdi
	movl	%r15d, %esi
	movl	%r12d, %edx
	callq	_aspeed_video_write
	movq	_VE_TGS_1@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	movq	_VE_TGS_FIRST@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	24(%rbx), %rsi
	callq	_FIELD_PREP
	movl	%eax, %r12d
	movl	(%r13), %edi
	movq	16(%rbx), %rsi
	incq	%rsi
	callq	_FIELD_PREP
	orl	%eax, %r12d
	movq	%rbx, %rdi
	movl	%r15d, %esi
	movl	%r12d, %edx
	callq	_aspeed_video_write
	movq	_VE_CTRL_INT_DE@GOTPCREL(%rip), %rax
	jmp	LBB0_6
LBB0_4:
	movq	_VE_CTRL_DIRECT_FETCH@GOTPCREL(%rip), %rax
LBB0_6:
	movq	_VE_CTRL@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	movl	(%rax), %ecx
	movq	%rbx, %rdi
	xorl	%edx, %edx
	callq	_aspeed_video_update
	shll	$2, %r14d
	movq	(%rbx), %rsi
	movl	(%rsi), %eax
	cmpl	%eax, %r14d
	jne	LBB0_7
LBB0_14:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	testl	%eax, %eax
	je	LBB0_9
## %bb.8:
	movq	%rbx, %rdi
	callq	_aspeed_video_free_buf
	movq	(%rbx), %rsi
LBB0_9:
	cmpl	$0, 8(%rsi)
	je	LBB0_11
## %bb.10:
	addq	$8, %rsi
	movq	%rbx, %rdi
	callq	_aspeed_video_free_buf
	movq	(%rbx), %rsi
LBB0_11:
	movq	%rbx, %rdi
	movl	%r14d, %edx
	callq	_aspeed_video_alloc_buf
	testl	%eax, %eax
	je	LBB0_13
## %bb.12:
	movq	(%rbx), %rsi
	addq	$8, %rsi
	movq	%rbx, %rdi
	movl	%r14d, %edx
	callq	_aspeed_video_alloc_buf
	testl	%eax, %eax
	je	LBB0_13
## %bb.15:
	movq	_VE_SRC0_ADDR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	(%rbx), %rax
	movl	4(%rax), %edx
	movq	%rbx, %rdi
	callq	_aspeed_video_write
	movq	_VE_SRC1_ADDR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	(%rbx), %rax
	movl	12(%rax), %edx
	movq	%rbx, %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_aspeed_video_write             ## TAILCALL
LBB0_13:
	movl	8(%rbx), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_err
	movq	(%rbx), %rsi
	cmpl	$0, (%rsi)
	je	LBB0_14
## %bb.16:
	movq	%rbx, %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_aspeed_video_free_buf          ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_VE_CAP_WINDOW,4,2              ## @VE_CAP_WINDOW
	.comm	_VE_COMP_WINDOW,4,2             ## @VE_COMP_WINDOW
	.comm	_VE_SRC_SCANLINE_OFFSET,4,2     ## @VE_SRC_SCANLINE_OFFSET
	.comm	_DIRECT_FETCH_THRESHOLD,4,2     ## @DIRECT_FETCH_THRESHOLD
	.comm	_VE_TGS_0,4,2                   ## @VE_TGS_0
	.comm	_VE_TGS_FIRST,4,2               ## @VE_TGS_FIRST
	.comm	_VE_TGS_LAST,4,2                ## @VE_TGS_LAST
	.comm	_VE_TGS_1,4,2                   ## @VE_TGS_1
	.comm	_VE_CTRL,4,2                    ## @VE_CTRL
	.comm	_VE_CTRL_INT_DE,4,2             ## @VE_CTRL_INT_DE
	.comm	_VE_CTRL_DIRECT_FETCH,4,2       ## @VE_CTRL_DIRECT_FETCH
	.comm	_VE_SRC0_ADDR,4,2               ## @VE_SRC0_ADDR
	.comm	_VE_SRC1_ADDR,4,2               ## @VE_SRC1_ADDR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to allocate source buffers\n"

	.no_dead_strip	_aspeed_video_set_resolution
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function aspeed_video_set_resolution
_aspeed_video_set_resolution:           ; @aspeed_video_set_resolution
	.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	x19, x0
	ldp	w8, w9, [x0, #48]
	mul	w20, w9, w8
	mov	x1, x20
	bl	_aspeed_video_calc_compressed_size
	ldr	w8, [x19, #48]
Lloh0:
	adrp	x9, _VE_CAP_WINDOW@GOTPAGE
Lloh1:
	ldr	x9, [x9, _VE_CAP_WINDOW@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x9]
	cmp	w8, #1680
	b.ne	LBB0_2
; %bb.1:
	ldr	w8, [x19, #52]
	mov	w9, #113246208
	orr	w2, w8, w9
	mov	x0, x19
	bl	_aspeed_video_write
	ldr	w8, [x19, #52]
	mov	w9, #48
	madd	w20, w8, w9, w20
	b	LBB0_3
LBB0_2:
	ldr	w9, [x19, #52]
	orr	w2, w9, w8, lsl #16
	mov	x0, x19
	bl	_aspeed_video_write
	ldr	w8, [x19, #52]
LBB0_3:
Lloh3:
	adrp	x9, _VE_COMP_WINDOW@GOTPAGE
Lloh4:
	ldr	x9, [x9, _VE_COMP_WINDOW@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x9]
	ldr	w9, [x19, #48]
	orr	w2, w8, w9, lsl #16
	mov	x0, x19
	bl	_aspeed_video_write
Lloh6:
	adrp	x8, _VE_SRC_SCANLINE_OFFSET@GOTPAGE
Lloh7:
	ldr	x8, [x8, _VE_SRC_SCANLINE_OFFSET@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	ldr	w8, [x19, #48]
	lsl	w2, w8, #2
	mov	x0, x19
	bl	_aspeed_video_write
Lloh9:
	adrp	x8, _DIRECT_FETCH_THRESHOLD@GOTPAGE
Lloh10:
	ldr	x8, [x8, _DIRECT_FETCH_THRESHOLD@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	cmp	w20, w8
	b.hs	LBB0_5
; %bb.4:
Lloh12:
	adrp	x8, _VE_TGS_0@GOTPAGE
Lloh13:
	ldr	x8, [x8, _VE_TGS_0@GOTPAGEOFF]
Lloh14:
	ldr	w21, [x8]
Lloh15:
	adrp	x23, _VE_TGS_FIRST@GOTPAGE
Lloh16:
	ldr	x23, [x23, _VE_TGS_FIRST@GOTPAGEOFF]
	ldr	w0, [x23]
	ldr	x8, [x19, #40]
	sub	x1, x8, #1
	bl	_FIELD_PREP
	mov	x22, x0
Lloh17:
	adrp	x24, _VE_TGS_LAST@GOTPAGE
Lloh18:
	ldr	x24, [x24, _VE_TGS_LAST@GOTPAGEOFF]
	ldr	w0, [x24]
	ldr	x1, [x19, #32]
	bl	_FIELD_PREP
	orr	w2, w0, w22
	mov	x0, x19
	mov	x1, x21
	bl	_aspeed_video_write
Lloh19:
	adrp	x8, _VE_TGS_1@GOTPAGE
Lloh20:
	ldr	x8, [x8, _VE_TGS_1@GOTPAGEOFF]
Lloh21:
	ldr	w21, [x8]
	ldr	w0, [x23]
	ldr	x1, [x19, #24]
	bl	_FIELD_PREP
	mov	x22, x0
	ldr	w0, [x24]
	ldr	x8, [x19, #16]
	add	x1, x8, #1
	bl	_FIELD_PREP
	orr	w2, w0, w22
	mov	x0, x19
	mov	x1, x21
	bl	_aspeed_video_write
Lloh22:
	adrp	x8, _VE_CTRL_INT_DE@GOTPAGE
Lloh23:
	ldr	x8, [x8, _VE_CTRL_INT_DE@GOTPAGEOFF]
	b	LBB0_6
LBB0_5:
Lloh24:
	adrp	x8, _VE_CTRL_DIRECT_FETCH@GOTPAGE
Lloh25:
	ldr	x8, [x8, _VE_CTRL_DIRECT_FETCH@GOTPAGEOFF]
LBB0_6:
Lloh26:
	adrp	x9, _VE_CTRL@GOTPAGE
Lloh27:
	ldr	x9, [x9, _VE_CTRL@GOTPAGEOFF]
Lloh28:
	ldr	w1, [x9]
	ldr	w3, [x8]
	mov	x0, x19
	mov	w2, #0
	bl	_aspeed_video_update
	lsl	w20, w20, #2
	ldr	x1, [x19]
	ldr	w8, [x1]
	cmp	w20, w8
	b.ne	LBB0_8
LBB0_7:
	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
LBB0_8:
	cbz	w8, LBB0_10
; %bb.9:
	mov	x0, x19
	bl	_aspeed_video_free_buf
	ldr	x1, [x19]
LBB0_10:
	mov	x8, x1
	ldr	w9, [x8, #8]!
	cbz	w9, LBB0_12
; %bb.11:
	mov	x0, x19
	mov	x1, x8
	bl	_aspeed_video_free_buf
	ldr	x1, [x19]
LBB0_12:
	mov	x0, x19
	mov	x2, x20
	bl	_aspeed_video_alloc_buf
	cbz	w0, LBB0_15
; %bb.13:
	ldr	x8, [x19]
	add	x1, x8, #8
	mov	x0, x19
	mov	x2, x20
	bl	_aspeed_video_alloc_buf
	cbz	w0, LBB0_15
; %bb.14:
Lloh29:
	adrp	x8, _VE_SRC0_ADDR@GOTPAGE
Lloh30:
	ldr	x8, [x8, _VE_SRC0_ADDR@GOTPAGEOFF]
Lloh31:
	ldr	w1, [x8]
	ldr	x8, [x19]
	ldr	w2, [x8, #4]
	mov	x0, x19
	bl	_aspeed_video_write
Lloh32:
	adrp	x8, _VE_SRC1_ADDR@GOTPAGE
Lloh33:
	ldr	x8, [x8, _VE_SRC1_ADDR@GOTPAGEOFF]
Lloh34:
	ldr	w1, [x8]
	ldr	x8, [x19]
	ldr	w2, [x8, #12]
	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
	b	_aspeed_video_write
LBB0_15:
	ldr	w0, [x19, #8]
Lloh35:
	adrp	x1, l_.str@PAGE
Lloh36:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
	ldr	x1, [x19]
	ldr	w8, [x1]
	cbz	w8, LBB0_7
; %bb.16:
	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
	b	_aspeed_video_free_buf
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpAdd	Lloh35, Lloh36
	.cfi_endproc
                                        ; -- End function
	.comm	_VE_CAP_WINDOW,4,2              ; @VE_CAP_WINDOW
	.comm	_VE_COMP_WINDOW,4,2             ; @VE_COMP_WINDOW
	.comm	_VE_SRC_SCANLINE_OFFSET,4,2     ; @VE_SRC_SCANLINE_OFFSET
	.comm	_DIRECT_FETCH_THRESHOLD,4,2     ; @DIRECT_FETCH_THRESHOLD
	.comm	_VE_TGS_0,4,2                   ; @VE_TGS_0
	.comm	_VE_TGS_FIRST,4,2               ; @VE_TGS_FIRST
	.comm	_VE_TGS_LAST,4,2                ; @VE_TGS_LAST
	.comm	_VE_TGS_1,4,2                   ; @VE_TGS_1
	.comm	_VE_CTRL,4,2                    ; @VE_CTRL
	.comm	_VE_CTRL_INT_DE,4,2             ; @VE_CTRL_INT_DE
	.comm	_VE_CTRL_DIRECT_FETCH,4,2       ; @VE_CTRL_DIRECT_FETCH
	.comm	_VE_SRC0_ADDR,4,2               ; @VE_SRC0_ADDR
	.comm	_VE_SRC1_ADDR,4,2               ; @VE_SRC1_ADDR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to allocate source buffers\n"

	.no_dead_strip	_aspeed_video_set_resolution
.subsections_via_symbols
