	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function be_fw_download
_be_fw_download:                        ## @be_fw_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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r15
	movq	%rdi, %rbx
	movl	$4, -56(%rbp)
	movq	8(%rdi), %rdi
	leaq	-52(%rbp), %rdx
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	$4, %esi
	callq	_dma_alloc_coherent
	movl	%eax, -48(%rbp)
	testl	%eax, %eax
	je	LBB0_14
## %bb.1:
	movq	(%r15), %r12
	movq	%rbx, -64(%rbp)                 ## 8-byte Spill
	movq	%rbx, %rdi
	movq	%r12, %rsi
	callq	_be_get_ufi_type
	movl	%eax, %ebx
	movl	(%r12), %edi
	callq	_le32_to_cpu
	testl	%eax, %eax
	jle	LBB0_15
## %bb.2:
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movl	%eax, %r13d
	shlq	$4, %r13
	xorl	%r14d, %r14d
	xorl	%r12d, %r12d
	jmp	LBB0_7
LBB0_3:                                 ##   in Loop: Header=BB0_7 Depth=1
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
LBB0_4:                                 ##   in Loop: Header=BB0_7 Depth=1
	movq	%r15, %rsi
	leaq	-56(%rbp), %rdx
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	callq	_be_flash_BEx
LBB0_5:                                 ##   in Loop: Header=BB0_7 Depth=1
	movl	%eax, %r12d
LBB0_6:                                 ##   in Loop: Header=BB0_7 Depth=1
	addq	$16, %r14
	cmpq	%r14, %r13
	je	LBB0_16
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%r15), %rax
	movl	16(%rax,%r14), %edi
	callq	_le32_to_cpu
	cmpl	$1, %eax
	jne	LBB0_6
## %bb.8:                               ##   in Loop: Header=BB0_7 Depth=1
	cmpl	$130, %ebx
	je	LBB0_12
## %bb.9:                               ##   in Loop: Header=BB0_7 Depth=1
	cmpl	$129, %ebx
	je	LBB0_3
## %bb.10:                              ##   in Loop: Header=BB0_7 Depth=1
	cmpl	$128, %ebx
	jne	LBB0_6
## %bb.11:                              ##   in Loop: Header=BB0_7 Depth=1
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movq	%r15, %rsi
	leaq	-56(%rbp), %rdx
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	callq	_be_flash_skyhawk
	jmp	LBB0_5
LBB0_12:                                ##   in Loop: Header=BB0_7 Depth=1
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	cmpl	$15, (%rdi)
	jle	LBB0_4
## %bb.13:                              ##   in Loop: Header=BB0_7 Depth=1
	movq	8(%rdi), %rdi
	leaq	L_.str(%rip), %rsi
	callq	_dev_err
	movl	$-1, %r12d
	jmp	LBB0_6
LBB0_14:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r12d, %r12d
	subl	(%rax), %r12d
	jmp	LBB0_22
LBB0_15:
	xorl	%r12d, %r12d
LBB0_16:
	movq	_UFI_TYPE2@GOTPCREL(%rip), %rax
	cmpl	(%rax), %ebx
	jne	LBB0_18
## %bb.17:
	leaq	-56(%rbp), %rdx
	movq	-64(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdi
	movq	%r15, %rsi
	xorl	%ecx, %ecx
	callq	_be_flash_BEx
	movl	%eax, %r12d
	jmp	LBB0_19
LBB0_18:
	cmpl	$-1, %ebx
	cmovel	%ebx, %r12d
	movq	-64(%rbp), %rbx                 ## 8-byte Reload
LBB0_19:
	movq	8(%rbx), %rdi
	movl	-48(%rbp), %edx
	movl	-56(%rbp), %esi
	movl	-52(%rbp), %ecx
	callq	_dma_free_coherent
	movq	8(%rbx), %rdi
	testl	%r12d, %r12d
	je	LBB0_21
## %bb.20:
	leaq	L_.str.1(%rip), %rsi
	callq	_dev_err
	jmp	LBB0_22
LBB0_21:
	leaq	L_.str.2(%rip), %rsi
	callq	_dev_info
	xorl	%r12d, %r12d
LBB0_22:
	movl	%r12d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Can't load BE3 UFI on BE3R\n"

	.comm	_UFI_TYPE2,4,2                  ## @UFI_TYPE2
L_.str.1:                               ## @.str.1
	.asciz	"Firmware load error\n"

L_.str.2:                               ## @.str.2
	.asciz	"Firmware flashed successfully\n"

	.no_dead_strip	_be_fw_download
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function be_fw_download
_be_fw_download:                        ; @be_fw_download
	.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	x20, x1
	mov	x19, x0
	mov	w8, #4
	str	w8, [sp]
	ldr	x0, [x0, #8]
	mov	x8, sp
	orr	x2, x8, #0x4
Lloh0:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh2:
	ldr	w3, [x8]
	mov	w1, #4
	bl	_dma_alloc_coherent
	str	w0, [sp, #8]
	cbz	w0, LBB0_13
; %bb.1:
	ldr	x22, [x20]
	mov	x0, x19
	mov	x1, x22
	bl	_be_get_ufi_type
	mov	x21, x0
	ldr	w0, [x22]
	bl	_le32_to_cpu
	cmp	w0, #1
	b.lt	LBB0_14
; %bb.2:
	mov	x22, x0
	mov	x25, #0
	mov	w24, #0
	mov	w8, w0
	lsl	x26, x8, #4
Lloh3:
	adrp	x23, l_.str@PAGE
Lloh4:
	add	x23, x23, l_.str@PAGEOFF
	b	LBB0_6
LBB0_3:                                 ;   in Loop: Header=BB0_6 Depth=1
	mov	x2, sp
	mov	x0, x19
	mov	x1, x20
	mov	x3, x22
	bl	_be_flash_BEx
LBB0_4:                                 ;   in Loop: Header=BB0_6 Depth=1
	mov	x24, x0
LBB0_5:                                 ;   in Loop: Header=BB0_6 Depth=1
	add	x25, x25, #16
	cmp	x26, x25
	b.eq	LBB0_15
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x20]
	add	x8, x8, x25
	ldr	w0, [x8, #16]
	bl	_le32_to_cpu
	cmp	w0, #1
	b.ne	LBB0_5
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	cmp	w21, #130
	b.eq	LBB0_11
; %bb.8:                                ;   in Loop: Header=BB0_6 Depth=1
	cmp	w21, #129
	b.eq	LBB0_3
; %bb.9:                                ;   in Loop: Header=BB0_6 Depth=1
	cmp	w21, #128
	b.ne	LBB0_5
; %bb.10:                               ;   in Loop: Header=BB0_6 Depth=1
	mov	x2, sp
	mov	x0, x19
	mov	x1, x20
	mov	x3, x22
	bl	_be_flash_skyhawk
	b	LBB0_4
LBB0_11:                                ;   in Loop: Header=BB0_6 Depth=1
	ldr	w8, [x19]
	cmp	w8, #15
	b.le	LBB0_3
; %bb.12:                               ;   in Loop: Header=BB0_6 Depth=1
	ldr	x0, [x19, #8]
	mov	x1, x23
	bl	_dev_err
	mov	w24, #-1
	b	LBB0_5
LBB0_13:
Lloh5:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh6:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_21
LBB0_14:
	mov	w24, #0
LBB0_15:
Lloh8:
	adrp	x8, _UFI_TYPE2@GOTPAGE
Lloh9:
	ldr	x8, [x8, _UFI_TYPE2@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	cmp	w21, w8
	b.ne	LBB0_17
; %bb.16:
	mov	x2, sp
	mov	x0, x19
	mov	x1, x20
	mov	w3, #0
	bl	_be_flash_BEx
	mov	x20, x0
	b	LBB0_18
LBB0_17:
	cmn	w21, #1
	csinv	w20, w24, wzr, ne
LBB0_18:
	ldr	x0, [x19, #8]
	ldp	w3, w2, [sp, #4]
	ldr	w1, [sp]
	bl	_dma_free_coherent
	ldr	x0, [x19, #8]
	cbz	w20, LBB0_20
; %bb.19:
Lloh11:
	adrp	x1, l_.str.1@PAGE
Lloh12:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err
	b	LBB0_21
LBB0_20:
Lloh13:
	adrp	x1, l_.str.2@PAGE
Lloh14:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_dev_info
LBB0_21:
	mov	x0, x20
	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 AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpAdd	Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Can't load BE3 UFI on BE3R\n"

	.comm	_UFI_TYPE2,4,2                  ; @UFI_TYPE2
l_.str.1:                               ; @.str.1
	.asciz	"Firmware load error\n"

l_.str.2:                               ; @.str.2
	.asciz	"Firmware flashed successfully\n"

	.no_dead_strip	_be_fw_download
.subsections_via_symbols
