// File: /workspace/github_cpp_makefile_star2_O3/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 0x4a4b(%rip), %r15      # 0x7fb0
movq (%r15), %rcx
leaq 0x1c24(%rip), %rdi      # 0x5193
movl $0xb, %esi
movl $0x1, %edx
callq 0x2410
movq (%r15), %rcx
leaq 0x1c17(%rip), %rdi      # 0x519f
movl $0x26, %esi
movl $0x1, %edx
callq 0x2410
movq (%r15), %rcx
leaq 0x1c25(%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 0x371f
sarl $0x4, %r15d
leaq 0x20(%rbx), %r14
leaq 0x8(%rbx), %rax
movq %rax, 0x30(%rsp)
leaq 0x4c53(%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), %dl
movb 0x16(%rsp), %sil
xorl %edi, %edi
xorl %r8d, %r8d
cmpb %dl, (%r12,%rdi,8)
jne 0x3620
cmpb %sil, 0x1(%r12,%rdi,8)
je 0x3637
cmpq $0x3, %rdi
leaq 0x1(%rdi), %r9
setae %r8b
movq %r9, %rdi
cmpq $0x4, %r9
jne 0x3613
jmp 0x364a
movl 0x4(%r12,%rdi,8), %edx
movl %edx, 0x1c(%rsp)
testb $0x1, %r8b
je 0x370f
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
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 0x4903(%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 0x1b43(%rip), %rsi      # 0x520f
xorl %eax, %eax
callq 0x2340
movq 0x10(%rbx), %rsi
cmpq 0x18(%rbx), %rsi
je 0x36f3
movl 0x2c(%rsp), %eax
movl %eax, 0x10(%rsi)
movups 0x1c(%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x14, 0x10(%rbx)
jmp 0x3702
movq 0x30(%rsp), %rdi
leaq 0x1c(%rsp), %rdx
callq 0x4878
incl %ebp
cmpl %r15d, %ebp
jne 0x35e4
jmp 0x371f
leal (%rcx,%rcx,4), %ecx
leal (%rax,%rcx,2), %eax
addl $0xfffffdf0, %eax       # imm = 0xFFFFFDF0
jmp 0x364f
movq 0x488a(%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