	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function usbvision_i2c_write_max4
_usbvision_i2c_write_max4:              ## @usbvision_i2c_write_max4
	.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	%ecx, %r14d
	movq	%rdx, %r15
	movq	%rdi, %rbx
	movl	%ecx, %r13d
	andl	$7, %r13d
	orl	$16, %r13d
	movl	%esi, -60(%rbp)                 ## 4-byte Spill
	movb	%sil, -46(%rbp)
	movb	%r13b, -45(%rbp)
	testw	%r14w, %r14w
	jle	LBB0_2
## %bb.1:
	leaq	-44(%rbp), %rdi
	movl	%r14d, %edx
	movq	%r15, %rsi
	callq	_memcpy
LBB0_2:
	movq	%r15, -72(%rbp)                 ## 8-byte Spill
	movq	%r14, -56(%rbp)                 ## 8-byte Spill
	leal	2(%r14), %eax
	movl	$5, %r14d
	cwtl
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	movq	_USBVISION_SER_CONT@GOTPCREL(%rip), %r12
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_5 Depth 2
	movl	(%rbx), %r15d
	movl	%r15d, %edi
	movl	$1, %esi
	callq	_usb_sndctrlpipe
	movq	_USBVISION_OP_CODE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	movq	_USB_TYPE_VENDOR@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movq	_USB_DIR_OUT@GOTPCREL(%rip), %rsi
	orl	(%rsi), %ecx
	movq	_USB_RECIP_ENDPOINT@GOTPCREL(%rip), %rsi
	orl	(%rsi), %ecx
	movq	_USBVISION_SER_ADRS@GOTPCREL(%rip), %rsi
	movl	(%rsi), %r9d
	movq	_HZ@GOTPCREL(%rip), %rsi
	movl	(%rsi), %r10d
	subq	$8, %rsp
	movl	%r15d, %edi
	movl	%eax, %esi
	xorl	%r8d, %r8d
	pushq	%r10
	pushq	-80(%rbp)                       ## 8-byte Folded Reload
	leaq	-46(%rbp), %rax
	pushq	%rax
	callq	_usb_control_msg
	addq	$32, %rsp
	testl	%eax, %eax
	js	LBB0_19
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	(%r12), %esi
	movq	%rbx, %rdi
	movl	%r13d, %edx
	callq	_usbvision_write_reg
	testl	%eax, %eax
	js	LBB0_19
	.p2align	4, 0x90
LBB0_5:                                 ##   Parent Loop BB0_3 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	(%r12), %esi
	movq	%rbx, %rdi
	callq	_usbvision_read_reg
	testl	%eax, %eax
	jle	LBB0_7
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=2
	movl	%eax, %ecx
	andl	$16, %ecx
	jne	LBB0_5
LBB0_7:                                 ##   in Loop: Header=BB0_3 Depth=1
	testl	%eax, %eax
	js	LBB0_19
## %bb.8:                               ##   in Loop: Header=BB0_3 Depth=1
	testb	$32, %al
	je	LBB0_11
## %bb.9:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	(%r12), %esi
	movq	%rbx, %rdi
	xorl	%edx, %edx
	callq	_usbvision_write_reg
	subl	$1, %r14d
	jae	LBB0_3
## %bb.10:
	movl	$-1, %eax
	jmp	LBB0_19
LBB0_11:
	movq	_i2c_debug@GOTPCREL(%rip), %rax
	movq	_DBG_I2C@GOTPCREL(%rip), %r15
	movl	(%r15), %edi
	testl	%edi, (%rax)
	je	LBB0_18
## %bb.12:
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	testw	%bx, %bx
	jle	LBB0_15
## %bb.13:
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	movzbl	(%rax), %edx
	movzbl	-60(%rbp), %r12d                ## 1-byte Folded Reload
	leaq	L_.str(%rip), %rsi
	movl	%r12d, %ecx
	callq	_PDEBUG
	cmpw	$1, %bx
	jne	LBB0_16
LBB0_15:
	movl	%ebx, %eax
	jmp	LBB0_19
LBB0_16:
	movl	%ebx, %r13d
	movl	$1, %ebx
	movq	-72(%rbp), %r14                 ## 8-byte Reload
	.p2align	4, 0x90
LBB0_17:                                ## =>This Inner Loop Header: Depth=1
	movl	(%r15), %edi
	movzbl	(%r14,%rbx), %edx
	leaq	L_.str(%rip), %rsi
	movl	%r12d, %ecx
	callq	_PDEBUG
	incq	%rbx
	cmpq	%rbx, %r13
	jne	LBB0_17
LBB0_18:
	movq	-56(%rbp), %rax                 ## 8-byte Reload
                                        ## kill: def $eax killed $eax killed $rax
LBB0_19:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_USBVISION_OP_CODE,4,2          ## @USBVISION_OP_CODE
	.comm	_USB_DIR_OUT,4,2                ## @USB_DIR_OUT
	.comm	_USB_TYPE_VENDOR,4,2            ## @USB_TYPE_VENDOR
	.comm	_USB_RECIP_ENDPOINT,4,2         ## @USB_RECIP_ENDPOINT
	.comm	_USBVISION_SER_ADRS,8,3         ## @USBVISION_SER_ADRS
	.comm	_HZ,4,2                         ## @HZ
	.comm	_USBVISION_SER_CONT,4,2         ## @USBVISION_SER_CONT
	.comm	_i2c_debug,4,2                  ## @i2c_debug
	.comm	_DBG_I2C,4,2                    ## @DBG_I2C
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"wrote %x at address %x"

	.no_dead_strip	_usbvision_i2c_write_max4
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function usbvision_i2c_write_max4
_usbvision_i2c_write_max4:              ; @usbvision_i2c_write_max4
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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, x3
	mov	x20, x2
	mov	x22, x0
	mov	w23, #16
	bfxil	w23, w3, #0, #3
	str	w1, [sp, #16]                   ; 4-byte Folded Spill
	strb	w1, [sp, #26]
	strb	w23, [sp, #27]
	cmp	w3, #1
	b.lt	LBB0_2
; %bb.1:
	add	x8, sp, #26
	add	x0, x8, #2
	mov	w2, w19
	mov	x1, x20
	bl	_memcpy
LBB0_2:
	str	x20, [sp, #8]                   ; 8-byte Folded Spill
	str	w19, [sp, #20]                  ; 4-byte Folded Spill
	add	w9, w19, #2
Lloh0:
	adrp	x28, _USB_TYPE_VENDOR@GOTPAGE
Lloh1:
	ldr	x28, [x28, _USB_TYPE_VENDOR@GOTPAGEOFF]
Lloh2:
	adrp	x21, _USB_RECIP_ENDPOINT@GOTPAGE
Lloh3:
	ldr	x21, [x21, _USB_RECIP_ENDPOINT@GOTPAGEOFF]
Lloh4:
	adrp	x20, _USBVISION_SER_ADRS@GOTPAGE
Lloh5:
	ldr	x20, [x20, _USBVISION_SER_ADRS@GOTPAGEOFF]
	mov	w8, #5
Lloh6:
	adrp	x19, _HZ@GOTPAGE
Lloh7:
	ldr	x19, [x19, _HZ@GOTPAGEOFF]
	sxth	w24, w9
Lloh8:
	adrp	x26, _USBVISION_SER_CONT@GOTPAGE
Lloh9:
	ldr	x26, [x26, _USBVISION_SER_CONT@GOTPAGEOFF]
LBB0_3:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_5 Depth 2
	mov	x27, x8
	ldr	w25, [x22]
	mov	x0, x25
	mov	w1, #1
	bl	_usb_sndctrlpipe
	mov	x1, x0
Lloh10:
	adrp	x8, _USBVISION_OP_CODE@GOTPAGE
Lloh11:
	ldr	x8, [x8, _USBVISION_OP_CODE@GOTPAGEOFF]
Lloh12:
	ldr	w2, [x8]
Lloh13:
	adrp	x8, _USB_DIR_OUT@GOTPAGE
Lloh14:
	ldr	x8, [x8, _USB_DIR_OUT@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	ldr	w9, [x28]
	orr	w8, w9, w8
	ldr	w9, [x21]
	orr	w3, w8, w9
	ldr	w5, [x20]
	ldr	w8, [x19]
	str	w8, [sp]
	add	x6, sp, #26
	mov	x0, x25
	mov	w4, #0
	mov	x7, x24
	bl	_usb_control_msg
	tbnz	w0, #31, LBB0_15
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w1, [x26]
	mov	x0, x22
	mov	x2, x23
	bl	_usbvision_write_reg
	tbnz	w0, #31, LBB0_15
LBB0_5:                                 ;   Parent Loop BB0_3 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w1, [x26]
	mov	x0, x22
	bl	_usbvision_read_reg
	and	w8, w0, #0x10
	cmp	w0, #1
	ccmp	w8, #0, #4, ge
	b.ne	LBB0_5
; %bb.6:                                ;   in Loop: Header=BB0_3 Depth=1
	tbnz	w0, #31, LBB0_15
; %bb.7:                                ;   in Loop: Header=BB0_3 Depth=1
	tbz	w0, #5, LBB0_10
; %bb.8:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w1, [x26]
	mov	x0, x22
	mov	w2, #0
	bl	_usbvision_write_reg
	sub	w8, w27, #1
	cbnz	w27, LBB0_3
; %bb.9:
	mov	w0, #-1
	b	LBB0_15
LBB0_10:
Lloh16:
	adrp	x8, _i2c_debug@GOTPAGE
Lloh17:
	ldr	x8, [x8, _i2c_debug@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
Lloh19:
	adrp	x19, _DBG_I2C@GOTPAGE
Lloh20:
	ldr	x19, [x19, _DBG_I2C@GOTPAGEOFF]
	ldr	w0, [x19]
	and	w8, w0, w8
	cmp	w8, #0
	ldr	w23, [sp, #20]                  ; 4-byte Folded Reload
	ccmp	w23, #1, #8, ne
	b.lt	LBB0_14
; %bb.11:
	ldr	x21, [sp, #8]                   ; 8-byte Folded Reload
	ldrb	w2, [x21]
Lloh21:
	adrp	x1, l_.str@PAGE
Lloh22:
	add	x1, x1, l_.str@PAGEOFF
	ldr	w24, [sp, #16]                  ; 4-byte Folded Reload
	mov	x3, x24
	bl	_PDEBUG
	cmp	w23, #1
	b.eq	LBB0_14
; %bb.12:
	mov	w8, w23
	sub	x20, x8, #1
	add	x22, x21, #1
Lloh23:
	adrp	x21, l_.str@PAGE
Lloh24:
	add	x21, x21, l_.str@PAGEOFF
LBB0_13:                                ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x19]
	ldrb	w2, [x22], #1
	mov	x1, x21
	mov	x3, x24
	bl	_PDEBUG
	subs	x20, x20, #1
	b.ne	LBB0_13
LBB0_14:
	mov	x0, x23
LBB0_15:
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpAdd	Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.comm	_USBVISION_OP_CODE,4,2          ; @USBVISION_OP_CODE
	.comm	_USB_DIR_OUT,4,2                ; @USB_DIR_OUT
	.comm	_USB_TYPE_VENDOR,4,2            ; @USB_TYPE_VENDOR
	.comm	_USB_RECIP_ENDPOINT,4,2         ; @USB_RECIP_ENDPOINT
	.comm	_USBVISION_SER_ADRS,8,3         ; @USBVISION_SER_ADRS
	.comm	_HZ,4,2                         ; @HZ
	.comm	_USBVISION_SER_CONT,4,2         ; @USBVISION_SER_CONT
	.comm	_i2c_debug,4,2                  ; @i2c_debug
	.comm	_DBG_I2C,4,2                    ; @DBG_I2C
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"wrote %x at address %x"

	.no_dead_strip	_usbvision_i2c_write_max4
.subsections_via_symbols
