	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function s5k4ecgx_load_firmware
_s5k4ecgx_load_firmware:                ## @s5k4ecgx_load_firmware
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	callq	_v4l2_get_subdevdata
	movq	%rax, %r14
	movq	_S5K4ECGX_FIRMWARE@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	movq	(%r15), %rax
	movl	(%rax), %edx
	leaq	-48(%rbp), %rdi
	callq	_request_firmware
	testl	%eax, %eax
	je	LBB0_2
## %bb.1:
	movl	%eax, %r13d
	movslq	(%rbx), %rdx
	leaq	L_.str(%rip), %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	callq	_v4l2_err
	jmp	LBB0_16
LBB0_2:
	movq	-48(%rbp), %rax
	movq	8(%rax), %rdi
	callq	_get_unaligned_le32
	movq	%rax, %r12
	movq	_debug@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	(%rbx), %r8d
	movq	-48(%rbp), %rax
	movq	(%rax), %r9
	movl	%r12d, (%rsp)
	leaq	L_.str.1(%rip), %rcx
	movl	$3, %edi
	movq	%r15, %rdx
	callq	_v4l2_dbg
	leal	1(%r12), %ebx
	movq	-48(%rbp), %rax
	movq	_FW_RECORD_SIZE@GOTPCREL(%rip), %rcx
	movslq	(%rcx), %rcx
	movslq	%ebx, %rdi
	imulq	%rcx, %rdi
	movq	_FW_CRC_SIZE@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	addq	%rdi, %rcx
	cmpq	%rcx, (%rax)
	jne	LBB0_12
## %bb.3:
	shlq	$2, %rdi
	addq	8(%rax), %rdi
	callq	_get_unaligned_le32
	movq	%rax, %r13
	movq	-48(%rbp), %rax
	movq	8(%rax), %rsi
	movq	_FW_RECORD_SIZE@GOTPCREL(%rip), %rax
	imull	(%rax), %ebx
	movl	$-1, %edi
	movl	%ebx, %edx
	callq	_crc32_le
	cmpq	%r13, %rax
	jne	LBB0_13
## %bb.4:
	testl	%r12d, %r12d
	jle	LBB0_11
## %bb.5:
	movq	-48(%rbp), %rax
	movq	_FW_RECORD_SIZE@GOTPCREL(%rip), %rcx
	movslq	(%rcx), %rbx
	shlq	$2, %rbx
	addq	8(%rax), %rbx
	xorl	%r13d, %r13d
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movq	%rbx, %rdi
	callq	_get_unaligned_le32
	movq	%rax, %r15
	addq	$32, %rbx
	movq	%rbx, %rdi
	callq	_get_unaligned_le16
	movq	%r15, %rcx
	subq	%r13, %rcx
	cmpq	$2, %rcx
	jne	LBB0_8
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	movq	_REG_CMDBUF0_ADDR@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	movq	%r14, %rdi
	movl	%eax, %edx
	callq	_s5k4ecgx_i2c_write
	jmp	LBB0_9
	.p2align	4, 0x90
LBB0_8:                                 ##   in Loop: Header=BB0_6 Depth=1
	movq	%r14, %rdi
	movq	%r15, %rsi
	movl	%eax, %edx
	callq	_s5k4ecgx_write
LBB0_9:                                 ##   in Loop: Header=BB0_6 Depth=1
	movl	%eax, %r13d
	testl	%eax, %eax
	jne	LBB0_15
## %bb.10:                              ##   in Loop: Header=BB0_6 Depth=1
	addq	$16, %rbx
	movq	%r15, %r13
	decl	%r12d
	jne	LBB0_6
LBB0_11:
	xorl	%r13d, %r13d
	jmp	LBB0_15
LBB0_12:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r13d, %r13d
	jmp	LBB0_14
LBB0_13:
	movq	%r13, %rcx
	leaq	L_.str.2(%rip), %rsi
	xorl	%r13d, %r13d
	movq	%r15, %rdi
	movq	%rax, %rdx
	xorl	%eax, %eax
	callq	_v4l2_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_14:
	subl	(%rax), %r13d
LBB0_15:
	movq	-48(%rbp), %rdi
	callq	_release_firmware
LBB0_16:
	movl	%r13d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_S5K4ECGX_FIRMWARE,4,2          ## @S5K4ECGX_FIRMWARE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to read firmware %s\n"

	.comm	_debug,4,2                      ## @debug
L_.str.1:                               ## @.str.1
	.asciz	"FW: %s size %zu register sets %d\n"

	.comm	_FW_RECORD_SIZE,4,2             ## @FW_RECORD_SIZE
	.comm	_FW_CRC_SIZE,8,3                ## @FW_CRC_SIZE
	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.2:                               ## @.str.2
	.asciz	"FW: invalid crc (%#x:%#x)\n"

	.comm	_REG_CMDBUF0_ADDR,4,2           ## @REG_CMDBUF0_ADDR
	.no_dead_strip	_s5k4ecgx_load_firmware
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function s5k4ecgx_load_firmware
_s5k4ecgx_load_firmware:                ; @s5k4ecgx_load_firmware
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.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
	mov	x21, x0
	bl	_v4l2_get_subdevdata
	mov	x19, x0
Lloh0:
	adrp	x23, _S5K4ECGX_FIRMWARE@GOTPAGE
Lloh1:
	ldr	x23, [x23, _S5K4ECGX_FIRMWARE@GOTPAGEOFF]
	ldr	w1, [x23]
	ldr	x8, [x21]
	ldr	w2, [x8]
	add	x0, sp, #8
	bl	_request_firmware
	cbz	w0, LBB0_2
; %bb.1:
	mov	x22, x0
	ldrsw	x2, [x23]
Lloh2:
	adrp	x1, l_.str@PAGE
Lloh3:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x21
	bl	_v4l2_err
	b	LBB0_15
LBB0_2:
	ldr	x8, [sp, #8]
	ldr	x0, [x8, #8]
	bl	_get_unaligned_le32
	mov	x20, x0
Lloh4:
	adrp	x8, _debug@GOTPAGE
Lloh5:
	ldr	x8, [x8, _debug@GOTPAGEOFF]
Lloh6:
	ldr	w1, [x8]
	ldr	w4, [x23]
	ldr	x8, [sp, #8]
	ldr	x5, [x8]
Lloh7:
	adrp	x3, l_.str.1@PAGE
Lloh8:
	add	x3, x3, l_.str.1@PAGEOFF
	mov	w0, #3
	mov	x2, x21
	mov	x6, x20
	bl	_v4l2_dbg
	add	w24, w20, #1
	ldr	x8, [sp, #8]
	ldr	x10, [x8]
Lloh9:
	adrp	x23, _FW_RECORD_SIZE@GOTPAGE
Lloh10:
	ldr	x23, [x23, _FW_RECORD_SIZE@GOTPAGEOFF]
	ldrsw	x9, [x23]
	sxtw	x11, w24
	mul	x9, x9, x11
Lloh11:
	adrp	x11, _FW_CRC_SIZE@GOTPAGE
Lloh12:
	ldr	x11, [x11, _FW_CRC_SIZE@GOTPAGEOFF]
Lloh13:
	ldr	x11, [x11]
	add	x11, x11, x9
	cmp	x10, x11
	b.ne	LBB0_13
; %bb.3:
	ldr	x8, [x8, #8]
	add	x0, x8, x9, lsl #2
	bl	_get_unaligned_le32
	mov	x22, x0
	ldr	x8, [sp, #8]
	ldr	x1, [x8, #8]
	ldr	w8, [x23]
	mul	w2, w8, w24
	mov	w0, #-1
	bl	_crc32_le
	cmp	x0, x22
	b.ne	LBB0_12
; %bb.4:
	cmp	w20, #1
	b.lt	LBB0_11
; %bb.5:
	mov	x25, #0
	ldr	x8, [sp, #8]
	ldr	x8, [x8, #8]
	ldrsw	x9, [x23]
	add	x22, x8, x9, lsl #2
Lloh14:
	adrp	x24, _REG_CMDBUF0_ADDR@GOTPAGE
Lloh15:
	ldr	x24, [x24, _REG_CMDBUF0_ADDR@GOTPAGEOFF]
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x22
	bl	_get_unaligned_le32
	mov	x21, x0
	add	x23, x22, #32
	mov	x0, x23
	bl	_get_unaligned_le16
	mov	x2, x0
	sub	x8, x21, x25
	cmp	x8, #2
	b.ne	LBB0_8
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	ldr	w1, [x24]
	mov	x0, x19
	bl	_s5k4ecgx_i2c_write
	b	LBB0_9
LBB0_8:                                 ;   in Loop: Header=BB0_6 Depth=1
	mov	x0, x19
	mov	x1, x21
	bl	_s5k4ecgx_write
LBB0_9:                                 ;   in Loop: Header=BB0_6 Depth=1
	mov	x22, x0
	cbnz	w0, LBB0_14
; %bb.10:                               ;   in Loop: Header=BB0_6 Depth=1
	add	x22, x23, #16
	mov	x25, x21
	subs	w20, w20, #1
	b.ne	LBB0_6
LBB0_11:
	mov	w22, #0
	b	LBB0_14
LBB0_12:
	mov	x2, x0
	str	x22, [sp]
Lloh16:
	adrp	x1, l_.str.2@PAGE
Lloh17:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x21
	bl	_v4l2_err
LBB0_13:
Lloh18:
	adrp	x8, _EINVAL@GOTPAGE
Lloh19:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_14:
	ldr	x0, [sp, #8]
	bl	_release_firmware
LBB0_15:
	mov	x0, x22
	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
	add	sp, sp, #96
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_S5K4ECGX_FIRMWARE,4,2          ; @S5K4ECGX_FIRMWARE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to read firmware %s\n"

	.comm	_debug,4,2                      ; @debug
l_.str.1:                               ; @.str.1
	.asciz	"FW: %s size %zu register sets %d\n"

	.comm	_FW_RECORD_SIZE,4,2             ; @FW_RECORD_SIZE
	.comm	_FW_CRC_SIZE,8,3                ; @FW_CRC_SIZE
	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.2:                               ; @.str.2
	.asciz	"FW: invalid crc (%#x:%#x)\n"

	.comm	_REG_CMDBUF0_ADDR,4,2           ; @REG_CMDBUF0_ADDR
	.no_dead_strip	_s5k4ecgx_load_firmware
.subsections_via_symbols
