	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function load_fw
_load_fw:                               ## @load_fw
	.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
                                        ## kill: def $edx killed $edx def $rdx
	leal	1(%rdx), %ecx
	movl	$-1, %eax
	cmpl	%edi, %ecx
	jne	LBB0_12
## %bb.1:
	movslq	%edx, %rax
	movq	(%rsi,%rax,8), %rdi
	movq	_O_RDONLY@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_open
	movl	%eax, %r15d
	testl	%eax, %eax
	jns	LBB0_3
## %bb.2:
	leaq	L_.str(%rip), %rsi
	movl	$1, %edi
	callq	_err
LBB0_3:
	leaq	-40(%rbp), %rdi
	movl	$8, %esi
	callq	_bzero
	movq	_MAX_FW_IMAGE_SIZE@GOTPCREL(%rip), %r12
	movl	(%r12), %edi
	incl	%edi
	callq	_malloc
	movl	%eax, %ebx
	movl	%eax, -36(%rbp)
	testl	%eax, %eax
	jne	LBB0_5
## %bb.4:
	leaq	L_.str(%rip), %rsi
	movl	$1, %edi
	callq	_err
LBB0_5:
	movl	(%r12), %edx
	incl	%edx
	movl	%r15d, %edi
	movl	%ebx, %esi
	callq	_read
	movl	%eax, %ebx
	testl	%eax, %eax
	js	LBB0_6
## %bb.7:
	cmpl	(%r12), %ebx
	jle	LBB0_9
LBB0_8:
	leaq	L_.str.1(%rip), %rsi
	movl	$1, %edi
	callq	_errx
LBB0_9:
	movl	%ebx, -40(%rbp)
	movq	_CHELSIO_LOAD_FW@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-40(%rbp), %rdx
	movq	%r14, %rdi
	callq	_doit
	testq	%rax, %rax
	jns	LBB0_11
## %bb.10:
	leaq	L_.str(%rip), %rsi
	movl	$1, %edi
	callq	_err
LBB0_11:
	movl	%r15d, %edi
	callq	_close
	xorl	%eax, %eax
LBB0_12:
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	leaq	L_.str(%rip), %rsi
	movl	$1, %edi
	callq	_err
	cmpl	(%r12), %ebx
	jg	LBB0_8
	jmp	LBB0_9
	.cfi_endproc
                                        ## -- End function
	.comm	_O_RDONLY,4,2                   ## @O_RDONLY
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"load firmware"

	.comm	_MAX_FW_IMAGE_SIZE,4,2          ## @MAX_FW_IMAGE_SIZE
L_.str.1:                               ## @.str.1
	.asciz	"FW image too large"

	.comm	_CHELSIO_LOAD_FW,4,2            ## @CHELSIO_LOAD_FW
	.no_dead_strip	_load_fw
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function load_fw
_load_fw:                               ; @load_fw
	.cfi_startproc
; %bb.0:
	add	w8, w2, #1
	cmp	w8, w0
	b.ne	LBB0_12
; %bb.1:
	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
	ldr	x0, [x1, w2, sxtw #3]
Lloh0:
	adrp	x8, _O_RDONLY@GOTPAGE
Lloh1:
	ldr	x8, [x8, _O_RDONLY@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	bl	_open
	mov	x20, x0
	tbz	w0, #31, LBB0_3
; %bb.2:
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	mov	w0, #1
	bl	_err
LBB0_3:
	add	x0, sp, #8
	mov	w1, #8
	bl	_bzero
Lloh5:
	adrp	x22, _MAX_FW_IMAGE_SIZE@GOTPAGE
Lloh6:
	ldr	x22, [x22, _MAX_FW_IMAGE_SIZE@GOTPAGEOFF]
	ldr	w8, [x22]
	add	w0, w8, #1
	bl	_malloc
	mov	x21, x0
	str	w0, [sp, #12]
	cbnz	w0, LBB0_5
; %bb.4:
Lloh7:
	adrp	x1, l_.str@PAGE
Lloh8:
	add	x1, x1, l_.str@PAGEOFF
	mov	w0, #1
	bl	_err
LBB0_5:
	ldr	w8, [x22]
	add	w2, w8, #1
	mov	x0, x20
	mov	x1, x21
	bl	_read
	mov	x21, x0
	tbz	w0, #31, LBB0_7
; %bb.6:
Lloh9:
	adrp	x1, l_.str@PAGE
Lloh10:
	add	x1, x1, l_.str@PAGEOFF
	mov	w0, #1
	bl	_err
LBB0_7:
	ldr	w8, [x22]
	cmp	w21, w8
	b.le	LBB0_9
; %bb.8:
Lloh11:
	adrp	x1, l_.str.1@PAGE
Lloh12:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	w0, #1
	bl	_errx
LBB0_9:
	str	w21, [sp, #8]
Lloh13:
	adrp	x8, _CHELSIO_LOAD_FW@GOTPAGE
Lloh14:
	ldr	x8, [x8, _CHELSIO_LOAD_FW@GOTPAGEOFF]
Lloh15:
	ldr	w1, [x8]
	add	x2, sp, #8
	mov	x0, x19
	bl	_doit
	tbz	x0, #63, LBB0_11
; %bb.10:
Lloh16:
	adrp	x1, l_.str@PAGE
Lloh17:
	add	x1, x1, l_.str@PAGEOFF
	mov	w0, #1
	bl	_err
LBB0_11:
	mov	x0, x20
	bl	_close
	mov	w0, #0
	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
LBB0_12:
	.cfi_def_cfa wsp, 0
	.cfi_same_value w30
	.cfi_same_value w29
	.cfi_same_value w19
	.cfi_same_value w20
	.cfi_same_value w21
	.cfi_same_value w22
	mov	w0, #-1
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_O_RDONLY,4,2                   ; @O_RDONLY
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"load firmware"

	.comm	_MAX_FW_IMAGE_SIZE,4,2          ; @MAX_FW_IMAGE_SIZE
l_.str.1:                               ; @.str.1
	.asciz	"FW image too large"

	.comm	_CHELSIO_LOAD_FW,4,2            ; @CHELSIO_LOAD_FW
	.no_dead_strip	_load_fw
.subsections_via_symbols
