	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ucbus_write
_ucbus_write:                           ## @ucbus_write
	.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, -52(%rbp)                 ## 4-byte Spill
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	cmpl	$0, (%rdi)
	js	LBB0_11
## %bb.1:
	movl	%edx, %ebx
	movq	%rsi, %r12
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_4 Depth 2
	movl	-52(%rbp), %eax                 ## 4-byte Reload
	cmpl	%eax, %ebx
	movl	%eax, %esi
	cmovll	%ebx, %esi
	movl	(%r12), %r13d
	movl	4(%r12), %eax
	movl	%r13d, %edx
	shll	$8, %edx
	movq	_SQ930_CTRL_UCBUS_IO@GOTPCREL(%rip), %rcx
	orl	(%rcx), %edx
	shll	$8, %eax
	sarl	$8, %r13d
	orl	%eax, %r13d
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	8(%rax), %r15
	cmpl	$2, %esi
	movl	%ebx, -56(%rbp)                 ## 4-byte Spill
	movq	%rsi, -72(%rbp)                 ## 8-byte Spill
	movl	%edx, -60(%rbp)                 ## 4-byte Spill
	jl	LBB0_7
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	leal	1(%rsi), %ecx
	xorl	%eax, %eax
	.p2align	4, 0x90
LBB0_4:                                 ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	8(%r12), %esi
	movl	%esi, (%r15,%rax)
	movl	8(%r12), %esi
	sarl	$8, %esi
	movl	%esi, 4(%r15,%rax)
	movl	12(%r12), %r9d
	addq	$8, %r12
	movl	%r9d, 8(%r15,%rax)
	decl	%ecx
	addq	$12, %rax
	cmpl	$2, %ecx
	ja	LBB0_4
## %bb.5:                               ##   in Loop: Header=BB0_2 Depth=1
	leaq	(%r15,%rax), %rbx
	testq	%rax, %rax
	je	LBB0_6
## %bb.12:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	_D_USBO@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	(%r15), %r8d
	leaq	L_.str(%rip), %rsi
	movl	%r13d, %ecx
	xorl	%eax, %eax
	callq	_PDEBUG
	movq	%rbx, %r15
	jmp	LBB0_8
LBB0_6:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	%rbx, %r15
LBB0_7:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	_D_USBO@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.1(%rip), %rsi
	movl	%r13d, %ecx
	xorl	%eax, %eax
	callq	_PDEBUG
LBB0_8:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	movl	16(%rbx), %r14d
	movl	%r14d, %edi
	xorl	%esi, %esi
	callq	_usb_sndctrlpipe
	movq	_USB_TYPE_VENDOR@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movq	_USB_DIR_OUT@GOTPCREL(%rip), %rdx
	orl	(%rdx), %ecx
	movq	_USB_RECIP_DEVICE@GOTPCREL(%rip), %rdx
	orl	(%rdx), %ecx
	movq	8(%rbx), %rbx
	subq	%rbx, %r15
	shrq	$2, %r15
	subq	$8, %rsp
	movl	%r14d, %edi
	movl	%eax, %esi
	movl	$12, %edx
	movl	-60(%rbp), %r8d                 ## 4-byte Reload
	movl	%r13d, %r9d
	pushq	$500                            ## imm = 0x1F4
	pushq	%r15
	pushq	%rbx
	callq	_usb_control_msg
	addq	$32, %rsp
	testl	%eax, %eax
	js	LBB0_9
## %bb.10:                              ##   in Loop: Header=BB0_2 Depth=1
	movl	-56(%rbp), %ebx                 ## 4-byte Reload
	subl	-72(%rbp), %ebx                 ## 4-byte Folded Reload
	movl	$30, %edi
	callq	_msleep
	addq	$8, %r12
	testl	%ebx, %ebx
	jg	LBB0_2
	jmp	LBB0_11
LBB0_9:
	movl	%eax, %ebx
	leaq	L_.str.2(%rip), %rdi
	movl	%eax, %esi
	xorl	%eax, %eax
	callq	_err
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	%ebx, (%rax)
LBB0_11:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SQ930_CTRL_UCBUS_IO,4,2        ## @SQ930_CTRL_UCBUS_IO
	.comm	_D_USBO,4,2                     ## @D_USBO
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"ucbus v: %04x i: %04x %02x...%02x"

L_.str.1:                               ## @.str.1
	.asciz	"ucbus v: %04x i: %04x"

	.comm	_USB_DIR_OUT,4,2                ## @USB_DIR_OUT
	.comm	_USB_TYPE_VENDOR,4,2            ## @USB_TYPE_VENDOR
	.comm	_USB_RECIP_DEVICE,4,2           ## @USB_RECIP_DEVICE
L_.str.2:                               ## @.str.2
	.asciz	"ucbus_write failed %d"

	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_USB_BUF_SZ,4,2                 ## @USB_BUF_SZ
	.no_dead_strip	_ucbus_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ucbus_write
_ucbus_write:                           ; @ucbus_write
	.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
	ldr	w8, [x0]
	tbnz	w8, #31, LBB0_19
; %bb.1:
	mov	x20, x3
	mov	x21, x2
	mov	x24, x1
	mov	x19, x0
	mov	w23, #500
LBB0_2:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_9 Depth 2
                                        ;     Child Loop BB0_12 Depth 2
	cmp	w21, w20
	csel	w28, w21, w20, lt
Lloh0:
	adrp	x8, _SQ930_CTRL_UCBUS_IO@GOTPAGE
Lloh1:
	ldr	x8, [x8, _SQ930_CTRL_UCBUS_IO@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	ldp	w9, w10, [x24]
	orr	w25, w8, w9, lsl #8
	lsl	w8, w10, #8
	orr	w26, w8, w9, asr #8
	ldr	x8, [x19, #8]
	cmp	w28, #1
	b.le	LBB0_7
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	subs	w9, w28, #2
	csel	w9, wzr, w9, lo
	cmp	w9, #8
	b.lo	LBB0_6
; %bb.4:                                ;   in Loop: Header=BB0_2 Depth=1
	subs	w10, w28, #2
	csel	w10, wzr, w10, lo
	add	x11, x24, w10, uxtw #3
	add	x11, x11, #16
	cmp	x8, x11
	b.hs	LBB0_8
; %bb.5:                                ;   in Loop: Header=BB0_2 Depth=1
	mov	w11, #12
	umaddl	x10, w10, w11, x8
	add	x10, x10, #12
	add	x11, x24, #8
	cmp	x11, x10
	b.hs	LBB0_8
LBB0_6:                                 ;   in Loop: Header=BB0_2 Depth=1
	mov	x10, x28
	mov	x9, x8
	b	LBB0_11
LBB0_7:                                 ;   in Loop: Header=BB0_2 Depth=1
	mov	x22, x8
	b	LBB0_15
LBB0_8:                                 ;   in Loop: Header=BB0_2 Depth=1
	add	w13, w9, #1
	ands	x9, x13, #0x7
	mov	w10, #8
	csel	x14, x10, x9, eq
	sub	x9, x13, x14
	sub	w10, w28, w9
	add	x11, x24, x9, lsl #3
	mov	w12, #12
	madd	x9, x9, x12, x8
	add	x12, x24, #40
	sub	x13, x14, x13
	mov	x14, x8
LBB0_9:                                 ;   Parent Loop BB0_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	sub	x15, x12, #32
	ld2.4s	{ v0, v1 }, [x15]
	sshr.4s	v3, v0, #8
	mov.16b	v2, v0
	ld2.4s	{ v5, v6 }, [x12]
	mov.16b	v4, v1
	sshr.4s	v17, v5, #8
	mov.16b	v16, v5
	mov.16b	v18, v6
	add	x15, x14, #96
	st3.4s	{ v2, v3, v4 }, [x14], #48
	st3.4s	{ v16, v17, v18 }, [x14]
	add	x12, x12, #64
	mov	x14, x15
	adds	x13, x13, #8
	b.ne	LBB0_9
; %bb.10:                               ;   in Loop: Header=BB0_2 Depth=1
	mov	x24, x11
LBB0_11:                                ;   in Loop: Header=BB0_2 Depth=1
	add	w10, w10, #1
LBB0_12:                                ;   Parent Loop BB0_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w11, [x24, #8]!
	str	w11, [x9]
	ldr	w11, [x24]
	asr	w11, w11, #8
	str	w11, [x9, #4]
	ldr	w11, [x24, #4]
	add	x22, x9, #12
	str	w11, [x9, #8]
	sub	w10, w10, #1
	mov	x9, x22
	cmp	w10, #2
	b.hi	LBB0_12
; %bb.13:                               ;   in Loop: Header=BB0_2 Depth=1
	cmp	x22, x8
	b.eq	LBB0_15
; %bb.14:                               ;   in Loop: Header=BB0_2 Depth=1
Lloh3:
	adrp	x9, _D_USBO@GOTPAGE
Lloh4:
	ldr	x9, [x9, _D_USBO@GOTPAGEOFF]
Lloh5:
	ldr	w0, [x9]
	ldr	w8, [x8]
	stp	x8, x11, [sp]
Lloh6:
	adrp	x1, l_.str@PAGE
Lloh7:
	add	x1, x1, l_.str@PAGEOFF
	b	LBB0_16
LBB0_15:                                ;   in Loop: Header=BB0_2 Depth=1
Lloh8:
	adrp	x8, _D_USBO@GOTPAGE
Lloh9:
	ldr	x8, [x8, _D_USBO@GOTPAGEOFF]
Lloh10:
	ldr	w0, [x8]
Lloh11:
	adrp	x1, l_.str.1@PAGE
Lloh12:
	add	x1, x1, l_.str.1@PAGEOFF
LBB0_16:                                ;   in Loop: Header=BB0_2 Depth=1
	mov	x2, x25
	mov	x3, x26
	bl	_PDEBUG
	ldr	w27, [x19, #16]
	mov	x0, x27
	mov	w1, #0
	bl	_usb_sndctrlpipe
	mov	x1, x0
Lloh13:
	adrp	x8, _USB_DIR_OUT@GOTPAGE
Lloh14:
	ldr	x8, [x8, _USB_DIR_OUT@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
Lloh16:
	adrp	x9, _USB_TYPE_VENDOR@GOTPAGE
Lloh17:
	ldr	x9, [x9, _USB_TYPE_VENDOR@GOTPAGEOFF]
Lloh18:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh19:
	adrp	x9, _USB_RECIP_DEVICE@GOTPAGE
Lloh20:
	ldr	x9, [x9, _USB_RECIP_DEVICE@GOTPAGEOFF]
Lloh21:
	ldr	w9, [x9]
	orr	w3, w8, w9
	ldr	x6, [x19, #8]
	sub	x8, x22, x6
	lsr	x7, x8, #2
	str	w23, [sp]
	mov	x0, x27
	mov	w2, #12
	mov	x4, x25
	mov	x5, x26
                                        ; kill: def $w7 killed $w7 killed $x7
	bl	_usb_control_msg
	tbnz	w0, #31, LBB0_18
; %bb.17:                               ;   in Loop: Header=BB0_2 Depth=1
	sub	w21, w21, w28
	mov	w0, #30
	bl	_msleep
	add	x24, x24, #8
	cmp	w21, #1
	b.ge	LBB0_2
	b	LBB0_19
LBB0_18:
	mov	x25, x0
	str	x25, [sp]
Lloh22:
	adrp	x0, l_.str.2@PAGE
Lloh23:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_err
	str	w25, [x19]
LBB0_19:
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpAdd	Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
	.comm	_SQ930_CTRL_UCBUS_IO,4,2        ; @SQ930_CTRL_UCBUS_IO
	.comm	_D_USBO,4,2                     ; @D_USBO
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"ucbus v: %04x i: %04x %02x...%02x"

l_.str.1:                               ; @.str.1
	.asciz	"ucbus v: %04x i: %04x"

	.comm	_USB_DIR_OUT,4,2                ; @USB_DIR_OUT
	.comm	_USB_TYPE_VENDOR,4,2            ; @USB_TYPE_VENDOR
	.comm	_USB_RECIP_DEVICE,4,2           ; @USB_RECIP_DEVICE
l_.str.2:                               ; @.str.2
	.asciz	"ucbus_write failed %d"

	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_USB_BUF_SZ,4,2                 ; @USB_BUF_SZ
	.no_dead_strip	_ucbus_write
.subsections_via_symbols
