	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function go7007_load_encoder
_go7007_load_encoder:                   ## @go7007_load_encoder
	.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	%rbx
	subq	$56, %rsp
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -32(%rbp)
	movaps	L___const.go7007_load_encoder.fw_name(%rip), %xmm0
	movaps	%xmm0, -64(%rbp)
	movl	$7235938, -48(%rbp)             ## imm = 0x6E6962
	cmpq	$0, 8(%rdi)
	je	LBB0_1
LBB0_10:
	movq	%rbx, %rdi
	callq	_go7007_interface_reset
	testq	%rax, %rax
	js	LBB0_14
## %bb.11:
	movq	8(%rbx), %rsi
	movl	(%rbx), %edx
	movq	%rbx, %rdi
	callq	_go7007_send_firmware
	testq	%rax, %rax
	js	LBB0_14
## %bb.12:
	leaq	-76(%rbp), %rsi
	leaq	-80(%rbp), %rdx
	movq	%rbx, %rdi
	callq	_go7007_read_interrupt
	testq	%rax, %rax
	js	LBB0_14
## %bb.13:
	movl	-76(%rbp), %ecx
	andl	$-2, %ecx
	xorl	%eax, %eax
	cmpl	$23130, %ecx                    ## imm = 0x5A5A
	je	LBB0_16
LBB0_14:
	leaq	L_.str.4(%rip), %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	callq	_v4l2_err
	jmp	LBB0_15
LBB0_1:
	movl	16(%rbx), %edx
	leaq	-72(%rbp), %rdi
	leaq	-64(%rbp), %rsi
	callq	_request_firmware
	testq	%rax, %rax
	je	LBB0_3
## %bb.2:
	leaq	L_.str(%rip), %rsi
	leaq	-64(%rbp), %rdx
	movq	%rbx, %rdi
	xorl	%eax, %eax
	callq	_v4l2_err
	jmp	LBB0_15
LBB0_3:
	movq	-72(%rbp), %rax
	cmpl	$16, (%rax)
	jl	LBB0_5
## %bb.4:
	movq	8(%rax), %rdi
	leaq	L_.str.1(%rip), %rsi
	movl	$11, %edx
	callq	_memcmp
	testq	%rax, %rax
	je	LBB0_7
LBB0_5:
	leaq	L_.str.2(%rip), %rsi
	leaq	-64(%rbp), %rdx
	movq	%rbx, %rdi
	xorl	%eax, %eax
	callq	_v4l2_err
LBB0_6:
	movq	-72(%rbp), %rdi
	callq	_release_firmware
LBB0_15:
	movl	$-1, %eax
LBB0_16:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	-32(%rbp), %rcx
	jne	LBB0_18
## %bb.17:
	addq	$56, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	movq	-72(%rbp), %rax
	movl	(%rax), %r14d
	addl	$-16, %r14d
	movq	8(%rax), %rdi
	addq	$16, %rdi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	%r14d, %esi
	callq	_kmemdup
	testq	%rax, %rax
	je	LBB0_8
## %bb.9:
	movq	%rax, %r15
	movq	-72(%rbp), %rdi
	callq	_release_firmware
	movl	%r14d, (%rbx)
	movq	%r15, 8(%rbx)
	jmp	LBB0_10
LBB0_8:
	leaq	L_.str.3(%rip), %rsi
	movq	%rbx, %rdi
	movl	%r14d, %edx
	xorl	%eax, %eax
	callq	_v4l2_err
	jmp	LBB0_6
LBB0_18:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
	.p2align	4                               ## @__const.go7007_load_encoder.fw_name
L___const.go7007_load_encoder.fw_name:
	.asciz	"go7007/go7007fw.bin"

L_.str:                                 ## @.str
	.asciz	"unable to load firmware from file \"%s\"\n"

L_.str.1:                               ## @.str.1
	.asciz	"WISGO7007FW"

L_.str.2:                               ## @.str.2
	.asciz	"file \"%s\" does not appear to be go7007 firmware\n"

	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
L_.str.3:                               ## @.str.3
	.asciz	"unable to allocate %d bytes for firmware transfer\n"

L_.str.4:                               ## @.str.4
	.asciz	"error transferring firmware\n"

	.no_dead_strip	_go7007_load_encoder
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function go7007_load_encoder
_go7007_load_encoder:                   ; @go7007_load_encoder
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	mov	x19, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	adrp	x9, l___const.go7007_load_encoder.fw_name@PAGE
	add	x9, x9, l___const.go7007_load_encoder.fw_name@PAGEOFF
	stur	x8, [x29, #-40]
	ldr	q0, [x9]
	str	q0, [sp, #32]
	mov	w8, #26978
	movk	w8, #110, lsl #16
	str	w8, [sp, #48]
	ldr	x8, [x0, #8]
	cbz	x8, LBB0_7
LBB0_1:
	mov	x0, x19
	bl	_go7007_interface_reset
	tbnz	x0, #63, LBB0_6
; %bb.2:
	ldr	x1, [x19, #8]
	ldr	w2, [x19]
	mov	x0, x19
	bl	_go7007_send_firmware
	tbnz	x0, #63, LBB0_6
; %bb.3:
	add	x1, sp, #20
	add	x2, sp, #16
	mov	x0, x19
	bl	_go7007_read_interrupt
	tbnz	x0, #63, LBB0_6
; %bb.4:
	ldr	w8, [sp, #20]
	mov	w9, #11565
	cmp	w9, w8, lsr #1
	b.ne	LBB0_6
; %bb.5:
	mov	w0, #0
	b	LBB0_11
LBB0_6:
Lloh3:
	adrp	x1, l_.str.4@PAGE
Lloh4:
	add	x1, x1, l_.str.4@PAGEOFF
	b	LBB0_9
LBB0_7:
	ldr	w2, [x19, #16]
	add	x20, sp, #32
	add	x0, sp, #24
	add	x1, sp, #32
	bl	_request_firmware
	cbz	x0, LBB0_13
; %bb.8:
	str	x20, [sp]
Lloh5:
	adrp	x1, l_.str@PAGE
Lloh6:
	add	x1, x1, l_.str@PAGEOFF
LBB0_9:
	mov	x0, x19
	bl	_v4l2_err
LBB0_10:
	mov	w0, #-1
LBB0_11:
	ldur	x8, [x29, #-40]
Lloh7:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh8:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh9:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_20
; %bb.12:
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_13:
	ldr	x8, [sp, #24]
	ldr	w9, [x8]
	cmp	w9, #16
	b.lt	LBB0_15
; %bb.14:
	ldr	x0, [x8, #8]
Lloh10:
	adrp	x1, l_.str.1@PAGE
Lloh11:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	w2, #11
	bl	_memcmp
	cbz	x0, LBB0_17
LBB0_15:
	add	x8, sp, #32
	str	x8, [sp]
Lloh12:
	adrp	x1, l_.str.2@PAGE
Lloh13:
	add	x1, x1, l_.str.2@PAGEOFF
LBB0_16:
	mov	x0, x19
	bl	_v4l2_err
	ldr	x0, [sp, #24]
	bl	_release_firmware
	b	LBB0_10
LBB0_17:
	ldr	x8, [sp, #24]
	ldr	w9, [x8]
	sub	w20, w9, #16
	ldr	x8, [x8, #8]
	add	x0, x8, #16
Lloh14:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh15:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh16:
	ldr	w2, [x8]
	mov	x1, x20
	bl	_kmemdup
	cbz	x0, LBB0_19
; %bb.18:
	mov	x21, x0
	ldr	x0, [sp, #24]
	bl	_release_firmware
	str	w20, [x19]
	str	x21, [x19, #8]
	b	LBB0_1
LBB0_19:
	str	x20, [sp]
Lloh17:
	adrp	x1, l_.str.3@PAGE
Lloh18:
	add	x1, x1, l_.str.3@PAGEOFF
	b	LBB0_16
LBB0_20:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpAdd	Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l___const.go7007_load_encoder.fw_name:  ; @__const.go7007_load_encoder.fw_name
	.asciz	"go7007/go7007fw.bin"

l_.str:                                 ; @.str
	.asciz	"unable to load firmware from file \"%s\"\n"

l_.str.1:                               ; @.str.1
	.asciz	"WISGO7007FW"

l_.str.2:                               ; @.str.2
	.asciz	"file \"%s\" does not appear to be go7007 firmware\n"

	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
l_.str.3:                               ; @.str.3
	.asciz	"unable to allocate %d bytes for firmware transfer\n"

l_.str.4:                               ; @.str.4
	.asciz	"error transferring firmware\n"

	.no_dead_strip	_go7007_load_encoder
.subsections_via_symbols
