	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function build_fw
_build_fw:                              ## @build_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	%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	_EXIT_FAILURE@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	movq	_kernel_info@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	movq	_rootfs_info@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	leal	(%r15,%rbx), %r13d
	addl	$96, %r13d
	movl	%r13d, %edi
	callq	_malloc
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%rax, %r14
	addl	%r15d, %ebx
	addl	$48, %ebx
	movq	%rax, %rdi
	xorl	%esi, %esi
	movl	%r13d, %edx
	callq	_memset
	movq	_MAGIC_FIRMWARE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_HOST_TO_LE32
	movq	%rax, 8(%r14)
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	leal	32(%rbx), %edi
	callq	_HOST_TO_LE32
	movq	%rax, (%r14)
	movq	_MAGIC_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_HOST_TO_LE32
	movq	%rax, 24(%r14)
	movq	_kernel_info@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edi
	addl	$16, %edi
	callq	_HOST_TO_LE32
	movq	%rax, 16(%r14)
	leaq	32(%r14), %r15
	movq	%rbx, %rdi
	movq	%r15, %rsi
	callq	_read_to_buf
	movl	%eax, %r12d
	testl	%eax, %eax
	jne	LBB0_6
## %bb.3:
	movl	%r13d, -44(%rbp)                ## 4-byte Spill
	movq	_kernel_info@GOTPCREL(%rip), %r12
	movslq	(%r12), %rbx
	movq	_board@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	(%rax), %edi
	callq	_HOST_TO_BE32
	movq	%rax, 8(%r15,%rbx)
	movl	(%r12), %esi
	addl	$12, %esi
	movq	%r15, %rdi
	callq	_cyg_crc32
	movl	%eax, %edi
	callq	_HOST_TO_BE32
	movq	%rax, (%r15,%rbx)
	movslq	(%r12), %rbx
	movq	_MAGIC_ROOTFS@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_HOST_TO_LE32
	movq	%rax, 24(%rbx,%r15)
	movq	_rootfs_info@GOTPCREL(%rip), %r12
	movl	(%r12), %edi
	addl	$16, %edi
	callq	_HOST_TO_LE32
	movq	%rax, 16(%rbx,%r15)
	leaq	(%rbx,%r15), %r13
	addq	$32, %r13
	movq	%r12, %rdi
	movq	%r13, %rsi
	callq	_read_to_buf
	movl	%eax, %r12d
	testl	%eax, %eax
	jne	LBB0_6
## %bb.4:
	movq	%r14, %r15
	addq	$16, %r15
	movq	_rootfs_info@GOTPCREL(%rip), %r12
	movslq	(%r12), %rbx
	movq	_board@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	(%rax), %edi
	callq	_HOST_TO_BE32
	movq	%rax, 8(%r13,%rbx)
	movl	(%r12), %esi
	addl	$12, %esi
	movq	%r13, %rdi
	callq	_cyg_crc32
	movl	%eax, %edi
	callq	_HOST_TO_BE32
	movq	%rax, (%r13,%rbx)
	movslq	(%r12), %rbx
	movq	_board@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	(%rax), %edi
	callq	_HOST_TO_BE32
	movq	%rax, 24(%rbx,%r13)
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	addl	$28, %esi
	movq	%r15, %rdi
                                        ## kill: def $esi killed $esi killed $rsi
	callq	_cyg_crc32
	movl	%eax, %edi
	callq	_HOST_TO_BE32
	movq	%rax, 16(%rbx,%r13)
	movq	%r14, %rdi
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	callq	_write_fw
	movl	%eax, %r12d
	testl	%eax, %eax
	jne	LBB0_6
## %bb.5:
	movq	_EXIT_SUCCESS@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
LBB0_6:
	movq	%r14, %rdi
	callq	_free
	jmp	LBB0_7
LBB0_1:
	leaq	L_.str(%rip), %rdi
	callq	_ERR
LBB0_7:
	movl	%r12d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EXIT_FAILURE,4,2               ## @EXIT_FAILURE
	.comm	_kernel_info,4,2                ## @kernel_info
	.comm	_rootfs_info,4,2                ## @rootfs_info
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"no memory for buffer\n"

	.comm	_MAGIC_FIRMWARE,4,2             ## @MAGIC_FIRMWARE
	.comm	_MAGIC_KERNEL,4,2               ## @MAGIC_KERNEL
	.comm	_board,8,3                      ## @board
	.comm	_MAGIC_ROOTFS,4,2               ## @MAGIC_ROOTFS
	.comm	_EXIT_SUCCESS,4,2               ## @EXIT_SUCCESS
	.no_dead_strip	_build_fw
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function build_fw
_build_fw:                              ; @build_fw
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
Lloh0:
	adrp	x8, _EXIT_FAILURE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EXIT_FAILURE@GOTPAGEOFF]
Lloh2:
	ldr	w24, [x8]
Lloh3:
	adrp	x23, _kernel_info@GOTPAGE
Lloh4:
	ldr	x23, [x23, _kernel_info@GOTPAGEOFF]
	ldr	w8, [x23]
Lloh5:
	adrp	x21, _rootfs_info@GOTPAGE
Lloh6:
	ldr	x21, [x21, _rootfs_info@GOTPAGEOFF]
	ldr	w9, [x21]
	add	w22, w8, w9
	add	w20, w22, #96
	mov	x0, x20
	bl	_malloc
	cbz	x0, LBB0_5
; %bb.1:
	mov	x19, x0
	add	w26, w22, #48
	mov	w1, #0
	mov	x2, x20
	bl	_memset
Lloh7:
	adrp	x8, _MAGIC_FIRMWARE@GOTPAGE
Lloh8:
	ldr	x8, [x8, _MAGIC_FIRMWARE@GOTPAGEOFF]
Lloh9:
	ldr	w0, [x8]
	bl	_HOST_TO_LE32
	str	x0, [x19, #8]
	add	w0, w26, #32
	bl	_HOST_TO_LE32
	str	x0, [x19]
Lloh10:
	adrp	x8, _MAGIC_KERNEL@GOTPAGE
Lloh11:
	ldr	x8, [x8, _MAGIC_KERNEL@GOTPAGEOFF]
Lloh12:
	ldr	w0, [x8]
	bl	_HOST_TO_LE32
	str	x0, [x19, #24]
	ldr	w8, [x23]
	add	w0, w8, #16
	bl	_HOST_TO_LE32
	mov	x22, x19
	str	x0, [x22, #16]!
	add	x25, x22, #16
	mov	x0, x23
	mov	x1, x25
	bl	_read_to_buf
	mov	x24, x0
	cbnz	w0, LBB0_4
; %bb.2:
	ldrsw	x8, [x23]
	add	x24, x25, x8
Lloh13:
	adrp	x27, _board@GOTPAGE
Lloh14:
	ldr	x27, [x27, _board@GOTPAGEOFF]
	ldr	x8, [x27]
	ldr	w0, [x8]
	bl	_HOST_TO_BE32
	str	x0, [x24, #8]
	ldr	w8, [x23]
	add	w1, w8, #12
	mov	x0, x25
	bl	_cyg_crc32
	bl	_HOST_TO_BE32
	str	x0, [x24]
	ldrsw	x8, [x23]
	add	x23, x8, x25
Lloh15:
	adrp	x8, _MAGIC_ROOTFS@GOTPAGE
Lloh16:
	ldr	x8, [x8, _MAGIC_ROOTFS@GOTPAGEOFF]
Lloh17:
	ldr	w0, [x8]
	bl	_HOST_TO_LE32
	str	x0, [x23, #24]
	ldr	w8, [x21]
	add	w0, w8, #16
	bl	_HOST_TO_LE32
	str	x0, [x23, #16]
	add	x23, x23, #32
	mov	x0, x21
	mov	x1, x23
	bl	_read_to_buf
	mov	x24, x0
	cbnz	w0, LBB0_4
; %bb.3:
	ldrsw	x8, [x21]
	add	x24, x23, x8
	ldr	x8, [x27]
	ldr	w0, [x8]
	bl	_HOST_TO_BE32
	str	x0, [x24, #8]
	ldr	w8, [x21]
	add	w1, w8, #12
	mov	x0, x23
	bl	_cyg_crc32
	bl	_HOST_TO_BE32
	str	x0, [x24]
	ldrsw	x8, [x21]
	add	x21, x8, x23
	ldr	x8, [x27]
	ldr	w0, [x8]
	bl	_HOST_TO_BE32
	str	x0, [x21, #24]
	add	w1, w26, #28
	mov	x0, x22
	bl	_cyg_crc32
	bl	_HOST_TO_BE32
	str	x0, [x21, #16]
	mov	x0, x19
	mov	x1, x20
	bl	_write_fw
Lloh18:
	adrp	x8, _EXIT_SUCCESS@GOTPAGE
Lloh19:
	ldr	x8, [x8, _EXIT_SUCCESS@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	cmp	w0, #0
	csel	w24, w8, w0, eq
LBB0_4:
	mov	x0, x19
	bl	_free
	b	LBB0_6
LBB0_5:
Lloh21:
	adrp	x0, l_.str@PAGE
Lloh22:
	add	x0, x0, l_.str@PAGEOFF
	bl	_ERR
LBB0_6:
	mov	x0, x24
	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
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpAdd	Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.comm	_EXIT_FAILURE,4,2               ; @EXIT_FAILURE
	.comm	_kernel_info,4,2                ; @kernel_info
	.comm	_rootfs_info,4,2                ; @rootfs_info
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"no memory for buffer\n"

	.comm	_MAGIC_FIRMWARE,4,2             ; @MAGIC_FIRMWARE
	.comm	_MAGIC_KERNEL,4,2               ; @MAGIC_KERNEL
	.comm	_board,8,3                      ; @board
	.comm	_MAGIC_ROOTFS,4,2               ; @MAGIC_ROOTFS
	.comm	_EXIT_SUCCESS,4,2               ; @EXIT_SUCCESS
	.no_dead_strip	_build_fw
.subsections_via_symbols
