	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ivtv_update_pgm_info
_ivtv_update_pgm_info:                  ## @ivtv_update_pgm_info
	.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	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movl	(%rdi), %edi
	callq	_read_enc
	movl	(%r14), %r13d
	movl	4(%r14), %ecx
	subl	%r13d, %eax
	addl	$-4, %eax
	cltq
	imulq	$715827883, %rax, %rax          ## imm = 0x2AAAAAAB
	movq	%rax, %rdx
	shrq	$63, %rdx
	sarq	$34, %rax
	addl	%edx, %eax
	cmpl	%ecx, %eax
	jge	LBB0_1
## %bb.3:
	addl	%ecx, %eax
	movl	8(%r14), %esi
	subl	%esi, %eax
                                        ## kill: def $eax killed $eax killed $rax
	cltd
	idivl	%ecx
	testl	%edx, %edx
	jle	LBB0_4
## %bb.5:
	movl	%edx, -84(%rbp)                 ## 4-byte Spill
	decl	%edx
	movl	%edx, -88(%rbp)                 ## 4-byte Spill
	xorl	%eax, %eax
	movq	%r14, -104(%rbp)                ## 8-byte Spill
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movl	%eax, -92(%rbp)                 ## 4-byte Spill
	addl	%eax, %esi
	movl	%esi, %eax
	cltd
	idivl	%ecx
	movl	%edx, %ebx
	movq	32(%r14), %r15
	leal	(%rbx,%rbx,2), %r14d
	leal	4(%r13,%r14,8), %r12d
	movl	$-1, -80(%rbp)
	movq	_V4L2_ENC_IDX_FRAME_I@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -76(%rbp)
	movq	_V4L2_ENC_IDX_FRAME_P@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -72(%rbp)
	movl	$-1, -68(%rbp)
	movq	_V4L2_ENC_IDX_FRAME_B@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -64(%rbp)
	movq	$-1, -60(%rbp)
	movl	$-1, -52(%rbp)
	leal	8(%r13,%r14,8), %edi
	callq	_read_enc
	leal	12(%r13,%r14,8), %edi
	callq	_read_enc
	movslq	%ebx, %rbx
	movl	%r12d, %edi
	callq	_read_enc
	shlq	$4, %rbx
	movl	%eax, 4(%r15,%rbx)
	leal	20(%r13,%r14,8), %edi
	callq	_read_enc
	leal	24(%r13,%r14,8), %edi
	callq	_read_enc
	leal	16(%r13,%r14,8), %edi
	movq	-104(%rbp), %r14                ## 8-byte Reload
	callq	_read_enc
                                        ## kill: def $eax killed $eax def $rax
	andl	$7, %eax
	movl	-80(%rbp,%rax,4), %eax
	movl	%eax, 12(%r15,%rbx)
	movl	-92(%rbp), %eax                 ## 4-byte Reload
	movl	4(%r14), %ecx
	movl	8(%r14), %esi
	cmpl	%eax, -88(%rbp)                 ## 4-byte Folded Reload
	je	LBB0_7
## %bb.10:                              ##   in Loop: Header=BB0_6 Depth=1
	movl	(%r14), %r13d
	incl	%eax
	jmp	LBB0_6
LBB0_1:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	cmpq	-48(%rbp), %rdx
	jne	LBB0_9
## %bb.2:
	leaq	L_.str(%rip), %rdi
	movl	%eax, %esi
	movl	%ecx, %edx
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_IVTV_DEBUG_WARN                ## TAILCALL
LBB0_7:
	movl	-84(%rbp), %eax                 ## 4-byte Reload
	jmp	LBB0_8
LBB0_4:
	xorl	%eax, %eax
LBB0_8:
	addl	%eax, %esi
	movl	%esi, %eax
	cltd
	idivl	%ecx
	movl	%edx, 8(%r14)
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_9
## %bb.11:
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_9:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Invalid PGM index %d (>= %d)\n"

	.comm	_V4L2_ENC_IDX_FRAME_I,4,2       ## @V4L2_ENC_IDX_FRAME_I
	.comm	_V4L2_ENC_IDX_FRAME_P,4,2       ## @V4L2_ENC_IDX_FRAME_P
	.comm	_V4L2_ENC_IDX_FRAME_B,4,2       ## @V4L2_ENC_IDX_FRAME_B
	.no_dead_strip	_ivtv_update_pgm_info
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ivtv_update_pgm_info
_ivtv_update_pgm_info:                  ; @ivtv_update_pgm_info
	.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
	mov	x19, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #40]
	ldr	w0, [x0]
	bl	_read_enc
	ldp	w8, w2, [x19]
	sub	w9, w0, w8
	sub	w9, w9, #4
	mov	w10, #43691
	movk	w10, #10922, lsl #16
	smull	x9, w9, w10
	lsr	x10, x9, #63
	asr	x9, x9, #34
	add	w1, w9, w10
	cmp	w1, w2
	b.ge	LBB0_5
; %bb.1:
	ldr	w9, [x19, #8]
	add	w10, w1, w2
	sub	w10, w10, w9
	sdiv	w11, w10, w2
	msub	w10, w11, w2, w10
	subs	w22, w10, #1
	b.lt	LBB0_8
; %bb.2:
	str	w10, [sp, #4]                   ; 4-byte Folded Spill
	mov	w23, #0
	mov	w25, #-1
Lloh3:
	adrp	x28, _V4L2_ENC_IDX_FRAME_B@GOTPAGE
Lloh4:
	ldr	x28, [x28, _V4L2_ENC_IDX_FRAME_B@GOTPAGEOFF]
	add	x21, sp, #8
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	add	w9, w9, w23
	sdiv	w10, w9, w2
	ldr	x24, [x19, #32]
	msub	w26, w10, w2, w9
Lloh5:
	adrp	x9, _V4L2_ENC_IDX_FRAME_I@GOTPAGE
Lloh6:
	ldr	x9, [x9, _V4L2_ENC_IDX_FRAME_I@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	stp	w25, w9, [sp, #8]
Lloh8:
	adrp	x9, _V4L2_ENC_IDX_FRAME_P@GOTPAGE
Lloh9:
	ldr	x9, [x9, _V4L2_ENC_IDX_FRAME_P@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	stp	w9, w25, [sp, #16]
	ldr	w9, [x28]
	str	w9, [sp, #24]
	mov	w9, #24
	madd	w27, w26, w9, w8
	add	w20, w27, #4
	movi.2d	v0, #0xffffffffffffffff
	stur	d0, [sp, #28]
	str	w25, [sp, #36]
	add	w0, w27, #8
	bl	_read_enc
	add	w0, w27, #12
	bl	_read_enc
	mov	x0, x20
	bl	_read_enc
	add	x20, x24, w26, sxtw #4
	str	w0, [x20, #4]
	add	w0, w27, #20
	bl	_read_enc
	add	w0, w27, #24
	bl	_read_enc
	add	w0, w27, #16
	bl	_read_enc
	and	w8, w0, #0x7
	ldr	w8, [x21, w8, uxtw #2]
	str	w8, [x20, #12]
	ldp	w2, w9, [x19, #4]
	cmp	w22, w23
	b.eq	LBB0_7
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w8, [x19]
	add	w23, w23, #1
	b	LBB0_3
LBB0_5:
	ldr	x8, [sp, #40]
Lloh11:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh12:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh13:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_11
; %bb.6:
Lloh14:
	adrp	x0, l_.str@PAGE
Lloh15:
	add	x0, x0, l_.str@PAGEOFF
	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
	b	_IVTV_DEBUG_WARN
LBB0_7:
	ldr	w8, [sp, #4]                    ; 4-byte Folded Reload
	b	LBB0_9
LBB0_8:
	mov	w8, #0
LBB0_9:
	add	w8, w9, w8
	sdiv	w9, w8, w2
	msub	w8, w9, w2, w8
	str	w8, [x19, #8]
	ldr	x8, [sp, #40]
Lloh16:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh17:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh18:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_11
; %bb.10:
	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_11:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Invalid PGM index %d (>= %d)\n"

	.comm	_V4L2_ENC_IDX_FRAME_I,4,2       ; @V4L2_ENC_IDX_FRAME_I
	.comm	_V4L2_ENC_IDX_FRAME_P,4,2       ; @V4L2_ENC_IDX_FRAME_P
	.comm	_V4L2_ENC_IDX_FRAME_B,4,2       ; @V4L2_ENC_IDX_FRAME_B
	.no_dead_strip	_ivtv_update_pgm_info
.subsections_via_symbols
