	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function i2c_start
_i2c_start:                             ## @i2c_start
	.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
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r15d
	movl	%edi, %r14d
	callq	_device_get_softc
	movq	%rax, %r12
	movl	$1000, %edi                     ## imm = 0x3E8
	callq	_DELAY
	movq	%r12, %rdi
	callq	_mtx_lock
	movq	_I2C_STATUS_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	callq	_i2c_read_reg
	movq	_I2CSR_MBB@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rdi
	callq	_debugf
	movq	%r12, %rdi
	callq	_mtx_unlock
	movl	%r14d, %edi
	callq	_i2c_stop
	movq	_IIC_EBUSERR@GOTPCREL(%rip), %rax
	jmp	LBB0_4
LBB0_2:
	movq	_I2C_CONTROL_REG@GOTPCREL(%rip), %rax
	movq	_I2CCR_MEN@GOTPCREL(%rip), %rcx
	movq	_I2CCR_MSTA@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	orl	(%rcx), %edx
	movl	(%rax), %esi
	movq	_I2CCR_MTX@GOTPCREL(%rip), %rax
	orl	(%rax), %edx
	movq	%r12, %rdi
	callq	_i2c_write_reg
	movq	_I2C_DATA_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	movl	%r15d, %edx
	callq	_i2c_write_reg
	movl	$1250, %edi                     ## imm = 0x4E2
	callq	_DELAY
	movl	%r14d, %edi
	movq	%r12, %rsi
	movl	$1, %edx
	movl	$1, %ecx
	callq	_i2c_do_wait
	movl	%eax, %ebx
	movq	%r12, %rdi
	callq	_mtx_unlock
	testl	%ebx, %ebx
	jne	LBB0_5
## %bb.3:
	movq	_IIC_NOERR@GOTPCREL(%rip), %rax
LBB0_4:
	movl	(%rax), %ebx
LBB0_5:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_I2C_STATUS_REG,4,2             ## @I2C_STATUS_REG
	.comm	_I2CSR_MBB,4,2                  ## @I2CSR_MBB
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"bus busy"

	.comm	_IIC_EBUSERR,4,2                ## @IIC_EBUSERR
	.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_MTX,4,2                  ## @I2CCR_MTX
	.comm	_I2C_DATA_REG,4,2               ## @I2C_DATA_REG
	.comm	_IIC_NOERR,4,2                  ## @IIC_NOERR
	.no_dead_strip	_i2c_start
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function i2c_start
_i2c_start:                             ; @i2c_start
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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	x21, x1
	mov	x19, x0
	bl	_device_get_softc
	mov	x20, x0
	mov	w0, #1000
	bl	_DELAY
	mov	x0, x20
	bl	_mtx_lock
Lloh0:
	adrp	x8, _I2C_STATUS_REG@GOTPAGE
Lloh1:
	ldr	x8, [x8, _I2C_STATUS_REG@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_i2c_read_reg
Lloh3:
	adrp	x8, _I2CSR_MBB@GOTPAGE
Lloh4:
	ldr	x8, [x8, _I2CSR_MBB@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	tst	w8, w0
	b.eq	LBB0_2
; %bb.1:
Lloh6:
	adrp	x0, l_.str@PAGE
Lloh7:
	add	x0, x0, l_.str@PAGEOFF
	bl	_debugf
	mov	x0, x20
	bl	_mtx_unlock
	mov	x0, x19
	bl	_i2c_stop
Lloh8:
	adrp	x8, _IIC_EBUSERR@GOTPAGE
Lloh9:
	ldr	x8, [x8, _IIC_EBUSERR@GOTPAGEOFF]
Lloh10:
	ldr	w0, [x8]
	b	LBB0_3
LBB0_2:
Lloh11:
	adrp	x8, _I2C_CONTROL_REG@GOTPAGE
Lloh12:
	ldr	x8, [x8, _I2C_CONTROL_REG@GOTPAGEOFF]
Lloh13:
	ldr	w1, [x8]
Lloh14:
	adrp	x8, _I2CCR_MEN@GOTPAGE
Lloh15:
	ldr	x8, [x8, _I2CCR_MEN@GOTPAGEOFF]
Lloh16:
	ldr	w8, [x8]
Lloh17:
	adrp	x9, _I2CCR_MSTA@GOTPAGE
Lloh18:
	ldr	x9, [x9, _I2CCR_MSTA@GOTPAGEOFF]
Lloh19:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh20:
	adrp	x9, _I2CCR_MTX@GOTPAGE
Lloh21:
	ldr	x9, [x9, _I2CCR_MTX@GOTPAGEOFF]
Lloh22:
	ldr	w9, [x9]
	orr	w2, w8, w9
	mov	x0, x20
	bl	_i2c_write_reg
Lloh23:
	adrp	x8, _I2C_DATA_REG@GOTPAGE
Lloh24:
	ldr	x8, [x8, _I2C_DATA_REG@GOTPAGEOFF]
Lloh25:
	ldr	w1, [x8]
	mov	x0, x20
	mov	x2, x21
	bl	_i2c_write_reg
	mov	w0, #1250
	bl	_DELAY
	mov	x0, x19
	mov	x1, x20
	mov	w2, #1
	mov	w3, #1
	bl	_i2c_do_wait
	mov	x19, x0
	mov	x0, x20
	bl	_mtx_unlock
Lloh26:
	adrp	x8, _IIC_NOERR@GOTPAGE
Lloh27:
	ldr	x8, [x8, _IIC_NOERR@GOTPAGEOFF]
Lloh28:
	ldr	w8, [x8]
	cmp	w19, #0
	csel	w0, w8, w19, eq
LBB0_3:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_I2C_STATUS_REG,4,2             ; @I2C_STATUS_REG
	.comm	_I2CSR_MBB,4,2                  ; @I2CSR_MBB
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"bus busy"

	.comm	_IIC_EBUSERR,4,2                ; @IIC_EBUSERR
	.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_MTX,4,2                  ; @I2CCR_MTX
	.comm	_I2C_DATA_REG,4,2               ; @I2C_DATA_REG
	.comm	_IIC_NOERR,4,2                  ; @IIC_NOERR
	.no_dead_strip	_i2c_start
.subsections_via_symbols
