	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ov5645_s_power
_ov5645_s_power:                        ## @ov5645_s_power
	.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	%esi, %r15d
	callq	_to_ov5645
	movq	%rax, %r12
	leaq	4(%rax), %r14
	movq	%r14, %rdi
	callq	_mutex_lock
	xorl	%eax, %eax
	testl	%r15d, %r15d
	sete	%al
	xorl	%ebx, %ebx
	movl	$0, %r13d
	cmpl	%eax, (%r12)
	jne	LBB0_8
## %bb.1:
	testl	%r15d, %r15d
	je	LBB0_7
## %bb.2:
	movq	%r12, %rdi
	callq	_ov5645_set_power_on
	testl	%eax, %eax
	js	LBB0_3
## %bb.4:
	movq	_ov5645_global_init_setting@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	movl	%r13d, %edi
	callq	_ARRAY_SIZE
	movq	%r12, %rdi
	movl	%r13d, %esi
	movl	%eax, %edx
	callq	_ov5645_set_register_array
	movl	%eax, %r13d
	testl	%eax, %eax
	js	LBB0_5
## %bb.6:
	movl	$500, %edi                      ## imm = 0x1F4
	movl	$1000, %esi                     ## imm = 0x3E8
	callq	_usleep_range
	jmp	LBB0_8
LBB0_7:
	movq	_OV5645_IO_MIPI_CTRL00@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	movl	$88, %edx
	callq	_ov5645_write_reg
	movq	%r12, %rdi
	callq	_ov5645_set_power_off
	xorl	%r13d, %r13d
LBB0_8:
	cmpl	$1, %r15d
	sbbl	%ebx, %ebx
	orl	$1, %ebx
	addl	(%r12), %ebx
	movl	%ebx, (%r12)
	shrl	$31, %ebx
	movl	%ebx, %edi
	callq	_WARN_ON
LBB0_9:
	movq	%r14, %rdi
	callq	_mutex_unlock
	movl	%r13d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_3:
	movl	%eax, %r13d
	jmp	LBB0_9
LBB0_5:
	movl	8(%r12), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_err
	movq	%r12, %rdi
	callq	_ov5645_set_power_off
	jmp	LBB0_9
	.cfi_endproc
                                        ## -- End function
	.comm	_ov5645_global_init_setting,4,2 ## @ov5645_global_init_setting
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"could not set init registers\n"

	.comm	_OV5645_IO_MIPI_CTRL00,4,2      ## @OV5645_IO_MIPI_CTRL00
	.no_dead_strip	_ov5645_s_power
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ov5645_s_power
_ov5645_s_power:                        ; @ov5645_s_power
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x21, x1
	bl	_to_ov5645
	mov	x20, x0
	add	x19, x0, #4
	mov	x0, x19
	bl	_mutex_lock
	ldr	w8, [x20]
	cmp	w21, #0
	cset	w9, eq
	cmp	w8, w9
	b.ne	LBB0_6
; %bb.1:
	cbz	w21, LBB0_5
; %bb.2:
	mov	x0, x20
	bl	_ov5645_set_power_on
	tbnz	w0, #31, LBB0_9
; %bb.3:
Lloh0:
	adrp	x8, _ov5645_global_init_setting@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ov5645_global_init_setting@GOTPAGEOFF]
Lloh2:
	ldr	w22, [x8]
	mov	x0, x22
	bl	_ARRAY_SIZE
	mov	x2, x0
	mov	x0, x20
	mov	x1, x22
	bl	_ov5645_set_register_array
	mov	x22, x0
	tbnz	w0, #31, LBB0_10
; %bb.4:
	mov	w0, #500
	mov	w1, #1000
	bl	_usleep_range
	b	LBB0_7
LBB0_5:
Lloh3:
	adrp	x8, _OV5645_IO_MIPI_CTRL00@GOTPAGE
Lloh4:
	ldr	x8, [x8, _OV5645_IO_MIPI_CTRL00@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	mov	x0, x20
	mov	w2, #88
	bl	_ov5645_write_reg
	mov	x0, x20
	bl	_ov5645_set_power_off
LBB0_6:
	mov	w22, #0
LBB0_7:
	ldr	w8, [x20]
	sub	w9, w8, #1
	cmp	w21, #0
	csinc	w8, w9, w8, eq
	str	w8, [x20]
	lsr	w0, w8, #31
	bl	_WARN_ON
LBB0_8:
	mov	x0, x19
	bl	_mutex_unlock
	mov	x0, x22
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
LBB0_9:
	mov	x22, x0
	b	LBB0_8
LBB0_10:
	ldr	w0, [x20, #8]
Lloh6:
	adrp	x1, l_.str@PAGE
Lloh7:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
	mov	x0, x20
	bl	_ov5645_set_power_off
	b	LBB0_8
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.comm	_ov5645_global_init_setting,4,2 ; @ov5645_global_init_setting
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"could not set init registers\n"

	.comm	_OV5645_IO_MIPI_CTRL00,4,2      ; @OV5645_IO_MIPI_CTRL00
	.no_dead_strip	_ov5645_s_power
.subsections_via_symbols
