	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ov965x_detect_sensor
_ov965x_detect_sensor:                  ## @ov965x_detect_sensor
	.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
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	callq	_to_ov965x
	movq	%rax, %r12
	leaq	8(%rax), %r15
	movq	%r15, %rdi
	callq	_mutex_lock
	movq	%r12, %rdi
	movl	$1, %esi
	callq	___ov965x_set_power
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_8
## %bb.1:
	movl	$25, %edi
	callq	_msleep
	movq	_REG_PID@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-40(%rbp), %rdx
	movq	%r12, %rdi
	callq	_ov965x_read
	testl	%eax, %eax
	je	LBB0_3
## %bb.2:
	movl	%eax, %ebx
	movq	%r12, %rdi
	xorl	%esi, %esi
	callq	___ov965x_set_power
	jmp	LBB0_8
LBB0_3:
	movq	_REG_VER@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-36(%rbp), %rdx
	movq	%r12, %rdi
	callq	_ov965x_read
	movl	%eax, %ebx
	movq	%r12, %rdi
	xorl	%esi, %esi
	callq	___ov965x_set_power
	testl	%ebx, %ebx
	jne	LBB0_8
## %bb.4:
	movl	-40(%rbp), %edi
	movl	-36(%rbp), %esi
	callq	_OV965X_ID
	movq	%rax, (%r12)
	movq	_OV9650_ID@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_6
## %bb.5:
	movq	_OV9652_ID@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_6
## %bb.7:
	leaq	L_.str.1(%rip), %rsi
	xorl	%ebx, %ebx
	movq	%r14, %rdi
	movq	%rax, %rdx
	xorl	%ecx, %ecx
	callq	_v4l2_err
	movq	_ENODEV@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	jmp	LBB0_8
LBB0_6:
	leaq	L_.str(%rip), %rsi
	movq	%r14, %rdi
	movq	%rax, %rdx
	callq	_v4l2_info
	xorl	%ebx, %ebx
LBB0_8:
	movq	%r15, %rdi
	callq	_mutex_unlock
	movl	%ebx, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_REG_PID,4,2                    ## @REG_PID
	.comm	_REG_VER,4,2                    ## @REG_VER
	.comm	_OV9650_ID,8,3                  ## @OV9650_ID
	.comm	_OV9652_ID,8,3                  ## @OV9652_ID
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Found OV%04X sensor\n"

L_.str.1:                               ## @.str.1
	.asciz	"Sensor detection failed (%04X, %d)\n"

	.comm	_ENODEV,4,2                     ## @ENODEV
	.no_dead_strip	_ov965x_detect_sensor
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ov965x_detect_sensor
_ov965x_detect_sensor:                  ; @ov965x_detect_sensor
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.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
	mov	x20, x0
	bl	_to_ov965x
	mov	x21, x0
	add	x19, x0, #8
	mov	x0, x19
	bl	_mutex_lock
	mov	x0, x21
	mov	w1, #1
	bl	___ov965x_set_power
	mov	x22, x0
	cbnz	w0, LBB0_7
; %bb.1:
	mov	w0, #25
	bl	_msleep
Lloh0:
	adrp	x8, _REG_PID@GOTPAGE
Lloh1:
	ldr	x8, [x8, _REG_PID@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	add	x2, sp, #12
	mov	x0, x21
	bl	_ov965x_read
	cbz	w0, LBB0_3
; %bb.2:
	mov	x22, x0
	mov	x0, x21
	mov	w1, #0
	bl	___ov965x_set_power
	b	LBB0_7
LBB0_3:
Lloh3:
	adrp	x8, _REG_VER@GOTPAGE
Lloh4:
	ldr	x8, [x8, _REG_VER@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	add	x2, sp, #8
	mov	x0, x21
	bl	_ov965x_read
	mov	x22, x0
	mov	x0, x21
	mov	w1, #0
	bl	___ov965x_set_power
	cbnz	w22, LBB0_7
; %bb.4:
	ldp	w1, w0, [sp, #8]
	bl	_OV965X_ID
	mov	x2, x0
	str	x0, [x21]
Lloh6:
	adrp	x8, _OV9650_ID@GOTPAGE
Lloh7:
	ldr	x8, [x8, _OV9650_ID@GOTPAGEOFF]
Lloh8:
	ldr	x8, [x8]
Lloh9:
	adrp	x9, _OV9652_ID@GOTPAGE
Lloh10:
	ldr	x9, [x9, _OV9652_ID@GOTPAGEOFF]
Lloh11:
	ldr	x9, [x9]
	cmp	x0, x8
	ccmp	x0, x9, #4, ne
	b.ne	LBB0_6
; %bb.5:
Lloh12:
	adrp	x1, l_.str@PAGE
Lloh13:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x20
	bl	_v4l2_info
	mov	w22, #0
	b	LBB0_7
LBB0_6:
Lloh14:
	adrp	x1, l_.str.1@PAGE
Lloh15:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x20
	mov	w3, #0
	bl	_v4l2_err
Lloh16:
	adrp	x8, _ENODEV@GOTPAGE
Lloh17:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_7:
	mov	x0, x19
	bl	_mutex_unlock
	mov	x0, x22
	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
	add	sp, sp, #64
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_REG_PID,4,2                    ; @REG_PID
	.comm	_REG_VER,4,2                    ; @REG_VER
	.comm	_OV9650_ID,8,3                  ; @OV9650_ID
	.comm	_OV9652_ID,8,3                  ; @OV9652_ID
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Found OV%04X sensor\n"

l_.str.1:                               ; @.str.1
	.asciz	"Sensor detection failed (%04X, %d)\n"

	.comm	_ENODEV,4,2                     ; @ENODEV
	.no_dead_strip	_ov965x_detect_sensor
.subsections_via_symbols
