	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ov511_i2c_read_internal
_ov511_i2c_read_internal:               ## @ov511_i2c_read_internal
	.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, %r14d
	movq	%rdi, %r15
	movq	_OV511_I2C_RETRIES@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	movq	_R511_I2C_CTL@GOTPCREL(%rip), %r12
	.p2align	4, 0x90
LBB0_1:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_3 Depth 2
	movq	_R51x_I2C_SADDR_2@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	movl	%r14d, %edx
	callq	_reg_w
	testl	%eax, %eax
	js	LBB0_11
## %bb.2:                               ##   in Loop: Header=BB0_1 Depth=1
	movl	(%r12), %esi
	movq	%r15, %rdi
	movl	$3, %edx
	callq	_reg_w
	testl	%eax, %eax
	js	LBB0_11
	.p2align	4, 0x90
LBB0_3:                                 ##   Parent Loop BB0_1 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	(%r12), %esi
	movq	%r15, %rdi
	callq	_reg_r
	movl	%eax, %ebx
	testl	%eax, %eax
	jle	LBB0_5
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=2
	movl	%ebx, %eax
	andl	$1, %eax
	je	LBB0_3
LBB0_5:                                 ##   in Loop: Header=BB0_1 Depth=1
	testl	%ebx, %ebx
	js	LBB0_12
## %bb.6:                               ##   in Loop: Header=BB0_1 Depth=1
	testb	$2, %bl
	je	LBB0_13
## %bb.7:                               ##   in Loop: Header=BB0_1 Depth=1
	movl	(%r12), %esi
	movq	%r15, %rdi
	movl	$16, %edx
	callq	_reg_w
	leal	-1(%r13), %eax
	testl	%r13d, %r13d
	movl	%eax, %r13d
	jg	LBB0_1
## %bb.8:
	leaq	L_.str(%rip), %rdi
LBB0_9:
	callq	_err
	movl	$-1, %ebx
	jmp	LBB0_12
LBB0_13:
	movq	_OV511_I2C_RETRIES@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	.p2align	4, 0x90
LBB0_14:                                ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_15 Depth 2
	movl	(%r12), %esi
	movq	%r15, %rdi
	movl	$5, %edx
	callq	_reg_w
	testl	%eax, %eax
	js	LBB0_11
	.p2align	4, 0x90
LBB0_15:                                ##   Parent Loop BB0_14 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	(%r12), %esi
	movq	%r15, %rdi
	callq	_reg_r
	movl	%eax, %ebx
	testl	%eax, %eax
	jle	LBB0_17
## %bb.16:                              ##   in Loop: Header=BB0_15 Depth=2
	movl	%ebx, %eax
	andl	$1, %eax
	je	LBB0_15
LBB0_17:                                ##   in Loop: Header=BB0_14 Depth=1
	testl	%ebx, %ebx
	js	LBB0_12
## %bb.18:                              ##   in Loop: Header=BB0_14 Depth=1
	testb	$2, %bl
	je	LBB0_23
## %bb.19:                              ##   in Loop: Header=BB0_14 Depth=1
	movl	(%r12), %esi
	movq	%r15, %rdi
	movl	$16, %edx
	callq	_reg_w
	testl	%eax, %eax
	js	LBB0_11
## %bb.20:                              ##   in Loop: Header=BB0_14 Depth=1
	leal	-1(%r13), %eax
	testl	%r13d, %r13d
	movl	%eax, %r13d
	jg	LBB0_14
## %bb.21:
	leaq	L_.str.1(%rip), %rdi
	jmp	LBB0_9
LBB0_11:
	movl	%eax, %ebx
LBB0_12:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_23:
	movq	_R51x_I2C_DATA@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_reg_r
	movl	%eax, %ebx
	movzbl	%r14b, %edx
	leaq	L_.str.2(%rip), %rsi
	movl	$5, %edi
	movl	%eax, %ecx
	callq	_PDEBUG
	movl	(%r12), %esi
	movq	%r15, %rdi
	movl	$5, %edx
	callq	_reg_w
	testl	%eax, %eax
	cmovsl	%eax, %ebx
	jmp	LBB0_12
	.cfi_endproc
                                        ## -- End function
	.comm	_OV511_I2C_RETRIES,4,2          ## @OV511_I2C_RETRIES
	.comm	_R51x_I2C_SADDR_2,4,2           ## @R51x_I2C_SADDR_2
	.comm	_R511_I2C_CTL,4,2               ## @R511_I2C_CTL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"i2c write retries exhausted"

L_.str.1:                               ## @.str.1
	.asciz	"i2c read retries exhausted"

	.comm	_R51x_I2C_DATA,4,2              ## @R51x_I2C_DATA
L_.str.2:                               ## @.str.2
	.asciz	"0x%02X:0x%02X"

	.no_dead_strip	_ov511_i2c_read_internal
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ov511_i2c_read_internal
_ov511_i2c_read_internal:               ; @ov511_i2c_read_internal
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x21, _OV511_I2C_RETRIES@GOTPAGE
Lloh1:
	ldr	x21, [x21, _OV511_I2C_RETRIES@GOTPAGEOFF]
	ldr	w23, [x21]
Lloh2:
	adrp	x24, _R51x_I2C_SADDR_2@GOTPAGE
Lloh3:
	ldr	x24, [x24, _R51x_I2C_SADDR_2@GOTPAGEOFF]
Lloh4:
	adrp	x22, _R511_I2C_CTL@GOTPAGE
Lloh5:
	ldr	x22, [x22, _R511_I2C_CTL@GOTPAGEOFF]
LBB0_1:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_3 Depth 2
	ldr	w1, [x24]
	mov	x0, x19
	mov	x2, x20
	bl	_reg_w
	tbnz	w0, #31, LBB0_9
; %bb.2:                                ;   in Loop: Header=BB0_1 Depth=1
	ldr	w1, [x22]
	mov	x0, x19
	mov	w2, #3
	bl	_reg_w
	tbnz	w0, #31, LBB0_9
LBB0_3:                                 ;   Parent Loop BB0_1 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w1, [x22]
	mov	x0, x19
	bl	_reg_r
	and	w8, w0, #0x1
	cmp	w0, #1
	ccmp	w8, #0, #0, ge
	b.eq	LBB0_3
; %bb.4:                                ;   in Loop: Header=BB0_1 Depth=1
	tbnz	w0, #31, LBB0_9
; %bb.5:                                ;   in Loop: Header=BB0_1 Depth=1
	tbz	w0, #1, LBB0_10
; %bb.6:                                ;   in Loop: Header=BB0_1 Depth=1
	ldr	w1, [x22]
	mov	x0, x19
	mov	w2, #16
	bl	_reg_w
	sub	w8, w23, #1
	cmp	w23, #0
	mov	x23, x8
	b.gt	LBB0_1
; %bb.7:
Lloh6:
	adrp	x0, l_.str@PAGE
Lloh7:
	add	x0, x0, l_.str@PAGEOFF
LBB0_8:
	bl	_err
	mov	w0, #-1
LBB0_9:
	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
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_10:
	ldr	w21, [x21]
LBB0_11:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_12 Depth 2
	ldr	w1, [x22]
	mov	x0, x19
	mov	w2, #5
	bl	_reg_w
	tbnz	w0, #31, LBB0_9
LBB0_12:                                ;   Parent Loop BB0_11 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w1, [x22]
	mov	x0, x19
	bl	_reg_r
	and	w8, w0, #0x1
	cmp	w0, #1
	ccmp	w8, #0, #0, ge
	b.eq	LBB0_12
; %bb.13:                               ;   in Loop: Header=BB0_11 Depth=1
	tbnz	w0, #31, LBB0_9
; %bb.14:                               ;   in Loop: Header=BB0_11 Depth=1
	tbz	w0, #1, LBB0_18
; %bb.15:                               ;   in Loop: Header=BB0_11 Depth=1
	ldr	w1, [x22]
	mov	x0, x19
	mov	w2, #16
	bl	_reg_w
	tbnz	w0, #31, LBB0_9
; %bb.16:                               ;   in Loop: Header=BB0_11 Depth=1
	sub	w8, w21, #1
	cmp	w21, #0
	mov	x21, x8
	b.gt	LBB0_11
; %bb.17:
Lloh8:
	adrp	x0, l_.str.1@PAGE
Lloh9:
	add	x0, x0, l_.str.1@PAGEOFF
	b	LBB0_8
LBB0_18:
Lloh10:
	adrp	x8, _R51x_I2C_DATA@GOTPAGE
Lloh11:
	ldr	x8, [x8, _R51x_I2C_DATA@GOTPAGEOFF]
Lloh12:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_reg_r
	mov	x21, x0
Lloh13:
	adrp	x1, l_.str.2@PAGE
Lloh14:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	w0, #5
	mov	x2, x20
	mov	x3, x21
	bl	_PDEBUG
	ldr	w1, [x22]
	mov	x0, x19
	mov	w2, #5
	bl	_reg_w
	cmp	w0, #0
	csel	w0, w0, w21, lt
	b	LBB0_9
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_OV511_I2C_RETRIES,4,2          ; @OV511_I2C_RETRIES
	.comm	_R51x_I2C_SADDR_2,4,2           ; @R51x_I2C_SADDR_2
	.comm	_R511_I2C_CTL,4,2               ; @R511_I2C_CTL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"i2c write retries exhausted"

l_.str.1:                               ; @.str.1
	.asciz	"i2c read retries exhausted"

	.comm	_R51x_I2C_DATA,4,2              ; @R51x_I2C_DATA
l_.str.2:                               ; @.str.2
	.asciz	"0x%02X:0x%02X"

	.no_dead_strip	_ov511_i2c_read_internal
.subsections_via_symbols
