	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function load_fw_from_host
_load_fw_from_host:                     ## @load_fw_from_host
	.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	%rdi, %r12
	movq	8(%rdi), %r14
	movl	$0, (%rdi)
	movq	_FILENAME_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_7
## %bb.1:
	movq	%rax, %r15
	movq	%r12, %rdi
	movq	%rax, %rsi
	callq	_get_firmware_variant
	testl	%eax, %eax
	js	LBB0_9
## %bb.2:
	movq	%r12, %rdi
	callq	_cl_data_to_dev
	leaq	-40(%rbp), %rdi
	movq	%r15, %rsi
	movl	%eax, %edx
	callq	_request_firmware
	testl	%eax, %eax
	js	LBB0_9
## %bb.3:
	movq	-40(%rbp), %rsi
	leaq	-48(%rbp), %rdx
	movq	%r12, %rdi
	callq	_ish_query_loader_prop
	testl	%eax, %eax
	js	LBB0_15
## %bb.4:
	movl	-48(%rbp), %edx
	movq	_LOADER_XFER_MODE_DIRECT_DMA@GOTPCREL(%rip), %rax
	testl	%edx, (%rax)
	je	LBB0_10
## %bb.5:
	movq	-40(%rbp), %rsi
	movq	%r12, %rdi
	callq	_ish_fw_xfer_direct_dma
	jmp	LBB0_6
LBB0_9:
	movl	%eax, %ebx
	jmp	LBB0_17
LBB0_7:
	movl	$1, (%r12)
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_18
LBB0_10:
	movq	_LOADER_XFER_MODE_ISHTP@GOTPCREL(%rip), %rax
	testl	%edx, (%rax)
	je	LBB0_12
## %bb.11:
	movq	-40(%rbp), %rsi
	movq	%r12, %rdi
	callq	_ish_fw_xfer_ishtp
LBB0_6:
	movl	%eax, %ebx
	testl	%ebx, %ebx
	js	LBB0_16
LBB0_13:
	movq	%r12, %rdi
	callq	_ish_fw_start
	testl	%eax, %eax
	js	LBB0_15
## %bb.14:
	movq	-40(%rbp), %rdi
	callq	_release_firmware
	movq	%r12, %rdi
	callq	_cl_data_to_dev
	leaq	L_.str.1(%rip), %rsi
	movl	%eax, %edi
	movq	%r15, %rdx
	callq	_dev_info
	movq	%r15, %rdi
	callq	_kfree
	xorl	%ebx, %ebx
	jmp	LBB0_21
LBB0_15:
	movl	%eax, %ebx
LBB0_16:
	movq	-40(%rbp), %rdi
	callq	_release_firmware
LBB0_17:
	movq	%r15, %rdi
	callq	_kfree
	cmpl	$0, (%r12)
	je	LBB0_20
LBB0_18:
	movslq	4(%r12), %rax
	leal	1(%rax), %ecx
	movl	%ecx, 4(%r12)
	movq	_MAX_LOAD_ATTEMPTS@GOTPCREL(%rip), %rcx
	cmpq	%rax, (%rcx)
	jle	LBB0_20
## %bb.19:
	movq	%r12, %rdi
	callq	_cl_data_to_dev
	leaq	L_.str.2(%rip), %rsi
	movl	%eax, %edi
	movl	%ebx, %edx
	callq	_dev_warn
	movq	%r14, %rdi
	callq	_ishtp_get_ishtp_device
	movl	%eax, %edi
	callq	_ish_hw_reset
	jmp	LBB0_21
LBB0_20:
	movq	%r12, %rdi
	callq	_cl_data_to_dev
	leaq	L_.str.3(%rip), %rsi
	movl	%eax, %edi
	movl	%ebx, %edx
	xorl	%eax, %eax
	callq	_dev_err
LBB0_21:
	movl	%ebx, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_12:
	movq	%r12, %rdi
	callq	_cl_data_to_dev
	leaq	L_.str(%rip), %rsi
	xorl	%ebx, %ebx
	movl	%eax, %edi
	xorl	%eax, %eax
	callq	_dev_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	testl	%ebx, %ebx
	jns	LBB0_13
	jmp	LBB0_16
	.cfi_endproc
                                        ## -- End function
	.comm	_FILENAME_SIZE,4,2              ## @FILENAME_SIZE
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_LOADER_XFER_MODE_DIRECT_DMA,4,2 ## @LOADER_XFER_MODE_DIRECT_DMA
	.comm	_LOADER_XFER_MODE_ISHTP,4,2     ## @LOADER_XFER_MODE_ISHTP
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"No transfer mode selected in firmware\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.1:                               ## @.str.1
	.asciz	"ISH firmware %s loaded\n"

	.comm	_MAX_LOAD_ATTEMPTS,8,3          ## @MAX_LOAD_ATTEMPTS
L_.str.2:                               ## @.str.2
	.asciz	"ISH host firmware load failed %d. Resetting ISH, and trying again..\n"

L_.str.3:                               ## @.str.3
	.asciz	"ISH host firmware load failed %d\n"

	.no_dead_strip	_load_fw_from_host
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function load_fw_from_host
_load_fw_from_host:                     ; @load_fw_from_host
	.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, x0
	ldr	x20, [x0, #8]
	str	wzr, [x0]
Lloh0:
	adrp	x8, _FILENAME_SIZE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _FILENAME_SIZE@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
Lloh3:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	bl	_kzalloc
	cbz	x0, LBB0_7
; %bb.1:
	mov	x21, x0
	mov	x0, x19
	mov	x1, x21
	bl	_get_firmware_variant
	tbnz	w0, #31, LBB0_6
; %bb.2:
	mov	x0, x19
	bl	_cl_data_to_dev
	mov	x2, x0
	add	x0, sp, #24
	mov	x1, x21
	bl	_request_firmware
	tbnz	w0, #31, LBB0_6
; %bb.3:
	ldr	x1, [sp, #24]
	add	x2, sp, #16
	mov	x0, x19
	bl	_ish_query_loader_prop
	tbnz	w0, #31, LBB0_13
; %bb.4:
	ldr	w2, [sp, #16]
Lloh6:
	adrp	x8, _LOADER_XFER_MODE_DIRECT_DMA@GOTPAGE
Lloh7:
	ldr	x8, [x8, _LOADER_XFER_MODE_DIRECT_DMA@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	tst	w8, w2
	b.eq	LBB0_8
; %bb.5:
	ldr	x1, [sp, #24]
	mov	x0, x19
	bl	_ish_fw_xfer_direct_dma
	mov	x22, x0
	tbz	w22, #31, LBB0_11
	b	LBB0_14
LBB0_6:
	mov	x22, x0
	b	LBB0_15
LBB0_7:
	mov	w8, #1
	str	w8, [x19]
Lloh9:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh10:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	neg	w22, w8
	b	LBB0_16
LBB0_8:
Lloh12:
	adrp	x8, _LOADER_XFER_MODE_ISHTP@GOTPAGE
Lloh13:
	ldr	x8, [x8, _LOADER_XFER_MODE_ISHTP@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	tst	w8, w2
	b.eq	LBB0_10
; %bb.9:
	ldr	x1, [sp, #24]
	mov	x0, x19
	bl	_ish_fw_xfer_ishtp
	mov	x22, x0
	tbz	w22, #31, LBB0_11
	b	LBB0_14
LBB0_10:
	mov	x0, x19
	bl	_cl_data_to_dev
Lloh15:
	adrp	x1, l_.str@PAGE
Lloh16:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
Lloh17:
	adrp	x8, _EINVAL@GOTPAGE
Lloh18:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh19:
	ldr	w8, [x8]
	neg	w22, w8
	tbnz	w22, #31, LBB0_14
LBB0_11:
	mov	x0, x19
	bl	_ish_fw_start
	tbnz	w0, #31, LBB0_13
; %bb.12:
	ldr	x0, [sp, #24]
	bl	_release_firmware
	mov	x0, x19
	bl	_cl_data_to_dev
Lloh20:
	adrp	x1, l_.str.1@PAGE
Lloh21:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x21
	bl	_dev_info
	mov	x0, x21
	bl	_kfree
	mov	w22, #0
	b	LBB0_19
LBB0_13:
	mov	x22, x0
LBB0_14:
	ldr	x0, [sp, #24]
	bl	_release_firmware
LBB0_15:
	mov	x0, x21
	bl	_kfree
	ldr	w8, [x19]
	cbz	w8, LBB0_18
LBB0_16:
	ldrsw	x8, [x19, #4]
	add	w9, w8, #1
	str	w9, [x19, #4]
Lloh22:
	adrp	x9, _MAX_LOAD_ATTEMPTS@GOTPAGE
Lloh23:
	ldr	x9, [x9, _MAX_LOAD_ATTEMPTS@GOTPAGEOFF]
Lloh24:
	ldr	x9, [x9]
	cmp	x9, x8
	b.le	LBB0_18
; %bb.17:
	mov	x0, x19
	bl	_cl_data_to_dev
Lloh25:
	adrp	x1, l_.str.2@PAGE
Lloh26:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x2, x22
	bl	_dev_warn
	mov	x0, x20
	bl	_ishtp_get_ishtp_device
	bl	_ish_hw_reset
	b	LBB0_19
LBB0_18:
	mov	x0, x19
	bl	_cl_data_to_dev
	str	x22, [sp]
Lloh27:
	adrp	x1, l_.str.3@PAGE
Lloh28:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_dev_err
LBB0_19:
	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
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpAdd	Lloh25, Lloh26
	.loh AdrpAdd	Lloh27, Lloh28
	.cfi_endproc
                                        ; -- End function
	.comm	_FILENAME_SIZE,4,2              ; @FILENAME_SIZE
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_LOADER_XFER_MODE_DIRECT_DMA,4,2 ; @LOADER_XFER_MODE_DIRECT_DMA
	.comm	_LOADER_XFER_MODE_ISHTP,4,2     ; @LOADER_XFER_MODE_ISHTP
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"No transfer mode selected in firmware\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.1:                               ; @.str.1
	.asciz	"ISH firmware %s loaded\n"

	.comm	_MAX_LOAD_ATTEMPTS,8,3          ; @MAX_LOAD_ATTEMPTS
l_.str.2:                               ; @.str.2
	.asciz	"ISH host firmware load failed %d. Resetting ISH, and trying again..\n"

l_.str.3:                               ; @.str.3
	.asciz	"ISH host firmware load failed %d\n"

	.no_dead_strip	_load_fw_from_host
.subsections_via_symbols
