// File: Jacobious52[P]Tanks/Game.cpp
// Function: main
int main(int argc, char const *argv[])
{
    signal(SIGINT, signal_handler);

    // default args
    float game_time = 0.05;
    int rain = 1;
    DebugView::shared_view()->show = false;
    bool skip = false;

    // handle args from terminal input
    for (int i = 1; i < argc; ++i)
    {
        if (std::string(argv[i]) == "--skip")
        {
            skip = true;
        }
        else if (std::string(argv[i]) == "--noaudio")
        {
            ConsoleTools::audio = false;
        }
        else if (std::string(argv[i]) == "--debug")
        {
            DebugView::shared_view()->show = true;
        }
        else if (std::string(argv[i]) == "--norain")
        {
            rain = 0;
        }
        else if (std::string(argv[i]) == "--replay")
        {
            ConsoleTools::replay = true;
        }
        else if (std::string(argv[i]) == "--gametime")
        {
            if (++i > argc)
            {
                break;
            }
            std::stringstream ss;
            ss << argv[i];
            ss >> game_time;
        }
        else if (std::string(argv[i]) == "--help")
        {
            std::ifstream helpfile("help.txt");
            ConsoleTools::set_fcolor(ConsoleTools::green);
            printf("\n%s\n", std::string(std::istreambuf_iterator<char>(helpfile),
                                        std::istreambuf_iterator<char>()).c_str());
            ConsoleTools::end_color();
            std::exit(0);
        }
    }

    // start
    Game game(skip, game_time, rain);
    game.run();

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x630, %rsp            # imm = 0x630
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x2, %edi
leaq -0x55(%rip), %rsi       # 0x11b20
callq 0x4430
movss 0x27a6(%rip), %xmm0     # 0x14328
movss %xmm0, -0x14(%rbp)
movl $0x1, -0x18(%rbp)
callq 0x70a0
movb $0x0, 0x31(%rax)
movb $0x0, -0x19(%rbp)
movl $0x1, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x122c5
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x580(%rbp)
leaq -0x41(%rbp), %rdi
movq %rdi, -0x578(%rbp)
callq 0x45f0
movq -0x580(%rbp), %rsi
movq -0x578(%rbp), %rdx
leaq -0x40(%rbp), %rdi
callq 0x4490
jmp 0x11bea
leaq 0x273b(%rip), %rsi      # 0x1432c
leaq -0x40(%rbp), %rdi
callq 0x9ea0
movb %al, -0x581(%rbp)
jmp 0x11c02
leaq -0x40(%rbp), %rdi
callq 0x4200
jmp 0x11c0d
leaq -0x41(%rbp), %rdi
callq 0x4400
movb -0x581(%rbp), %al
testb $0x1, %al
jne 0x11c22
jmp 0x11c60
movb $0x1, -0x19(%rbp)
jmp 0x122b5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x11c52
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x4200
jmp 0x11c50
jmp 0x11c52
leaq -0x41(%rbp), %rdi
callq 0x4400
jmp 0x12330
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x598(%rbp)
leaq -0x79(%rbp), %rdi
movq %rdi, -0x590(%rbp)
callq 0x45f0
movq -0x598(%rbp), %rsi
movq -0x590(%rbp), %rdx
leaq -0x78(%rbp), %rdi
callq 0x4490
jmp 0x11c9c
leaq 0x2690(%rip), %rsi      # 0x14333
leaq -0x78(%rbp), %rdi
callq 0x9ea0
movb %al, -0x599(%rbp)
jmp 0x11cb4
leaq -0x78(%rbp), %rdi
callq 0x4200
jmp 0x11cbf
leaq -0x79(%rbp), %rdi
callq 0x4400
movb -0x599(%rbp), %al
testb $0x1, %al
jne 0x11cd4
jmp 0x11d18
leaq 0x9675(%rip), %rax      # 0x1b350
movb $0x0, (%rax)
jmp 0x122b3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x11d0a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x4200
jmp 0x11d08
jmp 0x11d0a
leaq -0x79(%rbp), %rdi
callq 0x4400
jmp 0x12330
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x5b0(%rbp)
leaq -0xa1(%rbp), %rdi
movq %rdi, -0x5a8(%rbp)
callq 0x45f0
movq -0x5b0(%rbp), %rsi
movq -0x5a8(%rbp), %rdx
leaq -0xa0(%rbp), %rdi
callq 0x4490
jmp 0x11d5a
leaq 0x25dc(%rip), %rsi      # 0x1433d
leaq -0xa0(%rbp), %rdi
callq 0x9ea0
movb %al, -0x5b1(%rbp)
jmp 0x11d75
leaq -0xa0(%rbp), %rdi
callq 0x4200
jmp 0x11d83
leaq -0xa1(%rbp), %rdi
callq 0x4400
movb -0x5b1(%rbp), %al
testb $0x1, %al
jne 0x11d9b
jmp 0x11de4
callq 0x70a0
movb $0x1, 0x31(%rax)
jmp 0x122b1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x11dd3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x4200
jmp 0x11dd1
jmp 0x11dd3
leaq -0xa1(%rbp), %rdi
callq 0x4400
jmp 0x12330
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x5c8(%rbp)
leaq -0xc9(%rbp), %rdi
movq %rdi, -0x5c0(%rbp)
callq 0x45f0
movq -0x5c8(%rbp), %rsi
movq -0x5c0(%rbp), %rdx
leaq -0xc8(%rbp), %rdi
callq 0x4490
jmp 0x11e26
leaq 0x2518(%rip), %rsi      # 0x14345
leaq -0xc8(%rbp), %rdi
callq 0x9ea0
movb %al, -0x5c9(%rbp)
jmp 0x11e41
leaq -0xc8(%rbp), %rdi
callq 0x4200
jmp 0x11e4f
leaq -0xc9(%rbp), %rdi
callq 0x4400
movb -0x5c9(%rbp), %al
testb $0x1, %al
jne 0x11e67
jmp 0x11eae
movl $0x0, -0x18(%rbp)
jmp 0x122af
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x11e9d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x4200
jmp 0x11e9b
jmp 0x11e9d
leaq -0xc9(%rbp), %rdi
callq 0x4400
jmp 0x12330
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x5e0(%rbp)
leaq -0xf1(%rbp), %rdi
movq %rdi, -0x5d8(%rbp)
callq 0x45f0
movq -0x5e0(%rbp), %rsi
movq -0x5d8(%rbp), %rdx
leaq -0xf0(%rbp), %rdi
callq 0x4490
jmp 0x11ef0
leaq 0x2457(%rip), %rsi      # 0x1434e
leaq -0xf0(%rbp), %rdi
callq 0x9ea0
movb %al, -0x5e1(%rbp)
jmp 0x11f0b
leaq -0xf0(%rbp), %rdi
callq 0x4200
jmp 0x11f19
leaq -0xf1(%rbp), %rdi
callq 0x4400
movb -0x5e1(%rbp), %al
testb $0x1, %al
jne 0x11f31
jmp 0x11f7b
leaq 0x942a(%rip), %rax      # 0x1b362
movb $0x1, (%rax)
jmp 0x122ad
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x11f6a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x4200
jmp 0x11f68
jmp 0x11f6a
leaq -0xf1(%rbp), %rdi
callq 0x4400
jmp 0x12330
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x5f8(%rbp)
leaq -0x119(%rbp), %rdi
movq %rdi, -0x5f0(%rbp)
callq 0x45f0
movq -0x5f8(%rbp), %rsi
movq -0x5f0(%rbp), %rdx
leaq -0x118(%rbp), %rdi
callq 0x4490
jmp 0x11fbd
leaq 0x2393(%rip), %rsi      # 0x14357
leaq -0x118(%rbp), %rdi
callq 0x9ea0
movb %al, -0x5f9(%rbp)
jmp 0x11fd8
leaq -0x118(%rbp), %rdi
callq 0x4200
jmp 0x11fe6
leaq -0x119(%rbp), %rdi
callq 0x4400
movb -0x5f9(%rbp), %al
testb $0x1, %al
jne 0x12001
jmp 0x120b7
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
cmpl -0x8(%rbp), %eax
jle 0x1204f
jmp 0x122c5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x1203e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x118(%rbp), %rdi
callq 0x4200
jmp 0x1203c
jmp 0x1203e
leaq -0x119(%rbp), %rdi
callq 0x4400
jmp 0x12330
leaq -0x2a8(%rbp), %rdi
callq 0x4260
leaq -0x298(%rbp), %rdi
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x4390
jmp 0x12075
leaq -0x2a8(%rbp), %rdi
leaq -0x14(%rbp), %rsi
callq 0x40c0
jmp 0x12087
leaq -0x2a8(%rbp), %rdi
callq 0x4290
jmp 0x122ab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x2a8(%rbp), %rdi
callq 0x4290
jmp 0x120b2
jmp 0x12330
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x610(%rbp)
leaq -0x2c9(%rbp), %rdi
movq %rdi, -0x608(%rbp)
callq 0x45f0
movq -0x610(%rbp), %rsi
movq -0x608(%rbp), %rdx
leaq -0x2c8(%rbp), %rdi
callq 0x4490
jmp 0x120f9
leaq 0x2262(%rip), %rsi      # 0x14362
leaq -0x2c8(%rbp), %rdi
callq 0x9ea0
movb %al, -0x611(%rbp)
jmp 0x12114
leaq -0x2c8(%rbp), %rdi
callq 0x4200
jmp 0x12122
leaq -0x2c9(%rbp), %rdi
callq 0x4400
movb -0x611(%rbp), %al
testb $0x1, %al
jne 0x1213d
jmp 0x122a9
leaq 0x2225(%rip), %rsi      # 0x14369
leaq -0x4d8(%rbp), %rdi
movl $0x8, %edx
callq 0x4620
movl $0x20, %edi
callq 0x4af0
jmp 0x12161
leaq -0x508(%rbp), %rdi
leaq -0x4d8(%rbp), %rsi
callq 0x12350
leaq -0x518(%rbp), %rdi
callq 0x123d0
leaq -0x519(%rbp), %rdi
movq %rdi, -0x620(%rbp)
callq 0x45f0
movq -0x620(%rbp), %r9
movq -0x508(%rbp), %rsi
movl -0x500(%rbp), %edx
movq -0x518(%rbp), %rcx
movl -0x510(%rbp), %r8d
leaq -0x4f8(%rbp), %rdi
callq 0x12400
jmp 0x121c3
leaq -0x4f8(%rbp), %rdi
callq 0x4180
movq %rax, -0x628(%rbp)
jmp 0x121d8
movq -0x628(%rbp), %rsi
leaq 0x218c(%rip), %rdi      # 0x14372
xorl %eax, %eax
callq 0x4070
jmp 0x121ef
leaq -0x4f8(%rbp), %rdi
callq 0x4200
jmp 0x121fd
leaq -0x519(%rbp), %rdi
callq 0x4400
callq 0x4b80
jmp 0x12210
xorl %edi, %edi
callq 0x4440
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x12241
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x2c8(%rbp), %rdi
callq 0x4200
jmp 0x1223f
jmp 0x12241
leaq -0x2c9(%rbp), %rdi
callq 0x4400
jmp 0x12330
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x12296
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x1228a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x4f8(%rbp), %rdi
callq 0x4200
jmp 0x12288
jmp 0x1228a
leaq -0x519(%rbp), %rdi
callq 0x4400
leaq -0x4d8(%rbp), %rdi
callq 0x4100
jmp 0x122a4
jmp 0x12330
jmp 0x122ab
jmp 0x122ad
jmp 0x122af
jmp 0x122b1
jmp 0x122b3
jmp 0x122b5
jmp 0x122b7
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x11ba2
movss -0x14(%rbp), %xmm0
movl -0x18(%rbp), %edx
movzbl -0x19(%rbp), %esi
andl $0x1, %esi
leaq -0x570(%rbp), %rdi
movq %rdi, -0x630(%rbp)
callq 0x12490
movq -0x630(%rbp), %rdi
callq 0x12ba0
jmp 0x122f5
movl $0x0, -0x4(%rbp)
leaq -0x570(%rbp), %rdi
callq 0x12bc0
movl -0x4(%rbp), %eax
addq $0x630, %rsp            # imm = 0x630
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x570(%rbp), %rdi
callq 0x12bc0
jmp 0x1232e
jmp 0x12330
movq -0x50(%rbp), %rdi
callq 0x45e0
movq %rax, %rdi
callq 0x4ec0
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)