	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_gspca_coarse_grained_expo_autogain ## -- Begin function gspca_coarse_grained_expo_autogain
	.p2align	4, 0x90
_gspca_coarse_grained_expo_autogain:    ## @gspca_coarse_grained_expo_autogain
	.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
	movl	%ecx, %ebx
	movl	%edx, -44(%rbp)                 ## 4-byte Spill
	movl	%esi, %r15d
	movq	%rdi, %r14
	movq	24(%rdi), %rdi
	callq	_v4l2_ctrl_g_ctrl
	testq	%rax, %rax
	je	LBB0_9
## %bb.1:
	movq	16(%r14), %rdi
	callq	_v4l2_ctrl_g_ctrl
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	movq	8(%r14), %rdi
	callq	_v4l2_ctrl_g_ctrl
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movq	16(%r14), %rax
	movl	(%rax), %ecx
	movl	4(%rax), %r13d
	subl	%r13d, %ecx
	movslq	%ecx, %rax
	imulq	$1717986919, %rax, %r12         ## imm = 0x66666667
	movq	%r12, %rax
	shrq	$63, %rax
	sarq	$33, %r12
	addl	%eax, %r12d
	movl	-44(%rbp), %r8d                 ## 4-byte Reload
	movl	%r15d, %ecx
	leal	(%r13,%r12,4), %r15d
	movl	%r8d, %eax
	subl	%ecx, %eax
	cltd
	idivl	%ebx
	movl	%eax, %ebx
	movq	_D_FRAM@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str(%rip), %rdx
	movq	%r14, %rdi
	movl	%ebx, %r9d
	xorl	%eax, %eax
	callq	_gspca_dbg
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	movq	-64(%rbp), %rdx                 ## 8-byte Reload
	addl	%edx, %ebx
	cmpl	%r15d, %ebx
	jle	LBB0_5
## %bb.2:
	movq	8(%r14), %rax
	cmpl	%ecx, (%rax)
	jle	LBB0_5
## %bb.3:
	movq	%rcx, %r13
	movl	(%r14), %eax
	leal	1(%rax), %ecx
	movl	%ecx, (%r14)
	movl	$0, 4(%r14)
	cmpl	$3, %eax
	jl	LBB0_13
## %bb.4:
	leal	1(%r13), %r12d
	movl	$0, (%r14)
	cmpl	%edx, %r15d
	jne	LBB0_16
	jmp	LBB0_15
LBB0_5:
	leal	(%r13,%r12,2), %r15d
	cmpl	%r15d, %ebx
	movq	%rcx, %r13
	jge	LBB0_10
## %bb.6:
	movq	8(%r14), %rax
	cmpl	%r13d, 4(%rax)
	jge	LBB0_10
## %bb.7:
	movl	4(%r14), %eax
	leal	1(%rax), %ecx
	movl	%ecx, 4(%r14)
	movl	$0, (%r14)
	cmpl	$3, %eax
	jl	LBB0_13
## %bb.8:
	leal	-1(%r13), %r12d
	movl	$0, 4(%r14)
	cmpl	%edx, %r15d
	je	LBB0_15
LBB0_16:
	movq	16(%r14), %rdi
	movl	%r15d, %esi
	callq	_v4l2_ctrl_s_ctrl
	cmpl	%r13d, %r12d
	je	LBB0_18
	jmp	LBB0_17
LBB0_9:
	xorl	%eax, %eax
	jmp	LBB0_19
LBB0_10:
	movq	16(%r14), %rax
	movl	(%rax), %r15d
	cmpl	%r15d, %ebx
	jg	LBB0_12
## %bb.11:
	movl	4(%rax), %r15d
	cmpl	%r15d, %ebx
	cmovgl	%ebx, %r15d
LBB0_12:
	movq	$0, (%r14)
LBB0_13:
	movl	%r13d, %r12d
	cmpl	%edx, %r15d
	jne	LBB0_16
LBB0_15:
	xorl	%eax, %eax
	cmpl	%r13d, %r12d
	je	LBB0_19
LBB0_17:
	movq	8(%r14), %rdi
	movl	%r12d, %esi
	callq	_v4l2_ctrl_s_ctrl
LBB0_18:
	movq	_D_FRAM@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str.1(%rip), %rdx
	movq	%r14, %rdi
	movl	%r15d, %ecx
	movl	%r12d, %r8d
	xorl	%eax, %eax
	callq	_gspca_dbg
	movl	$1, %eax
LBB0_19:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_D_FRAM,4,2                     ## @D_FRAM
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"autogain: lum: %d, desired: %d, steps: %d\n"

L_.str.1:                               ## @.str.1
	.asciz	"autogain: changed gain: %d, expo: %d\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_gspca_coarse_grained_expo_autogain ; -- Begin function gspca_coarse_grained_expo_autogain
	.p2align	2
_gspca_coarse_grained_expo_autogain:    ; @gspca_coarse_grained_expo_autogain
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x25, x3
	mov	x23, x2
	mov	x24, x1
	mov	x19, x0
	ldr	x0, [x0, #24]
	bl	_v4l2_ctrl_g_ctrl
	cbz	x0, LBB0_18
; %bb.1:
	ldr	x0, [x19, #16]
	bl	_v4l2_ctrl_g_ctrl
	mov	x22, x0
	ldr	x0, [x19, #8]
	bl	_v4l2_ctrl_g_ctrl
	mov	x20, x0
	ldr	x8, [x19, #16]
	ldp	w9, w26, [x8]
	sub	w8, w9, w26
	mov	w9, #26215
	movk	w9, #26214, lsl #16
	smull	x8, w8, w9
	lsr	x9, x8, #63
	asr	x8, x8, #33
	add	w27, w8, w9
	add	w21, w26, w27, lsl #2
	sub	w8, w23, w24
	sdiv	w28, w8, w25
Lloh0:
	adrp	x25, _D_FRAM@GOTPAGE
Lloh1:
	ldr	x25, [x25, _D_FRAM@GOTPAGEOFF]
	ldr	w1, [x25]
Lloh2:
	adrp	x2, l_.str@PAGE
Lloh3:
	add	x2, x2, l_.str@PAGEOFF
	str	x28, [sp]
	mov	x0, x19
	mov	x3, x24
	mov	x4, x23
	bl	_gspca_dbg
	add	w8, w28, w22
	cmp	w8, w21
	b.le	LBB0_5
; %bb.2:
	ldr	x9, [x19, #8]
	ldr	w9, [x9]
	cmp	w9, w20
	b.le	LBB0_5
; %bb.3:
	ldr	w8, [x19]
	add	w9, w8, #1
	stp	w9, wzr, [x19]
	cmp	w8, #3
	b.lt	LBB0_13
; %bb.4:
	add	w23, w20, #1
	str	wzr, [x19]
	cmp	w21, w22
	b.ne	LBB0_9
	b	LBB0_14
LBB0_5:
	add	w21, w26, w27, lsl #1
	cmp	w8, w21
	b.ge	LBB0_10
; %bb.6:
	ldr	x9, [x19, #8]
	ldr	w9, [x9, #4]
	cmp	w9, w20
	b.ge	LBB0_10
; %bb.7:
	ldr	w8, [x19, #4]
	add	w9, w8, #1
	stp	wzr, w9, [x19]
	cmp	w8, #3
	b.lt	LBB0_13
; %bb.8:
	sub	w23, w20, #1
	str	wzr, [x19, #4]
	cmp	w21, w22
	b.eq	LBB0_14
LBB0_9:
	ldr	x0, [x19, #16]
	mov	x1, x21
	bl	_v4l2_ctrl_s_ctrl
	cmp	w23, w20
	b.eq	LBB0_17
	b	LBB0_16
LBB0_10:
	ldr	x9, [x19, #16]
	ldr	w21, [x9]
	cmp	w8, w21
	b.gt	LBB0_12
; %bb.11:
	ldr	w9, [x9, #4]
	cmp	w8, w9
	csel	w21, w8, w9, gt
LBB0_12:
	str	xzr, [x19]
LBB0_13:
	mov	x23, x20
	cmp	w21, w22
	b.ne	LBB0_9
LBB0_14:
	cmp	w23, w20
	b.ne	LBB0_16
; %bb.15:
	mov	w0, #0
	b	LBB0_18
LBB0_16:
	ldr	x0, [x19, #8]
	mov	x1, x23
	bl	_v4l2_ctrl_s_ctrl
LBB0_17:
	ldr	w1, [x25]
Lloh4:
	adrp	x2, l_.str.1@PAGE
Lloh5:
	add	x2, x2, l_.str.1@PAGEOFF
	mov	x0, x19
	mov	x3, x21
	mov	x4, x23
	bl	_gspca_dbg
	mov	w0, #1
LBB0_18:
	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
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_D_FRAM,4,2                     ; @D_FRAM
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"autogain: lum: %d, desired: %d, steps: %d\n"

l_.str.1:                               ; @.str.1
	.asciz	"autogain: changed gain: %d, expo: %d\n"

.subsections_via_symbols
