	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_go7007_construct_fw_image      ## -- Begin function go7007_construct_fw_image
	.p2align	4, 0x90
_go7007_construct_fw_image:             ## @go7007_construct_fw_image
	.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	$88, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	xorps	%xmm0, %xmm0
	movaps	%xmm0, -64(%rbp)
	movaps	%xmm0, -80(%rbp)
	movl	(%rdi), %eax
	addl	$-128, %eax
	movl	$-1, %r12d
	cmpl	$3, %eax
	ja	LBB0_24
## %bb.1:
	movq	%rsi, %r15
	movq	%rdi, %rbx
	movq	%rdx, -120(%rbp)                ## 8-byte Spill
	cltq
	leaq	l_switch.table.go7007_construct_fw_image(%rip), %rcx
	movq	(%rcx,%rax,8), %rax
	movl	(%rax), %r14d
	movq	_GO7007_FW_NAME@GOTPCREL(%rip), %r13
	movl	(%r13), %esi
	movl	4(%rdi), %edx
	leaq	-104(%rbp), %rdi
	callq	_request_firmware
	testq	%rax, %rax
	je	LBB0_3
## %bb.2:
	movl	4(%rbx), %edi
	movl	(%r13), %edx
	leaq	L_.str(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_24
LBB0_3:
	movl	%r14d, -112(%rbp)               ## 4-byte Spill
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	$65536, %edi                    ## imm = 0x10000
	movl	$2, %esi
	callq	_kcalloc
	movq	%rax, -88(%rbp)                 ## 8-byte Spill
	testq	%rax, %rax
	je	LBB0_10
## %bb.4:
	movq	-104(%rbp), %rdi
	movl	(%rdi), %r13d
	xorl	%r12d, %r12d
	cmpl	$4, %r13d
	jl	LBB0_5
## %bb.6:
	movq	%rbx, -96(%rbp)                 ## 8-byte Spill
	movq	%r15, -128(%rbp)                ## 8-byte Spill
	shrl	%r13d
	movq	8(%rdi), %r15
	xorl	%r12d, %r12d
	jmp	LBB0_7
	.p2align	4, 0x90
LBB0_12:                                ##   in Loop: Header=BB0_7 Depth=1
	movl	%ebx, %r12d
LBB0_21:                                ##   in Loop: Header=BB0_7 Depth=1
	movslq	%ecx, %rax
	leaq	(%r15,%rax,4), %r15
	cmpl	$1, %r13d
	jle	LBB0_22
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movl	%r12d, %ebx
	movl	(%r15), %edi
	callq	___le16_to_cpu
	movl	%eax, %r14d
	movl	4(%r15), %edi
	callq	___le16_to_cpu
	movl	%eax, %r12d
	leal	2(%r12), %ecx
	subl	%ecx, %r13d
	jl	LBB0_8
## %bb.11:                              ##   in Loop: Header=BB0_7 Depth=1
	testl	%r14d, -112(%rbp)               ## 4-byte Folded Reload
	je	LBB0_12
## %bb.13:                              ##   in Loop: Header=BB0_7 Depth=1
	movq	_FLAG_SPECIAL@GOTPCREL(%rip), %rax
	testl	%r14d, (%rax)
	je	LBB0_18
## %bb.14:                              ##   in Loop: Header=BB0_7 Depth=1
	movl	%ecx, -108(%rbp)                ## 4-byte Spill
	movl	8(%r15), %edi
	callq	___le16_to_cpu
	movl	%ebx, %r12d
	movslq	%ebx, %rsi
	movq	-88(%rbp), %rcx                 ## 8-byte Reload
	leaq	(%rcx,%rsi,4), %rdx
	movl	$65536, %ecx                    ## imm = 0x10000
	subl	%esi, %ecx
	movq	-96(%rbp), %r14                 ## 8-byte Reload
	movq	%r14, %rdi
	movl	%eax, %esi
	leaq	-80(%rbp), %r8
	callq	_do_special
	testl	%eax, %eax
	js	LBB0_15
## %bb.17:                              ##   in Loop: Header=BB0_7 Depth=1
	addl	%eax, %r12d
	movl	-108(%rbp), %ecx                ## 4-byte Reload
	jmp	LBB0_21
LBB0_18:                                ##   in Loop: Header=BB0_7 Depth=1
	movl	$65536, %eax                    ## imm = 0x10000
	subl	%ebx, %eax
	cmpl	%r12d, %eax
	jl	LBB0_19
## %bb.20:                              ##   in Loop: Header=BB0_7 Depth=1
	movslq	%ebx, %rax
	movl	%ecx, %r14d
	movq	-88(%rbp), %rcx                 ## 8-byte Reload
	leaq	(%rcx,%rax,4), %rdi
	leaq	8(%r15), %rsi
	leal	(%r12,%r12), %edx
	callq	_memcpy
	movl	%r14d, %ecx
	addl	%ebx, %r12d
                                        ## kill: def $r12d killed $r12d killed $r12
	jmp	LBB0_21
LBB0_5:
	movq	-120(%rbp), %rbx                ## 8-byte Reload
	jmp	LBB0_23
LBB0_8:
	movq	-96(%rbp), %rax                 ## 8-byte Reload
	movl	4(%rax), %edi
	movq	_GO7007_FW_NAME@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	leaq	L_.str.1(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_9
LBB0_22:
	movq	-104(%rbp), %rdi
	movq	-120(%rbp), %rbx                ## 8-byte Reload
	movq	-128(%rbp), %r15                ## 8-byte Reload
LBB0_23:
	callq	_release_firmware
	movq	-88(%rbp), %rax                 ## 8-byte Reload
	movq	%rax, (%r15)
	addl	%r12d, %r12d
	movl	%r12d, (%rbx)
	xorl	%r12d, %r12d
	jmp	LBB0_24
LBB0_15:
	movl	4(%r14), %edi
	jmp	LBB0_16
LBB0_19:
	movq	-96(%rbp), %rax                 ## 8-byte Reload
	movl	4(%rax), %edi
LBB0_16:
	leaq	L_.str.2(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_err
LBB0_9:
	movl	$-1, %r12d
LBB0_10:
	movq	-88(%rbp), %rdi                 ## 8-byte Reload
	callq	_kfree
	movq	-104(%rbp), %rdi
	callq	_release_firmware
LBB0_24:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_26
## %bb.25:
	movl	%r12d, %eax
	addq	$88, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_26:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_FLAG_MODE_MJPEG,4,2            ## @FLAG_MODE_MJPEG
	.comm	_FLAG_MODE_MPEG1,4,2            ## @FLAG_MODE_MPEG1
	.comm	_FLAG_MODE_MPEG2,4,2            ## @FLAG_MODE_MPEG2
	.comm	_FLAG_MODE_MPEG4,4,2            ## @FLAG_MODE_MPEG4
	.comm	_GO7007_FW_NAME,4,2             ## @GO7007_FW_NAME
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"unable to load firmware from file \"%s\"\n"

	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
L_.str.1:                               ## @.str.1
	.asciz	"firmware file \"%s\" appears to be corrupted\n"

	.comm	_FLAG_SPECIAL,4,2               ## @FLAG_SPECIAL
L_.str.2:                               ## @.str.2
	.asciz	"insufficient memory for firmware construction\n"

	.section	__DATA,__const
	.p2align	3                               ## @switch.table.go7007_construct_fw_image
l_switch.table.go7007_construct_fw_image:
	.quad	_FLAG_MODE_MPEG4
	.quad	_FLAG_MODE_MPEG2
	.quad	_FLAG_MODE_MPEG1
	.quad	_FLAG_MODE_MJPEG

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_go7007_construct_fw_image      ; -- Begin function go7007_construct_fw_image
	.p2align	2
_go7007_construct_fw_image:             ; @go7007_construct_fw_image
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #176
	.cfi_def_cfa_offset 176
	stp	x28, x27, [sp, #80]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #96]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #112]            ; 16-byte Folded Spill
	stp	x22, x21, [sp, #128]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #144]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #160]            ; 16-byte Folded Spill
	add	x29, sp, #160
	.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, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #72]
	movi.2d	v0, #0000000000000000
	stp	q0, q0, [sp, #32]
	ldr	w8, [x0]
	sub	w8, w8, #128
	cmp	w8, #3
	b.hi	LBB0_21
; %bb.1:
	mov	x19, x2
	mov	x20, x1
	mov	x22, x0
Lloh3:
	adrp	x9, l_switch.table.go7007_construct_fw_image@PAGE
Lloh4:
	add	x9, x9, l_switch.table.go7007_construct_fw_image@PAGEOFF
	ldr	x8, [x9, w8, sxtw #3]
	ldr	w26, [x8]
Lloh5:
	adrp	x21, _GO7007_FW_NAME@GOTPAGE
Lloh6:
	ldr	x21, [x21, _GO7007_FW_NAME@GOTPAGEOFF]
	ldr	w1, [x21]
	ldr	w2, [x0, #4]
	add	x0, sp, #24
	bl	_request_firmware
	cbz	x0, LBB0_3
; %bb.2:
	ldr	w0, [x22, #4]
	ldr	w8, [x21]
	str	x8, [sp]
Lloh7:
	adrp	x1, l_.str@PAGE
Lloh8:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
	b	LBB0_21
LBB0_3:
Lloh9:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh10:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh11:
	ldr	w2, [x8]
	mov	w0, #65536
	mov	w1, #2
	bl	_kcalloc
	str	x0, [sp, #16]                   ; 8-byte Folded Spill
	cbz	x0, LBB0_20
; %bb.4:
	ldr	x0, [sp, #24]
	ldr	w8, [x0]
	cmp	w8, #4
	b.lt	LBB0_14
; %bb.5:
	mov	w27, #0
	lsr	w28, w8, #1
	ldr	x25, [x0, #8]
	b	LBB0_7
LBB0_6:                                 ;   in Loop: Header=BB0_7 Depth=1
	add	x25, x25, w21, sxtw #2
	cmp	w28, #1
	b.le	LBB0_16
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x25]
	bl	___le16_to_cpu
	mov	x24, x0
	ldr	w0, [x25, #4]
	bl	___le16_to_cpu
	add	w21, w0, #2
	subs	w28, w28, w21
	b.lt	LBB0_15
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	tst	w24, w26
	b.eq	LBB0_6
; %bb.9:                                ;   in Loop: Header=BB0_7 Depth=1
Lloh12:
	adrp	x8, _FLAG_SPECIAL@GOTPAGE
Lloh13:
	ldr	x8, [x8, _FLAG_SPECIAL@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	tst	w8, w24
	b.eq	LBB0_12
; %bb.10:                               ;   in Loop: Header=BB0_7 Depth=1
	ldr	w0, [x25, #8]
	bl	___le16_to_cpu
	mov	x1, x0
	ldr	x8, [sp, #16]                   ; 8-byte Folded Reload
	add	x2, x8, w27, sxtw #2
	mov	w8, #65536
	sub	w3, w8, w27
	add	x4, sp, #32
	mov	x0, x22
	bl	_do_special
	tbnz	w0, #31, LBB0_18
; %bb.11:                               ;   in Loop: Header=BB0_7 Depth=1
	add	w27, w0, w27
	b	LBB0_6
LBB0_12:                                ;   in Loop: Header=BB0_7 Depth=1
	mov	x23, x0
	mov	w8, #65536
	sub	w8, w8, w27
	cmp	w8, w0
	b.lt	LBB0_18
; %bb.13:                               ;   in Loop: Header=BB0_7 Depth=1
	add	x1, x25, #8
	lsl	w2, w23, #1
	ldr	x8, [sp, #16]                   ; 8-byte Folded Reload
	add	x0, x8, w27, sxtw #2
	bl	_memcpy
	add	w27, w23, w27
	b	LBB0_6
LBB0_14:
	mov	w27, #0
	b	LBB0_17
LBB0_15:
	ldr	w0, [x22, #4]
Lloh15:
	adrp	x8, _GO7007_FW_NAME@GOTPAGE
Lloh16:
	ldr	x8, [x8, _GO7007_FW_NAME@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
	str	x8, [sp]
Lloh18:
	adrp	x1, l_.str.1@PAGE
Lloh19:
	add	x1, x1, l_.str.1@PAGEOFF
	b	LBB0_19
LBB0_16:
	ldr	x0, [sp, #24]
LBB0_17:
	bl	_release_firmware
	mov	w0, #0
	ldr	x8, [sp, #16]                   ; 8-byte Folded Reload
	str	x8, [x20]
	lsl	w8, w27, #1
	str	w8, [x19]
	b	LBB0_22
LBB0_18:
	ldr	w0, [x22, #4]
Lloh20:
	adrp	x1, l_.str.2@PAGE
Lloh21:
	add	x1, x1, l_.str.2@PAGEOFF
LBB0_19:
	bl	_dev_err
LBB0_20:
	ldr	x0, [sp, #16]                   ; 8-byte Folded Reload
	bl	_kfree
	ldr	x0, [sp, #24]
	bl	_release_firmware
LBB0_21:
	mov	w0, #-1
LBB0_22:
	ldr	x8, [sp, #72]
Lloh22:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh23:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh24:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_24
; %bb.23:
	ldp	x29, x30, [sp, #160]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #144]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #128]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #112]            ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #96]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #80]             ; 16-byte Folded Reload
	add	sp, sp, #176
	ret
LBB0_24:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.comm	_FLAG_MODE_MJPEG,4,2            ; @FLAG_MODE_MJPEG
	.comm	_FLAG_MODE_MPEG1,4,2            ; @FLAG_MODE_MPEG1
	.comm	_FLAG_MODE_MPEG2,4,2            ; @FLAG_MODE_MPEG2
	.comm	_FLAG_MODE_MPEG4,4,2            ; @FLAG_MODE_MPEG4
	.comm	_GO7007_FW_NAME,4,2             ; @GO7007_FW_NAME
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"unable to load firmware from file \"%s\"\n"

	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
l_.str.1:                               ; @.str.1
	.asciz	"firmware file \"%s\" appears to be corrupted\n"

	.comm	_FLAG_SPECIAL,4,2               ; @FLAG_SPECIAL
l_.str.2:                               ; @.str.2
	.asciz	"insufficient memory for firmware construction\n"

	.section	__DATA,__const
	.p2align	3                               ; @switch.table.go7007_construct_fw_image
l_switch.table.go7007_construct_fw_image:
	.quad	_FLAG_MODE_MPEG4
	.quad	_FLAG_MODE_MPEG2
	.quad	_FLAG_MODE_MPEG1
	.quad	_FLAG_MODE_MJPEG

.subsections_via_symbols
