	.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	%r13
	pushq	%r12
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r14
	movq	%rsi, %rdi
	callq	_fh2id
	movq	(%rax), %r12
	movq	_IVTV_MAX_PGM_INDEX@GOTPCREL(%rip), %r15
	movl	(%r15), %ecx
	movl	(%r12), %eax
	addl	%ecx, %eax
	subl	4(%r12), %eax
	movq	8(%r14), %rbx
	cltd
	idivl	%ecx
	movq	_V4L2_ENC_IDX_ENTRIES@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	cmpl	%r13d, %edx
	cmovll	%edx, %r13d
	movl	$0, (%r14)
	movl	(%r15), %eax
	movl	%eax, 4(%r14)
	leaq	16(%r12), %rdi
	callq	_atomic_read
	testl	%eax, %eax
	je	LBB0_7
## %bb.1:
	testl	%r13d, %r13d
	jle	LBB0_6
## %bb.2:
	movq	8(%r12), %rcx
	xorl	%esi, %esi
	movq	_V4L2_ENC_IDX_FRAME_MASK@GOTPCREL(%rip), %r8
	movq	_V4L2_ENC_IDX_FRAME_B@GOTPCREL(%rip), %rdi
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_5:                                 ##   in Loop: Header=BB0_3 Depth=1
	incl	%esi
	cmpl	%esi, %r13d
	je	LBB0_6
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movl	4(%r12), %eax
	addl	%esi, %eax
	cltd
	idivl	(%r15)
	movslq	%edx, %rax
	movl	(%rcx,%rax,4), %eax
	movl	%eax, (%rbx)
	andl	(%r8), %eax
	cmpl	(%rdi), %eax
	jg	LBB0_5
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	incl	(%r14)
	addq	$4, %rbx
	jmp	LBB0_5
LBB0_6:
	movl	(%r14), %eax
	addl	4(%r12), %eax
	cltd
	idivl	(%r15)
	movl	%edx, 4(%r12)
LBB0_7:
	xorl	%eax, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	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:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x19, x2
	mov	x0, x1
	bl	_fh2id
	ldr	x20, [x0]
	ldr	x22, [x19, #8]
Lloh0:
	adrp	x21, _IVTV_MAX_PGM_INDEX@GOTPAGE
Lloh1:
	ldr	x21, [x21, _IVTV_MAX_PGM_INDEX@GOTPAGEOFF]
	ldr	w8, [x21]
	ldp	w9, w10, [x20]
	add	w9, w8, w9
	sub	w9, w9, w10
	sdiv	w10, w9, w8
	msub	w8, w10, w8, w9
Lloh2:
	adrp	x9, _V4L2_ENC_IDX_ENTRIES@GOTPAGE
Lloh3:
	ldr	x9, [x9, _V4L2_ENC_IDX_ENTRIES@GOTPAGEOFF]
Lloh4:
	ldr	w9, [x9]
	cmp	w8, w9
	csel	w23, w8, w9, lt
	str	wzr, [x19]
	ldr	w8, [x21]
	str	w8, [x19, #4]
	add	x0, x20, #16
	bl	_atomic_read
	cbz	w0, LBB0_7
; %bb.1:
	cmp	w23, #1
	b.lt	LBB0_6
; %bb.2:
	mov	w8, #0
	ldr	x9, [x20, #8]
Lloh5:
	adrp	x10, _V4L2_ENC_IDX_FRAME_MASK@GOTPAGE
Lloh6:
	ldr	x10, [x10, _V4L2_ENC_IDX_FRAME_MASK@GOTPAGEOFF]
Lloh7:
	adrp	x11, _V4L2_ENC_IDX_FRAME_B@GOTPAGE
Lloh8:
	ldr	x11, [x11, _V4L2_ENC_IDX_FRAME_B@GOTPAGEOFF]
	b	LBB0_4
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	add	w8, w8, #1
	cmp	w23, w8
	b.eq	LBB0_6
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w12, [x20, #4]
	add	w12, w8, w12
	ldr	w13, [x21]
	sdiv	w14, w12, w13
	msub	w12, w14, w13, w12
	ldr	w12, [x9, w12, sxtw #2]
	str	w12, [x22]
	ldr	w13, [x10]
	and	w12, w13, w12
	ldr	w13, [x11]
	cmp	w12, w13
	b.gt	LBB0_3
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	w12, [x19]
	add	w12, w12, #1
	str	w12, [x19]
	add	x22, x22, #4
	b	LBB0_3
LBB0_6:
	ldr	w8, [x20, #4]
	ldr	w9, [x19]
	add	w8, w9, w8
	ldr	w9, [x21]
	sdiv	w10, w8, w9
	msub	w8, w10, w9, w8
	str	w8, [x20, #4]
LBB0_7:
	mov	w0, #0
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	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
