	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function diolan_usb_xfer
_diolan_usb_xfer:                       ## @diolan_usb_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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r12d
	movq	%rsi, %r14
	callq	_i2c_get_adapdata
	movq	%rax, %r13
	movq	%rax, %rdi
	callq	_diolan_i2c_start
	testl	%eax, %eax
	js	LBB0_25
## %bb.1:
	testl	%r12d, %r12d
	jle	LBB0_24
## %bb.2:
	movl	%r12d, %eax
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	xorl	%ebx, %ebx
	movl	%r12d, -60(%rbp)                ## 4-byte Spill
	movq	%r14, -48(%rbp)                 ## 8-byte Spill
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_20:                                ##   in Loop: Header=BB0_3 Depth=1
	movq	-80(%rbp), %rbx                 ## 8-byte Reload
	incq	%rbx
	cmpq	-72(%rbp), %rbx                 ## 8-byte Folded Reload
	movl	-60(%rbp), %r12d                ## 4-byte Reload
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	je	LBB0_24
LBB0_3:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_9 Depth 2
                                        ##     Child Loop BB0_22 Depth 2
	testq	%rbx, %rbx
	je	LBB0_5
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	%r13, %rdi
	callq	_diolan_i2c_repeated_start
	testl	%eax, %eax
	js	LBB0_23
LBB0_5:                                 ##   in Loop: Header=BB0_3 Depth=1
	movq	%rbx, -80(%rbp)                 ## 8-byte Spill
	shlq	$4, %rbx
	leaq	(%r14,%rbx), %r15
	movq	%r15, %rdi
	callq	_i2c_8bit_addr_from_msg
	movq	%r13, %rdi
	movq	%rax, %rsi
	callq	_diolan_i2c_put_byte_ack
	testl	%eax, %eax
	js	LBB0_23
## %bb.6:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	_I2C_M_RD@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%r14, %rax
	addq	%rbx, %r14
	addq	$4, %r14
	movl	4(%rax,%rbx), %eax
	testl	%ecx, (%r15)
	je	LBB0_15
## %bb.7:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	%r15, -96(%rbp)                 ## 8-byte Spill
	testl	%eax, %eax
	jle	LBB0_20
## %bb.8:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	leaq	(%rcx,%rbx), %r15
	addq	$8, %r15
	xorl	%r12d, %r12d
	movq	%r14, -88(%rbp)                 ## 8-byte Spill
	jmp	LBB0_9
	.p2align	4, 0x90
LBB0_17:                                ##   in Loop: Header=BB0_9 Depth=2
	xorl	%esi, %esi
	cmpq	%rax, %r12
	setl	%sil
	movq	%r13, %rdi
	leaq	-56(%rbp), %rdx
	callq	_diolan_i2c_get_byte_ack
	testl	%eax, %eax
	js	LBB0_23
LBB0_19:                                ##   in Loop: Header=BB0_9 Depth=2
	movq	-56(%rbp), %rax
	movq	(%r15), %rcx
	movq	%rax, (%rcx,%r12,8)
	incq	%r12
	movslq	(%r14), %rax
	cmpq	%rax, %r12
	jge	LBB0_20
LBB0_9:                                 ##   Parent Loop BB0_3 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	decl	%eax
	cltq
	testq	%r12, %r12
	jne	LBB0_17
## %bb.10:                              ##   in Loop: Header=BB0_9 Depth=2
	movq	%r13, %rdi
	cmpq	%rax, %r12
	setl	%al
	movq	_I2C_M_RECV_LEN@GOTPCREL(%rip), %rbx
	movl	(%rbx), %ecx
	movq	-96(%rbp), %r14                 ## 8-byte Reload
	andl	(%r14), %ecx
	setne	%cl
	orb	%al, %cl
	movzbl	%cl, %esi
	leaq	-56(%rbp), %rdx
	callq	_diolan_i2c_get_byte_ack
	testl	%eax, %eax
	js	LBB0_23
## %bb.11:                              ##   in Loop: Header=BB0_9 Depth=2
	movl	(%rbx), %eax
	testl	%eax, (%r14)
	movq	-88(%rbp), %r14                 ## 8-byte Reload
	je	LBB0_19
## %bb.12:                              ##   in Loop: Header=BB0_9 Depth=2
	movq	-56(%rbp), %rax
	testq	%rax, %rax
	je	LBB0_14
## %bb.13:                              ##   in Loop: Header=BB0_9 Depth=2
	movq	_I2C_SMBUS_BLOCK_MAX@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jg	LBB0_14
## %bb.18:                              ##   in Loop: Header=BB0_9 Depth=2
	addl	%eax, (%r14)
	jmp	LBB0_19
	.p2align	4, 0x90
LBB0_15:                                ##   in Loop: Header=BB0_3 Depth=1
	testl	%eax, %eax
	jle	LBB0_20
## %bb.16:                              ##   in Loop: Header=BB0_3 Depth=1
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	leaq	(%rax,%rbx), %r15
	addq	$8, %r15
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_22:                                ##   Parent Loop BB0_3 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	(%r15), %rax
	movq	(%rax,%rbx,8), %rsi
	movq	%r13, %rdi
	callq	_diolan_i2c_put_byte_ack
	testl	%eax, %eax
	js	LBB0_23
## %bb.21:                              ##   in Loop: Header=BB0_22 Depth=2
	incq	%rbx
	movslq	(%r14), %rax
	cmpq	%rax, %rbx
	jl	LBB0_22
	jmp	LBB0_20
LBB0_23:
	movl	%eax, %r12d
LBB0_24:
	movq	%r13, %rdi
	callq	_diolan_i2c_stop
	movl	%eax, %ecx
	testl	%r12d, %r12d
	movl	%r12d, %eax
	cmovnsl	%ecx, %eax
	testl	%ecx, %ecx
	cmovnsl	%r12d, %eax
LBB0_25:
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_14:
	movq	_EPROTO@GOTPCREL(%rip), %rax
	xorl	%r12d, %r12d
	subl	(%rax), %r12d
	jmp	LBB0_24
	.cfi_endproc
                                        ## -- End function
	.comm	_I2C_M_RD,4,2                   ## @I2C_M_RD
	.comm	_I2C_M_RECV_LEN,4,2             ## @I2C_M_RECV_LEN
	.comm	_I2C_SMBUS_BLOCK_MAX,8,3        ## @I2C_SMBUS_BLOCK_MAX
	.comm	_EPROTO,4,2                     ## @EPROTO
	.no_dead_strip	_diolan_usb_xfer
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function diolan_usb_xfer
_diolan_usb_xfer:                       ; @diolan_usb_xfer
	.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	x20, x2
	mov	x21, x1
	bl	_i2c_get_adapdata
	mov	x19, x0
	bl	_diolan_i2c_start
	tbnz	w0, #31, LBB0_24
; %bb.1:
	cmp	w20, #1
	b.lt	LBB0_23
; %bb.2:
	mov	x23, #0
Lloh0:
	adrp	x25, _I2C_M_RECV_LEN@GOTPAGE
Lloh1:
	ldr	x25, [x25, _I2C_M_RECV_LEN@GOTPAGEOFF]
	mov	w27, w20
	b	LBB0_4
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	add	x23, x23, #1
	cmp	x23, x27
	b.eq	LBB0_23
LBB0_4:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_12 Depth 2
                                        ;     Child Loop BB0_20 Depth 2
	cbz	x23, LBB0_6
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	x0, x19
	bl	_diolan_i2c_repeated_start
	tbnz	w0, #31, LBB0_22
LBB0_6:                                 ;   in Loop: Header=BB0_4 Depth=1
	add	x22, x21, x23, lsl #4
	mov	x0, x22
	bl	_i2c_8bit_addr_from_msg
	mov	x1, x0
	mov	x0, x19
	bl	_diolan_i2c_put_byte_ack
	tbnz	w0, #31, LBB0_22
; %bb.7:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	w9, [x22]
Lloh2:
	adrp	x8, _I2C_M_RD@GOTPAGE
Lloh3:
	ldr	x8, [x8, _I2C_M_RD@GOTPAGEOFF]
Lloh4:
	ldr	w10, [x8]
	add	x28, x21, x23, lsl #4
	ldr	w8, [x28, #4]!
	tst	w10, w9
	b.eq	LBB0_18
; %bb.8:                                ;   in Loop: Header=BB0_4 Depth=1
	cmp	w8, #1
	b.lt	LBB0_3
; %bb.9:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	x24, #0
	add	x9, x21, x23, lsl #4
	add	x26, x9, #8
	b	LBB0_12
LBB0_10:                                ;   in Loop: Header=BB0_12 Depth=2
	cmp	x24, x8
	cset	w1, lt
	add	x2, sp, #8
	mov	x0, x19
	bl	_diolan_i2c_get_byte_ack
	tbnz	w0, #31, LBB0_22
LBB0_11:                                ;   in Loop: Header=BB0_12 Depth=2
	ldr	x8, [sp, #8]
	ldr	x9, [x26]
	str	x8, [x9, x24, lsl #3]
	add	x24, x24, #1
	ldrsw	x8, [x28]
	cmp	x24, x8
	b.ge	LBB0_3
LBB0_12:                                ;   Parent Loop BB0_4 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	sub	w8, w8, #1
	sxtw	x8, w8
	cbnz	x24, LBB0_10
; %bb.13:                               ;   in Loop: Header=BB0_12 Depth=2
	ldr	w9, [x22]
	ldr	w10, [x25]
	tst	w10, w9
	ccmp	x24, x8, #8, eq
	cset	w1, lt
	add	x2, sp, #8
	mov	x0, x19
	bl	_diolan_i2c_get_byte_ack
	tbnz	w0, #31, LBB0_22
; %bb.14:                               ;   in Loop: Header=BB0_12 Depth=2
	ldr	w8, [x22]
	ldr	w9, [x25]
	tst	w9, w8
	b.eq	LBB0_11
; %bb.15:                               ;   in Loop: Header=BB0_12 Depth=2
	ldr	x8, [sp, #8]
	cbz	x8, LBB0_25
; %bb.16:                               ;   in Loop: Header=BB0_12 Depth=2
Lloh5:
	adrp	x9, _I2C_SMBUS_BLOCK_MAX@GOTPAGE
Lloh6:
	ldr	x9, [x9, _I2C_SMBUS_BLOCK_MAX@GOTPAGEOFF]
Lloh7:
	ldr	x9, [x9]
	cmp	x8, x9
	b.gt	LBB0_25
; %bb.17:                               ;   in Loop: Header=BB0_12 Depth=2
	ldr	w9, [x28]
	add	w8, w9, w8
	str	w8, [x28]
	b	LBB0_11
LBB0_18:                                ;   in Loop: Header=BB0_4 Depth=1
	cmp	w8, #1
	b.lt	LBB0_3
; %bb.19:                               ;   in Loop: Header=BB0_4 Depth=1
	mov	x22, #0
	add	x8, x21, x23, lsl #4
	add	x24, x8, #8
LBB0_20:                                ;   Parent Loop BB0_4 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	x8, [x24]
	ldr	x1, [x8, x22, lsl #3]
	mov	x0, x19
	bl	_diolan_i2c_put_byte_ack
	tbnz	w0, #31, LBB0_22
; %bb.21:                               ;   in Loop: Header=BB0_20 Depth=2
	add	x22, x22, #1
	ldrsw	x8, [x28]
	cmp	x22, x8
	b.lt	LBB0_20
	b	LBB0_3
LBB0_22:
	mov	x20, x0
LBB0_23:
	mov	x0, x19
	bl	_diolan_i2c_stop
	cmn	w20, #1
	ccmp	w0, #0, #0, gt
	csel	w0, w0, w20, lt
LBB0_24:
	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_25:
Lloh8:
	adrp	x8, _EPROTO@GOTPAGE
Lloh9:
	ldr	x8, [x8, _EPROTO@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_23
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_I2C_M_RD,4,2                   ; @I2C_M_RD
	.comm	_I2C_M_RECV_LEN,4,2             ; @I2C_M_RECV_LEN
	.comm	_I2C_SMBUS_BLOCK_MAX,8,3        ; @I2C_SMBUS_BLOCK_MAX
	.comm	_EPROTO,4,2                     ; @EPROTO
	.no_dead_strip	_diolan_usb_xfer
.subsections_via_symbols
