// File: /workspace/github_cpp_makefile_star2_O1/olegk0[P]readAVI/ReadAVI.cpp
// Function: ReadAVI::parse_idx1(int)
int ReadAVI::parse_idx1(int chunk_len)
{
    index_entry_t index_entry;
    index_entry.type = ctype_none;
    int t;

    MSG_DBG(2, "      IDX1\n");
    MSG_DBG(2, "      -------------------------------\n");
    MSG_DBG(2, "      stream  type   dwFlags         dwChunkOffset        dwChunkLength\n");

    for (t = 0; t < chunk_len / 16; t++) {
	char buf[5];
	read_chars(buf, 4);
	index_entry.stream_num = decodeCkid(buf, &index_entry.type);
	index_entry.dwFlags = read_int();
	index_entry.dwChunkOffset = read_int() + movi_offset + 0x10;
	index_entry.dwChunkLength = read_int();

	MSG_DBG(2, "         %d     %d     0x%08x      0x%08x           0x%08x\n", index_entry.stream_num, index_entry.type,
		index_entry.dwFlags, index_entry.dwChunkOffset, index_entry.dwChunkLength);
	index_entries.push_back(index_entry);
    }

    MSG_DBG(2, "\n");

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %esi, %r14d
movq %rdi, %rbx
movl $0x0, 0x1c(%rsp)
movq 0x4a0b(%rip), %r15      # 0x7fb0
movq (%r15), %rcx
leaq 0x1be4(%rip), %rdi      # 0x5193
movl $0xb, %esi
movl $0x1, %edx
callq 0x2410
movq (%r15), %rcx
leaq 0x1bd7(%rip), %rdi      # 0x519f
movl $0x26, %esi
movl $0x1, %edx
callq 0x2410
movq (%r15), %rcx
leaq 0x1be5(%rip), %rdi      # 0x51c6
movl $0x48, %esi
movl $0x1, %edx
callq 0x2410
leal 0xf(%r14), %r15d
testl %r14d, %r14d
cmovnsl %r14d, %r15d
cmpl $0x10, %r14d
jl 0x3754
sarl $0x4, %r15d
leaq 0x20(%rbx), %r14
leaq 0x8(%rbx), %rax
movq %rax, 0x30(%rsp)
leaq 0x4c13(%rip), %r12      # 0x8230
leaq 0x18(%rsp), %r13
xorl %ebp, %ebp
movl $0x4, %edx
movq %r14, %rdi
leaq 0x13(%rsp), %rsi
callq 0x22b0
movb $0x0, 0x17(%rsp)
movsbl 0x13(%rsp), %ecx
movsbl 0x14(%rsp), %eax
movb 0x15(%rsp), %sil
movb 0x16(%rsp), %dil
xorl %r8d, %r8d
xorl %edx, %edx
cmpb %sil, (%r12,%r8,8)
jne 0x3661
cmpb %dil, 0x1(%r12,%r8,8)
je 0x3677
cmpq $0x3, %r8
leaq 0x1(%r8), %r9
setae %dl
movq %r9, %r8
cmpq $0x4, %r9
jne 0x3654
jmp 0x3680
movl 0x4(%r12,%r8,8), %esi
movl %esi, 0x1c(%rsp)
leal (%rcx,%rcx,4), %ecx
leal (%rax,%rcx,2), %eax
addl $0xfffffdf0, %eax       # imm = 0xFFFFFDF0
testb $0x1, %dl
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmovnel %ecx, %eax
movl %eax, 0x20(%rsp)
movl $0x4, %edx
movq %r14, %rdi
movq %r13, %rsi
callq 0x22b0
movl 0x18(%rsp), %eax
movl %eax, 0x24(%rsp)
movl $0x4, %edx
movq %r14, %rdi
movq %r13, %rsi
callq 0x22b0
movl 0x18(%rsp), %eax
movl 0x330(%rbx), %ecx
addl %ecx, %eax
addl $0x10, %eax
movl %eax, 0x28(%rsp)
movl $0x4, %edx
movq %r14, %rdi
movq %r13, %rsi
callq 0x22b0
movl 0x18(%rsp), %eax
movl %eax, 0x2c(%rsp)
movq 0x48bc(%rip), %rcx      # 0x7fb0
movq (%rcx), %rdi
movl 0x1c(%rsp), %ecx
movl 0x20(%rsp), %edx
movl 0x24(%rsp), %r8d
movl 0x28(%rsp), %r9d
movl %eax, (%rsp)
leaq 0x1afc(%rip), %rsi      # 0x520f
xorl %eax, %eax
callq 0x2340
movq 0x10(%rbx), %rsi
cmpq 0x18(%rbx), %rsi
je 0x373a
movl 0x2c(%rsp), %eax
movl %eax, 0x10(%rsi)
movups 0x1c(%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x14, 0x10(%rbx)
jmp 0x3749
movq 0x30(%rsp), %rdi
leaq 0x1c(%rsp), %rdx
callq 0x48d8
incl %ebp
cmpl %r15d, %ebp
jne 0x3624
movq 0x4855(%rip), %rax      # 0x7fb0
movq (%rax), %rsi
movl $0xa, %edi
callq 0x22a0
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop