	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function amradio_send_cmd
_amradio_send_cmd:                      ## @amradio_send_cmd
	.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
	movq	%rdi, %r15
	movq	(%rdi), %rax
	movabsq	$365072220160, %rdi             ## imm = 0x5500000000
	movq	%rdi, (%rax)
	movl	$170, 8(%rax)
	movl	%r8d, -52(%rbp)                 ## 4-byte Spill
	movl	%r8d, 12(%rax)
	movl	%esi, -48(%rbp)                 ## 4-byte Spill
	movl	%esi, 16(%rax)
	movl	%edx, 20(%rax)
	movl	$0, 24(%rax)
	movq	%rcx, -64(%rbp)                 ## 8-byte Spill
	testq	%rcx, %rcx
	setne	%cl
	testl	%r9d, %r9d
	setne	%r12b
	orb	%cl, %r12b
	movzbl	%r12b, %ecx
	shll	$3, %ecx
	movl	%ecx, 28(%rax)
	movl	12(%r15), %ebx
	movl	%ebx, %edi
	movl	$2, %esi
	callq	_usb_sndintpipe
	movq	(%r15), %rdx
	movq	_BUFFER_LENGTH@GOTPCREL(%rip), %r13
	movl	(%r13), %ecx
	movq	_USB_TIMEOUT@GOTPCREL(%rip), %rsi
	movl	(%rsi), %r9d
	leaq	-44(%rbp), %r8
	movl	%ebx, %edi
	movl	%eax, %esi
	callq	_usb_bulk_msg
	movl	%eax, %r14d
	testl	%eax, %eax
	js	LBB0_2
## %bb.1:
	movl	-44(%rbp), %eax
	cmpl	(%r13), %eax
	jne	LBB0_2
## %bb.5:
	xorl	%ebx, %ebx
	testb	%r12b, %r12b
	je	LBB0_15
## %bb.6:
	movq	(%r15), %rdi
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	testq	%rsi, %rsi
	je	LBB0_8
## %bb.7:
	movl	-52(%rbp), %r14d                ## 4-byte Reload
	movl	%r14d, %edx
	callq	_memcpy
	movslq	%r14d, %rdi
	shlq	$2, %rdi
	addq	(%r15), %rdi
	movl	$8, %edx
	subl	%r14d, %edx
	xorl	%esi, %esi
	callq	_memset
	movl	12(%r15), %r14d
	movl	%r14d, %edi
	movl	$2, %esi
	callq	_usb_sndintpipe
	jmp	LBB0_9
LBB0_2:
	addq	$8, %r15
	movq	%r15, %rdi
	callq	_video_is_registered
	testq	%rax, %rax
	je	LBB0_4
## %bb.3:
	leaq	L_.str(%rip), %rsi
	movq	%r15, %rdi
	movl	-48(%rbp), %edx                 ## 4-byte Reload
	callq	_amradio_dev_warn
LBB0_4:
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	testl	%r14d, %r14d
	cmovnel	%r14d, %ebx
LBB0_15:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	xorl	%esi, %esi
	movl	$8, %edx
	callq	_memset
	movl	12(%r15), %r14d
	movl	%r14d, %edi
	movl	$129, %esi
	callq	_usb_rcvbulkpipe
LBB0_9:
	movq	(%r15), %rdx
	movq	_BUFFER_LENGTH@GOTPCREL(%rip), %r13
	movl	(%r13), %ecx
	movq	_USB_TIMEOUT@GOTPCREL(%rip), %rsi
	movl	(%rsi), %r9d
	leaq	-44(%rbp), %r8
	movl	%r14d, %edi
	movl	%eax, %esi
	callq	_usb_bulk_msg
	movl	%eax, %r12d
	testl	%eax, %eax
	jne	LBB0_11
## %bb.10:
	movl	-44(%rbp), %eax
	cmpl	(%r13), %eax
	je	LBB0_15
LBB0_11:
	addq	$8, %r15
	movq	%r15, %rdi
	callq	_video_is_registered
	testq	%rax, %rax
	movl	-48(%rbp), %edx                 ## 4-byte Reload
	je	LBB0_14
## %bb.12:
	movq	_AMRADIO_GET_READY_FLAG@GOTPCREL(%rip), %rax
	cmpl	%edx, (%rax)
	je	LBB0_14
## %bb.13:
	leaq	L_.str.1(%rip), %rsi
	movq	%r15, %rdi
	callq	_amradio_dev_warn
LBB0_14:
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	testl	%r12d, %r12d
	cmovnel	%r12d, %ebx
	jmp	LBB0_15
	.cfi_endproc
                                        ## -- End function
	.comm	_BUFFER_LENGTH,4,2              ## @BUFFER_LENGTH
	.comm	_USB_TIMEOUT,4,2                ## @USB_TIMEOUT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"cmd %02x failed\n"

	.comm	_EIO,4,2                        ## @EIO
	.comm	_AMRADIO_GET_READY_FLAG,4,2     ## @AMRADIO_GET_READY_FLAG
L_.str.1:                               ## @.str.1
	.asciz	"follow-up to cmd %02x failed\n"

	.no_dead_strip	_amradio_send_cmd
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal8,8byte_literals
	.p2align	3                               ; -- Begin function amradio_send_cmd
lCPI0_0:
	.long	0                               ; 0x0
	.long	85                              ; 0x55
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	2
_amradio_send_cmd:                      ; @amradio_send_cmd
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.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
	mov	x21, x4
	mov	x22, x3
	mov	x19, x1
	mov	x20, x0
	ldr	x8, [x0]
Lloh0:
	adrp	x9, lCPI0_0@PAGE
Lloh1:
	ldr	d0, [x9, lCPI0_0@PAGEOFF]
	str	d0, [x8]
	mov	w9, #170
	stp	w9, w4, [x8, #8]
	stp	w1, w2, [x8, #16]
	cmp	x3, #0
	ccmp	w5, #0, #0, eq
	cset	w26, ne
	mov	w9, #8
	csel	w9, w9, wzr, ne
	stp	wzr, w9, [x8, #24]
	ldr	w23, [x0, #12]
	mov	x0, x23
	mov	w1, #2
	bl	_usb_sndintpipe
	mov	x1, x0
	ldr	x2, [x20]
Lloh2:
	adrp	x24, _BUFFER_LENGTH@GOTPAGE
Lloh3:
	ldr	x24, [x24, _BUFFER_LENGTH@GOTPAGEOFF]
	ldr	w3, [x24]
Lloh4:
	adrp	x25, _USB_TIMEOUT@GOTPAGE
Lloh5:
	ldr	x25, [x25, _USB_TIMEOUT@GOTPAGEOFF]
	ldr	w5, [x25]
	add	x4, sp, #12
	mov	x0, x23
	bl	_usb_bulk_msg
	mov	x23, x0
	tbnz	w0, #31, LBB0_5
; %bb.1:
	ldr	w8, [sp, #12]
	ldr	w9, [x24]
	cmp	w8, w9
	b.ne	LBB0_5
; %bb.2:
	cbz	w26, LBB0_11
; %bb.3:
	ldr	x0, [x20]
	cbz	x22, LBB0_8
; %bb.4:
	mov	x1, x22
	mov	x2, x21
	bl	_memcpy
	ldr	x8, [x20]
	add	x0, x8, w21, sxtw #2
	mov	w8, #8
	sub	w2, w8, w21
	mov	w1, #0
	bl	_memset
	ldr	w21, [x20, #12]
	mov	x0, x21
	mov	w1, #2
	bl	_usb_sndintpipe
	b	LBB0_9
LBB0_5:
	add	x20, x20, #8
	mov	x0, x20
	bl	_video_is_registered
	cbz	x0, LBB0_7
; %bb.6:
Lloh6:
	adrp	x1, l_.str@PAGE
Lloh7:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x20
	mov	x2, x19
	bl	_amradio_dev_warn
LBB0_7:
Lloh8:
	adrp	x8, _EIO@GOTPAGE
Lloh9:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	cmp	w23, #0
	csneg	w0, w23, w8, ne
	b	LBB0_16
LBB0_8:
	mov	w1, #0
	mov	w2, #8
	bl	_memset
	ldr	w21, [x20, #12]
	mov	x0, x21
	mov	w1, #129
	bl	_usb_rcvbulkpipe
LBB0_9:
	mov	x1, x0
	ldr	x2, [x20]
	ldr	w3, [x24]
	ldr	w5, [x25]
	add	x4, sp, #12
	mov	x0, x21
	bl	_usb_bulk_msg
	mov	x21, x0
	cbnz	w0, LBB0_12
; %bb.10:
	ldr	w8, [sp, #12]
	ldr	w9, [x24]
	cmp	w8, w9
	b.ne	LBB0_12
LBB0_11:
	mov	w0, #0
	b	LBB0_16
LBB0_12:
	add	x20, x20, #8
	mov	x0, x20
	bl	_video_is_registered
	cbz	x0, LBB0_15
; %bb.13:
Lloh11:
	adrp	x8, _AMRADIO_GET_READY_FLAG@GOTPAGE
Lloh12:
	ldr	x8, [x8, _AMRADIO_GET_READY_FLAG@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	cmp	w8, w19
	b.eq	LBB0_15
; %bb.14:
Lloh14:
	adrp	x1, l_.str.1@PAGE
Lloh15:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x20
	mov	x2, x19
	bl	_amradio_dev_warn
LBB0_15:
Lloh16:
	adrp	x8, _EIO@GOTPAGE
Lloh17:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	cmp	w21, #0
	csneg	w0, w21, w8, ne
LBB0_16:
	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
	add	sp, sp, #96
	ret
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdr	Lloh0, Lloh1
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
	.comm	_BUFFER_LENGTH,4,2              ; @BUFFER_LENGTH
	.comm	_USB_TIMEOUT,4,2                ; @USB_TIMEOUT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"cmd %02x failed\n"

	.comm	_EIO,4,2                        ; @EIO
	.comm	_AMRADIO_GET_READY_FLAG,4,2     ; @AMRADIO_GET_READY_FLAG
l_.str.1:                               ; @.str.1
	.asciz	"follow-up to cmd %02x failed\n"

	.no_dead_strip	_amradio_send_cmd
.subsections_via_symbols
