	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function set_video_mode_Kiara
_set_video_mode_Kiara:                  ## @set_video_mode_Kiara
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	_PSZ_MAX@GOTPCREL(%rip), %rax
	cmpl	%esi, (%rax)
	jle	LBB0_2
## %bb.1:
	movl	(%r8), %eax
	cmpq	$4, %rax
	jb	LBB0_4
LBB0_2:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
LBB0_3:
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_21:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	movl	%edx, %r10d
	movl	%esi, %ebx
	movq	%rdi, %r14
	movl	$1, %edi
	cmpl	$5, %ecx
	jl	LBB0_8
## %bb.5:
	cmpl	$16, %ecx
	jb	LBB0_7
## %bb.6:
	movq	_PSZ_VGA@GOTPCREL(%rip), %rdx
	movl	$3, %edi
	cmpl	%ebx, (%rdx)
	je	LBB0_8
LBB0_7:
	cmpl	$30, %ecx
	movl	$30, %edx
	cmovll	%ecx, %edx
	movzbl	%dl, %ecx
	imull	$205, %ecx, %edi
	shrl	$10, %edi
LBB0_8:
	leal	-1(%rdi), %ecx
	movq	_Kiara_table@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	movslq	%ebx, %r11
	movq	(%rdx,%r11,8), %rdx
	movq	(%rdx,%rcx,8), %r12
	cmpl	$4, %eax
	movl	$3, %ecx
	cmovgel	%eax, %ecx
	movq	%rax, %r15
	shlq	$32, %r15
	leaq	(%rax,%rax,2), %rdx
	leaq	(%r12,%rdx,8), %r13
	negl	%ecx
	leal	1(%rax), %edx
	movabsq	$4294967296, %rax               ## imm = 0x100000000
	.p2align	4, 0x90
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	cmpq	$0, (%r13)
	jne	LBB0_12
## %bb.10:                              ##   in Loop: Header=BB0_9 Depth=1
	movl	%edx, (%r8)
	addq	%rax, %r15
	addq	$24, %r13
	leal	(%rcx,%rdx), %esi
	incl	%esi
                                        ## kill: def $edx killed $edx killed $rdx
	incl	%edx
                                        ## kill: def $edx killed $edx def $rdx
	cmpl	$2, %esi
	jne	LBB0_9
## %bb.11:
	movq	_ENOENT@GOTPCREL(%rip), %rcx
	jmp	LBB0_3
LBB0_12:
	sarq	$32, %r15
	testl	%r9d, %r9d
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	je	LBB0_14
## %bb.13:
	leaq	(%r15,%r15,2), %rax
	movl	16(%r12,%rax,8), %edx
	movq	%r14, %rdi
	movl	$4, %esi
	movl	$12, %ecx
	movl	%r10d, -48(%rbp)                ## 4-byte Spill
	movq	%r11, -64(%rbp)                 ## 8-byte Spill
	callq	_send_video_command
	movq	-64(%rbp), %r11                 ## 8-byte Reload
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	-48(%rbp), %r10d                ## 4-byte Reload
	testl	%eax, %eax
	js	LBB0_21
LBB0_14:
	leaq	(%r15,%r15,2), %rax
	movq	8(%r12,%rax,8), %r8
	testq	%r8, %r8
	jle	LBB0_17
## %bb.15:
	movq	_V4L2_PIX_FMT_YUV420@GOTPCREL(%rip), %rcx
	cmpl	%r10d, (%rcx)
	jne	LBB0_17
## %bb.16:
	leaq	(%r12,%rax,8), %rcx
	addq	$8, %rcx
	movq	%rcx, -48(%rbp)                 ## 8-byte Spill
	movl	16(%r12,%rax,8), %esi
	movq	%r14, %rdi
	movl	%r10d, %r12d
	movq	%r11, %r15
	callq	_pwc_dec23_init
	movq	%r15, %r11
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	%r12d, %r10d
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %r8
LBB0_17:
	movl	%r10d, (%r14)
	leal	(%rdi,%rdi,4), %edx
	movl	%edx, 4(%r14)
	movq	(%r13), %rax
	movq	%rax, 8(%r14)
	movq	_pwc_image_sizes@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	(%rax,%r11,8), %rcx
	movl	(%rcx), %eax
	movl	%eax, 16(%r14)
	movq	8(%rcx), %rcx
	movl	%ecx, 20(%r14)
	movq	%r8, 24(%r14)
	testq	%r8, %r8
	jle	LBB0_19
## %bb.18:
	movslq	%ecx, %rax
	imulq	%r8, %rax
	leaq	3(%rax), %rsi
	testq	%rax, %rax
	cmovnsq	%rax, %rsi
	shrq	$2, %rsi
	jmp	LBB0_20
LBB0_19:
	imull	%ecx, %eax
	shll	$2, %eax
	leal	(%rax,%rax,2), %ecx
	leal	(%rax,%rax,2), %esi
	addl	$7, %esi
	testl	%ecx, %ecx
	cmovnsl	%ecx, %esi
	sarl	$3, %esi
LBB0_20:
	movl	%esi, 32(%r14)
	leaq	L_.str(%rip), %rdi
                                        ## kill: def $esi killed $esi killed $rsi
	movl	%ebx, %ecx
                                        ## kill: def $r8d killed $r8d killed $r8
	callq	_PWC_TRACE
	xorl	%eax, %eax
	jmp	LBB0_21
	.cfi_endproc
                                        ## -- End function
	.comm	_PSZ_MAX,4,2                    ## @PSZ_MAX
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_PSZ_VGA,4,2                    ## @PSZ_VGA
	.comm	_Kiara_table,8,3                ## @Kiara_table
	.comm	_ENOENT,4,2                     ## @ENOENT
	.comm	_V4L2_PIX_FMT_YUV420,4,2        ## @V4L2_PIX_FMT_YUV420
	.comm	_pwc_image_sizes,8,3            ## @pwc_image_sizes
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"frame_size=%d, vframes=%d, vsize=%d, vbandlength=%d\n"

	.no_dead_strip	_set_video_mode_Kiara
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function set_video_mode_Kiara
_set_video_mode_Kiara:                  ; @set_video_mode_Kiara
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
Lloh0:
	adrp	x8, _PSZ_MAX@GOTPAGE
Lloh1:
	ldr	x8, [x8, _PSZ_MAX@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w1
	b.le	LBB0_2
; %bb.1:
	ldr	w8, [x4]
	cmp	w8, #4
	b.lo	LBB0_5
LBB0_2:
Lloh3:
	adrp	x8, _EINVAL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_3:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_4:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_5:
	mov	x21, x2
	mov	x19, x1
	mov	x20, x0
	cmp	w3, #5
	b.ge	LBB0_7
; %bb.6:
	mov	w22, #1
	b	LBB0_11
LBB0_7:
	cmp	w3, #16
	b.lo	LBB0_10
; %bb.8:
Lloh5:
	adrp	x9, _PSZ_VGA@GOTPAGE
Lloh6:
	ldr	x9, [x9, _PSZ_VGA@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	cmp	w9, w19
	b.ne	LBB0_10
; %bb.9:
	mov	w22, #3
	b	LBB0_11
LBB0_10:
	mov	w9, #30
	cmp	w3, #30
	csel	w9, w3, w9, lt
	and	w9, w9, #0xff
	mov	w10, #205
	mul	w9, w9, w10
	lsr	w22, w9, #10
LBB0_11:
	sub	w9, w22, #1
Lloh8:
	adrp	x10, _Kiara_table@GOTPAGE
Lloh9:
	ldr	x10, [x10, _Kiara_table@GOTPAGEOFF]
Lloh10:
	ldr	x10, [x10]
	sxtw	x23, w19
	ldr	x10, [x10, w19, sxtw #3]
	ldr	x25, [x10, w9, uxtw #3]
	mov	w9, #3
	cmp	w8, #3
	csel	w10, w8, w9, gt
	lsl	x9, x8, #32
	mov	w11, #24
	madd	x24, x8, x11, x25
	sub	w8, w8, #1
	mov	x11, #4294967296
LBB0_12:                                ; =>This Inner Loop Header: Depth=1
	ldr	x12, [x24]
	cbnz	x12, LBB0_15
; %bb.13:                               ;   in Loop: Header=BB0_12 Depth=1
	add	w12, w8, #2
	str	w12, [x4]
	add	x9, x9, x11
	add	x24, x24, #24
	add	w8, w8, #1
	cmp	w10, w8
	b.ne	LBB0_12
; %bb.14:
Lloh11:
	adrp	x8, _ENOENT@GOTPAGE
Lloh12:
	ldr	x8, [x8, _ENOENT@GOTPAGEOFF]
	b	LBB0_3
LBB0_15:
	asr	x26, x9, #32
	cbz	w5, LBB0_17
; %bb.16:
	mov	w8, #24
	madd	x8, x26, x8, x25
	ldr	w2, [x8, #16]
	mov	x0, x20
	mov	w1, #4
	mov	w3, #12
	bl	_send_video_command
	tbnz	w0, #31, LBB0_4
LBB0_17:
	mov	w8, #24
	madd	x27, x26, x8, x25
	ldr	x4, [x27, #8]!
Lloh13:
	adrp	x8, _V4L2_PIX_FMT_YUV420@GOTPAGE
Lloh14:
	ldr	x8, [x8, _V4L2_PIX_FMT_YUV420@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	cmp	x4, #1
	ccmp	w8, w21, #0, ge
	b.ne	LBB0_19
; %bb.18:
	mov	w8, #24
	madd	x8, x26, x8, x25
	ldr	w1, [x8, #16]
	mov	x0, x20
	bl	_pwc_dec23_init
	ldr	x4, [x27]
LBB0_19:
	add	w2, w22, w22, lsl #2
	stp	w21, w2, [x20]
	ldr	x8, [x24]
	str	x8, [x20, #8]
Lloh16:
	adrp	x8, _pwc_image_sizes@GOTPAGE
Lloh17:
	ldr	x8, [x8, _pwc_image_sizes@GOTPAGEOFF]
Lloh18:
	ldr	x8, [x8]
	ldr	x8, [x8, x23, lsl #3]
	ldr	w9, [x8]
	ldr	x8, [x8, #8]
	stp	w9, w8, [x20, #16]
	str	x4, [x20, #24]
	mul	w9, w9, w8
	add	w9, w9, w9, lsl #1
	lsl	w9, w9, #2
	add	w10, w9, #7
	cmp	w9, #0
	csel	w9, w10, w9, lt
	asr	w9, w9, #3
	sxtw	x8, w8
	mul	x8, x8, x4
	add	x10, x8, #3
	cmp	x8, #0
	csel	x8, x10, x8, lt
	lsr	x8, x8, #2
	cmp	x4, #1
	csel	w1, w9, w8, lt
	str	w1, [x20, #32]
Lloh19:
	adrp	x0, l_.str@PAGE
Lloh20:
	add	x0, x0, l_.str@PAGEOFF
	mov	x3, x19
                                        ; kill: def $w4 killed $w4 killed $x4
	bl	_PWC_TRACE
	mov	w0, #0
	b	LBB0_4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
	.comm	_PSZ_MAX,4,2                    ; @PSZ_MAX
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_PSZ_VGA,4,2                    ; @PSZ_VGA
	.comm	_Kiara_table,8,3                ; @Kiara_table
	.comm	_ENOENT,4,2                     ; @ENOENT
	.comm	_V4L2_PIX_FMT_YUV420,4,2        ; @V4L2_PIX_FMT_YUV420
	.comm	_pwc_image_sizes,8,3            ; @pwc_image_sizes
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"frame_size=%d, vframes=%d, vsize=%d, vbandlength=%d\n"

	.no_dead_strip	_set_video_mode_Kiara
.subsections_via_symbols
