	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ov511_mode_init_regs
_ov511_mode_init_regs:                  ## @ov511_mode_init_regs
	.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
	movl	%r8d, %r9d
	movl	%ecx, %r13d
	movl	%edx, %r12d
	movl	%esi, %ebx
	movq	%rdi, %r14
	testl	%r8d, %r8d
	je	LBB0_2
## %bb.1:
	movl	(%r14), %ebx
	movl	4(%r14), %r12d
LBB0_2:
	leaq	L_.str(%rip), %rsi
	movl	$3, %edi
	movl	%ebx, %edx
	movl	%r12d, %ecx
	movl	%r13d, %r8d
	callq	_PDEBUG
	movq	8(%r14), %rax
	movq	_SEN_SAA7111A@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_8
## %bb.3:
	movl	$320, %esi                      ## imm = 0x140
	cmpl	$240, %r12d
	jne	LBB0_5
## %bb.4:
	cmpl	$320, %ebx                      ## imm = 0x140
	je	LBB0_9
LBB0_5:
	cmpl	$480, %r12d                     ## imm = 0x1E0
	jne	LBB0_7
## %bb.6:
	cmpl	$640, %ebx                      ## imm = 0x280
	je	LBB0_9
LBB0_7:
	leaq	L_.str.1(%rip), %rdi
	jmp	LBB0_14
LBB0_8:
	movl	%ebx, %esi
LBB0_9:
	movl	%esi, %eax
	orl	%r12d, %eax
	testb	$7, %al
	je	LBB0_11
## %bb.10:
	leaq	L_.str.2(%rip), %rdi
	xorl	%r15d, %r15d
	movl	%r12d, %edx
	movl	%r13d, %ecx
	xorl	%eax, %eax
	callq	_err
	jmp	LBB0_15
LBB0_11:
	cmpl	16(%r14), %esi
	jl	LBB0_13
## %bb.12:
	cmpl	20(%r14), %r12d
	jge	LBB0_18
LBB0_13:
	leaq	L_.str.3(%rip), %rdi
LBB0_14:
	xorl	%r15d, %r15d
	xorl	%eax, %eax
	callq	_err
LBB0_15:
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_16:
	subl	(%rax), %r15d
LBB0_17:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_18:
	movl	%esi, -44(%rbp)                 ## 4-byte Spill
	movq	%r14, %rdi
	callq	_ov51x_stop
	testq	%rax, %rax
	js	LBB0_22
## %bb.19:
	movq	_VIDEO_PALETTE_GREY@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	cmpl	%r13d, (%rax)
	setne	%bl
	movq	_R511_CAM_UV_EN@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leal	(%rbx,%rbx), %r15d
	incl	%r15d
	movq	%r14, %rdi
	movl	%ebx, %edx
	callq	_reg_w
	movq	_R511_SNAP_UV_EN@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	movl	%ebx, %edx
	callq	_reg_w
	movq	_R511_SNAP_OPTS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	movl	%r15d, %edx
	callq	_reg_w
	movl	-44(%rbp), %ebx                 ## 4-byte Reload
	sarl	$3, %ebx
	decl	%ebx
	sarl	$3, %r12d
	decl	%r12d
	movq	_R511_CAM_PXCNT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	movl	%ebx, %edx
	callq	_reg_w
	movq	_R511_CAM_LNCNT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	movl	%r12d, %edx
	callq	_reg_w
	movq	_R511_CAM_PXDIV@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%r15d, %r15d
	movq	%r14, %rdi
	xorl	%edx, %edx
	callq	_reg_w
	movq	_R511_CAM_LNDIV@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	xorl	%edx, %edx
	callq	_reg_w
	movq	_R511_CAM_OPTS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	movl	$3, %edx
	callq	_reg_w
	movq	_R511_SNAP_PXCNT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	movl	%ebx, %edx
	callq	_reg_w
	movq	_R511_SNAP_LNCNT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	movl	%r12d, %edx
	callq	_reg_w
	movq	_R511_SNAP_PXDIV@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	xorl	%edx, %edx
	callq	_reg_w
	movq	_R511_SNAP_LNDIV@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	xorl	%edx, %edx
	callq	_reg_w
	cmpq	$0, 24(%r14)
	je	LBB0_21
## %bb.20:
	movq	_R511_COMP_EN@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	movl	$7, %edx
	callq	_reg_w
	movq	_R511_COMP_LUT_EN@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	movl	$3, %edx
	callq	_reg_w
	movq	_OV511_RESET_OMNICE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_ov51x_reset
LBB0_21:
	movq	%r14, %rdi
	callq	_ov51x_restart
	testq	%rax, %rax
	jns	LBB0_17
LBB0_22:
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
	jmp	LBB0_16
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"width:%d, height:%d, mode:%d, sub:%d"

	.comm	_SEN_SAA7111A,8,3               ## @SEN_SAA7111A
L_.str.1:                               ## @.str.1
	.asciz	"SAA7111A only allows 320x240 or 640x480"

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.2:                               ## @.str.2
	.asciz	"Invalid size (%d, %d) (mode = %d)"

L_.str.3:                               ## @.str.3
	.asciz	"Requested dimensions are too small"

	.comm	_EIO,4,2                        ## @EIO
	.comm	_VIDEO_PALETTE_GREY,4,2         ## @VIDEO_PALETTE_GREY
	.comm	_R511_CAM_UV_EN,4,2             ## @R511_CAM_UV_EN
	.comm	_R511_SNAP_UV_EN,4,2            ## @R511_SNAP_UV_EN
	.comm	_R511_SNAP_OPTS,4,2             ## @R511_SNAP_OPTS
	.comm	_R511_CAM_PXCNT,4,2             ## @R511_CAM_PXCNT
	.comm	_R511_CAM_LNCNT,4,2             ## @R511_CAM_LNCNT
	.comm	_R511_CAM_PXDIV,4,2             ## @R511_CAM_PXDIV
	.comm	_R511_CAM_LNDIV,4,2             ## @R511_CAM_LNDIV
	.comm	_R511_CAM_OPTS,4,2              ## @R511_CAM_OPTS
	.comm	_R511_SNAP_PXCNT,4,2            ## @R511_SNAP_PXCNT
	.comm	_R511_SNAP_LNCNT,4,2            ## @R511_SNAP_LNCNT
	.comm	_R511_SNAP_PXDIV,4,2            ## @R511_SNAP_PXDIV
	.comm	_R511_SNAP_LNDIV,4,2            ## @R511_SNAP_LNDIV
	.comm	_R511_COMP_EN,4,2               ## @R511_COMP_EN
	.comm	_R511_COMP_LUT_EN,4,2           ## @R511_COMP_LUT_EN
	.comm	_OV511_RESET_OMNICE,4,2         ## @OV511_RESET_OMNICE
	.no_dead_strip	_ov511_mode_init_regs
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ov511_mode_init_regs
_ov511_mode_init_regs:                  ; @ov511_mode_init_regs
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	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
	mov	x5, x4
	mov	x22, x3
	mov	x20, x2
	mov	x21, x1
	mov	x19, x0
	cbz	w4, LBB0_2
; %bb.1:
	ldp	w21, w20, [x19]
LBB0_2:
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	w0, #3
	mov	x2, x21
	mov	x3, x20
	mov	x4, x22
	bl	_PDEBUG
	ldr	x8, [x19, #8]
Lloh2:
	adrp	x9, _SEN_SAA7111A@GOTPAGE
Lloh3:
	ldr	x9, [x9, _SEN_SAA7111A@GOTPAGEOFF]
Lloh4:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_8
; %bb.3:
	cmp	w20, #240
	b.ne	LBB0_5
; %bb.4:
	cmp	w21, #320
	b.eq	LBB0_7
LBB0_5:
	cmp	w20, #480
	b.ne	LBB0_13
; %bb.6:
	cmp	w21, #640
	b.ne	LBB0_13
LBB0_7:
	mov	w21, #320
LBB0_8:
	orr	w8, w21, w20
	tst	w8, #0x7
	b.eq	LBB0_10
; %bb.9:
	stp	x20, x22, [sp, #8]
	str	x21, [sp]
Lloh5:
	adrp	x0, l_.str.2@PAGE
Lloh6:
	add	x0, x0, l_.str.2@PAGEOFF
	b	LBB0_14
LBB0_10:
	ldr	w8, [x19, #16]
	cmp	w21, w8
	b.lt	LBB0_12
; %bb.11:
	ldr	w8, [x19, #20]
	cmp	w20, w8
	b.ge	LBB0_17
LBB0_12:
Lloh7:
	adrp	x0, l_.str.3@PAGE
Lloh8:
	add	x0, x0, l_.str.3@PAGEOFF
	b	LBB0_14
LBB0_13:
Lloh9:
	adrp	x0, l_.str.1@PAGE
Lloh10:
	add	x0, x0, l_.str.1@PAGEOFF
LBB0_14:
	bl	_err
Lloh11:
	adrp	x8, _EINVAL@GOTPAGE
Lloh12:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_15:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_16:
	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
	add	sp, sp, #96
	ret
LBB0_17:
	mov	x0, x19
	bl	_ov51x_stop
	tbnz	x0, #63, LBB0_22
; %bb.18:
Lloh13:
	adrp	x8, _VIDEO_PALETTE_GREY@GOTPAGE
Lloh14:
	ldr	x8, [x8, _VIDEO_PALETTE_GREY@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	cmp	w8, w22
	cset	w22, ne
Lloh16:
	adrp	x8, _R511_CAM_UV_EN@GOTPAGE
Lloh17:
	ldr	x8, [x8, _R511_CAM_UV_EN@GOTPAGEOFF]
Lloh18:
	ldr	w1, [x8]
	mov	w8, #3
	csinc	w23, w8, wzr, ne
	mov	x0, x19
	mov	x2, x22
	bl	_reg_w
Lloh19:
	adrp	x8, _R511_SNAP_UV_EN@GOTPAGE
Lloh20:
	ldr	x8, [x8, _R511_SNAP_UV_EN@GOTPAGEOFF]
Lloh21:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x22
	bl	_reg_w
Lloh22:
	adrp	x8, _R511_SNAP_OPTS@GOTPAGE
Lloh23:
	ldr	x8, [x8, _R511_SNAP_OPTS@GOTPAGEOFF]
Lloh24:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x23
	bl	_reg_w
	asr	w8, w21, #3
	sub	w21, w8, #1
	asr	w8, w20, #3
	sub	w20, w8, #1
Lloh25:
	adrp	x8, _R511_CAM_PXCNT@GOTPAGE
Lloh26:
	ldr	x8, [x8, _R511_CAM_PXCNT@GOTPAGEOFF]
Lloh27:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x21
	bl	_reg_w
Lloh28:
	adrp	x8, _R511_CAM_LNCNT@GOTPAGE
Lloh29:
	ldr	x8, [x8, _R511_CAM_LNCNT@GOTPAGEOFF]
Lloh30:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x20
	bl	_reg_w
Lloh31:
	adrp	x8, _R511_CAM_PXDIV@GOTPAGE
Lloh32:
	ldr	x8, [x8, _R511_CAM_PXDIV@GOTPAGEOFF]
Lloh33:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #0
	bl	_reg_w
Lloh34:
	adrp	x8, _R511_CAM_LNDIV@GOTPAGE
Lloh35:
	ldr	x8, [x8, _R511_CAM_LNDIV@GOTPAGEOFF]
Lloh36:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #0
	bl	_reg_w
Lloh37:
	adrp	x8, _R511_CAM_OPTS@GOTPAGE
Lloh38:
	ldr	x8, [x8, _R511_CAM_OPTS@GOTPAGEOFF]
Lloh39:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #3
	bl	_reg_w
Lloh40:
	adrp	x8, _R511_SNAP_PXCNT@GOTPAGE
Lloh41:
	ldr	x8, [x8, _R511_SNAP_PXCNT@GOTPAGEOFF]
Lloh42:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x21
	bl	_reg_w
Lloh43:
	adrp	x8, _R511_SNAP_LNCNT@GOTPAGE
Lloh44:
	ldr	x8, [x8, _R511_SNAP_LNCNT@GOTPAGEOFF]
Lloh45:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x20
	bl	_reg_w
Lloh46:
	adrp	x8, _R511_SNAP_PXDIV@GOTPAGE
Lloh47:
	ldr	x8, [x8, _R511_SNAP_PXDIV@GOTPAGEOFF]
Lloh48:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #0
	bl	_reg_w
Lloh49:
	adrp	x8, _R511_SNAP_LNDIV@GOTPAGE
Lloh50:
	ldr	x8, [x8, _R511_SNAP_LNDIV@GOTPAGEOFF]
Lloh51:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #0
	bl	_reg_w
	ldr	x8, [x19, #24]
	cbz	x8, LBB0_20
; %bb.19:
Lloh52:
	adrp	x8, _R511_COMP_EN@GOTPAGE
Lloh53:
	ldr	x8, [x8, _R511_COMP_EN@GOTPAGEOFF]
Lloh54:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #7
	bl	_reg_w
Lloh55:
	adrp	x8, _R511_COMP_LUT_EN@GOTPAGE
Lloh56:
	ldr	x8, [x8, _R511_COMP_LUT_EN@GOTPAGEOFF]
Lloh57:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #3
	bl	_reg_w
Lloh58:
	adrp	x8, _OV511_RESET_OMNICE@GOTPAGE
Lloh59:
	ldr	x8, [x8, _OV511_RESET_OMNICE@GOTPAGEOFF]
Lloh60:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_ov51x_reset
LBB0_20:
	mov	x0, x19
	bl	_ov51x_restart
	tbnz	x0, #63, LBB0_22
; %bb.21:
	mov	w0, #0
	b	LBB0_16
LBB0_22:
Lloh61:
	adrp	x8, _EIO@GOTPAGE
Lloh62:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
	b	LBB0_15
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh49, Lloh50, Lloh51
	.loh AdrpLdrGotLdr	Lloh46, Lloh47, Lloh48
	.loh AdrpLdrGotLdr	Lloh43, Lloh44, Lloh45
	.loh AdrpLdrGotLdr	Lloh40, Lloh41, Lloh42
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.loh AdrpLdrGotLdr	Lloh34, Lloh35, Lloh36
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh58, Lloh59, Lloh60
	.loh AdrpLdrGotLdr	Lloh55, Lloh56, Lloh57
	.loh AdrpLdrGotLdr	Lloh52, Lloh53, Lloh54
	.loh AdrpLdrGot	Lloh61, Lloh62
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"width:%d, height:%d, mode:%d, sub:%d"

	.comm	_SEN_SAA7111A,8,3               ; @SEN_SAA7111A
l_.str.1:                               ; @.str.1
	.asciz	"SAA7111A only allows 320x240 or 640x480"

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.2:                               ; @.str.2
	.asciz	"Invalid size (%d, %d) (mode = %d)"

l_.str.3:                               ; @.str.3
	.asciz	"Requested dimensions are too small"

	.comm	_EIO,4,2                        ; @EIO
	.comm	_VIDEO_PALETTE_GREY,4,2         ; @VIDEO_PALETTE_GREY
	.comm	_R511_CAM_UV_EN,4,2             ; @R511_CAM_UV_EN
	.comm	_R511_SNAP_UV_EN,4,2            ; @R511_SNAP_UV_EN
	.comm	_R511_SNAP_OPTS,4,2             ; @R511_SNAP_OPTS
	.comm	_R511_CAM_PXCNT,4,2             ; @R511_CAM_PXCNT
	.comm	_R511_CAM_LNCNT,4,2             ; @R511_CAM_LNCNT
	.comm	_R511_CAM_PXDIV,4,2             ; @R511_CAM_PXDIV
	.comm	_R511_CAM_LNDIV,4,2             ; @R511_CAM_LNDIV
	.comm	_R511_CAM_OPTS,4,2              ; @R511_CAM_OPTS
	.comm	_R511_SNAP_PXCNT,4,2            ; @R511_SNAP_PXCNT
	.comm	_R511_SNAP_LNCNT,4,2            ; @R511_SNAP_LNCNT
	.comm	_R511_SNAP_PXDIV,4,2            ; @R511_SNAP_PXDIV
	.comm	_R511_SNAP_LNDIV,4,2            ; @R511_SNAP_LNDIV
	.comm	_R511_COMP_EN,4,2               ; @R511_COMP_EN
	.comm	_R511_COMP_LUT_EN,4,2           ; @R511_COMP_LUT_EN
	.comm	_OV511_RESET_OMNICE,4,2         ; @OV511_RESET_OMNICE
	.no_dead_strip	_ov511_mode_init_regs
.subsections_via_symbols
