	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function calculate_v_scale_registers
_calculate_v_scale_registers:           ## @calculate_v_scale_registers
	.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
	cmpl	%ecx, %edx
	jge	LBB0_2
## %bb.1:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_19
LBB0_2:
	movq	%r9, %r15
	movq	%r8, %r14
	movl	%ecx, %ebx
	movl	%edx, %r12d
	movl	%esi, %r13d
	movl	%esi, %edi
	callq	_V4L2_FIELD_HAS_BOTH
	testq	%rax, %rax
	je	LBB0_4
## %bb.3:
	leal	(%rbx,%rbx), %eax
	cmpl	%r12d, %eax
	jl	LBB0_12
	jmp	LBB0_9
LBB0_4:
	movq	_V4L2_FIELD_TOP@GOTPCREL(%rip), %rax
	cmpl	%r13d, (%rax)
	je	LBB0_7
## %bb.5:
	movq	_V4L2_FIELD_ALTERNATE@GOTPCREL(%rip), %rax
	cmpl	%r13d, (%rax)
	je	LBB0_7
## %bb.6:
	movq	_V4L2_FIELD_BOTTOM@GOTPCREL(%rip), %rax
	cmpl	%r13d, (%rax)
	jne	LBB0_12
LBB0_7:
	leal	(,%rbx,4), %eax
	addl	%ebx, %ebx
	cmpl	%r12d, %eax
	jge	LBB0_9
LBB0_12:
	notl	%ebx
	addl	%r12d, %ebx
	shll	$11, %ebx
	leal	(%rbx,%rbx,4), %eax
	cltd
	idivl	%r12d
	movl	%eax, %edx
	leal	9(%rdx), %eax
	cltq
	imulq	$1717986919, %rax, %rax         ## imm = 0x66666667
	movq	%rax, %rcx
	shrq	$63, %rcx
	sarq	$34, %rax
	leal	(%rax,%rcx), %r9d
	leal	(%rax,%rcx), %esi
	addl	$15, %esi
	leal	(%rax,%rcx), %ebx
	addl	$30, %ebx
	testl	%esi, %esi
	cmovnsl	%esi, %ebx
	xorl	%eax, %eax
	cmpl	$5111, %edx                     ## imm = 0x13F7
	jl	LBB0_14
## %bb.13:
	movl	$1024, %ecx                     ## imm = 0x400
	subl	%r9d, %ecx
	movl	%r9d, %eax
	cltd
	idivl	%ecx
LBB0_14:
	sarl	$4, %ebx
	movq	_hps_v_coeff_tab@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpl	$63, %eax
	movl	$63, %edx
	cmovll	%eax, %edx
	movslq	%edx, %rdx
	movl	(%rcx,%rdx,8), %r8d
	movslq	4(%rcx,%rdx,8), %rdi
	movq	_v_attenuation@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rsi
	movl	$-65536, %edx                   ## imm = 0xFFFF0000
	.p2align	4, 0x90
LBB0_15:                                ## =>This Inner Loop Header: Depth=1
	movq	(%rsi), %rcx
	addl	$65536, %edx                    ## imm = 0x10000
	testq	%rcx, %rcx
	je	LBB0_17
## %bb.16:                              ##   in Loop: Header=BB0_15 Depth=1
	addq	$8, %rsi
	cmpq	%rdi, %rcx
	jl	LBB0_15
LBB0_17:
	orl	%r8d, %edx
	movl	$-2147483648, %edi              ## imm = 0x80000000
	movl	%ebx, %esi
	jmp	LBB0_18
LBB0_9:
	xorl	%edi, %edi
	movl	$0, %r9d
	cmpl	%r12d, %ebx
	jge	LBB0_11
## %bb.10:
	shll	$10, %r12d
	incl	%ebx
	movl	%r12d, %eax
	cltd
	idivl	%ebx
	movl	%eax, %r9d
	addl	$-1024, %r9d                    ## imm = 0xFC00
LBB0_11:
	leal	15(%r9), %esi
	testl	%r9d, %r9d
	cmovnsl	%r9d, %esi
	leal	63(%r9), %ebx
	cmovnsl	%r9d, %ebx
	sarl	$4, %esi
	sarl	$6, %ebx
	addl	%esi, %ebx
	movl	$255, %edx
	xorl	%eax, %eax
LBB0_18:
	shll	$21, %r9d
	orl	%edi, %r9d
	shll	$15, %eax
	shll	$8, %ebx
	orl	%eax, %ebx
	orl	%r9d, %ebx
	addl	%esi, %esi
	orl	%ebx, %esi
	orl	%esi, (%r14)
	movq	_MASK_W0@GOTPCREL(%rip), %rax
	movq	_MASK_B2@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	notl	%ecx
	andl	(%r15), %ecx
	orl	%edx, %ecx
	movl	%ecx, (%r15)
	xorl	%eax, %eax
LBB0_19:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_V4L2_FIELD_TOP,4,2             ## @V4L2_FIELD_TOP
	.comm	_V4L2_FIELD_ALTERNATE,4,2       ## @V4L2_FIELD_ALTERNATE
	.comm	_V4L2_FIELD_BOTTOM,4,2          ## @V4L2_FIELD_BOTTOM
	.comm	_hps_v_coeff_tab,8,3            ## @hps_v_coeff_tab
	.comm	_v_attenuation,8,3              ## @v_attenuation
	.comm	_MASK_W0,4,2                    ## @MASK_W0
	.comm	_MASK_B2,4,2                    ## @MASK_B2
	.no_dead_strip	_calculate_v_scale_registers
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function calculate_v_scale_registers
_calculate_v_scale_registers:           ; @calculate_v_scale_registers
	.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
	cmp	w2, w3
	b.ge	LBB0_2
; %bb.1:
Lloh0:
	adrp	x8, _EINVAL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_17
LBB0_2:
	mov	x19, x5
	mov	x20, x4
	mov	x22, x3
	mov	x21, x2
	mov	x23, x1
	mov	x0, x1
	bl	_V4L2_FIELD_HAS_BOTH
	cbz	x0, LBB0_4
; %bb.3:
	cmp	w21, w22, lsl #1
	b.gt	LBB0_6
	b	LBB0_8
LBB0_4:
Lloh3:
	adrp	x8, _V4L2_FIELD_TOP@GOTPAGE
Lloh4:
	ldr	x8, [x8, _V4L2_FIELD_TOP@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
Lloh6:
	adrp	x9, _V4L2_FIELD_ALTERNATE@GOTPAGE
Lloh7:
	ldr	x9, [x9, _V4L2_FIELD_ALTERNATE@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
Lloh9:
	adrp	x10, _V4L2_FIELD_BOTTOM@GOTPAGE
Lloh10:
	ldr	x10, [x10, _V4L2_FIELD_BOTTOM@GOTPAGEOFF]
Lloh11:
	ldr	w10, [x10]
	cmp	w8, w23
	ccmp	w9, w23, #4, ne
	ccmp	w10, w23, #4, ne
	b.ne	LBB0_6
; %bb.5:
	cmp	w21, w22, lsl #2
	lsl	w22, w22, #1
	b.le	LBB0_8
LBB0_6:
	mvn	w8, w22
	add	w8, w8, w21
	add	w8, w8, w8, lsl #2
	lsl	w8, w8, #11
	sdiv	w10, w8, w21
	add	w8, w10, #9
	mov	w9, #26215
	movk	w9, #26214, lsl #16
	smull	x8, w8, w9
	lsr	x9, x8, #63
	asr	x8, x8, #34
	add	w8, w8, w9
	add	w9, w8, #15
	add	w11, w8, #30
	cmp	w9, #0
	csel	w9, w11, w9, lt
	asr	w9, w9, #4
	mov	w11, #5111
	cmp	w10, w11
	b.ge	LBB0_10
; %bb.7:
	mov	w10, #0
	b	LBB0_11
LBB0_8:
	cmp	w22, w21
	b.ge	LBB0_14
; %bb.9:
	lsl	w8, w21, #10
	add	w9, w22, #1
	sdiv	w8, w8, w9
	sub	w8, w8, #1024
	b	LBB0_15
LBB0_10:
	mov	w10, #1024
	sub	w10, w10, w8
	sdiv	w10, w8, w10
LBB0_11:
Lloh12:
	adrp	x11, _hps_v_coeff_tab@GOTPAGE
Lloh13:
	ldr	x11, [x11, _hps_v_coeff_tab@GOTPAGEOFF]
Lloh14:
	ldr	x11, [x11]
	mov	w12, #63
	cmp	w10, #63
	csel	w12, w10, w12, lt
	add	x12, x11, w12, sxtw #3
	ldp	w11, w12, [x12]
                                        ; kill: def $w12 killed $w12 def $x12
	sxtw	x12, w12
Lloh15:
	adrp	x13, _v_attenuation@GOTPAGE
Lloh16:
	ldr	x13, [x13, _v_attenuation@GOTPAGEOFF]
Lloh17:
	ldr	x13, [x13]
	mov	w14, #-65536
LBB0_12:                                ; =>This Inner Loop Header: Depth=1
	ldr	x15, [x13], #8
	add	w14, w14, #16, lsl #12          ; =65536
	cmp	x15, #0
	ccmp	x15, x12, #0, ne
	b.lt	LBB0_12
; %bb.13:
	orr	w11, w14, w11
	mov	w12, #-2147483648
	mov	x13, x9
	b	LBB0_16
LBB0_14:
	mov	w8, #0
LBB0_15:
	mov	w12, #0
	mov	w10, #0
	add	w9, w8, #15
	cmp	w8, #0
	csel	w9, w9, w8, lt
	asr	w13, w9, #4
	add	w9, w8, #63
	csel	w9, w9, w8, lt
	add	w9, w13, w9, asr #6
	mov	w11, #255
LBB0_16:
	mov	w0, #0
	orr	w8, w12, w8, lsl #21
	orr	w8, w8, w10, lsl #15
	orr	w8, w8, w9, lsl #8
	orr	w8, w8, w13, lsl #1
	ldr	w9, [x20]
	orr	w8, w8, w9
	str	w8, [x20]
Lloh18:
	adrp	x8, _MASK_W0@GOTPAGE
Lloh19:
	ldr	x8, [x8, _MASK_W0@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
Lloh21:
	adrp	x9, _MASK_B2@GOTPAGE
Lloh22:
	ldr	x9, [x9, _MASK_B2@GOTPAGEOFF]
Lloh23:
	ldr	w9, [x9]
	orr	w8, w9, w8
	ldr	w9, [x19]
	bic	w8, w9, w8
	orr	w8, w11, w8
	str	w8, [x19]
LBB0_17:
	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	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_V4L2_FIELD_TOP,4,2             ; @V4L2_FIELD_TOP
	.comm	_V4L2_FIELD_ALTERNATE,4,2       ; @V4L2_FIELD_ALTERNATE
	.comm	_V4L2_FIELD_BOTTOM,4,2          ; @V4L2_FIELD_BOTTOM
	.comm	_hps_v_coeff_tab,8,3            ; @hps_v_coeff_tab
	.comm	_v_attenuation,8,3              ; @v_attenuation
	.comm	_MASK_W0,4,2                    ; @MASK_W0
	.comm	_MASK_B2,4,2                    ; @MASK_B2
	.no_dead_strip	_calculate_v_scale_registers
.subsections_via_symbols
