	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ttusb2_i2c_xfer
_ttusb2_i2c_xfer:                       ## @ttusb2_i2c_xfer
	.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, %ebx
	movq	%rsi, %r14
	callq	_i2c_get_adapdata
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movq	%rax, %rdi
	callq	_mutex_lock_interruptible
	testq	%rax, %rax
	js	LBB0_1
## %bb.2:
	cmpl	$3, %ebx
	movl	%ebx, %esi
	jl	LBB0_11
## %bb.3:
	leaq	L_.str(%rip), %rdi
	movl	%esi, %ebx
	callq	_warn
	movl	%ebx, %esi
	jmp	LBB0_4
LBB0_1:
	movq	_EAGAIN@GOTPCREL(%rip), %rax
	xorl	%r12d, %r12d
	subl	(%rax), %r12d
	jmp	LBB0_17
LBB0_11:
	testl	%esi, %esi
	jle	LBB0_12
LBB0_4:
	xorl	%r13d, %r13d
	movl	%esi, -44(%rbp)                 ## 4-byte Spill
	jmp	LBB0_5
	.p2align	4, 0x90
LBB0_15:                                ##   in Loop: Header=BB0_5 Depth=1
	movl	%r12d, %r13d
	cmpl	%esi, %r12d
	jge	LBB0_16
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	leal	1(%r13), %r12d
	xorl	%eax, %eax
	movl	$0, %ebx
	cmpl	%esi, %r12d
	jge	LBB0_7
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	movslq	%r12d, %rcx
	leaq	(%rcx,%rcx,2), %rcx
	movq	_I2C_M_RD@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	testl	%edx, (%r14,%rcx,8)
	setne	%bl
LBB0_7:                                 ##   in Loop: Header=BB0_5 Depth=1
	movzbl	%bl, %edx
	movslq	%r13d, %rcx
	leaq	(%rcx,%rcx,2), %rcx
	movl	4(%r14,%rcx,8), %esi
	leal	(%rdx,%rsi,2), %esi
	movl	%esi, _ttusb2_i2c_xfer.obuf(%rip)
	movl	8(%r14,%rcx,8), %esi
	movl	%esi, _ttusb2_i2c_xfer.obuf+4(%rip)
	testb	%dl, %dl
	je	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_5 Depth=1
	movslq	%r12d, %rax
	leaq	(%rax,%rax,2), %rax
	movl	8(%r14,%rax,8), %eax
LBB0_9:                                 ##   in Loop: Header=BB0_5 Depth=1
	leaq	(%r14,%rcx,8), %r15
	addq	$8, %r15
	movl	%eax, _ttusb2_i2c_xfer.obuf+8(%rip)
	movq	16(%r14,%rcx,8), %rsi
	movl	(%r15), %edx
	leaq	_ttusb2_i2c_xfer.obuf+12(%rip), %rdi
	callq	_memcpy
	movq	_CMD_I2C_XFER@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	(%r15), %ecx
	addl	$3, %ecx
	movl	_ttusb2_i2c_xfer.obuf+8(%rip), %r9d
	addl	$3, %r9d
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	leaq	_ttusb2_i2c_xfer.obuf(%rip), %rdx
	leaq	_ttusb2_i2c_xfer.ibuf(%rip), %r8
	callq	_ttusb2_msg
	testq	%rax, %rax
	js	LBB0_10
## %bb.13:                              ##   in Loop: Header=BB0_5 Depth=1
	testb	%bl, %bl
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	je	LBB0_15
## %bb.14:                              ##   in Loop: Header=BB0_5 Depth=1
	movslq	%r12d, %rax
	leaq	(%rax,%rax,2), %rax
	movq	16(%r14,%rax,8), %rdi
	movl	8(%r14,%rax,8), %edx
	movl	%esi, %ebx
	leaq	_ttusb2_i2c_xfer.ibuf+12(%rip), %rsi
	callq	_memcpy
	movl	%ebx, %esi
	addl	$2, %r13d
	movl	%r13d, %r12d
	jmp	LBB0_15
LBB0_10:
	leaq	L_.str.1(%rip), %rdi
	callq	_err
	movl	%r13d, %r12d
	jmp	LBB0_16
LBB0_12:
	xorl	%r12d, %r12d
LBB0_16:
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_mutex_unlock
LBB0_17:
	movl	%r12d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
.zerofill __DATA,__bss,_ttusb2_i2c_xfer.obuf,240,4 ## @ttusb2_i2c_xfer.obuf
.zerofill __DATA,__bss,_ttusb2_i2c_xfer.ibuf,240,4 ## @ttusb2_i2c_xfer.ibuf
	.comm	_EAGAIN,4,2                     ## @EAGAIN
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"more than 2 i2c messages at a time is not handled yet. TODO."

	.comm	_I2C_M_RD,4,2                   ## @I2C_M_RD
	.comm	_CMD_I2C_XFER,4,2               ## @CMD_I2C_XFER
L_.str.1:                               ## @.str.1
	.asciz	"i2c transfer failed."

	.no_dead_strip	_ttusb2_i2c_xfer
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ttusb2_i2c_xfer
_ttusb2_i2c_xfer:                       ; @ttusb2_i2c_xfer
	.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	x20, x2
	mov	x21, x1
	bl	_i2c_get_adapdata
	mov	x19, x0
	bl	_mutex_lock_interruptible
	tbnz	x0, #63, LBB0_3
; %bb.1:
	cmp	w20, #3
	b.lt	LBB0_4
; %bb.2:
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_warn
	b	LBB0_5
LBB0_3:
Lloh2:
	adrp	x8, _EAGAIN@GOTPAGE
Lloh3:
	ldr	x8, [x8, _EAGAIN@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	neg	w23, w8
	b	LBB0_19
LBB0_4:
	cmp	w20, #1
	b.lt	LBB0_17
LBB0_5:
	mov	w27, #0
	mov	w26, #24
Lloh5:
	adrp	x22, _ttusb2_i2c_xfer.obuf@PAGE
Lloh6:
	add	x22, x22, _ttusb2_i2c_xfer.obuf@PAGEOFF
Lloh7:
	adrp	x24, _ttusb2_i2c_xfer.ibuf@PAGE
Lloh8:
	add	x24, x24, _ttusb2_i2c_xfer.ibuf@PAGEOFF
	b	LBB0_7
LBB0_6:                                 ;   in Loop: Header=BB0_7 Depth=1
	mov	x27, x23
	cmp	w23, w20
	b.ge	LBB0_18
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	sxtw	x8, w27
	add	x23, x8, #1
	cmp	w23, w20
	b.ge	LBB0_9
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	mul	x9, x23, x26
	ldr	w9, [x21, x9]
Lloh9:
	adrp	x10, _I2C_M_RD@GOTPAGE
Lloh10:
	ldr	x10, [x10, _I2C_M_RD@GOTPAGEOFF]
Lloh11:
	ldr	w10, [x10]
	tst	w10, w9
	cset	w25, ne
	b	LBB0_10
LBB0_9:                                 ;   in Loop: Header=BB0_7 Depth=1
	mov	w25, #0
LBB0_10:                                ;   in Loop: Header=BB0_7 Depth=1
	madd	x28, x8, x26, x21
	ldr	w9, [x28, #4]
	mov	x10, x25
	bfi	w10, w9, #1, #31
	str	w10, [x22]
	ldr	w9, [x28, #8]!
	str	w9, [x22, #4]
	cbz	w25, LBB0_12
; %bb.11:                               ;   in Loop: Header=BB0_7 Depth=1
	smaddl	x9, w23, w26, x21
	ldr	w9, [x9, #8]
	b	LBB0_13
LBB0_12:                                ;   in Loop: Header=BB0_7 Depth=1
	mov	w9, #0
LBB0_13:                                ;   in Loop: Header=BB0_7 Depth=1
	str	w9, [x22, #8]
	madd	x8, x8, x26, x21
	ldr	x1, [x8, #16]
	ldr	w2, [x28]
	add	x0, x22, #12
	bl	_memcpy
Lloh12:
	adrp	x8, _CMD_I2C_XFER@GOTPAGE
Lloh13:
	ldr	x8, [x8, _CMD_I2C_XFER@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
	ldr	w8, [x28]
	add	w3, w8, #3
	ldr	w8, [x22, #8]
	add	w5, w8, #3
	mov	x0, x19
	mov	x2, x22
	mov	x4, x24
	bl	_ttusb2_msg
	tbnz	x0, #63, LBB0_16
; %bb.14:                               ;   in Loop: Header=BB0_7 Depth=1
	cbz	w25, LBB0_6
; %bb.15:                               ;   in Loop: Header=BB0_7 Depth=1
	smaddl	x8, w23, w26, x21
	ldr	x0, [x8, #16]
	ldr	w2, [x8, #8]
Lloh15:
	adrp	x1, _ttusb2_i2c_xfer.ibuf@PAGE+12
Lloh16:
	add	x1, x1, _ttusb2_i2c_xfer.ibuf@PAGEOFF+12
	bl	_memcpy
	add	w23, w27, #2
	b	LBB0_6
LBB0_16:
Lloh17:
	adrp	x0, l_.str.1@PAGE
Lloh18:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_err
	mov	x23, x27
	b	LBB0_18
LBB0_17:
	mov	w23, #0
LBB0_18:
	mov	x0, x19
	bl	_mutex_unlock
LBB0_19:
	mov	x0, x23
	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 AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpAdd	Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
.zerofill __DATA,__bss,_ttusb2_i2c_xfer.obuf,240,2 ; @ttusb2_i2c_xfer.obuf
.zerofill __DATA,__bss,_ttusb2_i2c_xfer.ibuf,240,2 ; @ttusb2_i2c_xfer.ibuf
	.comm	_EAGAIN,4,2                     ; @EAGAIN
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"more than 2 i2c messages at a time is not handled yet. TODO."

	.comm	_I2C_M_RD,4,2                   ; @I2C_M_RD
	.comm	_CMD_I2C_XFER,4,2               ; @CMD_I2C_XFER
l_.str.1:                               ; @.str.1
	.asciz	"i2c transfer failed."

	.no_dead_strip	_ttusb2_i2c_xfer
.subsections_via_symbols
