	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function gspca_coarse_grained_expo_autogain
_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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, -68(%rbp)                 ## 4-byte Spill
	movq	8(%rdi), %r10
	movl	(%r10), %r13d
	testl	%r13d, %r13d
	jle	LBB0_7
## %bb.1:
	movq	%rdi, %r12
	movl	(%rdi), %r11d
	movq	_V4L2_CID_GAIN@GOTPCREL(%rip), %rax
	movq	(%rax), %r8
	movq	_V4L2_CID_EXPOSURE@GOTPCREL(%rip), %rax
	movq	(%rax), %r9
	shlq	$5, %r13
	xorl	%ebx, %ebx
	xorl	%ecx, %ecx
	xorl	%r14d, %r14d
	xorl	%r15d, %r15d
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_4:                                 ##   in Loop: Header=BB0_2 Depth=1
	incl	%ecx
	addq	$32, %rbx
	cmpq	%rbx, %r13
	je	LBB0_5
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	btl	%ecx, %r11d
	jb	LBB0_4
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	8(%r10), %rdi
	movq	8(%rdi,%rbx), %rax
	addq	%rbx, %rdi
	cmpq	%r8, %rax
	cmoveq	%rdi, %r15
	cmpq	%r9, %rax
	cmoveq	%rdi, %r14
	jmp	LBB0_4
LBB0_5:
	testq	%r15, %r15
	je	LBB0_7
## %bb.6:
	testq	%r14, %r14
	je	LBB0_7
## %bb.8:
	movl	%esi, -64(%rbp)                 ## 4-byte Spill
	movl	%edx, %ebx
	leaq	-44(%rbp), %rsi
	movq	%r12, %rdi
	callq	*24(%r15)
	xorl	%r13d, %r13d
	testq	%rax, %rax
	jne	LBB0_29
## %bb.9:
	leaq	-48(%rbp), %rsi
	movq	%r12, %rdi
	callq	*24(%r14)
	testq	%rax, %rax
	jne	LBB0_29
## %bb.10:
	movl	-44(%rbp), %eax
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
	movl	-48(%rbp), %eax
	movl	%eax, -56(%rbp)                 ## 4-byte Spill
	movl	16(%r15), %eax
	movl	20(%r15), %ecx
	subl	%ecx, %eax
	cltq
	imulq	$1717986919, %rax, %r13         ## imm = 0x66666667
	movq	%r13, %rax
	shrq	$63, %rax
	sarq	$33, %r13
	addl	%eax, %r13d
	movq	%rcx, -80(%rbp)                 ## 8-byte Spill
	leal	(%rcx,%r13,4), %eax
	movl	%eax, -60(%rbp)                 ## 4-byte Spill
	movl	%ebx, %ecx
	movl	%ebx, %eax
	movl	-64(%rbp), %r8d                 ## 4-byte Reload
	subl	%r8d, %eax
	cltd
	idivl	-68(%rbp)                       ## 4-byte Folded Reload
	movl	%eax, %ebx
	movq	_D_FRAM@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.1(%rip), %rsi
	movl	%r8d, %edx
	movl	%ebx, %r8d
	xorl	%eax, %eax
	callq	_PDEBUG
	movl	-60(%rbp), %esi                 ## 4-byte Reload
	addl	-44(%rbp), %ebx
	cmpl	%esi, %ebx
	jle	LBB0_13
## %bb.11:
	movslq	16(%r14), %rax
	cmpq	%rax, (%r12)
	jge	LBB0_13
## %bb.12:
	movl	%esi, -44(%rbp)
	incl	8(%r12)
	movl	12(%r12), %eax
	jmp	LBB0_16
LBB0_7:
	movq	_D_ERR@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%r13d, %r13d
	xorl	%eax, %eax
	callq	_PDEBUG
LBB0_29:
	movl	%r13d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_13:
	movq	-80(%rbp), %rax                 ## 8-byte Reload
	leal	(%rax,%r13,2), %esi
	cmpl	%esi, %ebx
	jge	LBB0_18
## %bb.14:
	movslq	20(%r14), %rax
	cmpq	%rax, (%r12)
	jle	LBB0_18
## %bb.15:
	movl	%esi, -44(%rbp)
	movl	12(%r12), %eax
	incl	%eax
	movl	%eax, 12(%r12)
LBB0_16:
	cmpl	$4, %eax
	movl	-56(%rbp), %ebx                 ## 4-byte Reload
	movl	-52(%rbp), %ecx                 ## 4-byte Reload
	jl	LBB0_23
## %bb.17:
	decl	-48(%rbp)
	movl	$0, 12(%r12)
	jmp	LBB0_25
LBB0_18:
	movl	%ebx, -44(%rbp)
	movl	16(%r15), %eax
	cmpl	%eax, %ebx
	jle	LBB0_20
## %bb.19:
	movl	%eax, -44(%rbp)
	movl	%eax, %ebx
	movl	-52(%rbp), %ecx                 ## 4-byte Reload
	jmp	LBB0_22
LBB0_20:
	movl	20(%r15), %eax
	cmpl	%eax, %ebx
	movl	-52(%rbp), %ecx                 ## 4-byte Reload
	jge	LBB0_22
## %bb.21:
	movl	%eax, -44(%rbp)
	movl	%eax, %ebx
LBB0_22:
	movq	$0, 8(%r12)
	movl	%ebx, %esi
	movl	-56(%rbp), %ebx                 ## 4-byte Reload
LBB0_23:
	cmpl	$4, 8(%r12)
	jl	LBB0_25
## %bb.24:
	incl	-48(%rbp)
	movl	$0, 8(%r12)
LBB0_25:
	xorl	%r13d, %r13d
	cmpl	%ecx, %esi
	je	LBB0_27
## %bb.26:
	movq	%r12, %rdi
	callq	*(%r15)
	movl	$1, %r13d
LBB0_27:
	movl	-48(%rbp), %esi
	cmpl	%ebx, %esi
	je	LBB0_29
## %bb.28:
	movq	%r12, %rdi
	callq	*(%r14)
	movl	$1, %r13d
	jmp	LBB0_29
	.cfi_endproc
                                        ## -- End function
	.comm	_V4L2_CID_GAIN,8,3              ## @V4L2_CID_GAIN
	.comm	_V4L2_CID_EXPOSURE,8,3          ## @V4L2_CID_EXPOSURE
	.comm	_D_ERR,4,2                      ## @D_ERR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Error: gspca_coarse_grained_expo_autogain called on cam without gain or exposure"

	.comm	_D_FRAM,4,2                     ## @D_FRAM
L_.str.1:                               ## @.str.1
	.asciz	"autogain: lum: %d, desired: %d, steps: %d"

	.no_dead_strip	_gspca_coarse_grained_expo_autogain
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function gspca_coarse_grained_expo_autogain
_gspca_coarse_grained_expo_autogain:    ; @gspca_coarse_grained_expo_autogain
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #144
	.cfi_def_cfa_offset 144
	stp	x28, x27, [sp, #48]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #64]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #80]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #96]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #112]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #128]            ; 16-byte Folded Spill
	add	x29, sp, #128
	.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
	ldr	x8, [x0, #8]
	ldr	w9, [x8]
	cmp	w9, #1
	b.lt	LBB0_12
; %bb.1:
	mov	x22, x3
	mov	x21, x2
	mov	x20, x1
	mov	x19, x0
	mov	x10, #0
	mov	x23, #0
	mov	x24, #0
Lloh0:
	adrp	x12, _V4L2_CID_GAIN@GOTPAGE
Lloh1:
	ldr	x12, [x12, _V4L2_CID_GAIN@GOTPAGEOFF]
	ldr	w11, [x0]
Lloh2:
	ldr	x12, [x12]
Lloh3:
	adrp	x13, _V4L2_CID_EXPOSURE@GOTPAGE
Lloh4:
	ldr	x13, [x13, _V4L2_CID_EXPOSURE@GOTPAGEOFF]
Lloh5:
	ldr	x13, [x13]
	mov	w14, #8
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	add	x10, x10, #1
	add	x14, x14, #32
	cmp	x9, x10
	b.eq	LBB0_5
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	lsr	w15, w11, w10
	tbnz	w15, #0, LBB0_2
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	x15, [x8, #8]
	add	x15, x15, x14
	ldr	x16, [x15], #-8
	cmp	x16, x12
	csel	x24, x15, x24, eq
	cmp	x16, x13
	csel	x23, x15, x23, eq
	b	LBB0_2
LBB0_5:
	cbz	x24, LBB0_12
; %bb.6:
	cbz	x23, LBB0_12
; %bb.7:
	ldr	x8, [x24, #24]
	add	x1, sp, #44
	mov	x0, x19
	blr	x8
	cbnz	x0, LBB0_13
; %bb.8:
	ldr	x8, [x23, #24]
	add	x1, sp, #40
	mov	x0, x19
	blr	x8
	cbnz	x0, LBB0_13
; %bb.9:
	ldp	w26, w8, [sp, #40]
	str	w8, [sp, #36]                   ; 4-byte Folded Spill
	ldp	w8, w27, [x24, #16]
	sub	w8, w8, w27
	mov	w9, #26215
	movk	w9, #26214, lsl #16
	smull	x8, w8, w9
	lsr	x9, x8, #63
	asr	x8, x8, #33
	add	w25, w8, w9
	add	w28, w27, w25, lsl #2
	sub	w8, w21, w20
	sdiv	w22, w8, w22
Lloh6:
	adrp	x8, _D_FRAM@GOTPAGE
Lloh7:
	ldr	x8, [x8, _D_FRAM@GOTPAGEOFF]
Lloh8:
	ldr	w0, [x8]
	stp	x21, x22, [sp, #8]
	str	x20, [sp]
Lloh9:
	adrp	x1, l_.str.1@PAGE
Lloh10:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_PDEBUG
	ldr	w8, [sp, #44]
	add	w1, w8, w22
	cmp	w1, w28
	b.le	LBB0_15
; %bb.10:
	ldr	x8, [x19]
	ldrsw	x9, [x23, #16]
	cmp	x8, x9
	b.ge	LBB0_15
; %bb.11:
	str	w28, [sp, #44]
	ldp	w8, w9, [x19, #8]
	add	w8, w8, #1
	str	w8, [x19, #8]
	mov	x1, x28
	b	LBB0_18
LBB0_12:
Lloh11:
	adrp	x8, _D_ERR@GOTPAGE
Lloh12:
	ldr	x8, [x8, _D_ERR@GOTPAGEOFF]
Lloh13:
	ldr	w0, [x8]
Lloh14:
	adrp	x1, l_.str@PAGE
Lloh15:
	add	x1, x1, l_.str@PAGEOFF
	bl	_PDEBUG
LBB0_13:
	mov	w0, #0
LBB0_14:
	ldp	x29, x30, [sp, #128]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #112]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #96]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #80]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #64]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #144
	ret
LBB0_15:
	add	w8, w27, w25, lsl #1
	cmp	w1, w8
	b.ge	LBB0_20
; %bb.16:
	ldr	x9, [x19]
	ldrsw	x10, [x23, #20]
	cmp	x9, x10
	b.le	LBB0_20
; %bb.17:
	str	w8, [sp, #44]
	ldr	w9, [x19, #12]
	add	w9, w9, #1
	str	w9, [x19, #12]
	mov	x1, x8
LBB0_18:
	cmp	w9, #4
	b.lt	LBB0_25
; %bb.19:
	ldp	w9, w8, [sp, #36]               ; 4-byte Folded Reload
	sub	w8, w8, #1
	str	w8, [sp, #40]
	str	wzr, [x19, #12]
	b	LBB0_28
LBB0_20:
	str	w1, [sp, #44]
	ldr	w8, [x24, #16]
	cmp	w1, w8
	b.le	LBB0_22
; %bb.21:
	str	w8, [sp, #44]
	mov	x1, x8
	ldr	w9, [sp, #36]                   ; 4-byte Folded Reload
	b	LBB0_24
LBB0_22:
	ldr	w8, [x24, #20]
	cmp	w1, w8
	ldr	w9, [sp, #36]                   ; 4-byte Folded Reload
	b.ge	LBB0_24
; %bb.23:
	str	w8, [sp, #44]
	mov	x1, x8
LBB0_24:
	str	xzr, [x19, #8]
	b	LBB0_26
LBB0_25:
	ldr	w9, [sp, #36]                   ; 4-byte Folded Reload
LBB0_26:
	ldr	w8, [x19, #8]
	cmp	w8, #4
	b.lt	LBB0_28
; %bb.27:
	ldr	w8, [sp, #40]
	add	w8, w8, #1
	str	w8, [sp, #40]
	str	wzr, [x19, #8]
LBB0_28:
	cmp	w1, w9
	b.ne	LBB0_30
; %bb.29:
	mov	w0, #0
	b	LBB0_31
LBB0_30:
	ldr	x8, [x24]
	mov	x0, x19
	blr	x8
	mov	w0, #1
LBB0_31:
	ldr	w1, [sp, #40]
	cmp	w1, w26
	b.eq	LBB0_14
; %bb.32:
	ldr	x8, [x23]
	mov	x0, x19
	blr	x8
	mov	w0, #1
	b	LBB0_14
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_V4L2_CID_GAIN,8,3              ; @V4L2_CID_GAIN
	.comm	_V4L2_CID_EXPOSURE,8,3          ; @V4L2_CID_EXPOSURE
	.comm	_D_ERR,4,2                      ; @D_ERR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Error: gspca_coarse_grained_expo_autogain called on cam without gain or exposure"

	.comm	_D_FRAM,4,2                     ; @D_FRAM
l_.str.1:                               ; @.str.1
	.asciz	"autogain: lum: %d, desired: %d, steps: %d"

	.no_dead_strip	_gspca_coarse_grained_expo_autogain
.subsections_via_symbols
