	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function af9035_ctrl_msg
_af9035_ctrl_msg:                       ## @af9035_ctrl_msg
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r13
	movq	%rdi, %r15
	callq	_d_to_priv
	movq	%rax, %r12
	movq	8(%r15), %r14
	movq	%r15, %rdi
	callq	_mutex_lock
	movslq	(%r13), %rdx
	movq	_BUF_LEN@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	leal	-6(%rax), %esi
	movl	4(%r13), %ecx
	cmpl	%esi, %edx
	jg	LBB0_5
## %bb.1:
	addl	$-5, %eax
	cmpl	%eax, %ecx
	jg	LBB0_5
## %bb.2:
	movq	%r14, -48(%rbp)                 ## 8-byte Spill
	addl	$5, %edx
	movq	(%r12), %rdi
	movl	%edx, (%rdi)
	movl	8(%r13), %eax
	movl	%eax, 4(%rdi)
	movl	12(%r13), %eax
	movl	%eax, 8(%rdi)
	movl	8(%r12), %eax
	leal	1(%rax), %ecx
	movl	%ecx, 8(%r12)
	movl	%eax, 12(%rdi)
	addq	$16, %rdi
	movq	16(%r13), %rsi
	movl	(%r13), %edx
	callq	_memcpy
	movl	(%r13), %ebx
	movl	4(%r13), %r14d
	addl	$6, %ebx
	addl	$5, %r14d
	movq	(%r12), %rdi
	movl	(%rdi), %esi
	decl	%esi
	callq	_af9035_checksum
	movzbl	%al, %edx
	sarl	$8, %eax
	movq	(%r12), %rcx
	movslq	(%rcx), %rsi
	movl	%eax, -4(%rcx,%rsi,4)
	movslq	(%rcx), %rax
	movl	%edx, (%rcx,%rax,4)
	movslq	12(%r13), %rax
	movq	_CMD_FW_DL@GOTPCREL(%rip), %rsi
	xorl	%edx, %edx
	cmpq	%rax, (%rsi)
	cmovel	%edx, %r14d
	movq	%r15, %rdi
	movq	%rcx, %rsi
	movl	%ebx, %edx
	movl	%r14d, %r8d
	callq	_dvb_usbv2_generic_rw_locked
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_7
## %bb.3:
	movslq	12(%r13), %rax
	movq	_CMD_FW_DL@GOTPCREL(%rip), %rcx
	cmpq	%rax, (%rcx)
	jne	LBB0_8
LBB0_4:
	xorl	%ebx, %ebx
	jmp	LBB0_7
LBB0_5:
	leaq	L_.str(%rip), %rsi
	xorl	%ebx, %ebx
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	_dev_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_6:
	subl	(%rax), %ebx
LBB0_7:
	movq	%r15, %rdi
	callq	_mutex_unlock
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	movq	(%r12), %rdi
	leal	-2(%r14), %esi
	callq	_af9035_checksum
	movq	(%r12), %rsi
	movslq	%r14d, %rdx
	movl	-8(%rsi,%rdx,4), %ecx
	shll	$8, %ecx
	orl	-4(%rsi,%rdx,4), %ecx
	cmpl	%eax, %ecx
	jne	LBB0_13
## %bb.9:
	movl	8(%rsi), %ecx
	testl	%ecx, %ecx
	je	LBB0_14
## %bb.10:
	movslq	12(%r13), %rdx
	movq	_CMD_IR_GET@GOTPCREL(%rip), %rax
	movl	$1, %ebx
	cmpq	%rdx, (%rax)
	je	LBB0_7
## %bb.11:
	cmpl	$1, %ecx
	je	LBB0_7
## %bb.12:
	leaq	L_.str.2(%rip), %rsi
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_dev_dbg
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	jmp	LBB0_6
LBB0_13:
	movslq	12(%r13), %rdx
	leaq	L_.str.1(%rip), %rsi
	xorl	%ebx, %ebx
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movl	%eax, %r8d
	xorl	%eax, %eax
	callq	_dev_err
	movq	_EIO@GOTPCREL(%rip), %rax
	jmp	LBB0_6
LBB0_14:
	movl	4(%r13), %edx
	testl	%edx, %edx
	je	LBB0_4
## %bb.15:
	movq	24(%r13), %rdi
	addq	$12, %rsi
	callq	_memcpy
	jmp	LBB0_4
	.cfi_endproc
                                        ## -- End function
	.comm	_BUF_LEN,4,2                    ## @BUF_LEN
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"too much data wlen=%d rlen=%d\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_CMD_FW_DL,8,3                  ## @CMD_FW_DL
L_.str.1:                               ## @.str.1
	.asciz	"command=%02x checksum mismatch (%04x != %04x)\n"

	.comm	_EIO,4,2                        ## @EIO
	.comm	_CMD_IR_GET,8,3                 ## @CMD_IR_GET
L_.str.2:                               ## @.str.2
	.asciz	"command=%02x failed fw error=%d\n"

	.comm	_ACK_HDR_LEN,4,2                ## @ACK_HDR_LEN
	.comm	_CHECKSUM_LEN,4,2               ## @CHECKSUM_LEN
	.comm	_REQ_HDR_LEN,4,2                ## @REQ_HDR_LEN
	.no_dead_strip	_af9035_ctrl_msg
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function af9035_ctrl_msg
_af9035_ctrl_msg:                       ; @af9035_ctrl_msg
	.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, x1
	mov	x19, x0
	bl	_d_to_priv
	mov	x22, x0
	ldr	x20, [x19, #8]
	mov	x0, x19
	bl	_mutex_lock
Lloh0:
	adrp	x8, _BUF_LEN@GOTPAGE
Lloh1:
	ldr	x8, [x8, _BUF_LEN@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	sub	w9, w8, #6
	ldp	w2, w3, [x21]
                                        ; kill: def $w2 killed $w2 def $x2
	sxtw	x2, w2
	sub	w8, w8, #5
	cmp	w2, w9
	ccmp	w3, w8, #0, le
	b.le	LBB0_3
; %bb.1:
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x20
	bl	_dev_err
Lloh5:
	adrp	x8, _EINVAL@GOTPAGE
Lloh6:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_2:
	ldr	w8, [x8]
	neg	w23, w8
	b	LBB0_6
LBB0_3:
	add	w8, w2, #5
	ldr	x9, [x22]
	str	w8, [x9]
	ldr	w8, [x21, #8]
	str	w8, [x9, #4]
	ldr	w8, [x21, #12]
	str	w8, [x9, #8]
	ldr	w8, [x22, #8]
	add	w10, w8, #1
	str	w10, [x22, #8]
	str	w8, [x9, #12]
	add	x0, x9, #16
	ldr	x1, [x21, #16]
	ldr	w2, [x21]
	bl	_memcpy
	ldp	w8, w9, [x21]
	add	w23, w8, #6
	add	w24, w9, #5
	ldr	x0, [x22]
	ldr	w8, [x0]
	sub	w1, w8, #1
	bl	_af9035_checksum
	asr	w8, w0, #8
	ldr	x1, [x22]
	ldrsw	x9, [x1]
	add	x9, x1, x9, lsl #2
	stur	w8, [x9, #-4]
	and	w8, w0, #0xff
	ldrsw	x9, [x1]
	str	w8, [x1, x9, lsl #2]
	ldrsw	x8, [x21, #12]
Lloh7:
	adrp	x25, _CMD_FW_DL@GOTPAGE
Lloh8:
	ldr	x25, [x25, _CMD_FW_DL@GOTPAGEOFF]
	ldr	x9, [x25]
	cmp	x9, x8
	csel	w24, wzr, w24, eq
	mov	x0, x19
	mov	x2, x23
	mov	x3, x1
	mov	x4, x24
	bl	_dvb_usbv2_generic_rw_locked
	mov	x23, x0
	cbnz	w0, LBB0_6
; %bb.4:
	ldrsw	x8, [x21, #12]
	ldr	x9, [x25]
	cmp	x9, x8
	b.ne	LBB0_7
LBB0_5:
	mov	w23, #0
LBB0_6:
	mov	x0, x19
	bl	_mutex_unlock
	mov	x0, x23
	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
LBB0_7:
	ldr	x0, [x22]
	sxtw	x8, w24
	sub	x23, x8, #2
	mov	x1, x23
	bl	_af9035_checksum
                                        ; kill: def $w0 killed $w0 def $x0
	ldr	x8, [x22]
	ldr	w9, [x8, x23, lsl #2]
	add	x10, x8, w24, sxtw #2
	ldur	w10, [x10, #-4]
	orr	w3, w10, w9, lsl #8
	cmp	w3, w0
	b.ne	LBB0_12
; %bb.8:
	ldr	w3, [x8, #8]
	cbz	w3, LBB0_14
; %bb.9:
	ldrsw	x2, [x21, #12]
Lloh9:
	adrp	x8, _CMD_IR_GET@GOTPAGE
Lloh10:
	ldr	x8, [x8, _CMD_IR_GET@GOTPAGEOFF]
Lloh11:
	ldr	x8, [x8]
	mov	w23, #1
	cmp	x8, x2
	b.eq	LBB0_6
; %bb.10:
	cmp	w3, #1
	b.eq	LBB0_6
; %bb.11:
Lloh12:
	adrp	x1, l_.str.2@PAGE
Lloh13:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x20
	bl	_dev_dbg
	b	LBB0_13
LBB0_12:
	ldrsw	x2, [x21, #12]
	str	x0, [sp]
Lloh14:
	adrp	x1, l_.str.1@PAGE
Lloh15:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x20
	bl	_dev_err
LBB0_13:
Lloh16:
	adrp	x8, _EIO@GOTPAGE
Lloh17:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
	b	LBB0_2
LBB0_14:
	ldr	w2, [x21, #4]
	cbz	w2, LBB0_5
; %bb.15:
	ldr	x0, [x21, #24]
	add	x1, x8, #12
	bl	_memcpy
	b	LBB0_5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_BUF_LEN,4,2                    ; @BUF_LEN
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"too much data wlen=%d rlen=%d\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_CMD_FW_DL,8,3                  ; @CMD_FW_DL
l_.str.1:                               ; @.str.1
	.asciz	"command=%02x checksum mismatch (%04x != %04x)\n"

	.comm	_EIO,4,2                        ; @EIO
	.comm	_CMD_IR_GET,8,3                 ; @CMD_IR_GET
l_.str.2:                               ; @.str.2
	.asciz	"command=%02x failed fw error=%d\n"

	.comm	_ACK_HDR_LEN,4,2                ; @ACK_HDR_LEN
	.comm	_CHECKSUM_LEN,4,2               ; @CHECKSUM_LEN
	.comm	_REQ_HDR_LEN,4,2                ; @REQ_HDR_LEN
	.no_dead_strip	_af9035_ctrl_msg
.subsections_via_symbols
