// File: olegk0[P]readAVI/ReadAVI.cpp
// Function: ReadAVI::ReadAVI(char const*)
ReadAVI::ReadAVI(const char *filename)
{
    data_buf = NULL;
    stream_format_vid.palette = NULL;
    data_buf_size = 0;
    inFile.exceptions(std::ifstream::failbit | std::ifstream::badbit);
    inFile.open(filename, ios_base::ate | ios_base::in | ios_base::binary);
    fileSize = inFile.tellg();
    inFile.close();
    inFile.open(filename, ios_base::in | ios_base::binary);
    try {
	parse_riff();
    } catch (std::system_error& e) { //file corrupted?
	std::cerr << e.code().message() << "\n";
	if (index_entries.size() == 0) {
	    free();
	    throw;
	}
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x68(%rbp)
leaq 0x5e26(%rip), %rax      # 0x8d58
movq %rax, (%rdi)
addq $0x8, %rdi
movq %rdi, -0x70(%rbp)
callq 0x52f0
movq -0x68(%rbp), %rdi
addq $0x20, %rdi
movq %rdi, -0x60(%rbp)
callq 0x2280
jmp 0x2f55
movq -0x68(%rbp), %rax
movq $0x0, 0x338(%rax)
movq $0x0, 0x2c8(%rax)
movl $0x0, 0x340(%rax)
movq 0x20(%rax), %rcx
movq -0x18(%rcx), %rcx
leaq 0x20(%rax,%rcx), %rax
movq %rax, -0x80(%rbp)
movl $0x4, %edi
movl $0x1, %esi
callq 0x5310
movl %eax, -0x74(%rbp)
jmp 0x2f9e
movl -0x74(%rbp), %esi
movq -0x80(%rbp), %rdi
callq 0x20e0
jmp 0x2fac
movq -0x68(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x98(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x90(%rbp)
movl $0x2, %edi
movl $0x8, %esi
callq 0x5330
movl %eax, -0x84(%rbp)
jmp 0x2fdd
movl -0x84(%rbp), %edi
movl $0x4, %esi
callq 0x5330
movl %eax, -0x9c(%rbp)
jmp 0x2ff5
movl -0x9c(%rbp), %edx
movq -0x90(%rbp), %rsi
movq -0x98(%rbp), %rdi
callq 0x2180
jmp 0x3010
movq -0x68(%rbp), %rdi
addq $0x20, %rdi
callq 0x23f0
movq %rdx, -0xb0(%rbp)
movq %rax, -0xa8(%rbp)
jmp 0x302d
movq -0xb0(%rbp), %rax
movq -0xa8(%rbp), %rcx
movq %rcx, -0x30(%rbp)
movq %rax, -0x28(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x5350
movq %rax, -0xb8(%rbp)
jmp 0x3055
movq -0x68(%rbp), %rdi
movq -0xb8(%rbp), %rax
movq %rax, 0x328(%rdi)
addq $0x20, %rdi
callq 0x20a0
jmp 0x3072
movq -0x68(%rbp), %rax
addq $0x20, %rax
movq %rax, -0xd0(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xc8(%rbp)
movl $0x8, %edi
movl $0x4, %esi
callq 0x5330
movl %eax, -0xbc(%rbp)
jmp 0x30a3
movl -0xbc(%rbp), %edx
movq -0xc8(%rbp), %rsi
movq -0xd0(%rbp), %rdi
callq 0x2180
jmp 0x30be
movq -0x68(%rbp), %rdi
callq 0x31f0
jmp 0x30c9
jmp 0x31ba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x31d5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x31cc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x31cc
movq -0x18(%rbp), %rdi
callq 0x2110
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
callq 0x5370
movq %rax, %rsi
leaq -0x58(%rbp), %rdi
callq 0x5390
jmp 0x3130
movq 0x5eb9(%rip), %rdi      # 0x8ff0
leaq -0x58(%rbp), %rsi
callq 0x21f0
movq %rax, -0xd8(%rbp)
jmp 0x3149
movq -0xd8(%rbp), %rdi
leaq 0x3827(%rip), %rsi      # 0x697e
callq 0x2220
jmp 0x315e
leaq -0x58(%rbp), %rdi
callq 0x2170
movq -0x68(%rbp), %rdi
addq $0x8, %rdi
callq 0x2ee0
cmpq $0x0, %rax
jne 0x31b1
movq -0x68(%rbp), %rdi
callq 0x3800
jmp 0x3185
callq 0x2390
jmp 0x31ef
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x31c3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x2170
jmp 0x31c3
callq 0x23d0
jmp 0x31b8
jmp 0x31ba
addq $0xe0, %rsp
popq %rbp
retq
callq 0x23d0
jmp 0x31ca
jmp 0x31cc
movq -0x60(%rbp), %rdi
callq 0x20c0
movq -0x70(%rbp), %rdi
callq 0x53e0
movq -0x18(%rbp), %rdi
callq 0x2410
movq %rax, %rdi
callq 0x2e30
nop