	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ivtv_g_enc_index
_ivtv_g_enc_index:                      ## @ivtv_g_enc_index
	.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
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r9
	movq	(%rsi), %r10
	movq	8(%rdx), %rcx
	movq	_IVTV_MAX_PGM_INDEX@GOTPCREL(%rip), %r8
	movl	(%r8), %edi
	movl	(%r10), %eax
	addl	%edi, %eax
	movl	4(%r10), %esi
	subl	%esi, %eax
	cltd
	idivl	%edi
	movq	_V4L2_ENC_IDX_ENTRIES@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	cmpl	%edi, %edx
	cmovll	%edx, %edi
	movl	$0, (%r9)
	testl	%edi, %edi
	jle	LBB0_1
## %bb.2:
	movq	8(%r10), %r11
	xorl	%ebx, %ebx
	movq	_V4L2_ENC_IDX_FRAME_MASK@GOTPCREL(%rip), %r14
	movq	_V4L2_ENC_IDX_FRAME_B@GOTPCREL(%rip), %r15
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_5:                                 ##   in Loop: Header=BB0_3 Depth=1
	incl	%ebx
	movl	4(%r10), %esi
	cmpl	%ebx, %edi
	je	LBB0_6
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	addl	%ebx, %esi
	movl	%esi, %eax
	cltd
	idivl	(%r8)
	movslq	%edx, %rax
	movl	(%r11,%rax,4), %eax
	movl	%eax, (%rcx)
	andl	(%r14), %eax
	cmpl	(%r15), %eax
	jg	LBB0_5
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	incl	(%r9)
	addq	$4, %rcx
	jmp	LBB0_5
LBB0_6:
	movl	(%r9), %eax
	jmp	LBB0_7
LBB0_1:
	xorl	%eax, %eax
LBB0_7:
	addl	%esi, %eax
	cltd
	idivl	(%r8)
	movl	%edx, 4(%r10)
	xorl	%eax, %eax
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_IVTV_MAX_PGM_INDEX,4,2         ## @IVTV_MAX_PGM_INDEX
	.comm	_V4L2_ENC_IDX_ENTRIES,4,2       ## @V4L2_ENC_IDX_ENTRIES
	.comm	_V4L2_ENC_IDX_FRAME_MASK,4,2    ## @V4L2_ENC_IDX_FRAME_MASK
	.comm	_V4L2_ENC_IDX_FRAME_B,4,2       ## @V4L2_ENC_IDX_FRAME_B
	.no_dead_strip	_ivtv_g_enc_index
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ivtv_g_enc_index
_ivtv_g_enc_index:                      ; @ivtv_g_enc_index
	.cfi_startproc
; %bb.0:
	ldr	x8, [x1]
Lloh0:
	adrp	x9, _IVTV_MAX_PGM_INDEX@GOTPAGE
Lloh1:
	ldr	x9, [x9, _IVTV_MAX_PGM_INDEX@GOTPAGEOFF]
	ldr	w10, [x9]
	ldp	w11, w12, [x8]
	add	w11, w10, w11
	sub	w11, w11, w12
	sdiv	w13, w11, w10
	msub	w11, w13, w10, w11
Lloh2:
	adrp	x13, _V4L2_ENC_IDX_ENTRIES@GOTPAGE
Lloh3:
	ldr	x13, [x13, _V4L2_ENC_IDX_ENTRIES@GOTPAGEOFF]
	ldr	x10, [x2, #8]
Lloh4:
	ldr	w13, [x13]
	cmp	w11, w13
	csel	w11, w11, w13, lt
	str	wzr, [x2]
	cmp	w11, #1
	b.lt	LBB0_6
; %bb.1:
	mov	w13, #0
	ldr	x14, [x8, #8]
Lloh5:
	adrp	x15, _V4L2_ENC_IDX_FRAME_MASK@GOTPAGE
Lloh6:
	ldr	x15, [x15, _V4L2_ENC_IDX_FRAME_MASK@GOTPAGEOFF]
Lloh7:
	adrp	x16, _V4L2_ENC_IDX_FRAME_B@GOTPAGE
Lloh8:
	ldr	x16, [x16, _V4L2_ENC_IDX_FRAME_B@GOTPAGEOFF]
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	add	w13, w13, #1
	ldr	w12, [x8, #4]
	cmp	w11, w13
	b.eq	LBB0_5
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	add	w12, w12, w13
	ldr	w17, [x9]
	sdiv	w0, w12, w17
	msub	w12, w0, w17, w12
	ldr	w12, [x14, w12, sxtw #2]
	str	w12, [x10]
	ldr	w17, [x15]
	and	w12, w17, w12
	ldr	w17, [x16]
	cmp	w12, w17
	b.gt	LBB0_2
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w12, [x2]
	add	w12, w12, #1
	str	w12, [x2]
	add	x10, x10, #4
	b	LBB0_2
LBB0_5:
	ldr	w10, [x2]
	b	LBB0_7
LBB0_6:
	mov	w10, #0
LBB0_7:
	add	w10, w10, w12
	ldr	w9, [x9]
	sdiv	w11, w10, w9
	msub	w9, w11, w9, w10
	str	w9, [x8, #4]
	mov	w0, #0
	ret
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.cfi_endproc
                                        ; -- End function
	.comm	_IVTV_MAX_PGM_INDEX,4,2         ; @IVTV_MAX_PGM_INDEX
	.comm	_V4L2_ENC_IDX_ENTRIES,4,2       ; @V4L2_ENC_IDX_ENTRIES
	.comm	_V4L2_ENC_IDX_FRAME_MASK,4,2    ; @V4L2_ENC_IDX_FRAME_MASK
	.comm	_V4L2_ENC_IDX_FRAME_B,4,2       ; @V4L2_ENC_IDX_FRAME_B
	.no_dead_strip	_ivtv_g_enc_index
.subsections_via_symbols
