	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_cx25840_loadfw                 ## -- Begin function cx25840_loadfw
	.p2align	4, 0x90
_cx25840_loadfw:                        ## @cx25840_loadfw
	.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	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	callq	_i2c_get_clientdata
	movl	%eax, %edi
	callq	_to_state
	movq	%rax, %r12
	movq	%rsp, -80(%rbp)                 ## 8-byte Spill
	movq	$0, -72(%rbp)
	movq	_FWSEND@GOTPCREL(%rip), %r14
	movl	(%r14), %eax
	shlq	$2, %rax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, -88(%rbp)                 ## 8-byte Spill
	movq	%r15, %rdi
	callq	_get_fw_name
	movq	%rax, %rbx
	movl	(%r14), %r13d
	movq	%r12, %rdi
	callq	_is_cx2388x
	testq	%rax, %rax
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	je	LBB0_2
## %bb.1:
	movq	%r15, %rdi
	movl	$352, %esi                      ## imm = 0x160
	callq	_cx25840_read
	movl	%eax, -64(%rbp)                 ## 4-byte Spill
	movq	%r15, %rdi
	movl	$356, %esi                      ## imm = 0x164
	callq	_cx25840_read
	movl	%eax, -60(%rbp)                 ## 4-byte Spill
	jmp	LBB0_3
LBB0_2:
	movl	$0, -64(%rbp)                   ## 4-byte Folded Spill
	movl	$0, -60(%rbp)                   ## 4-byte Folded Spill
LBB0_3:
	movq	%r12, %rdi
	callq	_is_cx231xx
	testq	%rax, %rax
	movq	%r12, -96(%rbp)                 ## 8-byte Spill
	setne	%bl
	cmpl	$17, %r13d
	setge	%r14b
	movq	%r15, %rdi
	callq	_FWDEV
	leaq	-72(%rbp), %rdi
	movq	-56(%rbp), %r12                 ## 8-byte Reload
	movq	%r12, %rsi
	movl	%eax, %edx
	callq	_request_firmware
	testq	%rax, %rax
	je	LBB0_5
## %bb.4:
	leaq	L_.str(%rip), %rsi
	movq	%r15, %rdi
	movq	%r12, %rdx
	callq	_v4l_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
LBB0_13:
	movq	-80(%rbp), %rbx                 ## 8-byte Reload
	jmp	LBB0_14
LBB0_5:
	movb	%bl, -56(%rbp)                  ## 1-byte Spill
	movq	%r15, %rdi
	callq	_start_fw_load
	movabsq	$8589934600, %rax               ## imm = 0x200000008
	movq	-88(%rbp), %rcx                 ## 8-byte Reload
	movq	%rax, (%rcx)
	movq	-72(%rbp), %rax
	movl	(%rax), %r12d
	testl	%r12d, %r12d
	jle	LBB0_9
## %bb.6:
	movb	-56(%rbp), %cl                  ## 1-byte Reload
	andb	%r14b, %cl
	movq	8(%rax), %rbx
	addl	$-2, %r13d
	testb	%cl, %cl
	movl	$14, %eax
	cmovel	%r13d, %eax
	movl	%eax, -56(%rbp)                 ## 4-byte Spill
	movq	-88(%rbp), %rax                 ## 8-byte Reload
	addq	$8, %rax
	movq	%rax, -104(%rbp)                ## 8-byte Spill
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movl	-56(%rbp), %edi                 ## 4-byte Reload
	movl	%r12d, %esi
	callq	_min
	movl	%eax, %r14d
	movq	-104(%rbp), %rdi                ## 8-byte Reload
	movq	%rbx, %rsi
	movl	%eax, %edx
	callq	_memcpy
	leal	2(%r14), %edx
	movq	%r15, %r13
	movq	%r15, %rdi
	movq	-88(%rbp), %rsi                 ## 8-byte Reload
	callq	_fw_write
	testl	%eax, %eax
	js	LBB0_12
## %bb.8:                               ##   in Loop: Header=BB0_7 Depth=1
	movslq	%r14d, %rax
	leaq	(%rbx,%rax,4), %rbx
	subl	%r14d, %r12d
	movq	%r13, %r15
	jg	LBB0_7
LBB0_9:
	movq	%r15, %rdi
	callq	_end_fw_load
	movq	-72(%rbp), %rdi
	movl	(%rdi), %r14d
	callq	_release_firmware
	movq	-96(%rbp), %rdi                 ## 8-byte Reload
	callq	_is_cx2388x
	testq	%rax, %rax
	movq	-80(%rbp), %rbx                 ## 8-byte Reload
	je	LBB0_11
## %bb.10:
	movq	%r15, %rdi
	movl	$352, %esi                      ## imm = 0x160
	movl	-64(%rbp), %edx                 ## 4-byte Reload
	callq	_cx25840_write
	movq	%r15, %rdi
	movl	$356, %esi                      ## imm = 0x164
	movl	-60(%rbp), %edx                 ## 4-byte Reload
	callq	_cx25840_write
LBB0_11:
	movq	%r15, %rdi
	movl	%r14d, %esi
	callq	_check_fw_load
	movl	%eax, %r15d
LBB0_14:
	movq	%rbx, %rsp
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_16
## %bb.15:
	movl	%r15d, %eax
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_12:
	movl	%eax, %r15d
	movq	-72(%rbp), %rdi
	callq	_release_firmware
	jmp	LBB0_13
LBB0_16:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_FWSEND,4,2                     ## @FWSEND
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"unable to open firmware %s\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal8,8byte_literals
	.p2align	3                               ; -- Begin function cx25840_loadfw
lCPI0_0:
	.long	8                               ; 0x8
	.long	2                               ; 0x2
	.section	__TEXT,__text,regular,pure_instructions
	.globl	_cx25840_loadfw
	.p2align	2
_cx25840_loadfw:                        ; @cx25840_loadfw
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	sub	sp, sp, #32
	mov	x19, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-88]
	bl	_i2c_get_clientdata
	bl	_to_state
	mov	x20, x0
	mov	x23, sp
	stur	xzr, [x29, #-96]
Lloh3:
	adrp	x22, _FWSEND@GOTPAGE
Lloh4:
	ldr	x22, [x22, _FWSEND@GOTPAGEOFF]
	ldr	w8, [x22]
	lsl	x8, x8, #2
	mov	x9, x8
Lloh5:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh6:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x9, sp
	add	x8, x8, #15
	and	x8, x8, #0x7fffffff0
	sub	x21, x9, x8
	mov	sp, x21
	mov	x0, x19
	bl	_get_fw_name
	mov	x24, x0
	ldr	w22, [x22]
	mov	x0, x20
	bl	_is_cx2388x
	cbz	x0, LBB0_2
; %bb.1:
	mov	x0, x19
	mov	w1, #352
	bl	_cx25840_read
	mov	x25, x0
	mov	x0, x19
	mov	w1, #356
	bl	_cx25840_read
	mov	x27, x0
	b	LBB0_3
LBB0_2:
	mov	w25, #0
	mov	w27, #0
LBB0_3:
	mov	x0, x20
	bl	_is_cx231xx
	cmp	x0, #0
	ccmp	w22, #16, #4, ne
	cset	w26, gt
	mov	x0, x19
	bl	_FWDEV
	mov	x2, x0
	sub	x0, x29, #96
	mov	x1, x24
	bl	_request_firmware
	cbz	x0, LBB0_5
; %bb.4:
Lloh7:
	adrp	x1, l_.str@PAGE
Lloh8:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	mov	x2, x24
	bl	_v4l_err
Lloh9:
	adrp	x8, _EINVAL@GOTPAGE
Lloh10:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	neg	w28, w8
	b	LBB0_13
LBB0_5:
	stp	w27, w25, [x29, #-104]          ; 8-byte Folded Spill
	mov	x0, x19
	bl	_start_fw_load
Lloh12:
	adrp	x8, lCPI0_0@PAGE
Lloh13:
	ldr	d0, [x8, lCPI0_0@PAGEOFF]
	str	d0, [x21]
	ldur	x8, [x29, #-96]
	ldr	w24, [x8]
	cmp	w24, #1
	b.lt	LBB0_9
; %bb.6:
	ldr	x25, [x8, #8]
	sub	w8, w22, #2
	mov	w9, #14
	cmp	w26, #0
	csel	w26, w9, w8, ne
	add	x27, x21, #8
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x26
	mov	x1, x24
	bl	_min
	mov	x22, x0
	mov	x0, x27
	mov	x1, x25
	mov	x2, x22
	bl	_memcpy
	add	w2, w22, #2
	mov	x0, x19
	mov	x1, x21
	bl	_fw_write
	tbnz	w0, #31, LBB0_12
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	sub	w24, w24, w22
	add	x25, x25, w22, sxtw #2
	cmp	w24, #0
	b.gt	LBB0_7
LBB0_9:
	mov	x0, x19
	bl	_end_fw_load
	ldur	x0, [x29, #-96]
	ldr	w21, [x0]
	bl	_release_firmware
	mov	x0, x20
	bl	_is_cx2388x
	cbz	x0, LBB0_11
; %bb.10:
	mov	x0, x19
	mov	w1, #352
	ldur	w2, [x29, #-100]                ; 4-byte Folded Reload
	bl	_cx25840_write
	mov	x0, x19
	mov	w1, #356
	ldur	w2, [x29, #-104]                ; 4-byte Folded Reload
	bl	_cx25840_write
LBB0_11:
	mov	x0, x19
	mov	x1, x21
	bl	_check_fw_load
	mov	x28, x0
	b	LBB0_13
LBB0_12:
	mov	x28, x0
	ldur	x0, [x29, #-96]
	bl	_release_firmware
LBB0_13:
	mov	sp, x23
	ldur	x8, [x29, #-88]
Lloh14:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh15:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh16:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_15
; %bb.14:
	mov	x0, x28
	sub	sp, x29, #80
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_15:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdr	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.comm	_FWSEND,4,2                     ; @FWSEND
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"unable to open firmware %s\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
.subsections_via_symbols
