	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ims_pcu_update_firmware_store
_ims_pcu_update_firmware_store:         ## @ims_pcu_update_firmware_store
	.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
	movq	%rcx, %r14
	movq	%rdx, %rbx
	callq	_to_usb_interface
	movq	%rax, %rdi
	callq	_usb_get_intfdata
	movq	%rax, %r12
	movq	$0, -40(%rbp)
	leaq	-44(%rbp), %rdx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_kstrtoint
	testl	%eax, %eax
	jne	LBB0_11
## %bb.1:
	cmpl	$1, -44(%rbp)
	jne	LBB0_2
## %bb.3:
	movq	%r12, %rdi
	callq	_mutex_lock_interruptible
	testl	%eax, %eax
	jne	LBB0_11
## %bb.4:
	movq	_IMS_PCU_FIRMWARE_NAME@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	movl	16(%r12), %edx
	leaq	-40(%rbp), %rdi
	callq	_request_ihex_firmware
	testl	%eax, %eax
	je	LBB0_6
## %bb.5:
	movl	%eax, %r15d
	movl	16(%r12), %edi
	movl	(%rbx), %edx
	leaq	L_.str(%rip), %rsi
	movl	%eax, %ecx
	callq	_dev_err
	jmp	LBB0_10
LBB0_2:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_11
LBB0_6:
	cmpq	$0, 8(%r12)
	je	LBB0_8
## %bb.7:
	movq	-40(%rbp), %rsi
	movq	%r12, %rdi
	callq	_ims_pcu_handle_firmware_update
	jmp	LBB0_9
LBB0_8:
	movq	%r12, %rdi
	callq	_ims_pcu_switch_to_bootloader
LBB0_9:
	movl	%eax, %r15d
	movq	-40(%rbp), %rdi
	callq	_release_firmware
LBB0_10:
	movq	%r12, %rdi
	callq	_mutex_unlock
	testl	%r15d, %r15d
	cmovnel	%r15d, %r14d
	movl	%r14d, %eax
LBB0_11:
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_IMS_PCU_FIRMWARE_NAME,4,2      ## @IMS_PCU_FIRMWARE_NAME
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to request firmware %s, error: %d\n"

	.no_dead_strip	_ims_pcu_update_firmware_store
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ims_pcu_update_firmware_store
_ims_pcu_update_firmware_store:         ; @ims_pcu_update_firmware_store
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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, x3
	mov	x21, x2
	bl	_to_usb_interface
	bl	_usb_get_intfdata
	mov	x20, x0
	str	xzr, [sp, #8]
	add	x2, sp, #4
	mov	x0, x21
	mov	w1, #0
	bl	_kstrtoint
	cbnz	w0, LBB0_11
; %bb.1:
	ldr	w8, [sp, #4]
	cmp	w8, #1
	b.ne	LBB0_5
; %bb.2:
	mov	x0, x20
	bl	_mutex_lock_interruptible
	cbnz	w0, LBB0_11
; %bb.3:
Lloh0:
	adrp	x22, _IMS_PCU_FIRMWARE_NAME@GOTPAGE
Lloh1:
	ldr	x22, [x22, _IMS_PCU_FIRMWARE_NAME@GOTPAGEOFF]
	ldr	w1, [x22]
	ldr	w2, [x20, #16]
	add	x0, sp, #8
	bl	_request_ihex_firmware
	cbz	w0, LBB0_6
; %bb.4:
	mov	x21, x0
	ldr	w0, [x20, #16]
	ldr	w2, [x22]
Lloh2:
	adrp	x1, l_.str@PAGE
Lloh3:
	add	x1, x1, l_.str@PAGEOFF
	mov	x3, x21
	bl	_dev_err
	b	LBB0_10
LBB0_5:
Lloh4:
	adrp	x8, _EINVAL@GOTPAGE
Lloh5:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_11
LBB0_6:
	ldr	x8, [x20, #8]
	cbz	x8, LBB0_8
; %bb.7:
	ldr	x1, [sp, #8]
	mov	x0, x20
	bl	_ims_pcu_handle_firmware_update
	b	LBB0_9
LBB0_8:
	mov	x0, x20
	bl	_ims_pcu_switch_to_bootloader
LBB0_9:
	mov	x21, x0
	ldr	x0, [sp, #8]
	bl	_release_firmware
LBB0_10:
	mov	x0, x20
	bl	_mutex_unlock
	cmp	w21, #0
	csel	w0, w19, w21, eq
LBB0_11:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_IMS_PCU_FIRMWARE_NAME,4,2      ; @IMS_PCU_FIRMWARE_NAME
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to request firmware %s, error: %d\n"

	.no_dead_strip	_ims_pcu_update_firmware_store
.subsections_via_symbols
