	.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, -44(%rbp)                 ## 4-byte Spill
	movq	%rcx, %r12
	movl	%edx, %r14d
	movq	%rsi, %rbx
	movl	%edi, -56(%rbp)                 ## 4-byte Spill
	callq	_device_get_softc
	movq	%rax, %r13
	movl	$0, (%r12)
	movq	%rax, %rdi
	callq	_mtx_lock
	testl	%r14d, %r14d
	je	LBB0_5
## %bb.1:
	cmpl	$1, %r14d
	jne	LBB0_3
## %bb.2:
	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_4
LBB0_3:
	movq	_I2CCR_MSTA@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_I2CCR_MEN@GOTPCREL(%rip), %rax
LBB0_4:
	movq	_I2C_CONTROL_REG@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	orl	(%rax), %edx
	movq	%r13, %rdi
	callq	_i2c_write_reg
	movq	_I2C_DATA_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	callq	_i2c_read_reg
	movl	$1000, %edi                     ## imm = 0x3E8
	callq	_DELAY
LBB0_5:
	cmpl	%r14d, (%r12)
	jge	LBB0_16
## %bb.6:
	leal	-2(%r14), %eax
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
	leal	-1(%r14), %eax
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	jmp	LBB0_7
	.p2align	4, 0x90
LBB0_15:                                ##   in Loop: Header=BB0_7 Depth=1
	movq	_I2C_DATA_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	callq	_i2c_read_reg
	movb	%al, (%rbx)
	incq	%rbx
	incl	(%r12)
	movl	$1250, %edi                     ## imm = 0x4E2
	callq	_DELAY
	cmpl	%r14d, (%r12)
	jge	LBB0_16
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movl	$1000, %edi                     ## imm = 0x3E8
	callq	_DELAY
	movl	-56(%rbp), %edi                 ## 4-byte Reload
	movq	%r13, %rsi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	callq	_i2c_do_wait
	testl	%eax, %eax
	jne	LBB0_8
## %bb.9:                               ##   in Loop: Header=BB0_7 Depth=1
	movl	(%r12), %eax
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_12
## %bb.10:                              ##   in Loop: Header=BB0_7 Depth=1
	cmpl	-52(%rbp), %eax                 ## 4-byte Folded Reload
	jne	LBB0_12
## %bb.11:                              ##   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
	movl	(%r12), %eax
LBB0_12:                                ##   in Loop: Header=BB0_7 Depth=1
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_15
## %bb.13:                              ##   in Loop: Header=BB0_7 Depth=1
	cmpl	-48(%rbp), %eax                 ## 4-byte Folded Reload
	jne	LBB0_15
## %bb.14:                              ##   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
	jmp	LBB0_15
LBB0_16:
	movq	%r13, %rdi
	callq	_mtx_unlock
	movq	_IIC_NOERR@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	jmp	LBB0_17
LBB0_8:
	movl	%eax, %r15d
	movq	%r13, %rdi
	callq	_mtx_unlock
LBB0_17:
	movl	%r15d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.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_DATA_REG,4,2               ## @I2C_DATA_REG
	.comm	_IIC_NOERR,4,2                  ## @IIC_NOERR
	.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:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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	x19, x4
	mov	x20, x3
	mov	x21, x2
	mov	x22, x1
	mov	x24, x0
	bl	_device_get_softc
	mov	x23, x0
	str	wzr, [x20]
	bl	_mtx_lock
	cbz	w21, LBB0_5
; %bb.1:
	cmp	w21, #1
	b.ne	LBB0_3
; %bb.2:
Lloh0:
	adrp	x8, _I2CCR_MEN@GOTPAGE
Lloh1:
	ldr	x8, [x8, _I2CCR_MEN@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x9, _I2CCR_MSTA@GOTPAGE
Lloh4:
	ldr	x9, [x9, _I2CCR_MSTA@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh6:
	adrp	x9, _I2CCR_TXAK@GOTPAGE
Lloh7:
	ldr	x9, [x9, _I2CCR_TXAK@GOTPAGEOFF]
	b	LBB0_4
LBB0_3:
Lloh8:
	adrp	x8, _I2CCR_MSTA@GOTPAGE
Lloh9:
	ldr	x8, [x8, _I2CCR_MSTA@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
Lloh11:
	adrp	x9, _I2CCR_MEN@GOTPAGE
Lloh12:
	ldr	x9, [x9, _I2CCR_MEN@GOTPAGEOFF]
LBB0_4:
Lloh13:
	adrp	x10, _I2C_CONTROL_REG@GOTPAGE
Lloh14:
	ldr	x10, [x10, _I2C_CONTROL_REG@GOTPAGEOFF]
Lloh15:
	ldr	w1, [x10]
	ldr	w9, [x9]
	orr	w2, w8, w9
	mov	x0, x23
	bl	_i2c_write_reg
Lloh16:
	adrp	x8, _I2C_DATA_REG@GOTPAGE
Lloh17:
	ldr	x8, [x8, _I2C_DATA_REG@GOTPAGEOFF]
Lloh18:
	ldr	w1, [x8]
	mov	x0, x23
	bl	_i2c_read_reg
	mov	w0, #1000
	bl	_DELAY
LBB0_5:
	ldr	w8, [x20]
	cmp	w8, w21
	b.ge	LBB0_15
; %bb.6:
	sub	w28, w21, #2
	sub	w26, w21, #1
Lloh19:
	adrp	x27, _I2CCR_TXAK@GOTPAGE
Lloh20:
	ldr	x27, [x27, _I2CCR_TXAK@GOTPAGEOFF]
	b	LBB0_8
LBB0_7:                                 ;   in Loop: Header=BB0_8 Depth=1
Lloh21:
	adrp	x8, _I2C_DATA_REG@GOTPAGE
Lloh22:
	ldr	x8, [x8, _I2C_DATA_REG@GOTPAGEOFF]
Lloh23:
	ldr	w1, [x8]
	mov	x0, x23
	bl	_i2c_read_reg
	strb	w0, [x22], #1
	ldr	w8, [x20]
	add	w8, w8, #1
	str	w8, [x20]
	mov	w0, #1250
	bl	_DELAY
	ldr	w8, [x20]
	cmp	w8, w21
	b.ge	LBB0_15
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	mov	w0, #1000
	bl	_DELAY
	mov	x0, x24
	mov	x1, x23
	mov	w2, #0
	mov	w3, #0
	bl	_i2c_do_wait
	cbnz	w0, LBB0_16
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=1
	ldr	w8, [x20]
	cbz	w19, LBB0_12
; %bb.10:                               ;   in Loop: Header=BB0_8 Depth=1
	cmp	w8, w28
	b.ne	LBB0_12
; %bb.11:                               ;   in Loop: Header=BB0_8 Depth=1
Lloh24:
	adrp	x8, _I2C_CONTROL_REG@GOTPAGE
Lloh25:
	ldr	x8, [x8, _I2C_CONTROL_REG@GOTPAGEOFF]
Lloh26:
	ldr	w1, [x8]
Lloh27:
	adrp	x8, _I2CCR_MEN@GOTPAGE
Lloh28:
	ldr	x8, [x8, _I2CCR_MEN@GOTPAGEOFF]
Lloh29:
	ldr	w8, [x8]
Lloh30:
	adrp	x9, _I2CCR_MSTA@GOTPAGE
Lloh31:
	ldr	x9, [x9, _I2CCR_MSTA@GOTPAGEOFF]
Lloh32:
	ldr	w9, [x9]
	orr	w8, w9, w8
	ldr	w9, [x27]
	orr	w2, w8, w9
	mov	x0, x23
	bl	_i2c_write_reg
	ldr	w8, [x20]
LBB0_12:                                ;   in Loop: Header=BB0_8 Depth=1
	cbz	w19, LBB0_7
; %bb.13:                               ;   in Loop: Header=BB0_8 Depth=1
	cmp	w8, w26
	b.ne	LBB0_7
; %bb.14:                               ;   in Loop: Header=BB0_8 Depth=1
Lloh33:
	adrp	x8, _I2C_CONTROL_REG@GOTPAGE
Lloh34:
	ldr	x8, [x8, _I2C_CONTROL_REG@GOTPAGEOFF]
Lloh35:
	ldr	w1, [x8]
Lloh36:
	adrp	x8, _I2CCR_MEN@GOTPAGE
Lloh37:
	ldr	x8, [x8, _I2CCR_MEN@GOTPAGEOFF]
Lloh38:
	ldr	w8, [x8]
	ldr	w9, [x27]
	orr	w2, w9, w8
	mov	x0, x23
	bl	_i2c_write_reg
	b	LBB0_7
LBB0_15:
	mov	x0, x23
	bl	_mtx_unlock
Lloh39:
	adrp	x8, _IIC_NOERR@GOTPAGE
Lloh40:
	ldr	x8, [x8, _IIC_NOERR@GOTPAGEOFF]
Lloh41:
	ldr	w25, [x8]
	b	LBB0_17
LBB0_16:
	mov	x25, x0
	mov	x0, x23
	bl	_mtx_unlock
LBB0_17:
	mov	x0, x25
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh36, Lloh37, Lloh38
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh39, Lloh40, Lloh41
	.cfi_endproc
                                        ; -- End function
	.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_DATA_REG,4,2               ; @I2C_DATA_REG
	.comm	_IIC_NOERR,4,2                  ; @IIC_NOERR
	.no_dead_strip	_i2c_read
.subsections_via_symbols
