	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ov772x_s_power
_ov772x_s_power:                        ## @ov772x_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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r15d
	callq	_to_ov772x
	movq	%rax, %rbx
	leaq	4(%rax), %r14
	movq	%r14, %rdi
	callq	_mutex_lock
	movl	(%rbx), %eax
	xorl	%ecx, %ecx
	testl	%r15d, %r15d
	sete	%cl
	cmpl	%ecx, %eax
	jne	LBB0_7
## %bb.1:
	movq	%rbx, %rdi
	testl	%r15d, %r15d
	je	LBB0_4
## %bb.2:
	callq	_ov772x_power_on
	movl	%eax, %r12d
	testl	%eax, %eax
	jne	LBB0_8
## %bb.3:
	movl	8(%rbx), %edx
	movl	12(%rbx), %esi
	movq	%rbx, %rdi
	callq	_ov772x_set_params
	jmp	LBB0_5
LBB0_4:
	callq	_ov772x_power_off
LBB0_5:
	movl	%eax, %r12d
	testl	%eax, %eax
	jne	LBB0_8
## %bb.6:
	movl	(%rbx), %eax
LBB0_7:
	xorl	%r12d, %r12d
	cmpl	$1, %r15d
	movl	$0, %edi
	sbbl	%edi, %edi
	orl	$1, %edi
	addl	%eax, %edi
	movl	%edi, (%rbx)
	shrl	$31, %edi
	leaq	L_.str(%rip), %rsi
	callq	_WARN
	xorl	%edi, %edi
	cmpl	$2, (%rbx)
	setge	%dil
	leaq	L_.str.1(%rip), %rsi
	callq	_WARN
LBB0_8:
	movq	%r14, %rdi
	callq	_mutex_unlock
	movl	%r12d, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Unbalanced power count\n"

L_.str.1:                               ## @.str.1
	.asciz	"Duplicated s_power call\n"

	.no_dead_strip	_ov772x_s_power
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ov772x_s_power
_ov772x_s_power:                        ; @ov772x_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_ov772x
	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:
	mov	x0, x20
	cbz	w21, LBB0_4
; %bb.2:
	bl	_ov772x_power_on
	mov	x22, x0
	cbnz	w0, LBB0_7
; %bb.3:
	ldp	w2, w1, [x20, #8]
	mov	x0, x20
	bl	_ov772x_set_params
	mov	x22, x0
	cbnz	w0, LBB0_7
	b	LBB0_5
LBB0_4:
	bl	_ov772x_power_off
	mov	x22, x0
	cbnz	w0, LBB0_7
LBB0_5:
	ldr	w8, [x20]
LBB0_6:
	sub	w9, w8, #1
	cmp	w21, #0
	csinc	w8, w9, w8, eq
	str	w8, [x20]
	lsr	w0, w8, #31
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_WARN
	ldr	w8, [x20]
	cmp	w8, #1
	cset	w0, gt
Lloh2:
	adrp	x1, l_.str.1@PAGE
Lloh3:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_WARN
	mov	w22, #0
LBB0_7:
	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
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Unbalanced power count\n"

l_.str.1:                               ; @.str.1
	.asciz	"Duplicated s_power call\n"

	.no_dead_strip	_ov772x_s_power
.subsections_via_symbols
