	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_sun8i_vi_scaler_setup          ## -- Begin function sun8i_vi_scaler_setup
	.p2align	4, 0x90
_sun8i_vi_scaler_setup:                 ## @sun8i_vi_scaler_setup
	.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	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%r9d, -48(%rbp)                 ## 4-byte Spill
	movl	%r8d, -44(%rbp)                 ## 4-byte Spill
	movl	%ecx, %ebx
	movl	%edx, %r13d
	movq	%rdi, %r14
	movq	48(%rbp), %rax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	movl	24(%rbp), %eax
	movl	%eax, -56(%rbp)                 ## 4-byte Spill
	movl	16(%rbp), %eax
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
	movl	40(%rbp), %r15d
	movl	32(%rbp), %r12d
	callq	_sun8i_vi_scaler_base
	movq	_SUN8I_VI_SCALER_PHASE_FRAC@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	addb	$-16, %cl
	shll	%cl, %r12d
	shll	%cl, %r15d
	movl	%eax, -80(%rbp)                 ## 4-byte Spill
	movq	_SUN8I_VI_SCALER_SCALE_FRAC@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -72(%rbp)                 ## 4-byte Spill
	movl	%r13d, -84(%rbp)                ## 4-byte Spill
	movl	%r13d, %edi
	movl	%ebx, -88(%rbp)                 ## 4-byte Spill
	movl	%ebx, %esi
	callq	_SUN8I_VI_SCALER_SIZE
	movl	%eax, -76(%rbp)                 ## 4-byte Spill
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	movl	-48(%rbp), %esi                 ## 4-byte Reload
	callq	_SUN8I_VI_SCALER_SIZE
	movl	%eax, -68(%rbp)                 ## 4-byte Spill
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %eax
	movl	%r12d, -44(%rbp)                ## 4-byte Spill
	movl	%r15d, -48(%rbp)                ## 4-byte Spill
	movl	%r15d, %esi
	cmpl	$2, %eax
	jne	LBB0_3
## %bb.1:
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	cmpl	$2, 4(%rcx)
	movl	-44(%rbp), %r12d                ## 4-byte Reload
	movl	-48(%rbp), %ecx                 ## 4-byte Reload
	movl	%ecx, %esi
	jne	LBB0_3
## %bb.2:
	movl	-44(%rbp), %r12d                ## 4-byte Reload
	sarl	%r12d
	movl	-48(%rbp), %edx                 ## 4-byte Reload
	sarl	%edx
	movq	_SUN8I_VI_SCALER_SCALE_FRAC@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	addb	$-2, %cl
	movq	$-1, %rsi
	shlq	%cl, %rsi
	addl	%edx, %esi
LBB0_3:
	movl	%r12d, -92(%rbp)                ## 4-byte Spill
	movq	%rsi, -104(%rbp)                ## 8-byte Spill
	movq	8(%r14), %rcx
	cmpq	$0, (%rcx)
	movl	-80(%rbp), %r13d                ## 4-byte Reload
	je	LBB0_9
## %bb.4:
	cmpl	$1, %eax
	jne	LBB0_7
## %bb.5:
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	cmpl	$1, 4(%rax)
	jne	LBB0_7
## %bb.6:
	movq	_SUN50I_SCALER_VSU_SCALE_MODE_UI@GOTPCREL(%rip), %rax
	jmp	LBB0_8
LBB0_7:
	movq	_SUN50I_SCALER_VSU_SCALE_MODE_NORMAL@GOTPCREL(%rip), %rax
LBB0_8:
	movl	(%rax), %r15d
	movl	(%r14), %ebx
	movl	%r13d, %edi
	callq	_SUN50I_SCALER_VSU_SCALE_MODE
	movl	%ebx, %edi
	movl	%eax, %esi
	movl	%r15d, %edx
	callq	_regmap_write
LBB0_9:
	movl	-72(%rbp), %ecx                 ## 4-byte Reload
	addb	$-16, %cl
	movl	-56(%rbp), %r15d                ## 4-byte Reload
	shll	%cl, %r15d
	movl	%r15d, -56(%rbp)                ## 4-byte Spill
                                        ## kill: def $cl killed $cl killed $ecx
	movl	-52(%rbp), %r12d                ## 4-byte Reload
	shll	%cl, %r12d
	movl	%r12d, -52(%rbp)                ## 4-byte Spill
	movl	(%r14), %ebx
	movl	%r13d, %edi
	callq	_SUN8I_SCALER_VSU_OUTSIZE
	movl	%ebx, %edi
	movl	%eax, %esi
	movl	-68(%rbp), %edx                 ## 4-byte Reload
	callq	_regmap_write
	movl	(%r14), %ebx
	movl	%r13d, %edi
	callq	_SUN8I_SCALER_VSU_YINSIZE
	movl	%ebx, %edi
	movl	%eax, %esi
	movl	-76(%rbp), %edx                 ## 4-byte Reload
	callq	_regmap_write
	movl	(%r14), %ebx
	movl	%r13d, %edi
	callq	_SUN8I_SCALER_VSU_YHSTEP
	movl	%ebx, %edi
	movl	%eax, %esi
	movl	%r12d, %edx
	callq	_regmap_write
	movl	(%r14), %ebx
	movl	%r13d, %edi
	callq	_SUN8I_SCALER_VSU_YVSTEP
	movl	%ebx, %edi
	movl	%eax, %esi
	movl	%r15d, %edx
	callq	_regmap_write
	movl	(%r14), %ebx
	movl	%r13d, %edi
	callq	_SUN8I_SCALER_VSU_YHPHASE
	movl	%ebx, %edi
	movl	%eax, %esi
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	callq	_regmap_write
	movl	(%r14), %ebx
	movl	%r13d, %edi
	callq	_SUN8I_SCALER_VSU_YVPHASE
	movl	%ebx, %edi
	movl	%eax, %esi
	movl	-48(%rbp), %edx                 ## 4-byte Reload
	callq	_regmap_write
	movl	(%r14), %r15d
	movl	%r13d, %edi
	callq	_SUN8I_SCALER_VSU_CINSIZE
	movl	%eax, %ebx
	movl	-84(%rbp), %eax                 ## 4-byte Reload
	cltd
	movq	-64(%rbp), %r12                 ## 8-byte Reload
	idivl	(%r12)
	movl	%eax, %edi
	movl	-88(%rbp), %eax                 ## 4-byte Reload
	cltd
	idivl	4(%r12)
	movl	%eax, %esi
	callq	_SUN8I_VI_SCALER_SIZE
	movl	%r15d, %edi
	movl	%ebx, %esi
	movl	%eax, %edx
	callq	_regmap_write
	movl	(%r14), %ebx
	movl	%r13d, %edi
	callq	_SUN8I_SCALER_VSU_CHSTEP
	movl	%eax, %esi
	movl	-52(%rbp), %eax                 ## 4-byte Reload
	cltd
	idivl	(%r12)
	movl	%ebx, %edi
	movl	%eax, %edx
	callq	_regmap_write
	movl	(%r14), %ebx
	movl	%r13d, %edi
	callq	_SUN8I_SCALER_VSU_CVSTEP
	movl	%eax, %esi
	movl	-56(%rbp), %r15d                ## 4-byte Reload
	movl	%r15d, %eax
	cltd
	idivl	4(%r12)
	movl	%ebx, %edi
	movl	%eax, %edx
	callq	_regmap_write
	movl	(%r14), %ebx
	movl	%r13d, %edi
	callq	_SUN8I_SCALER_VSU_CHPHASE
	movl	%ebx, %edi
	movl	%eax, %esi
	movl	-92(%rbp), %edx                 ## 4-byte Reload
	callq	_regmap_write
	movl	(%r14), %ebx
	movl	%r13d, %edi
	callq	_SUN8I_SCALER_VSU_CVPHASE
	movl	%ebx, %edi
	movl	%eax, %esi
	movq	-104(%rbp), %rdx                ## 8-byte Reload
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_regmap_write
	movl	(%r14), %edi
	movl	%r13d, %esi
	movl	-52(%rbp), %edx                 ## 4-byte Reload
	movl	%r15d, %ecx
	movq	%r12, %r8
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_sun8i_vi_scaler_set_coeff      ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_SUN8I_VI_SCALER_PHASE_FRAC,4,2 ## @SUN8I_VI_SCALER_PHASE_FRAC
	.comm	_SUN8I_VI_SCALER_SCALE_FRAC,4,2 ## @SUN8I_VI_SCALER_SCALE_FRAC
	.comm	_SUN50I_SCALER_VSU_SCALE_MODE_UI,4,2 ## @SUN50I_SCALER_VSU_SCALE_MODE_UI
	.comm	_SUN50I_SCALER_VSU_SCALE_MODE_NORMAL,4,2 ## @SUN50I_SCALER_VSU_SCALE_MODE_NORMAL
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_sun8i_vi_scaler_setup          ; -- Begin function sun8i_vi_scaler_setup
	.p2align	2
_sun8i_vi_scaler_setup:                 ; @sun8i_vi_scaler_setup
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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
	stp	w7, w6, [sp, #8]                ; 8-byte Folded Spill
	mov	x24, x5
	mov	x25, x4
	mov	x28, x3
	mov	x27, x2
	mov	x20, x0
	ldr	x19, [x29, #24]
	ldp	w23, w22, [x29, #16]
	bl	_sun8i_vi_scaler_base
	mov	x21, x0
Lloh0:
	adrp	x8, _SUN8I_VI_SCALER_PHASE_FRAC@GOTPAGE
Lloh1:
	ldr	x8, [x8, _SUN8I_VI_SCALER_PHASE_FRAC@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	sub	w8, w8, #16
	lsl	w23, w23, w8
	lsl	w26, w22, w8
Lloh3:
	adrp	x22, _SUN8I_VI_SCALER_SCALE_FRAC@GOTPAGE
Lloh4:
	ldr	x22, [x22, _SUN8I_VI_SCALER_SCALE_FRAC@GOTPAGEOFF]
	ldr	w8, [x22]
	str	w8, [sp]                        ; 4-byte Folded Spill
	stp	w27, w28, [sp, #16]             ; 8-byte Folded Spill
	mov	x0, x27
	mov	x1, x28
	bl	_SUN8I_VI_SCALER_SIZE
	str	w0, [sp, #4]                    ; 4-byte Folded Spill
	mov	x0, x25
	mov	x1, x24
	bl	_SUN8I_VI_SCALER_SIZE
	mov	x24, x0
	ldr	w8, [x19]
	mov	x11, x23
	mov	x10, x26
	cmp	w8, #2
	b.ne	LBB0_3
; %bb.1:
	ldr	w9, [x19, #4]
	mov	x11, x23
	mov	x10, x26
	cmp	w9, #2
	b.ne	LBB0_3
; %bb.2:
	asr	w11, w23, #1
	ldr	w9, [x22]
	sub	w9, w9, #2
	mov	x10, #-1
	lsl	x9, x10, x9
	add	w10, w9, w26, asr #1
LBB0_3:
	stp	w11, w10, [sp, #24]             ; 8-byte Folded Spill
	ldr	x9, [x20, #8]
	ldr	x9, [x9]
	cbz	x9, LBB0_9
; %bb.4:
	cmp	w8, #1
	b.ne	LBB0_7
; %bb.5:
	ldr	w8, [x19, #4]
	cmp	w8, #1
	b.ne	LBB0_7
; %bb.6:
Lloh5:
	adrp	x8, _SUN50I_SCALER_VSU_SCALE_MODE_UI@GOTPAGE
Lloh6:
	ldr	x8, [x8, _SUN50I_SCALER_VSU_SCALE_MODE_UI@GOTPAGEOFF]
	b	LBB0_8
LBB0_7:
Lloh7:
	adrp	x8, _SUN50I_SCALER_VSU_SCALE_MODE_NORMAL@GOTPAGE
Lloh8:
	ldr	x8, [x8, _SUN50I_SCALER_VSU_SCALE_MODE_NORMAL@GOTPAGEOFF]
LBB0_8:
	ldr	w25, [x8]
	ldr	w27, [x20]
	mov	x0, x21
	bl	_SUN50I_SCALER_VSU_SCALE_MODE
	mov	x1, x0
	mov	x0, x27
	mov	x2, x25
	bl	_regmap_write
LBB0_9:
	ldr	w8, [sp]                        ; 4-byte Folded Reload
	sub	w8, w8, #16
	ldr	w9, [sp, #8]                    ; 4-byte Folded Reload
	lsl	w27, w9, w8
	ldr	w9, [sp, #12]                   ; 4-byte Folded Reload
	lsl	w28, w9, w8
	ldr	w25, [x20]
	mov	x0, x21
	bl	_SUN8I_SCALER_VSU_OUTSIZE
	mov	x1, x0
	mov	x0, x25
	mov	x2, x24
	bl	_regmap_write
	ldr	w24, [x20]
	mov	x0, x21
	bl	_SUN8I_SCALER_VSU_YINSIZE
	mov	x1, x0
	mov	x0, x24
	ldr	w2, [sp, #4]                    ; 4-byte Folded Reload
	bl	_regmap_write
	ldr	w22, [x20]
	mov	x0, x21
	bl	_SUN8I_SCALER_VSU_YHSTEP
	mov	x1, x0
	mov	x0, x22
	mov	x2, x28
	bl	_regmap_write
	ldr	w22, [x20]
	mov	x0, x21
	bl	_SUN8I_SCALER_VSU_YVSTEP
	mov	x1, x0
	mov	x0, x22
	mov	x2, x27
	bl	_regmap_write
	ldr	w22, [x20]
	mov	x0, x21
	bl	_SUN8I_SCALER_VSU_YHPHASE
	mov	x1, x0
	mov	x0, x22
	mov	x2, x23
	bl	_regmap_write
	ldr	w22, [x20]
	mov	x0, x21
	bl	_SUN8I_SCALER_VSU_YVPHASE
	mov	x1, x0
	mov	x0, x22
	mov	x2, x26
	bl	_regmap_write
	ldr	w22, [x20]
	mov	x0, x21
	bl	_SUN8I_SCALER_VSU_CINSIZE
	mov	x23, x0
	ldp	w8, w9, [x19]
	ldr	w10, [sp, #16]                  ; 4-byte Folded Reload
	sdiv	w0, w10, w8
	ldr	w8, [sp, #20]                   ; 4-byte Folded Reload
	sdiv	w1, w8, w9
	bl	_SUN8I_VI_SCALER_SIZE
	mov	x2, x0
	mov	x0, x22
	mov	x1, x23
	bl	_regmap_write
	ldr	w22, [x20]
	mov	x0, x21
	bl	_SUN8I_SCALER_VSU_CHSTEP
	mov	x1, x0
	ldr	w8, [x19]
	sdiv	w2, w28, w8
	mov	x0, x22
	bl	_regmap_write
	ldr	w22, [x20]
	mov	x0, x21
	bl	_SUN8I_SCALER_VSU_CVSTEP
	mov	x1, x0
	ldr	w8, [x19, #4]
	sdiv	w2, w27, w8
	mov	x0, x22
	bl	_regmap_write
	ldr	w22, [x20]
	mov	x0, x21
	bl	_SUN8I_SCALER_VSU_CHPHASE
	mov	x1, x0
	mov	x0, x22
	ldr	w2, [sp, #24]                   ; 4-byte Folded Reload
	bl	_regmap_write
	ldr	w22, [x20]
	mov	x0, x21
	bl	_SUN8I_SCALER_VSU_CVPHASE
	mov	x1, x0
	mov	x0, x22
	ldr	w2, [sp, #28]                   ; 4-byte Folded Reload
	bl	_regmap_write
	ldr	w0, [x20]
	mov	x1, x21
	mov	x2, x28
	mov	x3, x27
	mov	x4, x19
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	b	_sun8i_vi_scaler_set_coeff
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_SUN8I_VI_SCALER_PHASE_FRAC,4,2 ; @SUN8I_VI_SCALER_PHASE_FRAC
	.comm	_SUN8I_VI_SCALER_SCALE_FRAC,4,2 ; @SUN8I_VI_SCALER_SCALE_FRAC
	.comm	_SUN50I_SCALER_VSU_SCALE_MODE_UI,4,2 ; @SUN50I_SCALER_VSU_SCALE_MODE_UI
	.comm	_SUN50I_SCALER_VSU_SCALE_MODE_NORMAL,4,2 ; @SUN50I_SCALER_VSU_SCALE_MODE_NORMAL
.subsections_via_symbols
