	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_pvr2_upload_firmware2          ## -- Begin function pvr2_upload_firmware2
	.p2align	4, 0x90
_pvr2_upload_firmware2:                 ## @pvr2_upload_firmware2
	.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	$0, -56(%rbp)
	movq	(%rdi), %rax
	xorl	%r13d, %r13d
	cmpq	$0, 8(%rax)
	je	LBB0_2
LBB0_1:
	movl	%r13d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_2:
	movq	%rdi, %r12
	leaq	L_.str(%rip), %rdi
	xorl	%eax, %eax
	callq	_trace_firmware
	leaq	_pvr2_upload_firmware2.fw_files(%rip), %rbx
	movq	%rbx, %rdi
	callq	_ARRAY_SIZE
	leaq	L_.str.1(%rip), %rdx
	leaq	-56(%rbp), %rsi
	movq	%r12, %rdi
	movl	%eax, %ecx
	movq	%rbx, %r8
	callq	_pvr2_locate_firmware
	testl	%eax, %eax
	js	LBB0_7
## %bb.3:
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movq	$0, 32(%r12)
	leaq	24(%r12), %rdi
	callq	_del_timer_sync
	cmpq	$0, 16(%r12)
	je	LBB0_5
## %bb.4:
	movq	$0, 16(%r12)
	leaq	L_.str.2(%rip), %rdi
	xorl	%esi, %esi
	callq	_trace_stbit
LBB0_5:
	movq	%r12, %rdi
	movl	$72, %esi
	movl	$-1, %edx
	callq	_pvr2_write_register
	movl	%eax, %ebx
	movq	%r12, %rdi
	movl	$-1, %esi
	movl	$136, %edx
	callq	_pvr2_hdw_gpio_chg_dir
	movl	%eax, %r14d
	orl	%ebx, %r14d
	movq	%r12, %rdi
	movl	$-1, %esi
	movl	$8, %edx
	callq	_pvr2_hdw_gpio_chg_out
	movl	%eax, %r15d
	movq	%r12, %rdi
	callq	_pvr2_hdw_cmd_deep_reset
	movl	%eax, %r13d
	orl	%r15d, %r13d
	orl	%r14d, %r13d
	movq	%r12, %rdi
	movl	$41060, %esi                    ## imm = 0xA064
	xorl	%edx, %edx
	callq	_pvr2_write_register
	movl	%eax, %r14d
	movq	%r12, %rdi
	movl	$-1, %esi
	movl	$1032, %edx                     ## imm = 0x408
	callq	_pvr2_hdw_gpio_chg_dir
	movl	%eax, %ebx
	orl	%r14d, %ebx
	movq	%r12, %rdi
	movl	$-1, %esi
	movl	$8, %edx
	callq	_pvr2_hdw_gpio_chg_out
	movl	%eax, %r15d
	orl	%ebx, %r15d
	orl	%r13d, %r15d
	movq	%r12, %rdi
	movl	$36952, %esi                    ## imm = 0x9058
	movl	$-19, %edx
	callq	_pvr2_write_register
	movl	%eax, %r14d
	movq	%r12, %rdi
	movl	$36948, %esi                    ## imm = 0x9054
	movl	$-3, %edx
	callq	_pvr2_write_register
	movl	%eax, %ebx
	orl	%r14d, %ebx
	movq	%r12, %rdi
	movl	$2040, %esi                     ## imm = 0x7F8
	movl	$-2147481600, %edx              ## imm = 0x80000800
	callq	_pvr2_write_register
	movl	%eax, %r13d
	orl	%ebx, %r13d
	movq	%r12, %rdi
	movl	$2044, %esi                     ## imm = 0x7FC
	movl	$26, %edx
	callq	_pvr2_write_register
	movl	%eax, %r14d
	orl	%r13d, %r14d
	orl	%r15d, %r14d
	movq	%r12, %rdi
	movl	$1792, %esi                     ## imm = 0x700
	xorl	%edx, %edx
	callq	_pvr2_write_register
	movl	%eax, %r15d
	movq	%r12, %rdi
	movl	$43520, %esi                    ## imm = 0xAA00
	xorl	%edx, %edx
	callq	_pvr2_write_register
	movl	%eax, %ebx
	orl	%r15d, %ebx
	movq	%r12, %rdi
	movl	$43524, %esi                    ## imm = 0xAA04
	movl	$358416, %edx                   ## imm = 0x57810
	callq	_pvr2_write_register
	movl	%eax, %r15d
	orl	%ebx, %r15d
	movq	%r12, %rdi
	movl	$43536, %esi                    ## imm = 0xAA10
	movl	$1344768, %edx                  ## imm = 0x148500
	callq	_pvr2_write_register
	movl	%eax, %r13d
	orl	%r15d, %r13d
	movq	%r12, %rdi
	movl	$43544, %esi                    ## imm = 0xAA18
	movl	$8650752, %edx                  ## imm = 0x840000
	callq	_pvr2_write_register
	movl	%eax, %ebx
	orl	%r13d, %ebx
	orl	%r14d, %ebx
	movq	_FX2CMD_FWPOST1@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	callq	_pvr2_issue_simple_cmd
	movl	%eax, %r14d
	orl	%ebx, %r14d
	movq	_FX2CMD_MEMSEL@GOTPCREL(%rip), %rax
	movl	$256, %esi                      ## imm = 0x100
	orl	(%rax), %esi
	movq	%r12, %rdi
	callq	_pvr2_issue_simple_cmd
	movl	%eax, %r13d
	orl	%r14d, %r13d
	je	LBB0_8
## %bb.6:
	movq	_PVR2_TRACE_ERROR_LEGS@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.3(%rip), %rsi
	movl	%r13d, %edx
	xorl	%eax, %eax
	callq	_pvr2_trace
	movq	-56(%rbp), %rdi
	callq	_release_firmware
	jmp	LBB0_11
LBB0_7:
	movl	%eax, %r13d
	jmp	LBB0_1
LBB0_8:
	movq	-56(%rbp), %rax
	movl	(%rax), %r13d
	testb	$3, %r13b
	je	LBB0_13
## %bb.9:
	movq	_PVR2_TRACE_ERROR_LEGS@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	leaq	_pvr2_upload_firmware2.fw_files(%rip), %rcx
	movq	(%rcx,%rax,8), %rdx
	leaq	L_.str.4(%rip), %rsi
	xorl	%r13d, %r13d
	movl	$4, %ecx
	xorl	%eax, %eax
	callq	_pvr2_trace
	movq	-56(%rbp), %rdi
	callq	_release_firmware
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_10:
	subl	(%rax), %r13d
LBB0_11:
	movq	(%r12), %rax
	movq	(%rax), %rax
	movq	_PVR2_ROUTING_SCHEME_GOTVIEW@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_1
## %bb.12:
	movq	%r12, %rdi
	movl	$2048, %esi                     ## imm = 0x800
	movl	$-1, %edx
	callq	_pvr2_hdw_gpio_chg_dir
	jmp	LBB0_1
LBB0_13:
	movq	_FIRMWARE_CHUNK_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_kmalloc
	testq	%rax, %rax
	je	LBB0_22
## %bb.14:
	movq	%rax, %r14
	movl	8(%r12), %edi
	movq	_PVR2_FIRMWARE_ENDPOINT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_usb_sndbulkpipe
	movl	%eax, -64(%rbp)                 ## 4-byte Spill
	testl	%r13d, %r13d
	movl	%r13d, -60(%rbp)                ## 4-byte Spill
	je	LBB0_23
## %bb.15:
	xorl	%r15d, %r15d
	movq	%r12, -80(%rbp)                 ## 8-byte Spill
	.p2align	4, 0x90
LBB0_16:                                ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_18 Depth 2
	subl	%r15d, %r13d
	movq	_FIRMWARE_CHUNK_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	cmpl	%eax, %r13d
	cmovael	%eax, %r13d
	movq	-56(%rbp), %rax
	movl	%r15d, %esi
	addq	8(%rax), %rsi
	movq	%r14, %rdi
	movl	%r13d, %edx
	callq	_memcpy
	cmpl	$4, %r13d
	jb	LBB0_19
## %bb.17:                              ##   in Loop: Header=BB0_16 Depth=1
	movl	%r13d, %ebx
	shrl	$2, %ebx
	xorl	%r12d, %r12d
	.p2align	4, 0x90
LBB0_18:                                ##   Parent Loop BB0_16 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	(%r14,%r12,4), %edi
	callq	_swab32
	movl	%eax, (%r14,%r12,4)
	incq	%r12
	cmpq	%r12, %rbx
	jne	LBB0_18
LBB0_19:                                ##   in Loop: Header=BB0_16 Depth=1
	movq	-80(%rbp), %r12                 ## 8-byte Reload
	movl	8(%r12), %edi
	movq	_HZ@GOTPCREL(%rip), %rax
	movl	(%rax), %r9d
	movl	-64(%rbp), %esi                 ## 4-byte Reload
	movq	%r14, %rdx
	movl	%r13d, %ecx
	leaq	-68(%rbp), %r8
	callq	_usb_bulk_msg
	xorl	%ebx, %ebx
	cmpl	%r13d, -68(%rbp)
	setne	%bl
	orl	%eax, %ebx
	jne	LBB0_25
## %bb.20:                              ##   in Loop: Header=BB0_16 Depth=1
	addl	%r13d, %r15d
	movl	-60(%rbp), %r13d                ## 4-byte Reload
	cmpl	%r15d, %r13d
	ja	LBB0_16
	jmp	LBB0_24
LBB0_22:
	movq	-56(%rbp), %rdi
	callq	_release_firmware
	movq	_PVR2_TRACE_ERROR_LEGS@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.5(%rip), %rsi
	xorl	%r13d, %r13d
	xorl	%eax, %eax
	callq	_pvr2_trace
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_10
LBB0_23:
	xorl	%r15d, %r15d
LBB0_24:
	xorl	%ebx, %ebx
LBB0_25:
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	cltq
	leaq	_pvr2_upload_firmware2.fw_files(%rip), %rcx
	movq	(%rcx,%rax,8), %rsi
	leaq	L_.str.6(%rip), %rdi
	xorl	%r13d, %r13d
	movl	%r15d, %edx
	movl	-60(%rbp), %ecx                 ## 4-byte Reload
	xorl	%eax, %eax
	callq	_trace_firmware
	movq	%r14, %rdi
	callq	_kfree
	movq	-56(%rbp), %rdi
	callq	_release_firmware
	testl	%ebx, %ebx
	je	LBB0_27
## %bb.26:
	movq	_PVR2_TRACE_ERROR_LEGS@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.7(%rip), %rsi
	xorl	%eax, %eax
	callq	_pvr2_trace
	movl	%ebx, %r13d
	jmp	LBB0_11
LBB0_27:
	movq	%r12, %rdi
	movl	$36948, %esi                    ## imm = 0x9054
	movl	$-1, %edx
	callq	_pvr2_write_register
	movl	%eax, %r14d
	movq	%r12, %rdi
	movl	$36952, %esi                    ## imm = 0x9058
	movl	$-24, %edx
	callq	_pvr2_write_register
	movl	%eax, %r15d
	orl	%r14d, %r15d
	movl	$256, %esi                      ## imm = 0x100
	movq	_FX2CMD_MEMSEL@GOTPCREL(%rip), %rax
	orl	(%rax), %esi
	movq	%r12, %rdi
	callq	_pvr2_issue_simple_cmd
	movl	%eax, %r14d
	orl	%r15d, %r14d
	je	LBB0_11
## %bb.28:
	movq	_PVR2_TRACE_ERROR_LEGS@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.8(%rip), %rsi
	xorl	%eax, %eax
	callq	_pvr2_trace
	movl	%r14d, %r13d
	jmp	LBB0_11
	.cfi_endproc
                                        ## -- End function
	.section	__DATA,__data
	.p2align	3                               ## @pvr2_upload_firmware2.fw_files
_pvr2_upload_firmware2.fw_files:
	.quad	128

	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"pvr2_upload_firmware2"

L_.str.1:                               ## @.str.1
	.asciz	"encoder"

L_.str.2:                               ## @.str.2
	.asciz	"state_encoder_runok"

	.comm	_FX2CMD_FWPOST1,4,2             ## @FX2CMD_FWPOST1
	.comm	_FX2CMD_MEMSEL,4,2              ## @FX2CMD_MEMSEL
	.comm	_PVR2_TRACE_ERROR_LEGS,4,2      ## @PVR2_TRACE_ERROR_LEGS
L_.str.3:                               ## @.str.3
	.asciz	"firmware2 upload prep failed, ret=%d"

L_.str.4:                               ## @.str.4
	.asciz	"size of %s firmware must be a multiple of %zu bytes"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_FIRMWARE_CHUNK_SIZE,4,2        ## @FIRMWARE_CHUNK_SIZE
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
L_.str.5:                               ## @.str.5
	.asciz	"failed to allocate memory for firmware2 upload"

	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_PVR2_FIRMWARE_ENDPOINT,4,2     ## @PVR2_FIRMWARE_ENDPOINT
	.comm	_HZ,4,2                         ## @HZ
L_.str.6:                               ## @.str.6
	.asciz	"upload of %s : %i / %i "

L_.str.7:                               ## @.str.7
	.asciz	"firmware2 upload transfer failure"

L_.str.8:                               ## @.str.8
	.asciz	"firmware2 upload post-proc failure"

	.comm	_PVR2_ROUTING_SCHEME_GOTVIEW,8,3 ## @PVR2_ROUTING_SCHEME_GOTVIEW
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_pvr2_upload_firmware2          ; -- Begin function pvr2_upload_firmware2
	.p2align	2
_pvr2_upload_firmware2:                 ; @pvr2_upload_firmware2
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #144
	.cfi_def_cfa_offset 144
	stp	x28, x27, [sp, #48]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #64]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #80]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #96]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #112]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #128]            ; 16-byte Folded Spill
	add	x29, sp, #128
	.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
	str	xzr, [sp, #40]
	ldr	x8, [x0]
	ldr	x8, [x8, #8]
	cbz	x8, LBB0_3
; %bb.1:
	mov	w23, #0
LBB0_2:
	mov	x0, x23
	ldp	x29, x30, [sp, #128]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #112]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #96]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #80]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #64]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #144
	ret
LBB0_3:
	mov	x19, x0
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_trace_firmware
Lloh2:
	adrp	x20, _pvr2_upload_firmware2.fw_files@PAGE
Lloh3:
	add	x20, x20, _pvr2_upload_firmware2.fw_files@PAGEOFF
	mov	x0, x20
	bl	_ARRAY_SIZE
	mov	x3, x0
Lloh4:
	adrp	x2, l_.str.1@PAGE
Lloh5:
	add	x2, x2, l_.str.1@PAGEOFF
	add	x1, sp, #40
	mov	x0, x19
	mov	x4, x20
	bl	_pvr2_locate_firmware
	mov	x21, x0
	tbnz	w0, #31, LBB0_8
; %bb.4:
	str	xzr, [x19, #32]
	add	x0, x19, #24
	bl	_del_timer_sync
	ldr	x8, [x19, #16]
	cbz	x8, LBB0_6
; %bb.5:
	str	xzr, [x19, #16]
Lloh6:
	adrp	x0, l_.str.2@PAGE
Lloh7:
	add	x0, x0, l_.str.2@PAGEOFF
	mov	x1, #0
	bl	_trace_stbit
LBB0_6:
	mov	x0, x19
	mov	w1, #72
	mov	w2, #-1
	bl	_pvr2_write_register
	mov	x22, x0
	mov	x0, x19
	mov	w1, #-1
	mov	w2, #136
	bl	_pvr2_hdw_gpio_chg_dir
	orr	w22, w0, w22
	mov	x0, x19
	mov	w1, #-1
	mov	w2, #8
	bl	_pvr2_hdw_gpio_chg_out
	orr	w22, w22, w0
	mov	x0, x19
	bl	_pvr2_hdw_cmd_deep_reset
	orr	w22, w22, w0
	mov	x0, x19
	mov	w1, #41060
	mov	w2, #0
	bl	_pvr2_write_register
	orr	w22, w22, w0
	mov	x0, x19
	mov	w1, #-1
	mov	w2, #1032
	bl	_pvr2_hdw_gpio_chg_dir
	orr	w22, w22, w0
	mov	x0, x19
	mov	w1, #-1
	mov	w2, #8
	bl	_pvr2_hdw_gpio_chg_out
	orr	w22, w22, w0
	mov	x0, x19
	mov	w1, #36952
	mov	w2, #-19
	bl	_pvr2_write_register
	orr	w22, w22, w0
	mov	x0, x19
	mov	w1, #36948
	mov	w2, #-3
	bl	_pvr2_write_register
	orr	w22, w22, w0
	mov	x0, x19
	mov	w1, #2040
	mov	w2, #2048
	movk	w2, #32768, lsl #16
	bl	_pvr2_write_register
	orr	w22, w22, w0
	mov	x0, x19
	mov	w1, #2044
	mov	w2, #26
	bl	_pvr2_write_register
	orr	w22, w22, w0
	mov	x0, x19
	mov	w1, #1792
	mov	w2, #0
	bl	_pvr2_write_register
	orr	w22, w22, w0
	mov	x0, x19
	mov	w1, #43520
	mov	w2, #0
	bl	_pvr2_write_register
	orr	w22, w22, w0
	mov	x0, x19
	mov	w1, #43524
	mov	w2, #30736
	movk	w2, #5, lsl #16
	bl	_pvr2_write_register
	orr	w22, w22, w0
	mov	x0, x19
	mov	w1, #43536
	mov	w2, #34048
	movk	w2, #20, lsl #16
	bl	_pvr2_write_register
	orr	w22, w22, w0
	mov	x0, x19
	mov	w1, #43544
	mov	w2, #8650752
	bl	_pvr2_write_register
	orr	w22, w22, w0
Lloh8:
	adrp	x8, _FX2CMD_FWPOST1@GOTPAGE
Lloh9:
	ldr	x8, [x8, _FX2CMD_FWPOST1@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_pvr2_issue_simple_cmd
	orr	w22, w22, w0
Lloh11:
	adrp	x25, _FX2CMD_MEMSEL@GOTPAGE
Lloh12:
	ldr	x25, [x25, _FX2CMD_MEMSEL@GOTPAGEOFF]
	ldr	w8, [x25]
	orr	w1, w8, #0x100
	mov	x0, x19
	bl	_pvr2_issue_simple_cmd
	orr	w23, w22, w0
	cbz	w23, LBB0_9
; %bb.7:
Lloh13:
	adrp	x8, _PVR2_TRACE_ERROR_LEGS@GOTPAGE
Lloh14:
	ldr	x8, [x8, _PVR2_TRACE_ERROR_LEGS@GOTPAGEOFF]
Lloh15:
	ldr	w0, [x8]
	str	x23, [sp]
Lloh16:
	adrp	x1, l_.str.3@PAGE
Lloh17:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_pvr2_trace
	ldr	x0, [sp, #40]
	bl	_release_firmware
	b	LBB0_29
LBB0_8:
	mov	x23, x21
	b	LBB0_2
LBB0_9:
	ldr	x8, [sp, #40]
	ldr	w27, [x8]
	tst	w27, #0x3
	b.eq	LBB0_12
; %bb.10:
Lloh18:
	adrp	x8, _PVR2_TRACE_ERROR_LEGS@GOTPAGE
Lloh19:
	ldr	x8, [x8, _PVR2_TRACE_ERROR_LEGS@GOTPAGEOFF]
Lloh20:
	ldr	w0, [x8]
	ldr	x8, [x20, w21, uxtw #3]
	mov	w9, #4
	stp	x8, x9, [sp]
Lloh21:
	adrp	x1, l_.str.4@PAGE
Lloh22:
	add	x1, x1, l_.str.4@PAGEOFF
	bl	_pvr2_trace
	ldr	x0, [sp, #40]
	bl	_release_firmware
Lloh23:
	adrp	x8, _EINVAL@GOTPAGE
Lloh24:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_11:
	ldr	w8, [x8]
	neg	w23, w8
	b	LBB0_29
LBB0_12:
Lloh25:
	adrp	x8, _FIRMWARE_CHUNK_SIZE@GOTPAGE
Lloh26:
	ldr	x8, [x8, _FIRMWARE_CHUNK_SIZE@GOTPAGEOFF]
Lloh27:
	ldr	w0, [x8]
Lloh28:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh29:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh30:
	ldr	w1, [x8]
	bl	_kmalloc
	cbz	x0, LBB0_22
; %bb.13:
	mov	x26, x0
	ldr	w0, [x19, #8]
Lloh31:
	adrp	x8, _PVR2_FIRMWARE_ENDPOINT@GOTPAGE
Lloh32:
	ldr	x8, [x8, _PVR2_FIRMWARE_ENDPOINT@GOTPAGEOFF]
Lloh33:
	ldr	w1, [x8]
	bl	_usb_sndbulkpipe
	cbz	w27, LBB0_23
; %bb.14:
	mov	x24, x0
	mov	w28, #0
LBB0_15:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_17 Depth 2
Lloh34:
	adrp	x8, _FIRMWARE_CHUNK_SIZE@GOTPAGE
Lloh35:
	ldr	x8, [x8, _FIRMWARE_CHUNK_SIZE@GOTPAGEOFF]
Lloh36:
	ldr	w8, [x8]
	sub	w9, w27, w28
	cmp	w9, w8
	csel	w25, w9, w8, lo
	ldr	x8, [sp, #40]
	ldr	x8, [x8, #8]
	add	x1, x8, w28, uxtw
	mov	x0, x26
	mov	x2, x25
	bl	_memcpy
	cmp	w25, #4
	b.lo	LBB0_18
; %bb.16:                               ;   in Loop: Header=BB0_15 Depth=1
	lsr	w23, w25, #2
	mov	x22, x26
LBB0_17:                                ;   Parent Loop BB0_15 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w0, [x22]
	bl	_swab32
	str	w0, [x22], #4
	subs	x23, x23, #1
	b.ne	LBB0_17
LBB0_18:                                ;   in Loop: Header=BB0_15 Depth=1
	ldr	w0, [x19, #8]
Lloh37:
	adrp	x8, _HZ@GOTPAGE
Lloh38:
	ldr	x8, [x8, _HZ@GOTPAGEOFF]
Lloh39:
	ldr	w5, [x8]
	add	x4, sp, #36
	mov	x1, x24
	mov	x2, x26
	mov	x3, x25
	bl	_usb_bulk_msg
	ldr	w8, [sp, #36]
	cmp	w8, w25
	cset	w8, ne
	orr	w23, w0, w8
	cbnz	w23, LBB0_21
; %bb.19:                               ;   in Loop: Header=BB0_15 Depth=1
	add	w28, w25, w28
	cmp	w27, w28
	b.hi	LBB0_15
; %bb.20:
	mov	w23, #0
LBB0_21:
Lloh40:
	adrp	x25, _FX2CMD_MEMSEL@GOTPAGE
Lloh41:
	ldr	x25, [x25, _FX2CMD_MEMSEL@GOTPAGEOFF]
	b	LBB0_24
LBB0_22:
	ldr	x0, [sp, #40]
	bl	_release_firmware
Lloh42:
	adrp	x8, _PVR2_TRACE_ERROR_LEGS@GOTPAGE
Lloh43:
	ldr	x8, [x8, _PVR2_TRACE_ERROR_LEGS@GOTPAGEOFF]
Lloh44:
	ldr	w0, [x8]
Lloh45:
	adrp	x1, l_.str.5@PAGE
Lloh46:
	add	x1, x1, l_.str.5@PAGEOFF
	bl	_pvr2_trace
Lloh47:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh48:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_11
LBB0_23:
	mov	w28, #0
	mov	w23, #0
LBB0_24:
	ldr	x8, [x20, w21, sxtw #3]
	stp	x28, x27, [sp, #8]
	str	x8, [sp]
Lloh49:
	adrp	x0, l_.str.6@PAGE
Lloh50:
	add	x0, x0, l_.str.6@PAGEOFF
	bl	_trace_firmware
	mov	x0, x26
	bl	_kfree
	ldr	x0, [sp, #40]
	bl	_release_firmware
	cbz	w23, LBB0_26
; %bb.25:
Lloh51:
	adrp	x8, _PVR2_TRACE_ERROR_LEGS@GOTPAGE
Lloh52:
	ldr	x8, [x8, _PVR2_TRACE_ERROR_LEGS@GOTPAGEOFF]
Lloh53:
	ldr	w0, [x8]
Lloh54:
	adrp	x1, l_.str.7@PAGE
Lloh55:
	add	x1, x1, l_.str.7@PAGEOFF
	b	LBB0_28
LBB0_26:
	mov	x0, x19
	mov	w1, #36948
	mov	w2, #-1
	bl	_pvr2_write_register
	mov	x20, x0
	mov	x0, x19
	mov	w1, #36952
	mov	w2, #-24
	bl	_pvr2_write_register
	orr	w20, w0, w20
	ldr	w8, [x25]
	orr	w1, w8, #0x100
	mov	x0, x19
	bl	_pvr2_issue_simple_cmd
	orr	w23, w20, w0
	cbz	w23, LBB0_29
; %bb.27:
Lloh56:
	adrp	x8, _PVR2_TRACE_ERROR_LEGS@GOTPAGE
Lloh57:
	ldr	x8, [x8, _PVR2_TRACE_ERROR_LEGS@GOTPAGEOFF]
Lloh58:
	ldr	w0, [x8]
Lloh59:
	adrp	x1, l_.str.8@PAGE
Lloh60:
	add	x1, x1, l_.str.8@PAGEOFF
LBB0_28:
	bl	_pvr2_trace
LBB0_29:
	ldr	x8, [x19]
	ldr	x8, [x8]
Lloh61:
	adrp	x9, _PVR2_ROUTING_SCHEME_GOTVIEW@GOTPAGE
Lloh62:
	ldr	x9, [x9, _PVR2_ROUTING_SCHEME_GOTVIEW@GOTPAGEOFF]
Lloh63:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_2
; %bb.30:
	mov	x0, x19
	mov	w1, #2048
	mov	w2, #-1
	bl	_pvr2_hdw_gpio_chg_dir
	b	LBB0_2
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh34, Lloh35, Lloh36
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.loh AdrpLdrGot	Lloh40, Lloh41
	.loh AdrpLdrGot	Lloh47, Lloh48
	.loh AdrpAdd	Lloh45, Lloh46
	.loh AdrpLdrGotLdr	Lloh42, Lloh43, Lloh44
	.loh AdrpAdd	Lloh49, Lloh50
	.loh AdrpAdd	Lloh54, Lloh55
	.loh AdrpLdrGotLdr	Lloh51, Lloh52, Lloh53
	.loh AdrpAdd	Lloh59, Lloh60
	.loh AdrpLdrGotLdr	Lloh56, Lloh57, Lloh58
	.loh AdrpLdrGotLdr	Lloh61, Lloh62, Lloh63
	.cfi_endproc
                                        ; -- End function
	.section	__DATA,__data
	.p2align	3                               ; @pvr2_upload_firmware2.fw_files
_pvr2_upload_firmware2.fw_files:
	.quad	128

	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"pvr2_upload_firmware2"

l_.str.1:                               ; @.str.1
	.asciz	"encoder"

l_.str.2:                               ; @.str.2
	.asciz	"state_encoder_runok"

	.comm	_FX2CMD_FWPOST1,4,2             ; @FX2CMD_FWPOST1
	.comm	_FX2CMD_MEMSEL,4,2              ; @FX2CMD_MEMSEL
	.comm	_PVR2_TRACE_ERROR_LEGS,4,2      ; @PVR2_TRACE_ERROR_LEGS
l_.str.3:                               ; @.str.3
	.asciz	"firmware2 upload prep failed, ret=%d"

l_.str.4:                               ; @.str.4
	.asciz	"size of %s firmware must be a multiple of %zu bytes"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_FIRMWARE_CHUNK_SIZE,4,2        ; @FIRMWARE_CHUNK_SIZE
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
l_.str.5:                               ; @.str.5
	.asciz	"failed to allocate memory for firmware2 upload"

	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_PVR2_FIRMWARE_ENDPOINT,4,2     ; @PVR2_FIRMWARE_ENDPOINT
	.comm	_HZ,4,2                         ; @HZ
l_.str.6:                               ; @.str.6
	.asciz	"upload of %s : %i / %i "

l_.str.7:                               ; @.str.7
	.asciz	"firmware2 upload transfer failure"

l_.str.8:                               ; @.str.8
	.asciz	"firmware2 upload post-proc failure"

	.comm	_PVR2_ROUTING_SCHEME_GOTVIEW,8,3 ; @PVR2_ROUTING_SCHEME_GOTVIEW
.subsections_via_symbols
