	.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
	pushq	%rax
	.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), %ebx
	movq	_data_size@GOTPCREL(%rip), %r13
	movl	(%r13), %r14d
	addl	$72, %r14d
	movl	%r14d, %edi
	callq	_malloc
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%rax, %r12
	movq	%rax, %r15
	addq	$72, %r15
	movq	_ifname@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	(%r13), %edx
	movq	%r15, %rsi
	callq	_read_to_buf
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_5
## %bb.3:
	movq	%r12, %rdi
	xorl	%esi, %esi
	movl	$72, %edx
	callq	_memset
	movl	64(%r12), %edi
	movq	_model@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$4, %edx
	callq	_strncpy
	movl	60(%r12), %edi
	movq	_magic@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$4, %edx
	callq	_strncpy
	movl	56(%r12), %edi
	movq	_fw_version@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$4, %edx
	callq	_strncpy
	movl	52(%r12), %edi
	movq	_mtd_name@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$4, %edx
	callq	_strncpy
	movq	_force@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 48(%r12)
	movq	_start_addr@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_htonl
	movq	%rax, 40(%r12)
	movq	_end_addr@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_htonl
	movq	%rax, 32(%r12)
	movl	(%r13), %edi
	callq	_htonl
	movq	%rax, 24(%r12)
	movq	_image_type@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 16(%r12)
	movl	(%r13), %esi
	movq	%r15, %rdi
	callq	_checksum
	movq	%rax, 8(%r12)
	movq	%r12, %rdi
	movl	$72, %esi
	callq	_checksum
	movq	%rax, (%r12)
	movq	%r12, %rdi
	movl	%r14d, %esi
	callq	_write_fw
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_5
## %bb.4:
	movq	_EXIT_SUCCESS@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
LBB0_5:
	movq	%r12, %rdi
	callq	_free
	jmp	LBB0_6
LBB0_1:
	leaq	L_.str(%rip), %rdi
	callq	_ERR
LBB0_6:
	movl	%ebx, %eax
	addq	$8, %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	_data_size,4,2                  ## @data_size
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"no memory for buffer\n"

	.comm	_ifname,4,2                     ## @ifname
	.comm	_model,4,2                      ## @model
	.comm	_magic,4,2                      ## @magic
	.comm	_fw_version,4,2                 ## @fw_version
	.comm	_mtd_name,4,2                   ## @mtd_name
	.comm	_force,4,2                      ## @force
	.comm	_start_addr,4,2                 ## @start_addr
	.comm	_end_addr,4,2                   ## @end_addr
	.comm	_image_type,4,2                 ## @image_type
	.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	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
Lloh0:
	adrp	x8, _EXIT_FAILURE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EXIT_FAILURE@GOTPAGEOFF]
Lloh2:
	ldr	w22, [x8]
Lloh3:
	adrp	x23, _data_size@GOTPAGE
Lloh4:
	ldr	x23, [x23, _data_size@GOTPAGEOFF]
	ldr	w8, [x23]
	add	w20, w8, #72
	mov	x0, x20
	bl	_malloc
	cbz	x0, LBB0_4
; %bb.1:
	mov	x19, x0
	add	x21, x0, #72
Lloh5:
	adrp	x8, _ifname@GOTPAGE
Lloh6:
	ldr	x8, [x8, _ifname@GOTPAGEOFF]
Lloh7:
	ldr	w0, [x8]
	ldr	w2, [x23]
	mov	x1, x21
	bl	_read_to_buf
	mov	x22, x0
	cbnz	w0, LBB0_3
; %bb.2:
	mov	x0, x19
	mov	w1, #0
	mov	w2, #72
	bl	_memset
	ldr	w0, [x19, #64]
Lloh8:
	adrp	x8, _model@GOTPAGE
Lloh9:
	ldr	x8, [x8, _model@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
	mov	w2, #4
	bl	_strncpy
	ldr	w0, [x19, #60]
Lloh11:
	adrp	x8, _magic@GOTPAGE
Lloh12:
	ldr	x8, [x8, _magic@GOTPAGEOFF]
Lloh13:
	ldr	w1, [x8]
	mov	w2, #4
	bl	_strncpy
	ldr	w0, [x19, #56]
Lloh14:
	adrp	x8, _fw_version@GOTPAGE
Lloh15:
	ldr	x8, [x8, _fw_version@GOTPAGEOFF]
Lloh16:
	ldr	w1, [x8]
	mov	w2, #4
	bl	_strncpy
	ldr	w0, [x19, #52]
Lloh17:
	adrp	x8, _mtd_name@GOTPAGE
Lloh18:
	ldr	x8, [x8, _mtd_name@GOTPAGEOFF]
Lloh19:
	ldr	w1, [x8]
	mov	w2, #4
	bl	_strncpy
Lloh20:
	adrp	x8, _force@GOTPAGE
Lloh21:
	ldr	x8, [x8, _force@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
	str	w8, [x19, #48]
Lloh23:
	adrp	x8, _start_addr@GOTPAGE
Lloh24:
	ldr	x8, [x8, _start_addr@GOTPAGEOFF]
Lloh25:
	ldr	w0, [x8]
	bl	_htonl
	str	x0, [x19, #40]
Lloh26:
	adrp	x8, _end_addr@GOTPAGE
Lloh27:
	ldr	x8, [x8, _end_addr@GOTPAGEOFF]
Lloh28:
	ldr	w0, [x8]
	bl	_htonl
	str	x0, [x19, #32]
	ldr	w0, [x23]
	bl	_htonl
	str	x0, [x19, #24]
Lloh29:
	adrp	x8, _image_type@GOTPAGE
Lloh30:
	ldr	x8, [x8, _image_type@GOTPAGEOFF]
Lloh31:
	ldr	w8, [x8]
	str	w8, [x19, #16]
	ldr	w1, [x23]
	mov	x0, x21
	bl	_checksum
	str	x0, [x19, #8]
	mov	x0, x19
	mov	w1, #72
	bl	_checksum
	str	x0, [x19]
	mov	x0, x19
	mov	x1, x20
	bl	_write_fw
Lloh32:
	adrp	x8, _EXIT_SUCCESS@GOTPAGE
Lloh33:
	ldr	x8, [x8, _EXIT_SUCCESS@GOTPAGEOFF]
Lloh34:
	ldr	w8, [x8]
	cmp	w0, #0
	csel	w22, w8, w0, eq
LBB0_3:
	mov	x0, x19
	bl	_free
	b	LBB0_5
LBB0_4:
Lloh35:
	adrp	x0, l_.str@PAGE
Lloh36:
	add	x0, x0, l_.str@PAGEOFF
	bl	_ERR
LBB0_5:
	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
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh35, Lloh36
	.cfi_endproc
                                        ; -- End function
	.comm	_EXIT_FAILURE,4,2               ; @EXIT_FAILURE
	.comm	_data_size,4,2                  ; @data_size
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"no memory for buffer\n"

	.comm	_ifname,4,2                     ; @ifname
	.comm	_model,4,2                      ; @model
	.comm	_magic,4,2                      ; @magic
	.comm	_fw_version,4,2                 ; @fw_version
	.comm	_mtd_name,4,2                   ; @mtd_name
	.comm	_force,4,2                      ; @force
	.comm	_start_addr,4,2                 ; @start_addr
	.comm	_end_addr,4,2                   ; @end_addr
	.comm	_image_type,4,2                 ; @image_type
	.comm	_EXIT_SUCCESS,4,2               ; @EXIT_SUCCESS
	.no_dead_strip	_build_fw
.subsections_via_symbols
