	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function m920x_firmware_download
_m920x_firmware_download:               ## @m920x_firmware_download
	.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	%rsi, %r13
	movq	%rdi, %r12
	movq	_GFP_KERNEL@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	movl	$65536, %edi                    ## imm = 0x10000
	callq	_kmalloc
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%rax, %rbx
	movl	(%r15), %esi
	movl	$4, %edi
	callq	_kmalloc
	testq	%rax, %rax
	je	LBB0_3
## %bb.4:
	movq	%rax, %r15
	movq	%rbx, -72(%rbp)                 ## 8-byte Spill
	movq	_M9206_FILTER@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	xorl	%edx, %edx
	movl	$32768, %ecx                    ## imm = 0x8000
	movq	%r15, %r8
	movl	$4, %r9d
	callq	_m920x_read
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_18
## %bb.5:
	leaq	L_.str(%rip), %rdi
	xorl	%ebx, %ebx
	movl	$4, %esi
	movq	%r15, %rdx
	xorl	%eax, %eax
	callq	_deb
	movq	_M9206_FW@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	movq	%r15, %r8
	movl	$1, %r9d
	callq	_m920x_read
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_18
## %bb.6:
	movq	%r12, -64(%rbp)                 ## 8-byte Spill
	movl	(%r15), %esi
	leaq	L_.str.1(%rip), %rdi
	xorl	%eax, %eax
	callq	_deb
	movl	(%r13), %ecx
	cmpl	$13, %ecx
	jb	LBB0_9
## %bb.7:
	xorl	%edi, %edi
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	addq	8(%r13), %rdi
	callq	_get_unaligned_le16
	leal	4(%rbx), %eax
	movslq	%eax, %rdi
	addq	8(%r13), %rdi
	callq	_get_unaligned_le16
	leal	8(%rbx), %eax
	movslq	%eax, %rdi
	addq	8(%r13), %rdi
	callq	_get_unaligned_le16
                                        ## kill: def $eax killed $eax def $rax
	movslq	(%r13), %rcx
	addl	%eax, %ebx
	addl	$12, %ebx
	movslq	%ebx, %rdi
	leaq	12(%rdi), %rax
	cmpq	%rcx, %rax
	jb	LBB0_8
LBB0_9:
	cmpl	%ecx, %ebx
	jne	LBB0_17
## %bb.10:
	movq	%r15, -56(%rbp)                 ## 8-byte Spill
	xorl	%r15d, %r15d
	movl	$0, %r14d
	cmpl	$13, %ecx
	jb	LBB0_14
## %bb.11:
	xorl	%edi, %edi
	xorl	%r15d, %r15d
	movq	-72(%rbp), %r12                 ## 8-byte Reload
	movq	-64(%rbp), %rbx                 ## 8-byte Reload
	.p2align	4, 0x90
LBB0_12:                                ## =>This Inner Loop Header: Depth=1
	addq	8(%r13), %rdi
	callq	_get_unaligned_le16
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	leal	4(%r15), %eax
	movslq	%eax, %rdi
	addq	8(%r13), %rdi
	callq	_get_unaligned_le16
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	leal	8(%r15), %eax
	movslq	%eax, %rdi
	addq	8(%r13), %rdi
	callq	_get_unaligned_le16
	movl	%eax, %r14d
	addl	$12, %r15d
	movslq	%r15d, %rsi
	addq	8(%r13), %rsi
	movq	%r12, %rdi
	movl	%eax, %edx
	callq	_memcpy
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_usb_sndctrlpipe
	movq	_M9206_FW@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	movq	_USB_DIR_OUT@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movq	_USB_TYPE_VENDOR@GOTPCREL(%rip), %rsi
	orl	(%rsi), %ecx
	subq	$8, %rsp
	movq	%rbx, %rdi
	movl	%eax, %esi
	movl	-48(%rbp), %r8d                 ## 4-byte Reload
	movl	-44(%rbp), %r9d                 ## 4-byte Reload
	pushq	$20
	pushq	%r14
	pushq	%r12
	callq	_usb_control_msg
	addq	$32, %rsp
	cmpl	%r14d, %eax
	jne	LBB0_16
## %bb.13:                              ##   in Loop: Header=BB0_12 Depth=1
	movl	$3, %edi
	callq	_msleep
	addl	%r14d, %r15d
	movslq	%r15d, %rdi
	leaq	12(%rdi), %rax
	movslq	(%r13), %rcx
	cmpq	%rcx, %rax
	jb	LBB0_12
LBB0_14:
	cmpl	%ecx, %r15d
	movq	-56(%rbp), %r15                 ## 8-byte Reload
	jne	LBB0_17
## %bb.15:
	movl	$36, %edi
	callq	_msleep
	movq	_M9206_CORE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_M9206_FW_GO@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movl	$1, %edx
	callq	_m920x_write
	leaq	L_.str.4(%rip), %rdi
	xorl	%eax, %eax
	callq	_deb
	jmp	LBB0_18
LBB0_3:
	movq	%rbx, %rdi
	callq	_kfree
LBB0_1:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	jmp	LBB0_19
LBB0_17:
	leaq	L_.str.3(%rip), %rdi
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	callq	_deb
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %r14d
LBB0_18:
	movq	%r15, %rdi
	callq	_kfree
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	callq	_kfree
LBB0_19:
	movl	%r14d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_16:
	leaq	L_.str.2(%rip), %rdi
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	callq	_deb
	movq	_EIO@GOTPCREL(%rip), %rax
	subl	(%rax), %r14d
	movq	-56(%rbp), %r15                 ## 8-byte Reload
	jmp	LBB0_18
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_M9206_FILTER,4,2               ## @M9206_FILTER
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%*ph\n"

	.comm	_M9206_FW,4,2                   ## @M9206_FW
L_.str.1:                               ## @.str.1
	.asciz	"%x\n"

	.comm	_USB_TYPE_VENDOR,4,2            ## @USB_TYPE_VENDOR
	.comm	_USB_DIR_OUT,4,2                ## @USB_DIR_OUT
L_.str.2:                               ## @.str.2
	.asciz	"error while uploading fw!\n"

	.comm	_EIO,4,2                        ## @EIO
L_.str.3:                               ## @.str.3
	.asciz	"bad firmware file!\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_M9206_CORE,4,2                 ## @M9206_CORE
	.comm	_M9206_FW_GO,4,2                ## @M9206_FW_GO
L_.str.4:                               ## @.str.4
	.asciz	"firmware uploaded!\n"

	.no_dead_strip	_m920x_firmware_download
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function m920x_firmware_download
_m920x_firmware_download:               ; @m920x_firmware_download
	.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
	mov	x22, x1
	mov	x21, x0
Lloh0:
	adrp	x20, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x20, [x20, _GFP_KERNEL@GOTPAGEOFF]
	ldr	w1, [x20]
	mov	w0, #65536
	bl	_kmalloc
	cbz	x0, LBB0_9
; %bb.1:
	mov	x19, x0
	ldr	w1, [x20]
	mov	w0, #4
	bl	_kmalloc
	cbz	x0, LBB0_8
; %bb.2:
	mov	x20, x0
Lloh2:
	adrp	x8, _M9206_FILTER@GOTPAGE
Lloh3:
	ldr	x8, [x8, _M9206_FILTER@GOTPAGEOFF]
Lloh4:
	ldr	w1, [x8]
	mov	x0, x21
	mov	w2, #0
	mov	w3, #32768
	mov	x4, x20
	mov	w5, #4
	bl	_m920x_read
	mov	x23, x0
	cbnz	w0, LBB0_20
; %bb.3:
	mov	w8, #4
	stp	x8, x20, [sp]
Lloh5:
	adrp	x0, l_.str@PAGE
Lloh6:
	add	x0, x0, l_.str@PAGEOFF
	bl	_deb
Lloh7:
	adrp	x26, _M9206_FW@GOTPAGE
Lloh8:
	ldr	x26, [x26, _M9206_FW@GOTPAGEOFF]
	ldr	w1, [x26]
	mov	x0, x21
	mov	w2, #0
	mov	w3, #0
	mov	x4, x20
	mov	w5, #1
	bl	_m920x_read
	mov	x23, x0
	cbnz	w0, LBB0_20
; %bb.4:
	ldr	w8, [x20]
	str	x8, [sp]
Lloh9:
	adrp	x0, l_.str.1@PAGE
Lloh10:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_deb
	ldr	w8, [x22]
	cmp	w8, #13
	b.lo	LBB0_10
; %bb.5:
	mov	x8, #0
	mov	w23, #0
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x9, [x22, #8]
	add	x0, x9, x8
	bl	_get_unaligned_le16
	add	w8, w23, #4
	ldr	x9, [x22, #8]
	add	x0, x9, w8, sxtw
	bl	_get_unaligned_le16
	add	w8, w23, #8
	ldr	x9, [x22, #8]
	add	x0, x9, w8, sxtw
	bl	_get_unaligned_le16
	add	w8, w23, w0
	ldrsw	x9, [x22]
	add	w23, w8, #12
	sxtw	x8, w23
	add	x10, x8, #12
	cmp	x10, x9
	b.lo	LBB0_6
; %bb.7:
	mov	x8, x9
	cmp	w23, w8
	b.eq	LBB0_11
	b	LBB0_18
LBB0_8:
	mov	x0, x19
	bl	_kfree
LBB0_9:
Lloh11:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh12:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	neg	w23, w8
	b	LBB0_21
LBB0_10:
	mov	w23, #0
	cmp	w23, w8
	b.ne	LBB0_18
LBB0_11:
	cmp	w8, #13
	b.lo	LBB0_15
; %bb.12:
	mov	x9, #0
	mov	w28, #0
	mov	w27, #20
LBB0_13:                                ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x22, #8]
	add	x0, x8, x9
	bl	_get_unaligned_le16
	mov	x24, x0
	add	w8, w28, #4
	ldr	x9, [x22, #8]
	add	x0, x9, w8, sxtw
	bl	_get_unaligned_le16
	mov	x25, x0
	add	w8, w28, #8
	ldr	x9, [x22, #8]
	add	x0, x9, w8, sxtw
	bl	_get_unaligned_le16
	mov	x23, x0
	add	w28, w28, #12
	ldr	x8, [x22, #8]
	add	x1, x8, w28, sxtw
	mov	x0, x19
	mov	x2, x23
	bl	_memcpy
	mov	x0, x21
	mov	w1, #0
	bl	_usb_sndctrlpipe
	mov	x1, x0
	ldr	w2, [x26]
Lloh14:
	adrp	x8, _USB_TYPE_VENDOR@GOTPAGE
Lloh15:
	ldr	x8, [x8, _USB_TYPE_VENDOR@GOTPAGEOFF]
Lloh16:
	ldr	w8, [x8]
Lloh17:
	adrp	x9, _USB_DIR_OUT@GOTPAGE
Lloh18:
	ldr	x9, [x9, _USB_DIR_OUT@GOTPAGEOFF]
Lloh19:
	ldr	w9, [x9]
	orr	w3, w9, w8
	str	w27, [sp]
	mov	x0, x21
	mov	x4, x24
	mov	x5, x25
	mov	x6, x19
	mov	x7, x23
	bl	_usb_control_msg
	cmp	w0, w23
	b.ne	LBB0_22
; %bb.14:                               ;   in Loop: Header=BB0_13 Depth=1
	mov	w0, #3
	bl	_msleep
	add	w28, w23, w28
	sxtw	x9, w28
	add	x10, x9, #12
	ldrsw	x8, [x22]
	cmp	x10, x8
	b.lo	LBB0_13
	b	LBB0_16
LBB0_15:
	mov	w28, #0
	mov	w23, #0
LBB0_16:
	cmp	w28, w8
	b.ne	LBB0_18
; %bb.17:
	mov	w0, #36
	bl	_msleep
Lloh20:
	adrp	x8, _M9206_CORE@GOTPAGE
Lloh21:
	ldr	x8, [x8, _M9206_CORE@GOTPAGEOFF]
Lloh22:
	ldr	w1, [x8]
Lloh23:
	adrp	x8, _M9206_FW_GO@GOTPAGE
Lloh24:
	ldr	x8, [x8, _M9206_FW_GO@GOTPAGEOFF]
Lloh25:
	ldr	w3, [x8]
	mov	x0, x21
	mov	w2, #1
	bl	_m920x_write
Lloh26:
	adrp	x0, l_.str.4@PAGE
Lloh27:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_deb
	b	LBB0_20
LBB0_18:
Lloh28:
	adrp	x0, l_.str.3@PAGE
Lloh29:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_deb
Lloh30:
	adrp	x8, _EINVAL@GOTPAGE
Lloh31:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_19:
	ldr	w8, [x8]
	neg	w23, w8
LBB0_20:
	mov	x0, x20
	bl	_kfree
	mov	x0, x19
	bl	_kfree
LBB0_21:
	mov	x0, x23
	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
LBB0_22:
Lloh32:
	adrp	x0, l_.str.2@PAGE
Lloh33:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_deb
Lloh34:
	adrp	x8, _EIO@GOTPAGE
Lloh35:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
	b	LBB0_19
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh30, Lloh31
	.loh AdrpAdd	Lloh28, Lloh29
	.loh AdrpLdrGot	Lloh34, Lloh35
	.loh AdrpAdd	Lloh32, Lloh33
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_M9206_FILTER,4,2               ; @M9206_FILTER
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%*ph\n"

	.comm	_M9206_FW,4,2                   ; @M9206_FW
l_.str.1:                               ; @.str.1
	.asciz	"%x\n"

	.comm	_USB_TYPE_VENDOR,4,2            ; @USB_TYPE_VENDOR
	.comm	_USB_DIR_OUT,4,2                ; @USB_DIR_OUT
l_.str.2:                               ; @.str.2
	.asciz	"error while uploading fw!\n"

	.comm	_EIO,4,2                        ; @EIO
l_.str.3:                               ; @.str.3
	.asciz	"bad firmware file!\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_M9206_CORE,4,2                 ; @M9206_CORE
	.comm	_M9206_FW_GO,4,2                ; @M9206_FW_GO
l_.str.4:                               ; @.str.4
	.asciz	"firmware uploaded!\n"

	.no_dead_strip	_m920x_firmware_download
.subsections_via_symbols
