	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function i2c_read
_i2c_read:                              ## @i2c_read
	.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	%r8d, -60(%rbp)                 ## 4-byte Spill
	movq	%rcx, %r15
	movl	%edx, %ebx
	movq	%rsi, %r14
	callq	_device_get_softc
	movq	%rax, %r13
	movq	%r15, -48(%rbp)                 ## 8-byte Spill
	movl	$0, (%r15)
	movl	(%rax), %ecx
	leaq	L_.str(%rip), %rdx
	movq	%rax, %rdi
	movl	$1, %esi
	movl	%ebx, %r8d
	callq	_DEVICE_DEBUGF
	cmpl	$1, %ebx
	je	LBB0_3
## %bb.1:
	testl	%ebx, %ebx
	jne	LBB0_4
## %bb.2:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	$0, (%rax)
	xorl	%r15d, %r15d
	jmp	LBB0_14
LBB0_3:
	movq	_I2CCR_MEN@GOTPCREL(%rip), %rax
	movq	_I2CCR_MSTA@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	orl	(%rax), %edx
	movq	_I2CCR_TXAK@GOTPCREL(%rip), %rax
	jmp	LBB0_5
LBB0_4:
	movq	_I2CCR_MSTA@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_I2CCR_MEN@GOTPCREL(%rip), %rax
LBB0_5:
	movq	_I2C_CONTROL_REG@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	orl	(%rax), %edx
	movq	%r13, %rdi
	callq	_i2c_write_reg
	movq	_I2C_STATUS_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%r15d, %r15d
	movq	%r13, %rdi
	xorl	%edx, %edx
	callq	_i2c_write_reg
	movq	_I2C_DATA_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	callq	_i2c_read_reg
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	$0, (%rax)
	testl	%ebx, %ebx
	jle	LBB0_14
## %bb.6:
	leal	-2(%rbx), %eax
	movl	%eax, -56(%rbp)                 ## 4-byte Spill
	leal	-1(%rbx), %eax
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
	jmp	LBB0_7
	.p2align	4, 0x90
LBB0_10:                                ##   in Loop: Header=BB0_7 Depth=1
	movq	_I2C_CONTROL_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_I2CCR_MSTA@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_I2CCR_MEN@GOTPCREL(%rip), %rax
	orl	(%rax), %edx
	movq	_I2CCR_TXAK@GOTPCREL(%rip), %rax
	orl	(%rax), %edx
	movq	%r13, %rdi
	callq	_i2c_write_reg
LBB0_13:                                ##   in Loop: Header=BB0_7 Depth=1
	movq	_I2C_DATA_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	callq	_i2c_read_reg
	movl	%eax, %r12d
	movq	%r13, %rdi
	movl	$1, %esi
	leaq	L_.str.1(%rip), %rdx
	movl	%eax, %ecx
	xorl	%eax, %eax
	callq	_DEBUGF
	movb	%r12b, (%r14)
	incq	%r14
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	movl	(%rcx), %eax
	incl	%eax
	movl	%eax, (%rcx)
	cmpl	%ebx, %eax
	jge	LBB0_14
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r13, %rdi
	xorl	%esi, %esi
	callq	_wait_for_xfer
	movl	%eax, %r15d
	movq	_IIC_NOERR@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r15d
	jne	LBB0_14
## %bb.8:                               ##   in Loop: Header=BB0_7 Depth=1
	movq	_I2C_STATUS_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	xorl	%edx, %edx
	callq	_i2c_write_reg
	cmpl	$0, -60(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_13
## %bb.9:                               ##   in Loop: Header=BB0_7 Depth=1
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %eax
	cmpl	-56(%rbp), %eax                 ## 4-byte Folded Reload
	je	LBB0_10
## %bb.11:                              ##   in Loop: Header=BB0_7 Depth=1
	cmpl	-52(%rbp), %eax                 ## 4-byte Folded Reload
	jne	LBB0_13
## %bb.12:                              ##   in Loop: Header=BB0_7 Depth=1
	movq	_I2C_CONTROL_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_I2CCR_TXAK@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_I2CCR_MEN@GOTPCREL(%rip), %rax
	orl	(%rax), %edx
	movq	%r13, %rdi
	callq	_i2c_write_reg
	movq	%r13, %rdi
	xorl	%esi, %esi
	callq	_wait_for_busbusy
	jmp	LBB0_13
LBB0_14:
	leaq	L_.str.2(%rip), %rdx
	movq	%r13, %rdi
	movl	$1, %esi
	xorl	%eax, %eax
	callq	_DEBUGF
	movq	%r13, %rdi
	movl	%r15d, %esi
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_i2c_error_handler              ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"read   0x%02x len %d: "

	.comm	_I2C_CONTROL_REG,4,2            ## @I2C_CONTROL_REG
	.comm	_I2CCR_MEN,4,2                  ## @I2CCR_MEN
	.comm	_I2CCR_MSTA,4,2                 ## @I2CCR_MSTA
	.comm	_I2CCR_TXAK,4,2                 ## @I2CCR_TXAK
	.comm	_I2C_STATUS_REG,4,2             ## @I2C_STATUS_REG
	.comm	_I2C_DATA_REG,4,2               ## @I2C_DATA_REG
	.comm	_IIC_NOERR,4,2                  ## @IIC_NOERR
L_.str.1:                               ## @.str.1
	.asciz	"0x%02x "

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

	.no_dead_strip	_i2c_read
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function i2c_read
_i2c_read:                              ; @i2c_read
	.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
	mov	x21, x4
	mov	x20, x3
	mov	x22, x2
	mov	x23, x1
	bl	_device_get_softc
	mov	x19, x0
	str	wzr, [x20]
	ldr	w3, [x0]
Lloh0:
	adrp	x2, l_.str@PAGE
Lloh1:
	add	x2, x2, l_.str@PAGEOFF
	mov	w1, #1
	mov	x4, x22
	bl	_DEVICE_DEBUGF
	cmp	w22, #1
	b.eq	LBB0_3
; %bb.1:
	cbnz	w22, LBB0_4
; %bb.2:
	mov	w24, #0
	str	wzr, [x20]
	b	LBB0_15
LBB0_3:
Lloh2:
	adrp	x8, _I2CCR_MEN@GOTPAGE
Lloh3:
	ldr	x8, [x8, _I2CCR_MEN@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
Lloh5:
	adrp	x9, _I2CCR_MSTA@GOTPAGE
Lloh6:
	ldr	x9, [x9, _I2CCR_MSTA@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh8:
	adrp	x9, _I2CCR_TXAK@GOTPAGE
Lloh9:
	ldr	x9, [x9, _I2CCR_TXAK@GOTPAGEOFF]
	b	LBB0_5
LBB0_4:
Lloh10:
	adrp	x8, _I2CCR_MSTA@GOTPAGE
Lloh11:
	ldr	x8, [x8, _I2CCR_MSTA@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
Lloh13:
	adrp	x9, _I2CCR_MEN@GOTPAGE
Lloh14:
	ldr	x9, [x9, _I2CCR_MEN@GOTPAGEOFF]
LBB0_5:
Lloh15:
	adrp	x10, _I2C_CONTROL_REG@GOTPAGE
Lloh16:
	ldr	x10, [x10, _I2C_CONTROL_REG@GOTPAGEOFF]
Lloh17:
	ldr	w1, [x10]
	ldr	w9, [x9]
	orr	w2, w8, w9
	mov	x0, x19
	bl	_i2c_write_reg
Lloh18:
	adrp	x8, _I2C_STATUS_REG@GOTPAGE
Lloh19:
	ldr	x8, [x8, _I2C_STATUS_REG@GOTPAGEOFF]
Lloh20:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #0
	bl	_i2c_write_reg
Lloh21:
	adrp	x27, _I2C_DATA_REG@GOTPAGE
Lloh22:
	ldr	x27, [x27, _I2C_DATA_REG@GOTPAGEOFF]
	ldr	w1, [x27]
	mov	x0, x19
	bl	_i2c_read_reg
	str	wzr, [x20]
	subs	w8, w22, #1
	str	w8, [sp, #12]                   ; 4-byte Folded Spill
	b.lt	LBB0_14
; %bb.6:
	sub	w28, w22, #2
Lloh23:
	adrp	x25, l_.str.1@PAGE
Lloh24:
	add	x25, x25, l_.str.1@PAGEOFF
	b	LBB0_9
LBB0_7:                                 ;   in Loop: Header=BB0_9 Depth=1
Lloh25:
	adrp	x8, _I2C_CONTROL_REG@GOTPAGE
Lloh26:
	ldr	x8, [x8, _I2C_CONTROL_REG@GOTPAGEOFF]
Lloh27:
	ldr	w1, [x8]
Lloh28:
	adrp	x8, _I2CCR_MEN@GOTPAGE
Lloh29:
	ldr	x8, [x8, _I2CCR_MEN@GOTPAGEOFF]
Lloh30:
	ldr	w8, [x8]
Lloh31:
	adrp	x9, _I2CCR_MSTA@GOTPAGE
Lloh32:
	ldr	x9, [x9, _I2CCR_MSTA@GOTPAGEOFF]
Lloh33:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh34:
	adrp	x9, _I2CCR_TXAK@GOTPAGE
Lloh35:
	ldr	x9, [x9, _I2CCR_TXAK@GOTPAGEOFF]
Lloh36:
	ldr	w9, [x9]
	orr	w2, w8, w9
	mov	x0, x19
	bl	_i2c_write_reg
LBB0_8:                                 ;   in Loop: Header=BB0_9 Depth=1
	ldr	w1, [x27]
	mov	x0, x19
	bl	_i2c_read_reg
	mov	x26, x0
	str	x26, [sp]
	mov	x0, x19
	mov	w1, #1
	mov	x2, x25
	bl	_DEBUGF
	strb	w26, [x23], #1
	ldr	w8, [x20]
	add	w8, w8, #1
	str	w8, [x20]
	cmp	w8, w22
	b.ge	LBB0_15
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x19
	mov	w1, #0
	bl	_wait_for_xfer
	mov	x24, x0
Lloh37:
	adrp	x8, _IIC_NOERR@GOTPAGE
Lloh38:
	ldr	x8, [x8, _IIC_NOERR@GOTPAGEOFF]
Lloh39:
	ldr	w8, [x8]
	cmp	w0, w8
	b.ne	LBB0_15
; %bb.10:                               ;   in Loop: Header=BB0_9 Depth=1
Lloh40:
	adrp	x8, _I2C_STATUS_REG@GOTPAGE
Lloh41:
	ldr	x8, [x8, _I2C_STATUS_REG@GOTPAGEOFF]
Lloh42:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #0
	bl	_i2c_write_reg
	cbz	w21, LBB0_8
; %bb.11:                               ;   in Loop: Header=BB0_9 Depth=1
	ldr	w8, [x20]
	cmp	w8, w28
	b.eq	LBB0_7
; %bb.12:                               ;   in Loop: Header=BB0_9 Depth=1
	ldr	w9, [sp, #12]                   ; 4-byte Folded Reload
	cmp	w8, w9
	b.ne	LBB0_8
; %bb.13:                               ;   in Loop: Header=BB0_9 Depth=1
Lloh43:
	adrp	x8, _I2C_CONTROL_REG@GOTPAGE
Lloh44:
	ldr	x8, [x8, _I2C_CONTROL_REG@GOTPAGEOFF]
Lloh45:
	ldr	w1, [x8]
Lloh46:
	adrp	x8, _I2CCR_MEN@GOTPAGE
Lloh47:
	ldr	x8, [x8, _I2CCR_MEN@GOTPAGEOFF]
Lloh48:
	ldr	w8, [x8]
Lloh49:
	adrp	x9, _I2CCR_TXAK@GOTPAGE
Lloh50:
	ldr	x9, [x9, _I2CCR_TXAK@GOTPAGEOFF]
Lloh51:
	ldr	w9, [x9]
	orr	w2, w9, w8
	mov	x0, x19
	bl	_i2c_write_reg
	mov	x0, x19
	mov	w1, #0
	bl	_wait_for_busbusy
	b	LBB0_8
LBB0_14:
	mov	w24, #0
LBB0_15:
Lloh52:
	adrp	x2, l_.str.2@PAGE
Lloh53:
	add	x2, x2, l_.str.2@PAGEOFF
	mov	x0, x19
	mov	w1, #1
	bl	_DEBUGF
	mov	x0, x19
	mov	x1, x24
	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
	b	_i2c_error_handler
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh34, Lloh35, Lloh36
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.loh AdrpLdrGotLdr	Lloh40, Lloh41, Lloh42
	.loh AdrpLdrGotLdr	Lloh49, Lloh50, Lloh51
	.loh AdrpLdrGotLdr	Lloh46, Lloh47, Lloh48
	.loh AdrpLdrGotLdr	Lloh43, Lloh44, Lloh45
	.loh AdrpAdd	Lloh52, Lloh53
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"read   0x%02x len %d: "

	.comm	_I2C_CONTROL_REG,4,2            ; @I2C_CONTROL_REG
	.comm	_I2CCR_MEN,4,2                  ; @I2CCR_MEN
	.comm	_I2CCR_MSTA,4,2                 ; @I2CCR_MSTA
	.comm	_I2CCR_TXAK,4,2                 ; @I2CCR_TXAK
	.comm	_I2C_STATUS_REG,4,2             ; @I2C_STATUS_REG
	.comm	_I2C_DATA_REG,4,2               ; @I2C_DATA_REG
	.comm	_IIC_NOERR,4,2                  ; @IIC_NOERR
l_.str.1:                               ; @.str.1
	.asciz	"0x%02x "

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

	.no_dead_strip	_i2c_read
.subsections_via_symbols
