	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_qlcnic_load_firmware           ## -- Begin function qlcnic_load_firmware
	.p2align	4, 0x90
_qlcnic_load_firmware:                  ## @qlcnic_load_firmware
	.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	%rdi, %r14
	movq	(%rdi), %rax
	movq	8(%rdi), %r15
	movq	_fw_name@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movq	(%rax), %rax
	movl	(%rcx,%rax,4), %edx
	movq	16(%rdi), %rbx
	leaq	L_.str(%rip), %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	callq	_dev_info
	testq	%rbx, %rbx
	je	LBB0_13
## %bb.1:
	movq	_QLCNIC_IMAGE_START@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movq	_QLCNIC_BOOTLD_START@GOTPCREL(%rip), %r12
	subl	(%r12), %ebx
	movq	%r14, %rdi
	callq	_qlcnic_get_bootld_offs
	movq	%rax, %r15
	leal	7(%rbx), %eax
	cmpl	$15, %eax
	jb	LBB0_6
## %bb.2:
	testl	%ebx, %ebx
	cmovnsl	%ebx, %eax
	movslq	(%r12), %rbx
	sarl	$3, %eax
	cmpl	$2, %eax
	movl	$1, %ecx
	cmovael	%eax, %ecx
	movslq	%ecx, %r12
	xorl	%r13d, %r13d
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r15,%r13,4), %edi
	callq	_le64_to_cpu
	movq	%r14, %rdi
	movq	%rbx, %rsi
	movl	%eax, %edx
	callq	_qlcnic_pci_mem_write_2M
	testq	%rax, %rax
	jne	LBB0_4
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	addq	$8, %rbx
	incq	%r13
	cmpq	%r13, %r12
	jne	LBB0_3
LBB0_6:
	movq	%r14, %rdi
	callq	_qlcnic_get_fw_size
	movl	%eax, %r12d
	movq	%r14, %rdi
	callq	_qlcnic_get_fw_offs
	movq	%rax, %r15
	movq	_QLCNIC_IMAGE_START@GOTPCREL(%rip), %rax
	movslq	(%rax), %r13
	leal	7(%r12), %eax
	cmpl	$15, %eax
	jae	LBB0_8
## %bb.7:
	xorl	%r12d, %r12d
	jmp	LBB0_11
LBB0_13:
	movq	_QLCNIC_BOOTLD_REGION@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-56(%rbp), %rdx
	movq	%r14, %rdi
	callq	_qlcnic_get_flt_entry
	testl	%eax, %eax
	je	LBB0_14
## %bb.15:
	movq	_QLCNIC_IMAGE_START@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	movq	_QLCNIC_BOOTLD_START@GOTPCREL(%rip), %rax
	movslq	(%rax), %rbx
	subl	%ebx, %r12d
	leaq	L_.str.1(%rip), %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	callq	_dev_info
	jmp	LBB0_16
LBB0_8:
	testl	%r12d, %r12d
	cmovnsl	%r12d, %eax
	sarl	$3, %eax
	cmpl	$2, %eax
	movl	$1, %ecx
	cmovael	%eax, %ecx
	movslq	%ecx, %r12
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r15,%rbx,4), %edi
	callq	_le64_to_cpu
	movq	%r14, %rdi
	movq	%r13, %rsi
	movl	%eax, %edx
	callq	_qlcnic_pci_mem_write_2M
	testq	%rax, %rax
	jne	LBB0_4
## %bb.10:                              ##   in Loop: Header=BB0_9 Depth=1
	addq	$8, %r13
	incq	%rbx
	cmpq	%rbx, %r12
	jne	LBB0_9
LBB0_11:
	movq	%r14, %rdi
	callq	_qlcnic_get_fw_size
	testb	$7, %al
	je	LBB0_22
## %bb.12:
	movl	(%r15,%r12,4), %edi
	callq	_le64_to_cpu
	movq	%r14, %rdi
	movq	%r13, %rsi
	movl	%eax, %edx
	callq	_qlcnic_pci_mem_write_2M
	testq	%rax, %rax
	je	LBB0_22
LBB0_4:
	movq	_EIO@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_23
LBB0_14:
	movl	-56(%rbp), %r12d
	movq	-48(%rbp), %rbx
LBB0_16:
	leal	7(%r12), %eax
	cmpl	$15, %eax
	jae	LBB0_17
LBB0_22:
	movl	$1000, %edi                     ## imm = 0x3E8
	movl	$1500, %esi                     ## imm = 0x5DC
	callq	_usleep_range
	movq	_QLCNIC_CRB_PEG_NET_0@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	$24, %rsi
	movq	%r14, %rdi
	movl	$4128, %edx                     ## imm = 0x1020
	callq	_QLCWR32
	movq	_QLCNIC_ROMUSB_GLB_SW_RESET@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movq	%r14, %rdi
	movl	$8388638, %edx                  ## imm = 0x80001E
	callq	_QLCWR32
	xorl	%eax, %eax
LBB0_23:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_17:
	testl	%r12d, %r12d
	cmovnsl	%r12d, %eax
	sarl	$3, %eax
	cmpl	$2, %eax
	movl	$1, %ecx
	cmovael	%eax, %ecx
	movslq	%ecx, %r13
	leaq	-64(%rbp), %r15
	leaq	-72(%rbp), %r12
	.p2align	4, 0x90
LBB0_18:                                ## =>This Inner Loop Header: Depth=1
	movq	%r14, %rdi
	movq	%rbx, %rsi
	movq	%r15, %rdx
	callq	_qlcnic_rom_fast_read
	testq	%rax, %rax
	jne	LBB0_4
## %bb.19:                              ##   in Loop: Header=BB0_18 Depth=1
	addq	$4, %rbx
	movq	%r14, %rdi
	movq	%rbx, %rsi
	movq	%r12, %rdx
	callq	_qlcnic_rom_fast_read
	testq	%rax, %rax
	jne	LBB0_4
## %bb.20:                              ##   in Loop: Header=BB0_18 Depth=1
	addq	$-4, %rbx
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	_qlcnic_pci_mem_write_2M
	testq	%rax, %rax
	jne	LBB0_4
## %bb.21:                              ##   in Loop: Header=BB0_18 Depth=1
	addq	$8, %rbx
	decq	%r13
	jne	LBB0_18
	jmp	LBB0_22
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"loading firmware from %s\n"

	.comm	_fw_name,8,3                    ## @fw_name
	.comm	_QLCNIC_IMAGE_START,4,2         ## @QLCNIC_IMAGE_START
	.comm	_QLCNIC_BOOTLD_START,4,2        ## @QLCNIC_BOOTLD_START
	.comm	_EIO,4,2                        ## @EIO
	.comm	_QLCNIC_BOOTLD_REGION,4,2       ## @QLCNIC_BOOTLD_REGION
L_.str.1:                               ## @.str.1
	.asciz	"using legacy method to get flash fw region"

	.comm	_QLCNIC_CRB_PEG_NET_0,8,3       ## @QLCNIC_CRB_PEG_NET_0
	.comm	_QLCNIC_ROMUSB_GLB_SW_RESET,8,3 ## @QLCNIC_ROMUSB_GLB_SW_RESET
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_qlcnic_load_firmware           ; -- Begin function qlcnic_load_firmware
	.p2align	2
_qlcnic_load_firmware:                  ; @qlcnic_load_firmware
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	mov	x19, x0
	ldp	x21, x20, [x0, #8]
Lloh0:
	adrp	x8, _fw_name@GOTPAGE
Lloh1:
	ldr	x8, [x8, _fw_name@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	ldr	x9, [x0]
	ldr	x9, [x9]
	ldr	w8, [x8, x9, lsl #2]
	str	x8, [sp]
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x21
	bl	_dev_info
	cbz	x20, LBB0_7
; %bb.1:
Lloh5:
	adrp	x23, _QLCNIC_IMAGE_START@GOTPAGE
Lloh6:
	ldr	x23, [x23, _QLCNIC_IMAGE_START@GOTPAGEOFF]
	ldr	w8, [x23]
Lloh7:
	adrp	x21, _QLCNIC_BOOTLD_START@GOTPAGE
Lloh8:
	ldr	x21, [x21, _QLCNIC_BOOTLD_START@GOTPAGEOFF]
	ldr	w9, [x21]
	sub	w22, w8, w9
	mov	x0, x19
	bl	_qlcnic_get_bootld_offs
	add	w8, w22, #7
	cmp	w8, #15
	b.lo	LBB0_5
; %bb.2:
	mov	x20, x0
	ldrsw	x21, [x21]
	cmp	w22, #0
	csel	w8, w8, w22, lt
	asr	w8, w8, #3
	cmp	w8, #1
	csinc	w8, w8, wzr, hi
	sxtw	x22, w8
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x20]
	bl	_le64_to_cpu
	mov	x2, x0
	mov	x0, x19
	mov	x1, x21
	bl	_qlcnic_pci_mem_write_2M
	cbnz	x0, LBB0_14
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	add	x21, x21, #8
	add	x20, x20, #4
	subs	x22, x22, #1
	b.ne	LBB0_3
LBB0_5:
	mov	x0, x19
	bl	_qlcnic_get_fw_size
	mov	x22, x0
	mov	x0, x19
	bl	_qlcnic_get_fw_offs
	mov	x21, x0
	ldrsw	x20, [x23]
	add	w8, w22, #7
	cmp	w8, #15
	b.hs	LBB0_9
; %bb.6:
	mov	x22, #0
	b	LBB0_12
LBB0_7:
Lloh9:
	adrp	x8, _QLCNIC_BOOTLD_REGION@GOTPAGE
Lloh10:
	ldr	x8, [x8, _QLCNIC_BOOTLD_REGION@GOTPAGEOFF]
Lloh11:
	ldr	w1, [x8]
	add	x2, sp, #16
	mov	x0, x19
	bl	_qlcnic_get_flt_entry
	cbz	w0, LBB0_15
; %bb.8:
Lloh12:
	adrp	x8, _QLCNIC_IMAGE_START@GOTPAGE
Lloh13:
	ldr	x8, [x8, _QLCNIC_IMAGE_START@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
Lloh15:
	adrp	x9, _QLCNIC_BOOTLD_START@GOTPAGE
Lloh16:
	ldr	x9, [x9, _QLCNIC_BOOTLD_START@GOTPAGEOFF]
Lloh17:
	ldrsw	x20, [x9]
	sub	w22, w8, w20
Lloh18:
	adrp	x1, l_.str.1@PAGE
Lloh19:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x21
	bl	_dev_info
	b	LBB0_16
LBB0_9:
	cmp	w22, #0
	csel	w8, w8, w22, lt
	asr	w8, w8, #3
	cmp	w8, #1
	csinc	w8, w8, wzr, hi
	sxtw	x22, w8
	mov	x23, x21
	mov	x24, x22
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x23]
	bl	_le64_to_cpu
	mov	x2, x0
	mov	x0, x19
	mov	x1, x20
	bl	_qlcnic_pci_mem_write_2M
	cbnz	x0, LBB0_14
; %bb.11:                               ;   in Loop: Header=BB0_10 Depth=1
	add	x20, x20, #8
	add	x23, x23, #4
	subs	x24, x24, #1
	b.ne	LBB0_10
LBB0_12:
	mov	x0, x19
	bl	_qlcnic_get_fw_size
	tst	w0, #0x7
	b.eq	LBB0_17
; %bb.13:
	ldr	w0, [x21, x22, lsl #2]
	bl	_le64_to_cpu
	mov	x2, x0
	mov	x0, x19
	mov	x1, x20
	bl	_qlcnic_pci_mem_write_2M
	cbz	x0, LBB0_17
LBB0_14:
Lloh20:
	adrp	x8, _EIO@GOTPAGE
Lloh21:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_18
LBB0_15:
	ldr	w22, [sp, #16]
	ldr	x20, [sp, #24]
LBB0_16:
	add	w8, w22, #7
	cmp	w8, #15
	b.hs	LBB0_19
LBB0_17:
	mov	w0, #1000
	mov	w1, #1500
	bl	_usleep_range
Lloh23:
	adrp	x8, _QLCNIC_CRB_PEG_NET_0@GOTPAGE
Lloh24:
	ldr	x8, [x8, _QLCNIC_CRB_PEG_NET_0@GOTPAGEOFF]
Lloh25:
	ldr	x8, [x8]
	add	x1, x8, #24
	mov	x0, x19
	mov	w2, #4128
	bl	_QLCWR32
Lloh26:
	adrp	x8, _QLCNIC_ROMUSB_GLB_SW_RESET@GOTPAGE
Lloh27:
	ldr	x8, [x8, _QLCNIC_ROMUSB_GLB_SW_RESET@GOTPAGEOFF]
Lloh28:
	ldr	x1, [x8]
	mov	x0, x19
	mov	w2, #30
	movk	w2, #128, lsl #16
	bl	_QLCWR32
	mov	w0, #0
LBB0_18:
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_19:
	cmp	w22, #0
	csel	w8, w8, w22, lt
	asr	w8, w8, #3
	cmp	w8, #1
	csinc	w8, w8, wzr, hi
	sxtw	x21, w8
LBB0_20:                                ; =>This Inner Loop Header: Depth=1
	add	x2, sp, #32
	mov	x0, x19
	mov	x1, x20
	bl	_qlcnic_rom_fast_read
	cbnz	x0, LBB0_14
; %bb.21:                               ;   in Loop: Header=BB0_20 Depth=1
	add	x20, x20, #4
	add	x2, sp, #40
	mov	x0, x19
	mov	x1, x20
	bl	_qlcnic_rom_fast_read
	cbnz	x0, LBB0_14
; %bb.22:                               ;   in Loop: Header=BB0_20 Depth=1
	sub	x20, x20, #4
	mov	x0, x19
	mov	x1, x20
	bl	_qlcnic_pci_mem_write_2M
	cbnz	x0, LBB0_14
; %bb.23:                               ;   in Loop: Header=BB0_20 Depth=1
	add	x20, x20, #8
	subs	x21, x21, #1
	b.ne	LBB0_20
	b	LBB0_17
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"loading firmware from %s\n"

	.comm	_fw_name,8,3                    ; @fw_name
	.comm	_QLCNIC_IMAGE_START,4,2         ; @QLCNIC_IMAGE_START
	.comm	_QLCNIC_BOOTLD_START,4,2        ; @QLCNIC_BOOTLD_START
	.comm	_EIO,4,2                        ; @EIO
	.comm	_QLCNIC_BOOTLD_REGION,4,2       ; @QLCNIC_BOOTLD_REGION
l_.str.1:                               ; @.str.1
	.asciz	"using legacy method to get flash fw region"

	.comm	_QLCNIC_CRB_PEG_NET_0,8,3       ; @QLCNIC_CRB_PEG_NET_0
	.comm	_QLCNIC_ROMUSB_GLB_SW_RESET,8,3 ; @QLCNIC_ROMUSB_GLB_SW_RESET
.subsections_via_symbols
