	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function pvr2_upload_firmware1
_pvr2_upload_firmware1:                 ## @pvr2_upload_firmware1
	.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, %rbx
	movq	$0, -48(%rbp)
	movq	8(%rdi), %rax
	cmpl	$0, 12(%rax)
	je	LBB0_1
## %bb.2:
	movq	_FW1_STATE_FAILED@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%rbx)
	leaq	L_.str.1(%rip), %rdi
	xorl	%eax, %eax
	callq	_trace_firmware
	movq	8(%rbx), %rax
	movl	8(%rax), %r8d
	movl	12(%rax), %ecx
	leaq	L_.str.2(%rip), %rdx
	leaq	-48(%rbp), %rsi
	movq	%rbx, %rdi
	callq	_pvr2_locate_firmware
	testl	%eax, %eax
	js	LBB0_3
## %bb.5:
	movl	4(%rbx), %r14d
	movl	%r14d, %edi
	xorl	%esi, %esi
	callq	_usb_sndbulkpipe
	movl	%r14d, %edi
	movl	%eax, %esi
	callq	_usb_clear_halt
	movl	4(%rbx), %edi
	xorl	%esi, %esi
	callq	_usb_sndctrlpipe
	movl	%eax, %r15d
	movq	-48(%rbp), %rax
	movl	(%rax), %r12d
	cmpl	$8192, %r12d                    ## imm = 0x2000
	je	LBB0_9
## %bb.6:
	movq	8(%rbx), %rax
	movq	(%rax), %rax
	testq	%rax, %rax
	je	LBB0_8
## %bb.7:
	cmpl	$16384, %r12d                   ## imm = 0x4000
	jne	LBB0_8
LBB0_9:
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$2048, %edi                     ## imm = 0x800
	callq	_kmalloc
	testq	%rax, %rax
	je	LBB0_10
## %bb.11:
	movq	%rax, %r13
	movq	%rbx, %rdi
	movl	$1, %esi
	callq	_pvr2_hdw_cpureset_assert
	movl	%r12d, %eax
	movq	%rbx, %r12
	xorl	%r14d, %r14d
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_12:                                ## =>This Inner Loop Header: Depth=1
	movq	-48(%rbp), %rax
	movl	%r14d, %esi
	addq	8(%rax), %rsi
	movq	%r13, %rdi
	movl	$2048, %edx                     ## imm = 0x800
	callq	_memcpy
	movl	4(%r12), %edi
	movq	_HZ@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	subq	$8, %rsp
	movl	%r15d, %esi
	movl	$160, %edx
	movl	$64, %ecx
	movl	%r14d, %r8d
	xorl	%r9d, %r9d
	pushq	%rax
	pushq	$2048                           ## imm = 0x800
	pushq	%r13
	callq	_usb_control_msg
	addq	$32, %rsp
	addl	%eax, %ebx
	addl	$2048, %r14d                    ## imm = 0x800
	cmpl	-52(%rbp), %r14d                ## 4-byte Folded Reload
	jb	LBB0_12
## %bb.13:
	leaq	L_.str.5(%rip), %rdi
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	callq	_trace_firmware
	movq	%r12, %rdi
	xorl	%esi, %esi
	callq	_pvr2_hdw_cpureset_assert
	movq	%r13, %rdi
	callq	_kfree
	movq	-48(%rbp), %rdi
	callq	_release_firmware
	leaq	L_.str.6(%rip), %rdi
	movl	%ebx, %esi
	xorl	%eax, %eax
	callq	_trace_firmware
	cmpl	-52(%rbp), %ebx                 ## 4-byte Folded Reload
	jne	LBB0_15
## %bb.14:
	movq	_FW1_STATE_RELOAD@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%r12)
	jmp	LBB0_17
LBB0_1:
	movq	_FW1_STATE_OK@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%rbx)
	movq	_PVR2_TRACE_ERROR_LEGS@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	callq	_pvr2_trace
	movq	_ENOTTY@GOTPCREL(%rip), %rax
	jmp	LBB0_16
LBB0_3:
	movl	%eax, %r14d
	movq	_ENOENT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	%r14d, %eax
	jne	LBB0_17
## %bb.4:
	movq	_FW1_STATE_MISSING@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%rbx)
	jmp	LBB0_17
LBB0_10:
	movq	-48(%rbp), %rdi
	callq	_release_firmware
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	jmp	LBB0_16
LBB0_8:
	testq	%rax, %rax
	movq	_PVR2_TRACE_ERROR_LEGS@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.3(%rip), %rax
	leaq	L_.str.4(%rip), %rsi
	cmovneq	%rax, %rsi
	xorl	%r14d, %r14d
	movl	%r12d, %edx
	xorl	%eax, %eax
	callq	_pvr2_trace
	movq	-48(%rbp), %rdi
	callq	_release_firmware
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_16
LBB0_15:
	movq	_EIO@GOTPCREL(%rip), %rax
LBB0_16:
	subl	(%rax), %r14d
LBB0_17:
	movl	%r14d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_FW1_STATE_OK,4,2               ## @FW1_STATE_OK
	.comm	_PVR2_TRACE_ERROR_LEGS,4,2      ## @PVR2_TRACE_ERROR_LEGS
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Connected device type defines no firmware to upload; ignoring firmware"

	.comm	_ENOTTY,4,2                     ## @ENOTTY
	.comm	_FW1_STATE_FAILED,4,2           ## @FW1_STATE_FAILED
L_.str.1:                               ## @.str.1
	.asciz	"pvr2_upload_firmware1"

L_.str.2:                               ## @.str.2
	.asciz	"fx2 controller"

	.comm	_ENOENT,4,2                     ## @ENOENT
	.comm	_FW1_STATE_MISSING,4,2          ## @FW1_STATE_MISSING
L_.str.3:                               ## @.str.3
	.asciz	"Wrong fx2 firmware size (expected 8192 or 16384, got %u)"

L_.str.4:                               ## @.str.4
	.asciz	"Wrong fx2 firmware size (expected 8192, got %u)"

	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_HZ,4,2                         ## @HZ
L_.str.5:                               ## @.str.5
	.asciz	"Upload done, releasing device's CPU"

L_.str.6:                               ## @.str.6
	.asciz	"Upload done (%d bytes sent)"

	.comm	_FW1_STATE_RELOAD,4,2           ## @FW1_STATE_RELOAD
	.comm	_EIO,4,2                        ## @EIO
	.no_dead_strip	_pvr2_upload_firmware1
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function pvr2_upload_firmware1
_pvr2_upload_firmware1:                 ; @pvr2_upload_firmware1
	.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	x19, x0
	str	xzr, [sp, #8]
	ldr	x8, [x0, #8]
	ldr	w8, [x8, #12]
	cbz	w8, LBB0_10
; %bb.1:
Lloh0:
	adrp	x8, _FW1_STATE_FAILED@GOTPAGE
Lloh1:
	ldr	x8, [x8, _FW1_STATE_FAILED@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	str	w8, [x19]
Lloh3:
	adrp	x0, l_.str.1@PAGE
Lloh4:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_trace_firmware
	ldr	x8, [x19, #8]
	ldp	w4, w3, [x8, #8]
Lloh5:
	adrp	x2, l_.str.2@PAGE
Lloh6:
	add	x2, x2, l_.str.2@PAGEOFF
	add	x1, sp, #8
	mov	x0, x19
	bl	_pvr2_locate_firmware
	tbnz	w0, #31, LBB0_11
; %bb.2:
	ldr	w20, [x19, #4]
	mov	x0, x20
	mov	w1, #0
	bl	_usb_sndbulkpipe
	mov	x1, x0
	mov	x0, x20
	bl	_usb_clear_halt
	ldr	w0, [x19, #4]
	mov	w1, #0
	bl	_usb_sndctrlpipe
	mov	x20, x0
	ldr	x8, [sp, #8]
	ldr	w23, [x8]
	cmp	w23, #2, lsl #12                ; =8192
	b.eq	LBB0_5
; %bb.3:
	ldr	x8, [x19, #8]
	ldr	x8, [x8]
	cbz	x8, LBB0_14
; %bb.4:
	cmp	w23, #4, lsl #12                ; =16384
	b.ne	LBB0_14
LBB0_5:
Lloh7:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh8:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh9:
	ldr	w1, [x8]
	mov	w0, #2048
	bl	_kmalloc
	cbz	x0, LBB0_15
; %bb.6:
	mov	x21, x0
	mov	x0, x19
	mov	w1, #1
	bl	_pvr2_hdw_cpureset_assert
	mov	w22, #0
	mov	w24, #0
Lloh10:
	adrp	x25, _HZ@GOTPAGE
Lloh11:
	ldr	x25, [x25, _HZ@GOTPAGEOFF]
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [sp, #8]
	ldr	x8, [x8, #8]
	add	x1, x8, w22, uxtw
	mov	x0, x21
	mov	w2, #2048
	bl	_memcpy
	ldr	w0, [x19, #4]
	ldr	w8, [x25]
	str	w8, [sp]
	mov	x1, x20
	mov	w2, #160
	mov	w3, #64
	mov	x4, x22
	mov	w5, #0
	mov	x6, x21
	mov	w7, #2048
	bl	_usb_control_msg
	add	w24, w24, w0
	add	w22, w22, #2048
	cmp	w22, w23
	b.lo	LBB0_7
; %bb.8:
Lloh12:
	adrp	x0, l_.str.5@PAGE
Lloh13:
	add	x0, x0, l_.str.5@PAGEOFF
	bl	_trace_firmware
	mov	x0, x19
	mov	w1, #0
	bl	_pvr2_hdw_cpureset_assert
	mov	x0, x21
	bl	_kfree
	ldr	x0, [sp, #8]
	bl	_release_firmware
	str	x24, [sp]
Lloh14:
	adrp	x0, l_.str.6@PAGE
Lloh15:
	add	x0, x0, l_.str.6@PAGEOFF
	bl	_trace_firmware
	cmp	w24, w23
	b.ne	LBB0_16
; %bb.9:
	mov	w0, #0
Lloh16:
	adrp	x8, _FW1_STATE_RELOAD@GOTPAGE
Lloh17:
	ldr	x8, [x8, _FW1_STATE_RELOAD@GOTPAGEOFF]
	b	LBB0_13
LBB0_10:
Lloh18:
	adrp	x8, _FW1_STATE_OK@GOTPAGE
Lloh19:
	ldr	x8, [x8, _FW1_STATE_OK@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	str	w8, [x19]
Lloh21:
	adrp	x8, _PVR2_TRACE_ERROR_LEGS@GOTPAGE
Lloh22:
	ldr	x8, [x8, _PVR2_TRACE_ERROR_LEGS@GOTPAGEOFF]
Lloh23:
	ldr	w0, [x8]
Lloh24:
	adrp	x1, l_.str@PAGE
Lloh25:
	add	x1, x1, l_.str@PAGEOFF
	bl	_pvr2_trace
Lloh26:
	adrp	x8, _ENOTTY@GOTPAGE
Lloh27:
	ldr	x8, [x8, _ENOTTY@GOTPAGEOFF]
	b	LBB0_17
LBB0_11:
Lloh28:
	adrp	x8, _ENOENT@GOTPAGE
Lloh29:
	ldr	x8, [x8, _ENOENT@GOTPAGEOFF]
Lloh30:
	ldr	w8, [x8]
	cmn	w0, w8
	b.ne	LBB0_18
; %bb.12:
Lloh31:
	adrp	x8, _FW1_STATE_MISSING@GOTPAGE
Lloh32:
	ldr	x8, [x8, _FW1_STATE_MISSING@GOTPAGEOFF]
LBB0_13:
	ldr	w8, [x8]
	str	w8, [x19]
	b	LBB0_18
LBB0_14:
Lloh33:
	adrp	x9, _PVR2_TRACE_ERROR_LEGS@GOTPAGE
Lloh34:
	ldr	x9, [x9, _PVR2_TRACE_ERROR_LEGS@GOTPAGEOFF]
Lloh35:
	ldr	w0, [x9]
Lloh36:
	adrp	x9, l_.str.4@PAGE
Lloh37:
	add	x9, x9, l_.str.4@PAGEOFF
Lloh38:
	adrp	x10, l_.str.3@PAGE
Lloh39:
	add	x10, x10, l_.str.3@PAGEOFF
	cmp	x8, #0
	csel	x1, x10, x9, ne
	str	x23, [sp]
	bl	_pvr2_trace
LBB0_15:
	ldr	x0, [sp, #8]
	bl	_release_firmware
Lloh40:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh41:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_17
LBB0_16:
Lloh42:
	adrp	x8, _EIO@GOTPAGE
Lloh43:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
LBB0_17:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_18:
	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 AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh26, Lloh27
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGot	Lloh31, Lloh32
	.loh AdrpAdd	Lloh38, Lloh39
	.loh AdrpAdd	Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGot	Lloh40, Lloh41
	.loh AdrpLdrGot	Lloh42, Lloh43
	.cfi_endproc
                                        ; -- End function
	.comm	_FW1_STATE_OK,4,2               ; @FW1_STATE_OK
	.comm	_PVR2_TRACE_ERROR_LEGS,4,2      ; @PVR2_TRACE_ERROR_LEGS
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Connected device type defines no firmware to upload; ignoring firmware"

	.comm	_ENOTTY,4,2                     ; @ENOTTY
	.comm	_FW1_STATE_FAILED,4,2           ; @FW1_STATE_FAILED
l_.str.1:                               ; @.str.1
	.asciz	"pvr2_upload_firmware1"

l_.str.2:                               ; @.str.2
	.asciz	"fx2 controller"

	.comm	_ENOENT,4,2                     ; @ENOENT
	.comm	_FW1_STATE_MISSING,4,2          ; @FW1_STATE_MISSING
l_.str.3:                               ; @.str.3
	.asciz	"Wrong fx2 firmware size (expected 8192 or 16384, got %u)"

l_.str.4:                               ; @.str.4
	.asciz	"Wrong fx2 firmware size (expected 8192, got %u)"

	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_HZ,4,2                         ; @HZ
l_.str.5:                               ; @.str.5
	.asciz	"Upload done, releasing device's CPU"

l_.str.6:                               ; @.str.6
	.asciz	"Upload done (%d bytes sent)"

	.comm	_FW1_STATE_RELOAD,4,2           ; @FW1_STATE_RELOAD
	.comm	_EIO,4,2                        ; @EIO
	.no_dead_strip	_pvr2_upload_firmware1
.subsections_via_symbols
