// File: /workspace/github_cpp_makefile_star2_O2/ninjabear[P]dr-doom/src/main.cpp
// Function: main
int main(int argc, char **argv) {

    if (argc != 2) {
        usage();
        return PROC_OTHER_ERROR;
    }

    string method(argv[1]);

    switch (get_mode(method)) {
        case memory: 
            if (are_you_sure("This process will consume as much memory as it possibly can. This may make your system unstable!")) {
                cout << endl << "Understood. Memory cannon mode activating!" << endl << endl;
                consume_memory();
            }
            break;
        case fork_proc:
            if (are_you_sure("This process will spawn as many processes as it can. These processes will spawn processes and so on. This is going to be difficult to clean up!")) {
                cout << "Understood. Fork-bomb mode activating." << endl << endl;
                fork_bomb();
            }
            break;
        case cpu:
            if (are_you_sure("This process will create a thread that runs an infinite loop for each core. Killing this process should restore normal behaviour.")) {
                cout << endl << "Understood. Halt and catch fire mode activating." << endl << endl;
                consume_cpu();
            }
            break;
        case thread_b:
            if (are_you_sure("This process will create as many threads as it can. These threads will be zombies (consume no CPU). Killing this process should restore normal behaviour.")) {
                cout << endl << "Understood, activating." << endl << endl; 
                thread_bomb();
            }
            break;
        case file_handles:
            if (are_you_sure("This process will open a temp file for writing using as many file handles as possible.")) {
                cout << endl << "Understood. Opening file over and over again." << endl << endl;
                many_open_file_handles();
            }
            break;
        case version:
            show_version();
            break;
        case help:
        case unknown: 
        default: 
            usage();
            break;
    }

    return 0;    
}

// Assembly:
pushq %rbx
subq $0x50, %rsp
cmpl $0x2, %edi
jne 0x2959
movq 0x8(%rsi), %rsi
leaq 0x30(%rsp), %rbx
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x2b52
movq %rbx, %rdi
callq 0x2772
cmpl $0x6, %eax
ja 0x29d9
movl %eax, %eax
leaq 0x171d(%rip), %rcx      # 0x4004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x1857(%rip), %rsi      # 0x414e
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x2b52
leaq 0x10(%rsp), %rdi
callq 0x284d
movl %eax, %ebx
leaq 0x10(%rsp), %rdi
callq 0x2348
testb %bl, %bl
je 0x2b0a
movq 0x46a5(%rip), %rdi      # 0x6fd0
callq 0x20d0
leaq 0x1878(%rip), %rsi      # 0x41af
movq %rax, %rdi
callq 0x21e0
movq %rax, %rdi
callq 0x20d0
movq %rax, %rdi
callq 0x20d0
callq 0x32d3
jmp 0x2b0a
callq 0x2598
pushq $0x1
popq %rax
jmp 0x2b16
leaq 0x19d7(%rip), %rsi      # 0x4344
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x2b52
leaq 0x10(%rsp), %rdi
callq 0x284d
movl %eax, %ebx
leaq 0x10(%rsp), %rdi
callq 0x2348
testb %bl, %bl
je 0x2b0a
movq 0x462f(%rip), %rdi      # 0x6fd0
callq 0x20d0
leaq 0x1a31(%rip), %rsi      # 0x43de
movq %rax, %rdi
callq 0x21e0
movq %rax, %rdi
callq 0x20d0
movq %rax, %rdi
callq 0x20d0
callq 0x3610
jmp 0x2b0a
callq 0x256c
jmp 0x2b0a
callq 0x2598
jmp 0x2b0a
leaq 0x17f0(%rip), %rsi      # 0x41da
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x2b52
leaq 0x10(%rsp), %rdi
callq 0x284d
movl %eax, %ebx
leaq 0x10(%rsp), %rdi
callq 0x2348
testb %bl, %bl
je 0x2b0a
movq 0x45b2(%rip), %rdi      # 0x6fd0
leaq 0x1845(%rip), %rsi      # 0x426a
callq 0x21e0
movq %rax, %rdi
callq 0x20d0
movq %rax, %rdi
callq 0x20d0
callq 0x3608
jmp 0x2b0a
leaq 0x19ab(%rip), %rsi      # 0x43f6
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x2b52
leaq 0x10(%rsp), %rdi
callq 0x284d
movl %eax, %ebx
leaq 0x10(%rsp), %rdi
callq 0x2348
testb %bl, %bl
je 0x2b0a
movq 0x4551(%rip), %rdi      # 0x6fd0
callq 0x20d0
leaq 0x19c2(%rip), %rsi      # 0x444d
movq %rax, %rdi
callq 0x21e0
movq %rax, %rdi
callq 0x20d0
movq %rax, %rdi
callq 0x20d0
callq 0x2dd4
jmp 0x2b0a
leaq 0x17e0(%rip), %rsi      # 0x4291
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x2b52
leaq 0x10(%rsp), %rdi
callq 0x284d
movl %eax, %ebx
leaq 0x10(%rsp), %rdi
callq 0x2348
testb %bl, %bl
je 0x2b0a
movq 0x44ef(%rip), %rdi      # 0x6fd0
callq 0x20d0
leaq 0x1826(%rip), %rsi      # 0x4313
movq %rax, %rdi
callq 0x21e0
movq %rax, %rdi
callq 0x20d0
movq %rax, %rdi
callq 0x20d0
callq 0x2c30
leaq 0x30(%rsp), %rdi
callq 0x2348
xorl %eax, %eax
addq $0x50, %rsp
popq %rbx
retq
jmp 0x2b24
jmp 0x2b24
jmp 0x2b24
jmp 0x2b24
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x2348
jmp 0x2b40
jmp 0x2b3d
jmp 0x2b3d
jmp 0x2b3d
jmp 0x2b3d
jmp 0x2b3d
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x2348
movq %rbx, %rdi
callq 0x2310