	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_zd_usb_rfwrite                 ## -- Begin function zd_usb_rfwrite
	.p2align	4, 0x90
_zd_usb_rfwrite:                        ## @zd_usb_rfwrite
	.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
	movq	%rdx, %r12
	movq	%rsi, %r15
	movq	%rdi, %r14
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_in_atomic
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	movq	%r14, %rdi
	callq	_zd_usb_dev
	leaq	L_.str(%rip), %rsi
	movl	%eax, %edi
	xorl	%eax, %eax
	callq	_dev_dbg_f
	movq	_EWOULDBLOCK@GOTPCREL(%rip), %rax
	jmp	LBB0_19
LBB0_2:
	movq	_USB_MIN_RFWRITE_BIT_COUNT@GOTPCREL(%rip), %rbx
	cmpq	%r12, (%rbx)
	jbe	LBB0_4
## %bb.3:
	movq	%r14, %rdi
	callq	_zd_usb_dev
	movq	(%rbx), %rcx
	leaq	L_.str.1(%rip), %rsi
	jmp	LBB0_6
LBB0_4:
	movq	_USB_MAX_RFWRITE_BIT_COUNT@GOTPCREL(%rip), %r13
	movq	(%r13), %rbx
	movq	%r14, %rdi
	callq	_zd_usb_dev
	cmpq	%r12, %rbx
	jae	LBB0_7
## %bb.5:
	movq	(%r13), %rcx
	leaq	L_.str.2(%rip), %rsi
LBB0_6:
	xorl	%ebx, %ebx
	movl	%eax, %edi
	movq	%r12, %rdx
	xorl	%eax, %eax
	callq	_dev_dbg_f
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_19:
	subl	(%rax), %ebx
LBB0_20:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	leaq	L_.str.3(%rip), %rsi
	movl	%eax, %edi
	movq	%r15, %rdx
	movq	%r12, %rcx
	xorl	%eax, %eax
	callq	_dev_dbg_f
	movq	_ZD_CR203@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	leaq	-56(%rbp), %rsi
	movq	%r14, %rdi
	callq	_zd_usb_ioread16
	testl	%eax, %eax
	je	LBB0_10
## %bb.8:
	movl	%eax, %ebx
	movq	%r14, %rdi
	callq	_zd_usb_dev
	leaq	L_.str.4(%rip), %rsi
	jmp	LBB0_9
LBB0_10:
	movq	%r15, -72(%rbp)                 ## 8-byte Spill
	movq	_RF_IF_LE@GOTPCREL(%rip), %rax
	movq	_RF_CLK@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	orq	(%rax), %rcx
	movq	_RF_DATA@GOTPCREL(%rip), %rax
	orq	(%rax), %rcx
	notq	%rcx
	andq	%rcx, -56(%rbp)
	movq	%r14, %rdi
	callq	_zd_usb_to_chip
	movq	%rax, %rdi
	callq	_mutex_is_locked
	movl	%eax, %edi
	callq	_ZD_ASSERT
	movq	(%r13), %rax
	leaq	23(,%rax,4), %rax
	xorl	%edi, %edi
	cmpq	$-9, %rax
	setb	%dil
	callq	_BUILD_BUG_ON
	leaq	32(,%r12,4), %rax
	xorl	%edi, %edi
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	cmpq	$9, %rax
	setae	%dil
	callq	_BUG_ON
	movq	(%r14), %rbx
	movq	_USB_REQ_WRITE_RF@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	callq	_cpu_to_le16
	movq	%rax, 24(%rbx)
	movl	$2, %edi
	callq	_cpu_to_le16
	movq	%rax, 16(%rbx)
	movq	%r12, %rdi
	callq	_cpu_to_le16
	movq	%rbx, %r15
	movq	%rax, 8(%rbx)
	testq	%r12, %r12
	je	LBB0_15
## %bb.11:
	leal	-1(%r12), %r13d
	xorl	%ebx, %ebx
	jmp	LBB0_12
	.p2align	4, 0x90
LBB0_14:                                ##   in Loop: Header=BB0_12 Depth=1
	orq	-56(%rbp), %rdi
	callq	_cpu_to_le16
	movq	(%r15), %rcx
	movq	%rax, (%rcx,%rbx,8)
	incq	%rbx
	decl	%r13d
	cmpq	%rbx, %r12
	je	LBB0_15
LBB0_12:                                ## =>This Inner Loop Header: Depth=1
	movl	$1, %eax
	movl	%r13d, %ecx
	shll	%cl, %eax
	movslq	%eax, %rdi
	andq	-72(%rbp), %rdi                 ## 8-byte Folded Reload
	je	LBB0_14
## %bb.13:                              ##   in Loop: Header=BB0_12 Depth=1
	movq	_RF_DATA@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	jmp	LBB0_14
LBB0_15:
	movq	%r14, %rdi
	callq	_zd_usb_to_usbdev
	leaq	-44(%rbp), %rcx
	movq	%rax, %rdi
	movq	%r15, %rsi
	movq	-64(%rbp), %r15                 ## 8-byte Reload
	movl	%r15d, %edx
	movl	$50, %r8d
	callq	_zd_ep_regs_out_msg
	testl	%eax, %eax
	je	LBB0_17
## %bb.16:
	movl	%eax, %ebx
	movq	%r14, %rdi
	callq	_zd_usb_dev
	leaq	L_.str.5(%rip), %rsi
LBB0_9:
	movl	%eax, %edi
	movl	%ebx, %edx
	xorl	%eax, %eax
	callq	_dev_dbg_f
	jmp	LBB0_20
LBB0_17:
	xorl	%ebx, %ebx
	cmpl	%r15d, -44(%rbp)
	je	LBB0_20
## %bb.18:
	movq	%r14, %rdi
	callq	_zd_usb_dev
	movl	-44(%rbp), %ecx
	leaq	L_.str.6(%rip), %rsi
	xorl	%ebx, %ebx
	movl	%eax, %edi
	movl	%r15d, %edx
	xorl	%eax, %eax
	callq	_dev_dbg_f
	movq	_EIO@GOTPCREL(%rip), %rax
	jmp	LBB0_19
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"error: io in atomic context not supported\n"

	.comm	_EWOULDBLOCK,4,2                ## @EWOULDBLOCK
	.comm	_USB_MIN_RFWRITE_BIT_COUNT,8,3  ## @USB_MIN_RFWRITE_BIT_COUNT
L_.str.1:                               ## @.str.1
	.asciz	"error: bits %d are smaller than USB_MIN_RFWRITE_BIT_COUNT %d\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_USB_MAX_RFWRITE_BIT_COUNT,8,3  ## @USB_MAX_RFWRITE_BIT_COUNT
L_.str.2:                               ## @.str.2
	.asciz	"error: bits %d exceed USB_MAX_RFWRITE_BIT_COUNT %d\n"

L_.str.3:                               ## @.str.3
	.asciz	"value %#09x bits %d\n"

	.comm	_ZD_CR203,4,2                   ## @ZD_CR203
L_.str.4:                               ## @.str.4
	.asciz	"error %d: Couldn't read ZD_CR203\n"

	.comm	_RF_IF_LE,8,3                   ## @RF_IF_LE
	.comm	_RF_CLK,8,3                     ## @RF_CLK
	.comm	_RF_DATA,8,3                    ## @RF_DATA
	.comm	_USB_REQ_WRITE_RF,8,3           ## @USB_REQ_WRITE_RF
L_.str.5:                               ## @.str.5
	.asciz	"error in zd_ep_regs_out_msg(). Error number %d\n"

L_.str.6:                               ## @.str.6
	.asciz	"error in zd_ep_regs_out_msg() req_len %d != actual_req_len %d\n"

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

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_zd_usb_rfwrite                 ; -- Begin function zd_usb_rfwrite
	.p2align	2
_zd_usb_rfwrite:                        ; @zd_usb_rfwrite
	.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	x20, x2
	mov	x21, x1
	mov	x19, x0
	bl	_in_atomic
	cbz	x0, LBB0_2
; %bb.1:
	mov	x0, x19
	bl	_zd_usb_dev
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_dbg_f
Lloh2:
	adrp	x8, _EWOULDBLOCK@GOTPAGE
Lloh3:
	ldr	x8, [x8, _EWOULDBLOCK@GOTPAGEOFF]
	b	LBB0_7
LBB0_2:
Lloh4:
	adrp	x22, _USB_MIN_RFWRITE_BIT_COUNT@GOTPAGE
Lloh5:
	ldr	x22, [x22, _USB_MIN_RFWRITE_BIT_COUNT@GOTPAGEOFF]
	ldr	x8, [x22]
	cmp	x8, x20
	b.ls	LBB0_4
; %bb.3:
	mov	x0, x19
	bl	_zd_usb_dev
	ldr	x8, [x22]
	stp	x20, x8, [sp]
Lloh6:
	adrp	x1, l_.str.1@PAGE
Lloh7:
	add	x1, x1, l_.str.1@PAGEOFF
	b	LBB0_6
LBB0_4:
Lloh8:
	adrp	x23, _USB_MAX_RFWRITE_BIT_COUNT@GOTPAGE
Lloh9:
	ldr	x23, [x23, _USB_MAX_RFWRITE_BIT_COUNT@GOTPAGEOFF]
	ldr	x22, [x23]
	mov	x0, x19
	bl	_zd_usb_dev
	cmp	x22, x20
	b.hs	LBB0_9
; %bb.5:
	ldr	x8, [x23]
	stp	x20, x8, [sp]
Lloh10:
	adrp	x1, l_.str.2@PAGE
Lloh11:
	add	x1, x1, l_.str.2@PAGEOFF
LBB0_6:
	bl	_dev_dbg_f
Lloh12:
	adrp	x8, _EINVAL@GOTPAGE
Lloh13:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_7:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_8:
	mov	x0, x22
	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
LBB0_9:
	stp	x21, x20, [sp]
Lloh14:
	adrp	x1, l_.str.3@PAGE
Lloh15:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_dev_dbg_f
Lloh16:
	adrp	x8, _ZD_CR203@GOTPAGE
Lloh17:
	ldr	x8, [x8, _ZD_CR203@GOTPAGEOFF]
Lloh18:
	ldr	w2, [x8]
	add	x1, sp, #16
	mov	x0, x19
	bl	_zd_usb_ioread16
	cbz	w0, LBB0_11
; %bb.10:
	mov	x22, x0
	mov	x0, x19
	bl	_zd_usb_dev
	str	x22, [sp]
Lloh19:
	adrp	x1, l_.str.4@PAGE
Lloh20:
	add	x1, x1, l_.str.4@PAGEOFF
	bl	_dev_dbg_f
	b	LBB0_8
LBB0_11:
Lloh21:
	adrp	x8, _RF_IF_LE@GOTPAGE
Lloh22:
	ldr	x8, [x8, _RF_IF_LE@GOTPAGEOFF]
Lloh23:
	ldr	x8, [x8]
Lloh24:
	adrp	x9, _RF_CLK@GOTPAGE
Lloh25:
	ldr	x9, [x9, _RF_CLK@GOTPAGEOFF]
Lloh26:
	ldr	x9, [x9]
Lloh27:
	adrp	x24, _RF_DATA@GOTPAGE
Lloh28:
	ldr	x24, [x24, _RF_DATA@GOTPAGEOFF]
	orr	x8, x9, x8
	ldr	x9, [x24]
	orr	x8, x8, x9
	ldr	x9, [sp, #16]
	bic	x8, x9, x8
	str	x8, [sp, #16]
	mov	x0, x19
	bl	_zd_usb_to_chip
	bl	_mutex_is_locked
	bl	_ZD_ASSERT
	ldr	x8, [x23]
	lsl	x8, x8, #2
	add	x8, x8, #23
	cmn	x8, #9
	cset	w0, lo
	bl	_BUILD_BUG_ON
	lsl	x8, x20, #2
	add	x22, x8, #32
	cmp	x22, #8
	cset	w0, hi
	bl	_BUG_ON
	ldr	x23, [x19]
Lloh29:
	adrp	x8, _USB_REQ_WRITE_RF@GOTPAGE
Lloh30:
	ldr	x8, [x8, _USB_REQ_WRITE_RF@GOTPAGEOFF]
Lloh31:
	ldr	x0, [x8]
	bl	_cpu_to_le16
	str	x0, [x23, #24]
	mov	w0, #2
	bl	_cpu_to_le16
	str	x0, [x23, #16]
	mov	x0, x20
	bl	_cpu_to_le16
	str	x0, [x23, #8]
	cbz	x20, LBB0_14
; %bb.12:
	mov	x25, #0
	sub	w26, w20, #1
	mov	w27, #1
LBB0_13:                                ; =>This Inner Loop Header: Depth=1
	ldr	x8, [sp, #16]
	lsl	w9, w27, w26
	sxtw	x9, w9
	ldr	x10, [x24]
	tst	x9, x21
	csel	x9, xzr, x10, eq
	orr	x0, x9, x8
	bl	_cpu_to_le16
	ldr	x8, [x23]
	str	x0, [x8, x25, lsl #3]
	add	x25, x25, #1
	sub	w26, w26, #1
	cmp	x20, x25
	b.ne	LBB0_13
LBB0_14:
	mov	x0, x19
	bl	_zd_usb_to_usbdev
	add	x3, sp, #28
	mov	x1, x23
	mov	x2, x22
	mov	w4, #50
	bl	_zd_ep_regs_out_msg
	cbz	w0, LBB0_16
; %bb.15:
	mov	x20, x0
	mov	x0, x19
	bl	_zd_usb_dev
	str	x20, [sp]
Lloh32:
	adrp	x1, l_.str.5@PAGE
Lloh33:
	add	x1, x1, l_.str.5@PAGEOFF
	bl	_dev_dbg_f
	mov	x22, x20
	b	LBB0_8
LBB0_16:
	ldr	w8, [sp, #28]
	cmp	w8, w22
	b.ne	LBB0_18
; %bb.17:
	mov	w22, #0
	b	LBB0_8
LBB0_18:
	mov	x0, x19
	bl	_zd_usb_dev
	ldr	w8, [sp, #28]
                                        ; kill: def $w22 killed $w22 killed $x22 def $x22
	stp	x22, x8, [sp]
Lloh34:
	adrp	x1, l_.str.6@PAGE
Lloh35:
	add	x1, x1, l_.str.6@PAGEOFF
	bl	_dev_dbg_f
Lloh36:
	adrp	x8, _EIO@GOTPAGE
Lloh37:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
	b	LBB0_7
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGot	Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpAdd	Lloh32, Lloh33
	.loh AdrpLdrGot	Lloh36, Lloh37
	.loh AdrpAdd	Lloh34, Lloh35
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"error: io in atomic context not supported\n"

	.comm	_EWOULDBLOCK,4,2                ; @EWOULDBLOCK
	.comm	_USB_MIN_RFWRITE_BIT_COUNT,8,3  ; @USB_MIN_RFWRITE_BIT_COUNT
l_.str.1:                               ; @.str.1
	.asciz	"error: bits %d are smaller than USB_MIN_RFWRITE_BIT_COUNT %d\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_USB_MAX_RFWRITE_BIT_COUNT,8,3  ; @USB_MAX_RFWRITE_BIT_COUNT
l_.str.2:                               ; @.str.2
	.asciz	"error: bits %d exceed USB_MAX_RFWRITE_BIT_COUNT %d\n"

l_.str.3:                               ; @.str.3
	.asciz	"value %#09x bits %d\n"

	.comm	_ZD_CR203,4,2                   ; @ZD_CR203
l_.str.4:                               ; @.str.4
	.asciz	"error %d: Couldn't read ZD_CR203\n"

	.comm	_RF_IF_LE,8,3                   ; @RF_IF_LE
	.comm	_RF_CLK,8,3                     ; @RF_CLK
	.comm	_RF_DATA,8,3                    ; @RF_DATA
	.comm	_USB_REQ_WRITE_RF,8,3           ; @USB_REQ_WRITE_RF
l_.str.5:                               ; @.str.5
	.asciz	"error in zd_ep_regs_out_msg(). Error number %d\n"

l_.str.6:                               ; @.str.6
	.asciz	"error in zd_ep_regs_out_msg() req_len %d != actual_req_len %d\n"

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