	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function bttv_i2c_readbytes
_bttv_i2c_readbytes:                    ## @bttv_i2c_readbytes
	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, -52(%rbp)                 ## 4-byte Spill
	movq	%rdi, -64(%rbp)                 ## 8-byte Spill
	movl	(%rsi), %r13d
	testl	%r13d, %r13d
	jle	LBB0_16
## %bb.1:
	movq	%rsi, %rcx
	movq	_BT848_I2C@GOTPCREL(%rip), %r15
	xorl	%r14d, %r14d
	movq	%rsi, -48(%rbp)                 ## 8-byte Spill
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_12:                                ##   in Loop: Header=BB0_2 Depth=1
	incq	%r14
	movslq	(%rcx), %r13
	cmpq	%r13, %r14
	jge	LBB0_16
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movl	4(%rcx), %eax
	movl	%eax, %r12d
	shll	$25, %r12d
	decl	%r13d
	movslq	%r13d, %rcx
	cmpq	%rcx, %r14
	movq	_BT848_I2C_W3B@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	movl	$0, %ebx
	cmovgel	%ebx, %edx
	movq	_BT878_I2C_NOSTOP@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, %esi
	cmovgel	%ebx, %esi
	cmpl	$0, -52(%rbp)                   ## 4-byte Folded Reload
	cmovel	%ecx, %esi
	testq	%r14, %r14
	movq	_BT878_I2C_NOSTART@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, %edi
	cmovel	%ebx, %edi
	movq	_I2C_HW@GOTPCREL(%rip), %rbx
	orl	(%rbx), %r12d
	orl	%edx, %r12d
	orl	%edi, %r12d
	orl	%esi, %r12d
	orl	$16777216, %r12d                ## imm = 0x1000000
	movq	_i2c_debug@GOTPCREL(%rip), %rdx
	cmpq	$0, (%rdx)
	je	LBB0_5
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	andl	%r12d, %ecx
	jne	LBB0_5
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	leal	(%rax,%rax), %esi
	incl	%esi
	leaq	L_.str(%rip), %rdi
	xorl	%eax, %eax
	callq	_pr_cont
LBB0_5:                                 ##   in Loop: Header=BB0_2 Depth=1
	movl	(%r15), %esi
	movl	%r12d, %edi
	callq	_btwrite
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	callq	_bttv_i2c_wait_done
	testl	%eax, %eax
	js	LBB0_6
## %bb.7:                               ##   in Loop: Header=BB0_2 Depth=1
	je	LBB0_13
## %bb.8:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	(%r15), %edi
	callq	_btread
	movzbl	%ah, %esi
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	movq	8(%rcx), %rax
	movl	%esi, (%rax,%r14,4)
	movq	_i2c_debug@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_12
## %bb.9:                               ##   in Loop: Header=BB0_2 Depth=1
	leaq	L_.str.1(%rip), %rdi
	xorl	%eax, %eax
	callq	_pr_cont
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	movq	_i2c_debug@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_12
## %bb.10:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	_BT878_I2C_NOSTOP@GOTPCREL(%rip), %rax
	testl	%r12d, (%rax)
	jne	LBB0_12
## %bb.11:                              ##   in Loop: Header=BB0_2 Depth=1
	leaq	L_.str.2(%rip), %rdi
	xorl	%eax, %eax
	callq	_pr_cont
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	jmp	LBB0_12
LBB0_6:
	movl	%eax, %r13d
	jmp	LBB0_14
LBB0_13:
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%r13d, %r13d
	subl	(%rax), %r13d
LBB0_14:
	movq	_i2c_debug@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_16
## %bb.15:
	leaq	L_.str.3(%rip), %rdi
	movl	%r13d, %esi
	xorl	%eax, %eax
	callq	_pr_cont
LBB0_16:
	movl	%r13d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_I2C_HW,4,2                     ## @I2C_HW
	.comm	_BT848_I2C_W3B,4,2              ## @BT848_I2C_W3B
	.comm	_BT878_I2C_NOSTOP,4,2           ## @BT878_I2C_NOSTOP
	.comm	_BT878_I2C_NOSTART,4,2          ## @BT878_I2C_NOSTART
	.comm	_i2c_debug,8,3                  ## @i2c_debug
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	" <R %02x"

	.comm	_BT848_I2C,4,2                  ## @BT848_I2C
L_.str.1:                               ## @.str.1
	.asciz	" =%02x"

L_.str.2:                               ## @.str.2
	.asciz	" >\n"

	.comm	_EIO,4,2                        ## @EIO
L_.str.3:                               ## @.str.3
	.asciz	" ERR: %d\n"

	.no_dead_strip	_bttv_i2c_readbytes
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function bttv_i2c_readbytes
_bttv_i2c_readbytes:                    ; @bttv_i2c_readbytes
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	ldr	w26, [x1]
	cmp	w26, #1
	b.lt	LBB0_14
; %bb.1:
	mov	x19, x2
	mov	x20, x1
	mov	x21, x0
	mov	x28, #0
Lloh0:
	adrp	x22, _BT878_I2C_NOSTOP@GOTPAGE
Lloh1:
	ldr	x22, [x22, _BT878_I2C_NOSTOP@GOTPAGEOFF]
Lloh2:
	adrp	x23, _BT878_I2C_NOSTART@GOTPAGE
Lloh3:
	ldr	x23, [x23, _BT878_I2C_NOSTART@GOTPAGEOFF]
Lloh4:
	adrp	x27, _i2c_debug@GOTPAGE
Lloh5:
	ldr	x27, [x27, _i2c_debug@GOTPAGEOFF]
Lloh6:
	adrp	x24, _BT848_I2C@GOTPAGE
Lloh7:
	ldr	x24, [x24, _BT848_I2C@GOTPAGEOFF]
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	add	x28, x28, #1
	ldrsw	x26, [x20]
	cmp	x28, x26
	b.ge	LBB0_14
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	sub	w8, w26, #1
Lloh8:
	adrp	x9, _BT848_I2C_W3B@GOTPAGE
Lloh9:
	ldr	x9, [x9, _BT848_I2C_W3B@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	cmp	x28, w8, sxtw
	csel	w9, w9, wzr, lt
	ccmp	w19, #0, #4, ge
	ldr	w8, [x20, #4]
Lloh11:
	adrp	x10, _I2C_HW@GOTPAGE
Lloh12:
	ldr	x10, [x10, _I2C_HW@GOTPAGEOFF]
Lloh13:
	ldr	w10, [x10]
	ldr	w11, [x22]
	csel	w11, wzr, w11, ne
	ldr	w12, [x23]
	cmp	x28, #0
	csel	w13, wzr, w12, eq
	orr	w10, w10, w8, lsl #25
	orr	w9, w10, w9
	orr	w9, w9, w11
	orr	w9, w9, w13
	orr	w25, w9, #0x1000000
	ldr	x9, [x27]
	and	w10, w25, w12
	cmp	x9, #0
	ccmp	w10, #0, #0, ne
	b.ne	LBB0_5
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	w9, #1
	bfi	w9, w8, #1, #31
	str	x9, [sp]
Lloh14:
	adrp	x0, l_.str@PAGE
Lloh15:
	add	x0, x0, l_.str@PAGEOFF
	bl	_pr_cont
LBB0_5:                                 ;   in Loop: Header=BB0_3 Depth=1
	ldr	w1, [x24]
	mov	x0, x25
	bl	_btwrite
	mov	x0, x21
	bl	_bttv_i2c_wait_done
	mov	x26, x0
	tbnz	w0, #31, LBB0_12
; %bb.6:                                ;   in Loop: Header=BB0_3 Depth=1
	cbz	w26, LBB0_11
; %bb.7:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w0, [x24]
	bl	_btread
	ubfx	w8, w0, #8, #8
	ldr	x9, [x20, #8]
	str	w8, [x9, x28, lsl #2]
	ldr	x9, [x27]
	cbz	x9, LBB0_2
; %bb.8:                                ;   in Loop: Header=BB0_3 Depth=1
	str	x8, [sp]
Lloh16:
	adrp	x0, l_.str.1@PAGE
Lloh17:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_pr_cont
	ldr	x8, [x27]
	cbz	x8, LBB0_2
; %bb.9:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w8, [x22]
	tst	w8, w25
	b.ne	LBB0_2
; %bb.10:                               ;   in Loop: Header=BB0_3 Depth=1
Lloh18:
	adrp	x0, l_.str.2@PAGE
Lloh19:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_pr_cont
	b	LBB0_2
LBB0_11:
Lloh20:
	adrp	x8, _EIO@GOTPAGE
Lloh21:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
	neg	w26, w8
LBB0_12:
	ldr	x8, [x27]
	cbz	x8, LBB0_14
; %bb.13:
	mov	x8, x26
	str	x8, [sp]
Lloh23:
	adrp	x0, l_.str.3@PAGE
Lloh24:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_pr_cont
LBB0_14:
	mov	x0, x26
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpAdd	Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.comm	_I2C_HW,4,2                     ; @I2C_HW
	.comm	_BT848_I2C_W3B,4,2              ; @BT848_I2C_W3B
	.comm	_BT878_I2C_NOSTOP,4,2           ; @BT878_I2C_NOSTOP
	.comm	_BT878_I2C_NOSTART,4,2          ; @BT878_I2C_NOSTART
	.comm	_i2c_debug,8,3                  ; @i2c_debug
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	" <R %02x"

	.comm	_BT848_I2C,4,2                  ; @BT848_I2C
l_.str.1:                               ; @.str.1
	.asciz	" =%02x"

l_.str.2:                               ; @.str.2
	.asciz	" >\n"

	.comm	_EIO,4,2                        ; @EIO
l_.str.3:                               ; @.str.3
	.asciz	" ERR: %d\n"

	.no_dead_strip	_bttv_i2c_readbytes
.subsections_via_symbols
