// File: /workspace/github_cpp_makefile_star2_O1/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 %r14
pushq %rbx
subq $0x48, %rsp
cmpl $0x2, %edi
jne 0x2cf5
movq 0x8(%rsi), %rsi
leaq 0x28(%rsp), %rbx
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0x311a
movq %rbx, %rdi
callq 0x2a25
cmpl $0x6, %eax
ja 0x2dfb
movl %eax, %eax
leaq 0x2405(%rip), %rcx      # 0x5004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x18(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x2536(%rip), %rsi      # 0x514e
leaq 0x258f(%rip), %rdx      # 0x51ae
leaq 0x8(%rsp), %rdi
callq 0x3158
leaq 0x8(%rsp), %rdi
callq 0x2b18
movl %eax, %ebx
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x2c4c
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2200
testb %bl, %bl
je 0x30a0
movq 0x5375(%rip), %rdi      # 0x7fd0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x21d0
movsbl %al, %esi
movq 0x535a(%rip), %rdi      # 0x7fd0
callq 0x2030
movq %rax, %rdi
callq 0x2130
movq %rax, %rbx
leaq 0x2522(%rip), %rsi      # 0x51af
movl $0x2a, %edx
movq %rax, %rdi
callq 0x2210
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2130
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2130
callq 0x3962
jmp 0x30a0
callq 0x2619
movl $0x1, %eax
jmp 0x30bd
leaq 0x18(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x2630(%rip), %rsi      # 0x5344
leaq 0x26c2(%rip), %rdx      # 0x53dd
leaq 0x8(%rsp), %rdi
callq 0x3158
leaq 0x8(%rsp), %rdi
callq 0x2b18
movl %eax, %ebx
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x2d48
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2200
testb %bl, %bl
je 0x30a0
movq 0x5279(%rip), %rdi      # 0x7fd0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x21d0
movsbl %al, %esi
movq 0x525e(%rip), %rdi      # 0x7fd0
callq 0x2030
movq %rax, %rdi
callq 0x2130
movq %rax, %rbx
leaq 0x2655(%rip), %rsi      # 0x53de
movl $0x17, %edx
movq %rax, %rdi
callq 0x2210
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2130
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2130
callq 0x3d68
jmp 0x30a0
callq 0x25bc
jmp 0x30a0
callq 0x2619
jmp 0x30a0
leaq 0x18(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x23c5(%rip), %rsi      # 0x51da
leaq 0x244d(%rip), %rdx      # 0x5269
leaq 0x8(%rsp), %rdi
callq 0x3158
leaq 0x8(%rsp), %rdi
callq 0x2b18
movl %eax, %ebx
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x2e49
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2200
testb %bl, %bl
je 0x30a0
movq 0x5178(%rip), %rbx      # 0x7fd0
leaq 0x240b(%rip), %rsi      # 0x526a
movl $0x26, %edx
movq %rbx, %rdi
callq 0x2210
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x21d0
movsbl %al, %esi
movq 0x5146(%rip), %rdi      # 0x7fd0
callq 0x2030
movq %rax, %rdi
callq 0x2130
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2130
callq 0x3d60
jmp 0x30a0
leaq 0x18(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x251b(%rip), %rsi      # 0x53f6
leaq 0x256a(%rip), %rdx      # 0x544c
leaq 0x8(%rsp), %rdi
callq 0x3158
leaq 0x8(%rsp), %rdi
callq 0x2b18
movl %eax, %ebx
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x2f0f
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2200
testb %bl, %bl
je 0x30a0
movq 0x50b2(%rip), %rdi      # 0x7fd0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x21d0
movsbl %al, %esi
movq 0x5097(%rip), %rdi      # 0x7fd0
callq 0x2030
movq %rax, %rdi
callq 0x2130
movq %rax, %rbx
leaq 0x24fd(%rip), %rsi      # 0x544d
movl $0x2d, %edx
movq %rax, %rdi
callq 0x2210
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2130
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2130
callq 0x335c
jmp 0x30a0
leaq 0x18(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x22c9(%rip), %rsi      # 0x5291
leaq 0x2343(%rip), %rdx      # 0x5312
leaq 0x8(%rsp), %rdi
callq 0x3158
leaq 0x8(%rsp), %rdi
callq 0x2b18
movl %eax, %ebx
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x2ffc
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2200
testb %bl, %bl
je 0x30a0
movq 0x4fc5(%rip), %rdi      # 0x7fd0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x21d0
movsbl %al, %esi
movq 0x4faa(%rip), %rdi      # 0x7fd0
callq 0x2030
movq %rax, %rdi
callq 0x2130
movq %rax, %rbx
leaq 0x22d6(%rip), %rsi      # 0x5313
movl $0x30, %edx
movq %rax, %rdi
callq 0x2210
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2130
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2130
callq 0x31e8
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x30bb
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2200
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r14
retq
jmp 0x30cd
jmp 0x30cd
jmp 0x30cd
jmp 0x30cd
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x30f6
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0x30f6
jmp 0x30f3
jmp 0x30f3
jmp 0x30f3
jmp 0x30f3
jmp 0x30f3
movq %rax, %rbx
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3111
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2200
movq %rbx, %rdi
callq 0x2320
nop