// File: sc0ty[P]CODExtract/src/main.cpp
// Function: main
int main(int argc, char *argv[])
{
    cout << endl << "  COD Extractor - created by sc0ty 2011 - http://sc0ty.pl";
    if (argc < 2)
    {
        cout << endl << endl << "use:" << endl;
        cout << "  codextract <file.cod> <file-2.cod> ... <file-n.cod>" << endl << endl;
        return 0;
    }

    CODFile cod;

    for (int i=1; i<argc; i++)
    {
        try
        {
            // load file and show filename
            cout << endl << endl << "  File \"" << argv[i] << "\"";
            cod.LoadFile(argv[i]);

            // load parent file and show filename
            if (cod.LoadParent())
            {
                cout << ", parent file \"" << cod.getFileName() << "\"";
            }

            // show info
            cout << endl << endl;
            ShowCODInfo(&cod);
            SaveIcon(&cod);
        }

        catch (const char *ex)
        {
            cout << endl << endl << "\tError: " << ex;
            cout << " (" << cod.getFileName() << ")" << endl;
        }

        cod.Close();
    }

    cout << endl;
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq 0x6a18(%rip), %rdi      # 0x9fd8
movq 0x69f9(%rip), %rsi      # 0x9fc0
callq 0x3240
movq %rax, %rdi
leaq 0x3a2e(%rip), %rsi      # 0x7004
callq 0x3200
cmpl $0x2, -0x8(%rbp)
jge 0x365e
movq 0x69f0(%rip), %rdi      # 0x9fd8
movq 0x69d1(%rip), %rsi      # 0x9fc0
callq 0x3240
movq %rax, %rdi
movq 0x69c2(%rip), %rsi      # 0x9fc0
callq 0x3240
movq %rax, %rdi
leaq 0x3a31(%rip), %rsi      # 0x703e
callq 0x3200
movq %rax, %rdi
movq 0x69a4(%rip), %rsi      # 0x9fc0
callq 0x3240
movq 0x69b0(%rip), %rdi      # 0x9fd8
leaq 0x3a14(%rip), %rsi      # 0x7043
callq 0x3200
movq %rax, %rdi
movq 0x6982(%rip), %rsi      # 0x9fc0
callq 0x3240
movq %rax, %rdi
movq 0x6973(%rip), %rsi      # 0x9fc0
callq 0x3240
movl $0x0, -0x4(%rbp)
jmp 0x39db
leaq -0x78(%rbp), %rdi
callq 0x4090
movl $0x1, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x39a9
movq 0x6957(%rip), %rdi      # 0x9fd8
movq 0x6938(%rip), %rsi      # 0x9fc0
callq 0x3240
movq %rax, -0xe0(%rbp)
jmp 0x3696
movq -0xe0(%rbp), %rdi
movq 0x691c(%rip), %rsi      # 0x9fc0
callq 0x3240
movq %rax, -0xe8(%rbp)
jmp 0x36b2
movq -0xe8(%rbp), %rdi
leaq 0x39b9(%rip), %rsi      # 0x7079
callq 0x3200
movq %rax, -0xf0(%rbp)
jmp 0x36ce
movq -0xf0(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq -0x7c(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x3200
movq %rax, -0xf8(%rbp)
jmp 0x36ef
movq -0xf8(%rbp), %rdi
leaq 0x3983(%rip), %rsi      # 0x7080
callq 0x3200
jmp 0x3704
movq -0x10(%rbp), %rax
movslq -0x7c(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq -0x78(%rbp), %rdi
callq 0x4270
jmp 0x371b
leaq -0x78(%rbp), %rdi
callq 0x4770
movb %al, -0xf9(%rbp)
jmp 0x372c
movb -0xf9(%rbp), %al
testb $0x1, %al
jne 0x373b
jmp 0x3913
movq 0x6896(%rip), %rdi      # 0x9fd8
leaq 0x3939(%rip), %rsi      # 0x7082
callq 0x3200
movq %rax, -0x108(%rbp)
jmp 0x3757
leaq -0xb0(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x4c30
jmp 0x3769
movq -0x108(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x31d0
movq %rax, -0x110(%rbp)
jmp 0x3785
movq -0x110(%rbp), %rdi
leaq 0x38ed(%rip), %rsi      # 0x7080
callq 0x3200
jmp 0x379a
leaq -0xb0(%rbp), %rdi
callq 0x3140
jmp 0x3913
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x37dd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x3140
movl -0x8c(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x39d0
movq -0x88(%rbp), %rdi
callq 0x30b0
movq %rax, -0xb8(%rbp)
movq 0x67ce(%rip), %rdi      # 0x9fd8
movq 0x67af(%rip), %rsi      # 0x9fc0
callq 0x3240
movq %rax, -0x118(%rbp)
jmp 0x381f
movq -0x118(%rbp), %rdi
movq 0x6793(%rip), %rsi      # 0x9fc0
callq 0x3240
movq %rax, -0x120(%rbp)
jmp 0x383b
movq -0x120(%rbp), %rdi
leaq 0x3849(%rip), %rsi      # 0x7092
callq 0x3200
movq %rax, -0x128(%rbp)
jmp 0x3857
movq -0x128(%rbp), %rdi
movq -0xb8(%rbp), %rsi
callq 0x3200
jmp 0x386c
movq 0x6765(%rip), %rdi      # 0x9fd8
leaq 0x3821(%rip), %rsi      # 0x709b
callq 0x3200
movq %rax, -0x130(%rbp)
jmp 0x3888
leaq -0xd8(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x4c30
jmp 0x389a
movq -0x130(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x31d0
movq %rax, -0x138(%rbp)
jmp 0x38b6
movq -0x138(%rbp), %rdi
leaq 0x38d8(%rip), %rsi      # 0x719c
callq 0x3200
movq %rax, -0x140(%rbp)
jmp 0x38d2
movq -0x140(%rbp), %rdi
movq 0x66e0(%rip), %rsi      # 0x9fc0
callq 0x3240
jmp 0x38e7
leaq -0xd8(%rbp), %rdi
callq 0x3140
callq 0x33b0
leaq -0x78(%rbp), %rdi
callq 0x4150
jmp 0x3903
jmp 0x3905
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x366e
movq 0x66be(%rip), %rdi      # 0x9fd8
movq 0x669f(%rip), %rsi      # 0x9fc0
callq 0x3240
movq %rax, -0x148(%rbp)
jmp 0x392f
movq -0x148(%rbp), %rdi
movq 0x6683(%rip), %rsi      # 0x9fc0
callq 0x3240
jmp 0x3944
leaq -0x78(%rbp), %rdi
callq 0x3a00
jmp 0x394f
leaq -0x78(%rbp), %rdi
callq 0x3e90
jmp 0x395a
jmp 0x38f8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x398e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x3140
callq 0x33b0
jmp 0x39d0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x39d0
movq 0x6628(%rip), %rdi      # 0x9fd8
movq 0x6609(%rip), %rsi      # 0x9fc0
callq 0x3240
jmp 0x39be
movl $0x0, -0x4(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x4100
jmp 0x39db
leaq -0x78(%rbp), %rdi
callq 0x4100
jmp 0x39e7
movl -0x4(%rbp), %eax
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
movq -0x88(%rbp), %rdi
callq 0x33f0
nopw %cs:(%rax,%rax)