	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function kiic_transfer
_kiic_transfer:                         ## @kiic_transfer
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, -44(%rbp)                 ## 4-byte Spill
	movq	%rsi, %r12
	movl	%edi, %r14d
	callq	_device_get_softc
	movq	%rax, %r15
	leaq	24(%rax), %rbx
	movq	%rbx, %rdi
	callq	_mtx_lock
	movl	(%r15), %ecx
	movq	_I2C_BUSY@GOTPCREL(%rip), %r13
	movl	(%r13), %eax
	testl	%ecx, %eax
	je	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rcx
	movl	%r14d, %edi
	movq	%rbx, %rsi
	xorl	%edx, %edx
	movl	$100, %r8d
	callq	_mtx_sleep
	movl	(%r15), %ecx
	movl	(%r13), %eax
LBB0_2:
	testl	%ecx, %eax
	je	LBB0_4
## %bb.3:
	movq	%rbx, %rdi
	callq	_mtx_unlock
	movq	_ETIMEDOUT@GOTPCREL(%rip), %rax
LBB0_18:
	movl	(%rax), %eax
	jmp	LBB0_19
LBB0_4:
	movl	%r14d, -52(%rbp)                ## 4-byte Spill
	movq	%rbx, -64(%rbp)                 ## 8-byte Spill
	movl	%eax, (%r15)
	movq	_ISR@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movq	%r15, %rdi
	movl	%ebx, %esi
	callq	_kiic_readreg
	movq	%r15, %rdi
	movl	%ebx, %esi
	movl	%eax, %edx
	callq	_kiic_writereg
	movq	_STATUS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	xorl	%edx, %edx
	callq	_kiic_writereg
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	jle	LBB0_16
## %bb.5:
	movl	$0, -48(%rbp)                   ## 4-byte Folded Spill
	xorl	%r14d, %r14d
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movslq	%r14d, %rbx
	leaq	(%rbx,%rbx,2), %r13
	movq	_IIC_M_NOSTOP@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r12,%r13,8)
	je	LBB0_10
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	incl	%r14d
	movslq	%r14d, %rbx
	leaq	(%rbx,%rbx,2), %rcx
	movq	_IIC_M_RD@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_I2C_COMBMODE@GOTPCREL(%rip), %rax
	andl	(%r12,%rcx,8), %edx
	jne	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_6 Depth=1
	movq	_I2C_STDSUBMODE@GOTPCREL(%rip), %rax
LBB0_9:                                 ##   in Loop: Header=BB0_6 Depth=1
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_kiic_setmode
	xorl	%edi, %edi
	cmpl	$1, 4(%r12,%r13,8)
	sete	%dil
	leaq	L_.str.1(%rip), %rsi
	callq	_KASSERT
	movq	8(%r12,%r13,8), %rax
	movl	(%rax), %eax
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	jmp	LBB0_11
	.p2align	4, 0x90
LBB0_10:                                ##   in Loop: Header=BB0_6 Depth=1
	movq	_I2C_STDMODE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_kiic_setmode
LBB0_11:                                ##   in Loop: Header=BB0_6 Depth=1
	leaq	(%rbx,%rbx,2), %rax
	movq	8(%r12,%rax,8), %rcx
	movq	%rcx, 8(%r15)
	movl	4(%r12,%rax,8), %edx
	movl	%edx, 16(%r15)
	movq	_I2C_BUSY@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, (%r15)
	movl	16(%r12,%rax,8), %ebx
	imull	$200, %edx, %r13d
	addl	$101000, %r13d                  ## imm = 0x18A88
	movq	_IIC_M_RD@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	testl	%edx, (%r12,%rax,8)
	je	LBB0_13
## %bb.12:                              ##   in Loop: Header=BB0_6 Depth=1
	movq	_I2C_READING@GOTPCREL(%rip), %rdx
	orl	(%rdx), %ecx
	movl	%ecx, (%r15)
	orl	$1, %ebx
LBB0_13:                                ##   in Loop: Header=BB0_6 Depth=1
	leaq	(%r12,%rax,8), %rax
	addq	$4, %rax
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	orl	20(%r15), %ebx
	movl	%ebx, %esi
	shrl	$8, %esi
	andl	$1, %esi
	movq	%r15, %rdi
	callq	_kiic_setport
	movq	_ADDR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movzbl	%bl, %edx
	movq	%r15, %rdi
	callq	_kiic_writereg
	movq	_SUBADDR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	movl	-48(%rbp), %edx                 ## 4-byte Reload
	callq	_kiic_writereg
	movq	_CONTROL@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	movq	%r15, %rdi
	callq	_kiic_readreg
	movq	_I2C_CT_ADDR@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movl	(%rbx), %esi
	movq	%r15, %rdi
	movl	%eax, %edx
	callq	_kiic_writereg
	movl	-52(%rbp), %edi                 ## 4-byte Reload
	movq	-64(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rsi
	xorl	%edx, %edx
	leaq	L_.str(%rip), %rcx
	movl	%r13d, %r8d
	callq	_mtx_sleep
	movl	16(%r15), %ecx
	movq	-72(%rbp), %rdx                 ## 8-byte Reload
	subl	%ecx, (%rdx)
	movq	_I2C_ERROR@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%ecx, (%r15)
	jne	LBB0_17
## %bb.14:                              ##   in Loop: Header=BB0_6 Depth=1
	movq	_EWOULDBLOCK@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	je	LBB0_17
## %bb.15:                              ##   in Loop: Header=BB0_6 Depth=1
	incl	%r14d
	cmpl	-44(%rbp), %r14d                ## 4-byte Folded Reload
	jl	LBB0_6
LBB0_16:
	movl	$0, (%r15)
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	callq	_mtx_unlock
	xorl	%eax, %eax
LBB0_19:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_17:
	movl	28(%r15), %edi
	leaq	L_.str.2(%rip), %rsi
	callq	_device_printf
	movl	$0, (%r15)
	movq	%rbx, %rdi
	callq	_mtx_unlock
	movq	_EIO@GOTPCREL(%rip), %rax
	jmp	LBB0_18
	.cfi_endproc
                                        ## -- End function
	.comm	_I2C_BUSY,4,2                   ## @I2C_BUSY
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"kiic"

	.comm	_ETIMEDOUT,4,2                  ## @ETIMEDOUT
	.comm	_ISR,4,2                        ## @ISR
	.comm	_STATUS,4,2                     ## @STATUS
	.comm	_IIC_M_NOSTOP,4,2               ## @IIC_M_NOSTOP
	.comm	_IIC_M_RD,4,2                   ## @IIC_M_RD
	.comm	_I2C_COMBMODE,4,2               ## @I2C_COMBMODE
	.comm	_I2C_STDSUBMODE,4,2             ## @I2C_STDSUBMODE
L_.str.1:                               ## @.str.1
	.asciz	"oversize I2C message"

	.comm	_I2C_STDMODE,4,2                ## @I2C_STDMODE
	.comm	_I2C_READING,4,2                ## @I2C_READING
	.comm	_ADDR,4,2                       ## @ADDR
	.comm	_SUBADDR,4,2                    ## @SUBADDR
	.comm	_CONTROL,4,2                    ## @CONTROL
	.comm	_I2C_CT_ADDR,4,2                ## @I2C_CT_ADDR
	.comm	_I2C_ERROR,4,2                  ## @I2C_ERROR
	.comm	_EWOULDBLOCK,4,2                ## @EWOULDBLOCK
L_.str.2:                               ## @.str.2
	.asciz	"I2C error\n"

	.comm	_EIO,4,2                        ## @EIO
	.no_dead_strip	_kiic_transfer
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function kiic_transfer
_kiic_transfer:                         ; @kiic_transfer
	.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
	str	w2, [sp, #12]                   ; 4-byte Folded Spill
	mov	x22, x1
	mov	x23, x0
	bl	_device_get_softc
	mov	x20, x0
	add	x19, x0, #24
	mov	x0, x19
	bl	_mtx_lock
	ldr	w9, [x20]
Lloh0:
	adrp	x28, _I2C_BUSY@GOTPAGE
Lloh1:
	ldr	x28, [x28, _I2C_BUSY@GOTPAGEOFF]
	ldr	w8, [x28]
	tst	w8, w9
	b.eq	LBB0_2
; %bb.1:
Lloh2:
	adrp	x3, l_.str@PAGE
Lloh3:
	add	x3, x3, l_.str@PAGEOFF
	mov	x0, x23
	mov	x1, x19
	mov	w2, #0
	mov	w4, #100
	bl	_mtx_sleep
	ldr	w9, [x20]
	ldr	w8, [x28]
LBB0_2:
	tst	w8, w9
	b.eq	LBB0_5
; %bb.3:
	mov	x0, x19
	bl	_mtx_unlock
Lloh4:
	adrp	x8, _ETIMEDOUT@GOTPAGE
Lloh5:
	ldr	x8, [x8, _ETIMEDOUT@GOTPAGEOFF]
LBB0_4:
	ldr	w0, [x8]
	b	LBB0_16
LBB0_5:
	str	w8, [x20]
Lloh6:
	adrp	x8, _ISR@GOTPAGE
Lloh7:
	ldr	x8, [x8, _ISR@GOTPAGEOFF]
Lloh8:
	ldr	w24, [x8]
	mov	x0, x20
	mov	x1, x24
	bl	_kiic_readreg
	mov	x2, x0
	mov	x0, x20
	mov	x1, x24
	bl	_kiic_writereg
Lloh9:
	adrp	x8, _STATUS@GOTPAGE
Lloh10:
	ldr	x8, [x8, _STATUS@GOTPAGEOFF]
Lloh11:
	ldr	w1, [x8]
	mov	x0, x20
	mov	w2, #0
	bl	_kiic_writereg
	ldr	w8, [sp, #12]                   ; 4-byte Folded Reload
	cmp	w8, #1
	b.lt	LBB0_15
; %bb.6:
	mov	w26, #0
	mov	w24, #0
	mov	w25, #24
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	sxtw	x27, w24
	smull	x8, w24, w25
	ldr	w8, [x22, x8]
Lloh12:
	adrp	x9, _IIC_M_NOSTOP@GOTPAGE
Lloh13:
	ldr	x9, [x9, _IIC_M_NOSTOP@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_9
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	add	x21, x27, #1
	madd	x24, x27, x25, x22
	ldr	w8, [x24, #24]
Lloh15:
	adrp	x27, _IIC_M_RD@GOTPAGE
Lloh16:
	ldr	x27, [x27, _IIC_M_RD@GOTPAGEOFF]
	ldr	w9, [x27]
	tst	w9, w8
Lloh17:
	adrp	x8, _I2C_STDSUBMODE@GOTPAGE
Lloh18:
	ldr	x8, [x8, _I2C_STDSUBMODE@GOTPAGEOFF]
Lloh19:
	adrp	x9, _I2C_COMBMODE@GOTPAGE
Lloh20:
	ldr	x9, [x9, _I2C_COMBMODE@GOTPAGEOFF]
	csel	x8, x8, x9, eq
	ldr	w1, [x8]
	mov	x0, x20
	bl	_kiic_setmode
	ldr	w8, [x24, #4]
	cmp	w8, #1
	cset	w0, eq
Lloh21:
	adrp	x1, l_.str.1@PAGE
Lloh22:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_KASSERT
	ldr	x8, [x24, #8]
	ldr	w26, [x8]
	mov	x24, x21
	b	LBB0_10
LBB0_9:                                 ;   in Loop: Header=BB0_7 Depth=1
Lloh23:
	adrp	x8, _I2C_STDMODE@GOTPAGE
Lloh24:
	ldr	x8, [x8, _I2C_STDMODE@GOTPAGEOFF]
Lloh25:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_kiic_setmode
	mov	x21, x27
Lloh26:
	adrp	x27, _IIC_M_RD@GOTPAGE
Lloh27:
	ldr	x27, [x27, _IIC_M_RD@GOTPAGEOFF]
LBB0_10:                                ;   in Loop: Header=BB0_7 Depth=1
	madd	x21, x21, x25, x22
	ldr	x10, [x21, #8]
	ldr	w8, [x21, #16]
	ldr	w11, [x21]
	ldr	w9, [x21, #4]!
	str	x10, [x20, #8]
	str	w9, [x20, #16]
	ldr	w10, [x28]
	str	w10, [x20]
	ldr	w12, [x27]
	tst	w12, w11
	b.eq	LBB0_12
; %bb.11:                               ;   in Loop: Header=BB0_7 Depth=1
Lloh28:
	adrp	x11, _I2C_READING@GOTPAGE
Lloh29:
	ldr	x11, [x11, _I2C_READING@GOTPAGEOFF]
Lloh30:
	ldr	w11, [x11]
	orr	w10, w11, w10
	str	w10, [x20]
	orr	w8, w8, #0x1
LBB0_12:                                ;   in Loop: Header=BB0_7 Depth=1
	mov	w10, #200
	mov	w11, #35464
	movk	w11, #1, lsl #16
	madd	w27, w9, w10, w11
	ldr	w9, [x20, #20]
	orr	w28, w9, w8
	ubfx	w1, w28, #8, #1
	mov	x0, x20
	bl	_kiic_setport
Lloh31:
	adrp	x8, _ADDR@GOTPAGE
Lloh32:
	ldr	x8, [x8, _ADDR@GOTPAGEOFF]
Lloh33:
	ldr	w1, [x8]
	and	w2, w28, #0xff
	mov	x0, x20
	bl	_kiic_writereg
Lloh34:
	adrp	x8, _SUBADDR@GOTPAGE
Lloh35:
	ldr	x8, [x8, _SUBADDR@GOTPAGEOFF]
Lloh36:
	ldr	w1, [x8]
	mov	x0, x20
	mov	x2, x26
	bl	_kiic_writereg
Lloh37:
	adrp	x28, _CONTROL@GOTPAGE
Lloh38:
	ldr	x28, [x28, _CONTROL@GOTPAGEOFF]
	ldr	w1, [x28]
	mov	x0, x20
	bl	_kiic_readreg
Lloh39:
	adrp	x8, _I2C_CT_ADDR@GOTPAGE
Lloh40:
	ldr	x8, [x8, _I2C_CT_ADDR@GOTPAGEOFF]
Lloh41:
	ldr	w8, [x8]
	orr	w2, w8, w0
	ldr	w1, [x28]
	mov	x0, x20
	bl	_kiic_writereg
	mov	x0, x23
	mov	x1, x19
	mov	w2, #0
Lloh42:
	adrp	x3, l_.str@PAGE
Lloh43:
	add	x3, x3, l_.str@PAGEOFF
	mov	x4, x27
	bl	_mtx_sleep
	ldr	w8, [x20, #16]
	ldr	w9, [x21]
	sub	w8, w9, w8
	str	w8, [x21]
	ldr	w8, [x20]
Lloh44:
	adrp	x9, _I2C_ERROR@GOTPAGE
Lloh45:
	ldr	x9, [x9, _I2C_ERROR@GOTPAGEOFF]
Lloh46:
	ldr	w9, [x9]
	tst	w9, w8
	b.ne	LBB0_17
; %bb.13:                               ;   in Loop: Header=BB0_7 Depth=1
Lloh47:
	adrp	x8, _EWOULDBLOCK@GOTPAGE
Lloh48:
	ldr	x8, [x8, _EWOULDBLOCK@GOTPAGEOFF]
Lloh49:
	ldr	w8, [x8]
	cmp	w0, w8
	b.eq	LBB0_17
; %bb.14:                               ;   in Loop: Header=BB0_7 Depth=1
	add	w24, w24, #1
	ldr	w8, [sp, #12]                   ; 4-byte Folded Reload
	cmp	w24, w8
Lloh50:
	adrp	x28, _I2C_BUSY@GOTPAGE
Lloh51:
	ldr	x28, [x28, _I2C_BUSY@GOTPAGEOFF]
	b.lt	LBB0_7
LBB0_15:
	str	wzr, [x20]
	mov	x0, x19
	bl	_mtx_unlock
	mov	w0, #0
LBB0_16:
	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
LBB0_17:
	ldr	w0, [x20, #28]
Lloh52:
	adrp	x1, l_.str.2@PAGE
Lloh53:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_device_printf
	str	wzr, [x20]
	mov	x0, x19
	bl	_mtx_unlock
Lloh54:
	adrp	x8, _EIO@GOTPAGE
Lloh55:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
	b	LBB0_4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh44, Lloh45, Lloh46
	.loh AdrpAdd	Lloh42, Lloh43
	.loh AdrpLdrGotLdr	Lloh39, Lloh40, Lloh41
	.loh AdrpLdrGot	Lloh37, Lloh38
	.loh AdrpLdrGotLdr	Lloh34, Lloh35, Lloh36
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh47, Lloh48, Lloh49
	.loh AdrpLdrGot	Lloh50, Lloh51
	.loh AdrpLdrGot	Lloh54, Lloh55
	.loh AdrpAdd	Lloh52, Lloh53
	.cfi_endproc
                                        ; -- End function
	.comm	_I2C_BUSY,4,2                   ; @I2C_BUSY
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"kiic"

	.comm	_ETIMEDOUT,4,2                  ; @ETIMEDOUT
	.comm	_ISR,4,2                        ; @ISR
	.comm	_STATUS,4,2                     ; @STATUS
	.comm	_IIC_M_NOSTOP,4,2               ; @IIC_M_NOSTOP
	.comm	_IIC_M_RD,4,2                   ; @IIC_M_RD
	.comm	_I2C_COMBMODE,4,2               ; @I2C_COMBMODE
	.comm	_I2C_STDSUBMODE,4,2             ; @I2C_STDSUBMODE
l_.str.1:                               ; @.str.1
	.asciz	"oversize I2C message"

	.comm	_I2C_STDMODE,4,2                ; @I2C_STDMODE
	.comm	_I2C_READING,4,2                ; @I2C_READING
	.comm	_ADDR,4,2                       ; @ADDR
	.comm	_SUBADDR,4,2                    ; @SUBADDR
	.comm	_CONTROL,4,2                    ; @CONTROL
	.comm	_I2C_CT_ADDR,4,2                ; @I2C_CT_ADDR
	.comm	_I2C_ERROR,4,2                  ; @I2C_ERROR
	.comm	_EWOULDBLOCK,4,2                ; @EWOULDBLOCK
l_.str.2:                               ; @.str.2
	.asciz	"I2C error\n"

	.comm	_EIO,4,2                        ; @EIO
	.no_dead_strip	_kiic_transfer
.subsections_via_symbols
