	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_build_fw                       ## -- Begin function build_fw
	.p2align	4, 0x90
_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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	movq	_EXIT_FAILURE@GOTPCREL(%rip), %rax
	movq	_kernel_len@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r12d
	addl	%ebx, %r12d
	movq	_combined@GOTPCREL(%rip), %rcx
	cmpq	$0, (%rcx)
	movl	%r12d, %r14d
	jne	LBB0_2
## %bb.1:
	movq	_layout@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movl	(%rcx), %r14d
LBB0_2:
	movl	(%rax), %r13d
	movl	%r14d, %edi
	callq	_malloc
	testq	%rax, %rax
	je	LBB0_3
## %bb.4:
	movq	%rax, %r15
	movq	%rax, %rdi
	movl	$255, %esi
	movl	%r14d, %edx
	callq	_memset
	addq	%r15, %rbx
	movq	_kernel_info@GOTPCREL(%rip), %rdi
	movq	%rbx, %rsi
	callq	_read_to_buf
	movl	%eax, %r13d
	testl	%eax, %eax
	je	LBB0_5
LBB0_11:
	movq	%r15, %rdi
	callq	_free
	jmp	LBB0_12
LBB0_3:
	leaq	L_.str(%rip), %rdi
	callq	_ERR
LBB0_12:
	movl	%r13d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	movq	_combined@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_6
LBB0_9:
	movq	_strip_padding@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	cmovel	%r14d, %r12d
	movq	%r15, %rdi
	movl	%r12d, %esi
	callq	_fill_header
	movq	_ofname@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%r15, %rsi
	movl	%r12d, %edx
	callq	_write_fw
	movl	%eax, %r13d
	testl	%eax, %eax
	jne	LBB0_11
## %bb.10:
	movq	_EXIT_SUCCESS@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	jmp	LBB0_11
LBB0_6:
	movq	_rootfs_ofs@GOTPCREL(%rip), %r12
	movslq	(%r12), %rax
	movq	%r15, %rsi
	addq	%rax, %rsi
	movq	_rootfs_info@GOTPCREL(%rip), %rbx
	movq	%rbx, %rdi
	callq	_read_to_buf
	movl	%eax, %r13d
	testl	%eax, %eax
	jne	LBB0_11
## %bb.7:
	movq	%r12, %rcx
	movl	(%rbx), %r12d
	movq	_add_jffs2_eof@GOTPCREL(%rip), %rax
	addl	(%rcx), %r12d
	cmpq	$0, (%rax)
	je	LBB0_9
## %bb.8:
	movq	_layout@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	movl	%r12d, %esi
	callq	_pad_jffs2
	movl	%eax, %r12d
	jmp	LBB0_9
	.cfi_endproc
                                        ## -- End function
	.comm	_EXIT_FAILURE,4,2               ## @EXIT_FAILURE
	.comm	_kernel_len,8,3                 ## @kernel_len
	.comm	_combined,8,3                   ## @combined
	.comm	_layout,8,3                     ## @layout
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"no memory for buffer\n"

	.comm	_kernel_info,4,2                ## @kernel_info
	.comm	_rootfs_ofs,4,2                 ## @rootfs_ofs
	.comm	_rootfs_info,4,2                ## @rootfs_info
	.comm	_add_jffs2_eof,8,3              ## @add_jffs2_eof
	.comm	_strip_padding,4,2              ## @strip_padding
	.comm	_ofname,4,2                     ## @ofname
	.comm	_EXIT_SUCCESS,4,2               ## @EXIT_SUCCESS
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_build_fw                       ; -- Begin function build_fw
	.p2align	2
_build_fw:                              ; @build_fw
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x23, x0
Lloh0:
	adrp	x8, _EXIT_FAILURE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EXIT_FAILURE@GOTPAGEOFF]
Lloh2:
	adrp	x9, _kernel_len@GOTPAGE
Lloh3:
	ldr	x9, [x9, _kernel_len@GOTPAGEOFF]
Lloh4:
	ldr	w9, [x9]
	add	w21, w9, w23
Lloh5:
	adrp	x24, _combined@GOTPAGE
Lloh6:
	ldr	x24, [x24, _combined@GOTPAGEOFF]
	ldr	x9, [x24]
	mov	x20, x21
	cbnz	x9, LBB0_2
; %bb.1:
Lloh7:
	adrp	x9, _layout@GOTPAGE
Lloh8:
	ldr	x9, [x9, _layout@GOTPAGEOFF]
Lloh9:
	ldr	x9, [x9]
	ldr	w20, [x9]
LBB0_2:
	ldr	w22, [x8]
	mov	x0, x20
	bl	_malloc
	cbz	x0, LBB0_6
; %bb.3:
	mov	x19, x0
	mov	w1, #255
	mov	x2, x20
	bl	_memset
	add	x1, x19, x23
Lloh10:
	adrp	x0, _kernel_info@GOTPAGE
Lloh11:
	ldr	x0, [x0, _kernel_info@GOTPAGEOFF]
	bl	_read_to_buf
	mov	x22, x0
	cbnz	w0, LBB0_8
; %bb.4:
	ldr	x8, [x24]
	cbz	x8, LBB0_7
LBB0_5:
Lloh12:
	adrp	x8, _strip_padding@GOTPAGE
Lloh13:
	ldr	x8, [x8, _strip_padding@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	cmp	w8, #0
	csel	w20, w20, w21, eq
	mov	x0, x19
	mov	x1, x20
	bl	_fill_header
Lloh15:
	adrp	x8, _ofname@GOTPAGE
Lloh16:
	ldr	x8, [x8, _ofname@GOTPAGEOFF]
Lloh17:
	ldr	w0, [x8]
	mov	x1, x19
	mov	x2, 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	w22, w8, w0, eq
	b	LBB0_8
LBB0_6:
Lloh21:
	adrp	x0, l_.str@PAGE
Lloh22:
	add	x0, x0, l_.str@PAGEOFF
	bl	_ERR
	b	LBB0_9
LBB0_7:
Lloh23:
	adrp	x23, _rootfs_ofs@GOTPAGE
Lloh24:
	ldr	x23, [x23, _rootfs_ofs@GOTPAGEOFF]
	ldrsw	x8, [x23]
	add	x1, x19, x8
Lloh25:
	adrp	x21, _rootfs_info@GOTPAGE
Lloh26:
	ldr	x21, [x21, _rootfs_info@GOTPAGEOFF]
	mov	x0, x21
	bl	_read_to_buf
	mov	x22, x0
	cbz	w0, LBB0_10
LBB0_8:
	mov	x0, x19
	bl	_free
LBB0_9:
	mov	x0, x22
	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
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_10:
	ldr	w8, [x23]
	ldr	w9, [x21]
	add	w21, w9, w8
Lloh27:
	adrp	x8, _add_jffs2_eof@GOTPAGE
Lloh28:
	ldr	x8, [x8, _add_jffs2_eof@GOTPAGEOFF]
Lloh29:
	ldr	x8, [x8]
	cbz	x8, LBB0_5
; %bb.11:
Lloh30:
	adrp	x8, _layout@GOTPAGE
Lloh31:
	ldr	x8, [x8, _layout@GOTPAGEOFF]
Lloh32:
	ldr	x8, [x8]
	ldr	w2, [x8]
	mov	x0, x19
	mov	x1, x21
	bl	_pad_jffs2
	mov	x21, x0
	b	LBB0_5
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.cfi_endproc
                                        ; -- End function
	.comm	_EXIT_FAILURE,4,2               ; @EXIT_FAILURE
	.comm	_kernel_len,8,3                 ; @kernel_len
	.comm	_combined,8,3                   ; @combined
	.comm	_layout,8,3                     ; @layout
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"no memory for buffer\n"

	.comm	_kernel_info,4,2                ; @kernel_info
	.comm	_rootfs_ofs,4,2                 ; @rootfs_ofs
	.comm	_rootfs_info,4,2                ; @rootfs_info
	.comm	_add_jffs2_eof,8,3              ; @add_jffs2_eof
	.comm	_strip_padding,4,2              ; @strip_padding
	.comm	_ofname,4,2                     ; @ofname
	.comm	_EXIT_SUCCESS,4,2               ; @EXIT_SUCCESS
.subsections_via_symbols
