	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_wrap_fw                        ## -- Begin function wrap_fw
	.p2align	4, 0x90
_wrap_fw:                               ## @wrap_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	_image_info@GOTPCREL(%rip), %rax
	cmpl	$0, 8(%rax)
	je	LBB0_1
## %bb.2:
	movq	_image_info@GOTPCREL(%rip), %r15
	movq	%r15, %rdi
	callq	_get_file_stat
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_16
## %bb.3:
	movq	_firmware_size@GOTPCREL(%rip), %rax
	movq	(%rax), %rbx
	movq	%rbx, %rdi
	callq	_malloc
	testq	%rax, %rax
	je	LBB0_4
## %bb.6:
	movq	%rax, %r14
	movq	_AUH_SIZE@GOTPCREL(%rip), %r13
	movq	(%r13), %rax
	addq	(%r15), %rax
	cmpq	%rbx, %rax
	jle	LBB0_8
## %bb.7:
	leaq	L_.str.1(%rip), %rdi
	jmp	LBB0_5
LBB0_1:
	movq	_EXIT_FAILURE@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	jmp	LBB0_16
LBB0_4:
	leaq	L_.str(%rip), %rdi
	jmp	LBB0_5
LBB0_8:
	movq	_family_member@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	je	LBB0_9
## %bb.10:
	movq	_rom_id@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpl	$0, (%rax)
	je	LBB0_11
## %bb.12:
	movq	%r14, %rdi
	movl	$255, %esi
	movq	%rbx, %rdx
	callq	_memset
	movq	(%r13), %r15
	addq	%r14, %r15
	movq	_image_info@GOTPCREL(%rip), %r12
	movq	%r12, %rdi
	movq	%r15, %rsi
	callq	_read_to_buf
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_15
## %bb.13:
	addq	(%r12), %r15
	subq	%r14, %r15
	movslq	%r15d, %rbx
	movq	%rbx, %rsi
	subq	(%r13), %rsi
	movq	%r14, %rdi
	callq	_fill_auh
	movq	_ofname@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%r14, %rsi
	movl	%ebx, %edx
	callq	_write_fw
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_15
## %bb.14:
	movq	_EXIT_SUCCESS@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
LBB0_15:
	movq	%r14, %rdi
	callq	_free
	jmp	LBB0_16
LBB0_9:
	leaq	L_.str.2(%rip), %rdi
	jmp	LBB0_5
LBB0_11:
	leaq	L_.str.3(%rip), %rdi
LBB0_5:
	callq	_ERR
	xorl	%ebx, %ebx
LBB0_16:
	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	_image_info,16,3                ## @image_info
	.comm	_firmware_size,8,3              ## @firmware_size
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"no memory for buffer\n"

	.comm	_AUH_SIZE,8,3                   ## @AUH_SIZE
L_.str.1:                               ## @.str.1
	.asciz	"data is bigger than firmware_size!\n"

	.comm	_family_member,4,2              ## @family_member
L_.str.2:                               ## @.str.2
	.asciz	"No family_member!\n"

	.comm	_rom_id,8,3                     ## @rom_id
L_.str.3:                               ## @.str.3
	.asciz	"No rom_id!\n"

	.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	_wrap_fw                        ; -- Begin function wrap_fw
	.p2align	2
_wrap_fw:                               ; @wrap_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, _image_info@GOTPAGE
Lloh1:
	ldr	x8, [x8, _image_info@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8, #8]
	cbz	w8, LBB0_5
; %bb.1:
Lloh3:
	adrp	x21, _image_info@GOTPAGE
Lloh4:
	ldr	x21, [x21, _image_info@GOTPAGEOFF]
	mov	x0, x21
	bl	_get_file_stat
	mov	x20, x0
	cbnz	w0, LBB0_15
; %bb.2:
Lloh5:
	adrp	x8, _firmware_size@GOTPAGE
Lloh6:
	ldr	x8, [x8, _firmware_size@GOTPAGEOFF]
Lloh7:
	ldr	x20, [x8]
	mov	x0, x20
	bl	_malloc
	cbz	x0, LBB0_6
; %bb.3:
	ldr	x8, [x21]
Lloh8:
	adrp	x23, _AUH_SIZE@GOTPAGE
Lloh9:
	ldr	x23, [x23, _AUH_SIZE@GOTPAGEOFF]
	ldr	x9, [x23]
	add	x8, x9, x8
	cmp	x8, x20
	b.le	LBB0_7
; %bb.4:
Lloh10:
	adrp	x0, l_.str.1@PAGE
Lloh11:
	add	x0, x0, l_.str.1@PAGEOFF
	b	LBB0_14
LBB0_5:
Lloh12:
	adrp	x8, _EXIT_FAILURE@GOTPAGE
Lloh13:
	ldr	x8, [x8, _EXIT_FAILURE@GOTPAGEOFF]
Lloh14:
	ldr	w20, [x8]
	b	LBB0_15
LBB0_6:
Lloh15:
	adrp	x0, l_.str@PAGE
Lloh16:
	add	x0, x0, l_.str@PAGEOFF
	b	LBB0_14
LBB0_7:
Lloh17:
	adrp	x8, _family_member@GOTPAGE
Lloh18:
	ldr	x8, [x8, _family_member@GOTPAGEOFF]
Lloh19:
	ldr	w8, [x8]
	cbz	w8, LBB0_12
; %bb.8:
Lloh20:
	adrp	x8, _rom_id@GOTPAGE
Lloh21:
	ldr	x8, [x8, _rom_id@GOTPAGEOFF]
Lloh22:
	ldr	x8, [x8]
	ldr	w8, [x8]
	cbz	w8, LBB0_13
; %bb.9:
	mov	x19, x0
	mov	w1, #255
	mov	x2, x20
	bl	_memset
	ldr	x8, [x23]
	add	x21, x19, x8
Lloh23:
	adrp	x22, _image_info@GOTPAGE
Lloh24:
	ldr	x22, [x22, _image_info@GOTPAGEOFF]
	mov	x0, x22
	mov	x1, x21
	bl	_read_to_buf
	mov	x20, x0
	cbnz	w0, LBB0_11
; %bb.10:
	ldr	x8, [x22]
	add	x8, x21, x8
	sub	x20, x8, x19
	sxtw	x8, w20
	ldr	x9, [x23]
	sub	x1, x8, x9
	mov	x0, x19
	bl	_fill_auh
Lloh25:
	adrp	x8, _ofname@GOTPAGE
Lloh26:
	ldr	x8, [x8, _ofname@GOTPAGEOFF]
Lloh27:
	ldr	w0, [x8]
	mov	x1, x19
	mov	x2, x20
	bl	_write_fw
Lloh28:
	adrp	x8, _EXIT_SUCCESS@GOTPAGE
Lloh29:
	ldr	x8, [x8, _EXIT_SUCCESS@GOTPAGEOFF]
Lloh30:
	ldr	w8, [x8]
	cmp	w0, #0
	csel	w20, w8, w0, eq
LBB0_11:
	mov	x0, x19
	bl	_free
	b	LBB0_15
LBB0_12:
Lloh31:
	adrp	x0, l_.str.2@PAGE
Lloh32:
	add	x0, x0, l_.str.2@PAGEOFF
	b	LBB0_14
LBB0_13:
Lloh33:
	adrp	x0, l_.str.3@PAGE
Lloh34:
	add	x0, x0, l_.str.3@PAGEOFF
LBB0_14:
	bl	_ERR
	mov	w20, #0
LBB0_15:
	mov	x0, x20
	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 AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpAdd	Lloh31, Lloh32
	.loh AdrpAdd	Lloh33, Lloh34
	.cfi_endproc
                                        ; -- End function
	.comm	_EXIT_FAILURE,4,2               ; @EXIT_FAILURE
	.comm	_image_info,16,3                ; @image_info
	.comm	_firmware_size,8,3              ; @firmware_size
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"no memory for buffer\n"

	.comm	_AUH_SIZE,8,3                   ; @AUH_SIZE
l_.str.1:                               ; @.str.1
	.asciz	"data is bigger than firmware_size!\n"

	.comm	_family_member,4,2              ; @family_member
l_.str.2:                               ; @.str.2
	.asciz	"No family_member!\n"

	.comm	_rom_id,8,3                     ; @rom_id
l_.str.3:                               ; @.str.3
	.asciz	"No rom_id!\n"

	.comm	_ofname,4,2                     ; @ofname
	.comm	_EXIT_SUCCESS,4,2               ; @EXIT_SUCCESS
.subsections_via_symbols
