	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function smsusb1_load_firmware
_smsusb1_load_firmware:                 ## @smsusb1_load_firmware
	.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	%r12
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r14d
	movl	%esi, %ebx
	movq	%rdi, %r15
	testl	%esi, %esi
	jns	LBB0_2
## %bb.1:
	movl	%r14d, %edi
	callq	_sms_get_board
	movl	(%rax), %ebx
LBB0_2:
	movq	_DEVICE_MODE_DVBT@GOTPCREL(%rip), %rax
	cmpl	(%rax), %ebx
	jl	LBB0_4
## %bb.3:
	movq	_DEVICE_MODE_DVBT_BDA@GOTPCREL(%rip), %rax
	cmpl	(%rax), %ebx
	jg	LBB0_4
## %bb.5:
	movl	%ebx, %edi
	movl	%r14d, %esi
	callq	_sms_get_fw_name
	movq	%rax, %r14
	leaq	-40(%rbp), %rdi
	movq	%rax, %rsi
	movq	%r15, %rdx
	callq	_request_firmware
	testl	%eax, %eax
	jns	LBB0_8
## %bb.6:
	leaq	L_.str.1(%rip), %rdi
	movq	%r14, %rsi
	movl	%ebx, %edx
	callq	_pr_warn
	movq	_smsusb1_fw_lkup@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movslq	%ebx, %rcx
	movq	(%rax,%rcx,8), %r14
	leaq	-40(%rbp), %rdi
	movq	%r14, %rsi
	movq	%r15, %rdx
	callq	_request_firmware
	testl	%eax, %eax
	js	LBB0_7
LBB0_8:
	movq	-40(%rbp), %rax
	movl	(%rax), %edi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_kmalloc
	testq	%rax, %rax
	je	LBB0_10
## %bb.9:
	movq	%rax, %rbx
	movq	-40(%rbp), %rax
	movl	(%rax), %edx
	movl	4(%rax), %esi
	movq	%rbx, %rdi
	callq	_memcpy
	movq	%r15, %rdi
	movl	$2, %esi
	callq	_usb_sndbulkpipe
	movq	-40(%rbp), %rcx
	movl	(%rcx), %ecx
	leaq	-44(%rbp), %r8
	movq	%r15, %rdi
	movl	%eax, %esi
	movq	%rbx, %rdx
	movl	$1000, %r9d                     ## imm = 0x3E8
	callq	_usb_bulk_msg
	movl	%eax, %r12d
	movq	-40(%rbp), %rax
	movslq	(%rax), %rsi
	movl	-44(%rbp), %edx
	leaq	L_.str.3(%rip), %rdi
	movl	%r12d, %ecx
	xorl	%eax, %eax
	callq	_pr_debug
	movq	%rbx, %rdi
	callq	_kfree
	jmp	LBB0_11
LBB0_4:
	leaq	L_.str(%rip), %rdi
	xorl	%r12d, %r12d
	movl	%ebx, %esi
	xorl	%eax, %eax
	callq	_pr_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %r12d
	jmp	LBB0_12
LBB0_10:
	leaq	L_.str.4(%rip), %rdi
	xorl	%r12d, %r12d
	xorl	%eax, %eax
	callq	_pr_err
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	subl	(%rax), %r12d
LBB0_11:
	movq	-40(%rbp), %rax
	movl	(%rax), %edx
	leaq	L_.str.5(%rip), %rdi
	movq	%r14, %rsi
	xorl	%eax, %eax
	callq	_pr_debug
	movq	-40(%rbp), %rdi
	callq	_release_firmware
LBB0_12:
	movl	%r12d, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	movl	%eax, %r12d
	leaq	L_.str.2(%rip), %rdi
	movq	%r14, %rsi
	movl	%ebx, %edx
	callq	_pr_warn
	jmp	LBB0_12
	.cfi_endproc
                                        ## -- End function
	.comm	_DEVICE_MODE_DVBT,4,2           ## @DEVICE_MODE_DVBT
	.comm	_DEVICE_MODE_DVBT_BDA,4,2       ## @DEVICE_MODE_DVBT_BDA
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"invalid firmware id specified %d\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.1:                               ## @.str.1
	.asciz	"failed to open '%s' mode %d, trying again with default firmware\n"

	.comm	_smsusb1_fw_lkup,8,3            ## @smsusb1_fw_lkup
L_.str.2:                               ## @.str.2
	.asciz	"failed to open '%s' mode %d\n"

	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
L_.str.3:                               ## @.str.3
	.asciz	"sent %zu(%d) bytes, rc %d\n"

L_.str.4:                               ## @.str.4
	.asciz	"failed to allocate firmware buffer\n"

	.comm	_ENOMEM,4,2                     ## @ENOMEM
L_.str.5:                               ## @.str.5
	.asciz	"read FW %s, size=%zu\n"

	.no_dead_strip	_smsusb1_load_firmware
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function smsusb1_load_firmware
_smsusb1_load_firmware:                 ; @smsusb1_load_firmware
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	mov	x19, x2
	mov	x21, x1
	mov	x20, x0
	tbz	w1, #31, LBB0_2
; %bb.1:
	mov	x0, x19
	bl	_sms_get_board
	ldr	w21, [x0]
LBB0_2:
Lloh0:
	adrp	x8, _DEVICE_MODE_DVBT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _DEVICE_MODE_DVBT@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x9, _DEVICE_MODE_DVBT_BDA@GOTPAGE
Lloh4:
	ldr	x9, [x9, _DEVICE_MODE_DVBT_BDA@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	cmp	w21, w8
	ccmp	w21, w9, #0, ge
	b.le	LBB0_4
; %bb.3:
	str	x21, [sp]
Lloh6:
	adrp	x0, l_.str@PAGE
Lloh7:
	add	x0, x0, l_.str@PAGEOFF
	bl	_pr_err
Lloh8:
	adrp	x8, _EINVAL@GOTPAGE
Lloh9:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	neg	w22, w8
	b	LBB0_10
LBB0_4:
	mov	x0, x21
	mov	x1, x19
	bl	_sms_get_fw_name
	mov	x19, x0
	add	x0, sp, #24
	mov	x1, x19
	mov	x2, x20
	bl	_request_firmware
	tbz	w0, #31, LBB0_6
; %bb.5:
Lloh11:
	adrp	x0, l_.str.1@PAGE
Lloh12:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x1, x19
	mov	x2, x21
	bl	_pr_warn
Lloh13:
	adrp	x8, _smsusb1_fw_lkup@GOTPAGE
Lloh14:
	ldr	x8, [x8, _smsusb1_fw_lkup@GOTPAGEOFF]
Lloh15:
	ldr	x8, [x8]
	ldr	x19, [x8, w21, sxtw #3]
	add	x0, sp, #24
	mov	x1, x19
	mov	x2, x20
	bl	_request_firmware
	tbnz	w0, #31, LBB0_11
LBB0_6:
	ldr	x8, [sp, #24]
	ldr	w0, [x8]
Lloh16:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh17:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh18:
	ldr	w1, [x8]
	bl	_kmalloc
	cbz	x0, LBB0_8
; %bb.7:
	mov	x21, x0
	ldr	x8, [sp, #24]
	ldp	w2, w1, [x8]
	bl	_memcpy
	mov	x0, x20
	mov	w1, #2
	bl	_usb_sndbulkpipe
	mov	x1, x0
	ldr	x8, [sp, #24]
	ldr	w3, [x8]
	add	x4, sp, #20
	mov	x0, x20
	mov	x2, x21
	mov	w5, #1000
	bl	_usb_bulk_msg
	mov	x22, x0
	ldr	x8, [sp, #24]
	ldrsw	x1, [x8]
	ldr	w2, [sp, #20]
	str	x22, [sp]
Lloh19:
	adrp	x0, l_.str.3@PAGE
Lloh20:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_pr_debug
	mov	x0, x21
	bl	_kfree
	b	LBB0_9
LBB0_8:
Lloh21:
	adrp	x0, l_.str.4@PAGE
Lloh22:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_pr_err
Lloh23:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh24:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh25:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_9:
	ldr	x8, [sp, #24]
	ldr	w2, [x8]
Lloh26:
	adrp	x0, l_.str.5@PAGE
Lloh27:
	add	x0, x0, l_.str.5@PAGEOFF
	mov	x1, x19
	bl	_pr_debug
	ldr	x0, [sp, #24]
	bl	_release_firmware
LBB0_10:
	mov	x0, x22
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
LBB0_11:
	mov	x22, x0
Lloh28:
	adrp	x0, l_.str.2@PAGE
Lloh29:
	add	x0, x0, l_.str.2@PAGEOFF
	mov	x1, x19
	mov	x2, x21
	bl	_pr_warn
	b	LBB0_10
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpAdd	Lloh28, Lloh29
	.cfi_endproc
                                        ; -- End function
	.comm	_DEVICE_MODE_DVBT,4,2           ; @DEVICE_MODE_DVBT
	.comm	_DEVICE_MODE_DVBT_BDA,4,2       ; @DEVICE_MODE_DVBT_BDA
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"invalid firmware id specified %d\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.1:                               ; @.str.1
	.asciz	"failed to open '%s' mode %d, trying again with default firmware\n"

	.comm	_smsusb1_fw_lkup,8,3            ; @smsusb1_fw_lkup
l_.str.2:                               ; @.str.2
	.asciz	"failed to open '%s' mode %d\n"

	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
l_.str.3:                               ; @.str.3
	.asciz	"sent %zu(%d) bytes, rc %d\n"

l_.str.4:                               ; @.str.4
	.asciz	"failed to allocate firmware buffer\n"

	.comm	_ENOMEM,4,2                     ; @ENOMEM
l_.str.5:                               ; @.str.5
	.asciz	"read FW %s, size=%zu\n"

	.no_dead_strip	_smsusb1_load_firmware
.subsections_via_symbols
