// File: Jacobious52[P]Tanks/GameView.cpp
// Function: GameView::_get_input()
void GameView::_get_input()
{
    // choose tank depending on turn
    Tank *current_tank = (turn == false) ? _tank1 : _tank2;
    float angle_offset = (turn == false) ? 0: M_PI;
    turn = !turn;

    _input_box->draw();

    // draw tank name
    ConsoleTools::set_color(current_tank->get_fcolor(), ConsoleTools::endc);
    ConsoleTools::set_cursor(_input_box->get_position().x + 1, _input_box->get_position().y + 1);
    printf("%s", current_tank->get_name().c_str());

    // draw input text stuff
    ConsoleTools::set_cursor(_input_box->get_position().x + 1, _input_box->get_position().y + 3);
    printf("power: ");
    ConsoleTools::set_cursor(_input_box->get_position().x + 1, _input_box->get_position().y + 4);
    printf("angle: ");

    // write to input file
    if (DebugView::shared_view()->show == true)
    {
        std::ofstream file("computer.txt", std::ios::app);
        file << (rand() % 7) + 1 << " " << (rand() % 80) << std::endl;
        file.close();
    }

    // get power input
    ConsoleTools::move_cursor(ConsoleTools::up, 1);
    float p = ConsoleTools::get_input<float>("float! ",
        Point<int>(_input_box->get_position().x + 1, _input_box->get_position().y + 3));
    ConsoleTools::play_music("beep.wav");

    // get angle input
    ConsoleTools::set_cursor(_input_box->get_position().x + StringTools::string_width("angle: ") + 1, _input_box->get_position().y + 4);
    float a = ConsoleTools::get_input<float>("float! ",
        Point<int>(_input_box->get_position().x + 1, _input_box->get_position().y + 4));

    // write power and angle to replay file
    if (ConsoleTools::replay == false)
    {
        std::ofstream file("replay.txt", std::ios::app);
        file << p << " " << a << std::endl;
        file.close();
    }

    DebugView::shared_view()->watch("power", p);
    DebugView::shared_view()->watch("angle", a);

    if (a == -1 && p == -1)
    {
        _should_remove_from_parent = true;
        return;
    }

    // create new bulelt and fire
    // bullet already deleted by update loop
    _bullet = new Bullet(current_tank->get_position(), std::abs(angle_offset - a*(M_PI/180)), MIN(p, 10.0), _terrain);
    _bullet->fire();
    add_child(_bullet);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x6f0, %rsp            # imm = 0x6F0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x5c0(%rbp)
movb 0x60(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x5c2b
movq -0x5c0(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x5c8(%rbp)
jmp 0x5c3d
movq -0x5c0(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x5c8(%rbp)
movq -0x5c0(%rbp), %rax
movq -0x5c8(%rbp), %rcx
movq %rcx, -0x10(%rbp)
movb 0x60(%rax), %al
testb $0x1, %al
movsd 0xe404(%rip), %xmm0     # 0x14060
xorps %xmm1, %xmm1
movsd %xmm1, -0x5d8(%rbp)
movsd %xmm0, -0x5d0(%rbp)
jne 0x5c81
movsd -0x5d8(%rbp), %xmm0
movsd %xmm0, -0x5d0(%rbp)
movq -0x5c0(%rbp), %rax
movsd -0x5d0(%rbp), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x14(%rbp)
movb 0x60(%rax), %cl
notb %cl
andb $0x1, %cl
movb %cl, 0x60(%rax)
movq 0x58(%rax), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
movq -0x10(%rbp), %rdi
callq 0xa650
movl %eax, %edi
xorl %esi, %esi
callq 0x4b50
movq -0x5c0(%rbp), %rax
movq 0x58(%rax), %rdi
callq 0x10660
movq %rax, %rcx
movq -0x5c0(%rbp), %rax
movq %rcx, -0x1c(%rbp)
movl -0x1c(%rbp), %ecx
incl %ecx
movl %ecx, -0x5ec(%rbp)
movq 0x58(%rax), %rdi
callq 0x10660
movl -0x5ec(%rbp), %edi
movq %rax, -0x24(%rbp)
movl -0x20(%rbp), %esi
incl %esi
callq 0x4c00
movq -0x10(%rbp), %rsi
leaq -0x48(%rbp), %rdi
movq %rdi, -0x5e8(%rbp)
callq 0x10b80
movq -0x5e8(%rbp), %rdi
callq 0x4180
movq %rax, -0x5e0(%rbp)
jmp 0x5d32
movq -0x5e0(%rbp), %rsi
leaq 0xe461(%rip), %rdi      # 0x141a1
xorl %eax, %eax
callq 0x4070
jmp 0x5d49
leaq -0x48(%rbp), %rdi
callq 0x4200
movq -0x5c0(%rbp), %rax
movq 0x58(%rax), %rdi
callq 0x10660
movq %rax, %rcx
movq -0x5c0(%rbp), %rax
movq %rcx, -0x5c(%rbp)
movl -0x5c(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x5f4(%rbp)
movq 0x58(%rax), %rdi
callq 0x10660
movl -0x5f4(%rbp), %edi
movq %rax, -0x64(%rbp)
movl -0x60(%rbp), %esi
addl $0x3, %esi
callq 0x4c00
leaq 0xe31a(%rip), %rdi      # 0x140bb
movb $0x0, %al
callq 0x4070
movq -0x5c0(%rbp), %rax
movq 0x58(%rax), %rdi
callq 0x10660
movq %rax, %rcx
movq -0x5c0(%rbp), %rax
movq %rcx, -0x6c(%rbp)
movl -0x6c(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x5f0(%rbp)
movq 0x58(%rax), %rdi
callq 0x10660
movl -0x5f0(%rbp), %edi
movq %rax, -0x74(%rbp)
movl -0x70(%rbp), %esi
addl $0x4, %esi
callq 0x4c00
leaq 0xe2cc(%rip), %rdi      # 0x140c3
movb $0x0, %al
callq 0x4070
callq 0x70a0
movb 0x31(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x5f3d
leaq 0xe2b0(%rip), %rsi      # 0x140cb
leaq -0x278(%rbp), %rdi
movq %rdi, -0x608(%rbp)
movl $0x1, %edx
callq 0x4410
callq 0x4110
movq -0x608(%rbp), %rdi
movl %eax, %edx
movslq %edx, %rax
imulq $-0x6db6db6d, %rax, %rax # imm = 0x92492493
shrq $0x20, %rax
addl %edx, %eax
movl %eax, %ecx
shrl $0x1f, %ecx
sarl $0x2, %eax
addl %ecx, %eax
movl %eax, %ecx
shll $0x3, %ecx
subl %ecx, %eax
movl %eax, %ecx
movl %edx, %eax
leal 0x1(%rax,%rcx), %esi
callq 0x45b0
movq %rax, -0x600(%rbp)
jmp 0x5e78
movq -0x600(%rbp), %rdi
leaq 0xe227(%rip), %rsi      # 0x140ad
callq 0x4390
movq %rax, -0x610(%rbp)
jmp 0x5e94
callq 0x4110
movq -0x610(%rbp), %rdi
movl %eax, %esi
movslq %esi, %rax
imulq $0x66666667, %rax, %rcx # imm = 0x66666667
movq %rcx, %rax
shrq $0x3f, %rax
sarq $0x25, %rcx
addl %eax, %ecx
shll $0x4, %ecx
movl %ecx, %eax
leal (%rax,%rax,4), %eax
subl %eax, %esi
callq 0x45b0
movq %rax, -0x618(%rbp)
jmp 0x5ed1
movq -0x618(%rbp), %rdi
movq 0x150e9(%rip), %rsi     # 0x1afc8
callq 0x43e0
jmp 0x5ee6
leaq -0x278(%rbp), %rdi
callq 0x44c0
jmp 0x5ef4
leaq -0x278(%rbp), %rdi
callq 0x44e0
jmp 0x5f3d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x4200
jmp 0x5f19
jmp 0x6711
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x278(%rbp), %rdi
callq 0x44e0
jmp 0x5f38
jmp 0x6711
movl $0x41, %edi
movl $0x1, %esi
callq 0x4c80
leaq -0x2a1(%rbp), %rdi
movq %rdi, -0x620(%rbp)
callq 0x45f0
movq -0x620(%rbp), %rdx
leaq 0xe16b(%rip), %rsi      # 0x140d8
leaq -0x2a0(%rbp), %rdi
callq 0x4490
jmp 0x5f7b
movq -0x5c0(%rbp), %rax
movq 0x58(%rax), %rdi
callq 0x10660
movq %rax, -0x628(%rbp)
jmp 0x5f94
movq -0x5c0(%rbp), %rax
movq -0x628(%rbp), %rcx
movq %rcx, -0x2b4(%rbp)
movl -0x2b4(%rbp), %ecx
incl %ecx
movl %ecx, -0x634(%rbp)
movq 0x58(%rax), %rdi
callq 0x10660
movq %rax, -0x630(%rbp)
jmp 0x5fc9
movl -0x634(%rbp), %esi
movq -0x630(%rbp), %rax
movq %rax, -0x2bc(%rbp)
movl -0x2b8(%rbp), %edx
addl $0x3, %edx
leaq -0x2ac(%rbp), %rdi
callq 0x4ed0
jmp 0x5ff4
movq -0x2ac(%rbp), %rsi
leaq -0x2a0(%rbp), %rdi
callq 0x7550
movss %xmm0, -0x638(%rbp)
jmp 0x6011
leaq -0x2a0(%rbp), %rdi
callq 0x4200
jmp 0x601f
leaq -0x2a1(%rbp), %rdi
callq 0x4400
movss -0x638(%rbp), %xmm0
movss %xmm0, -0x27c(%rbp)
leaq -0x2e1(%rbp), %rdi
movq %rdi, -0x640(%rbp)
callq 0x45f0
movq -0x640(%rbp), %rdx
leaq 0xe084(%rip), %rsi      # 0x140e0
leaq -0x2e0(%rbp), %rdi
callq 0x4490
jmp 0x606a
leaq -0x2e0(%rbp), %rdi
callq 0x4d20
jmp 0x6078
leaq -0x2e0(%rbp), %rdi
callq 0x4200
jmp 0x6086
leaq -0x2e1(%rbp), %rdi
callq 0x4400
movq -0x5c0(%rbp), %rax
movq 0x58(%rax), %rdi
callq 0x10660
movq %rax, -0x2ec(%rbp)
movl -0x2ec(%rbp), %eax
movl %eax, -0x64c(%rbp)
leaq -0x311(%rbp), %rdi
movq %rdi, -0x648(%rbp)
callq 0x45f0
movq -0x648(%rbp), %rdx
leaq 0xdfed(%rip), %rsi      # 0x140c3
leaq -0x310(%rbp), %rdi
callq 0x4490
jmp 0x60e4
leaq -0x310(%rbp), %rdi
callq 0xaeb0
movl %eax, -0x650(%rbp)
jmp 0x60f8
movq -0x5c0(%rbp), %rax
movl -0x64c(%rbp), %esi
movl -0x650(%rbp), %ecx
movl %ecx, %edx
movl %esi, %ecx
leal 0x1(%rcx,%rdx), %ecx
movl %ecx, -0x65c(%rbp)
movq 0x58(%rax), %rdi
callq 0x10660
movq %rax, -0x658(%rbp)
jmp 0x612b
movl -0x65c(%rbp), %edi
movq -0x658(%rbp), %rax
movq %rax, -0x31c(%rbp)
movl -0x318(%rbp), %esi
addl $0x4, %esi
callq 0x4c00
jmp 0x614f
leaq -0x310(%rbp), %rdi
callq 0x4200
jmp 0x615d
leaq -0x311(%rbp), %rdi
callq 0x4400
leaq -0x341(%rbp), %rdi
movq %rdi, -0x668(%rbp)
callq 0x45f0
movq -0x668(%rbp), %rdx
leaq 0xdf4e(%rip), %rsi      # 0x140d8
leaq -0x340(%rbp), %rdi
callq 0x4490
jmp 0x6198
movq -0x5c0(%rbp), %rax
movq 0x58(%rax), %rdi
callq 0x10660
movq %rax, -0x670(%rbp)
jmp 0x61b1
movq -0x5c0(%rbp), %rax
movq -0x670(%rbp), %rcx
movq %rcx, -0x354(%rbp)
movl -0x354(%rbp), %ecx
incl %ecx
movl %ecx, -0x67c(%rbp)
movq 0x58(%rax), %rdi
callq 0x10660
movq %rax, -0x678(%rbp)
jmp 0x61e6
movl -0x67c(%rbp), %esi
movq -0x678(%rbp), %rax
movq %rax, -0x35c(%rbp)
movl -0x358(%rbp), %edx
addl $0x4, %edx
leaq -0x34c(%rbp), %rdi
callq 0x4ed0
jmp 0x6211
movq -0x34c(%rbp), %rsi
leaq -0x340(%rbp), %rdi
callq 0x7550
movss %xmm0, -0x680(%rbp)
jmp 0x622e
leaq -0x340(%rbp), %rdi
callq 0x4200
jmp 0x623c
leaq -0x341(%rbp), %rdi
callq 0x4400
movss -0x680(%rbp), %xmm0
movss %xmm0, -0x320(%rbp)
leaq 0x15103(%rip), %rax     # 0x1b362
movb (%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x6423
leaq 0xde73(%rip), %rsi      # 0x140e9
leaq -0x560(%rbp), %rdi
movq %rdi, -0x690(%rbp)
movl $0x1, %edx
callq 0x4410
movq -0x690(%rbp), %rdi
movss -0x27c(%rbp), %xmm0
callq 0x4280
movq %rax, -0x688(%rbp)
jmp 0x62ab
movq -0x688(%rbp), %rdi
leaq 0xddf4(%rip), %rsi      # 0x140ad
callq 0x4390
movq %rax, -0x698(%rbp)
jmp 0x62c7
movq -0x698(%rbp), %rdi
movss -0x320(%rbp), %xmm0
callq 0x4280
movq %rax, -0x6a0(%rbp)
jmp 0x62e4
movq -0x6a0(%rbp), %rdi
movq 0x14cd6(%rip), %rsi     # 0x1afc8
callq 0x43e0
jmp 0x62f9
leaq -0x560(%rbp), %rdi
callq 0x44c0
jmp 0x6307
leaq -0x560(%rbp), %rdi
callq 0x44e0
jmp 0x6423
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x6342
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x2a0(%rbp), %rdi
callq 0x4200
jmp 0x6340
jmp 0x6342
leaq -0x2a1(%rbp), %rdi
callq 0x4400
jmp 0x6711
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x637d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x2e0(%rbp), %rdi
callq 0x4200
jmp 0x637b
jmp 0x637d
leaq -0x2e1(%rbp), %rdi
callq 0x4400
jmp 0x6711
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x63b8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x310(%rbp), %rdi
callq 0x4200
jmp 0x63b6
jmp 0x63b8
leaq -0x311(%rbp), %rdi
callq 0x4400
jmp 0x6711
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x63f3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x340(%rbp), %rdi
callq 0x4200
jmp 0x63f1
jmp 0x63f3
leaq -0x341(%rbp), %rdi
callq 0x4400
jmp 0x6711
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x560(%rbp), %rdi
callq 0x44e0
jmp 0x641e
jmp 0x6711
callq 0x70a0
movq %rax, -0x6b0(%rbp)
leaq -0x581(%rbp), %rdi
movq %rdi, -0x6a8(%rbp)
callq 0x45f0
movq -0x6a8(%rbp), %rdx
leaq 0xdca4(%rip), %rsi      # 0x140f4
leaq -0x580(%rbp), %rdi
callq 0x4490
jmp 0x645e
movq -0x6b0(%rbp), %rdi
movss -0x27c(%rbp), %xmm0
leaq -0x580(%rbp), %rsi
callq 0x10cc0
jmp 0x647b
leaq -0x580(%rbp), %rdi
callq 0x4200
jmp 0x6489
leaq -0x581(%rbp), %rdi
callq 0x4400
callq 0x70a0
movq %rax, -0x6c0(%rbp)
leaq -0x5a9(%rbp), %rdi
movq %rdi, -0x6b8(%rbp)
callq 0x45f0
movq -0x6b8(%rbp), %rdx
leaq 0xdc38(%rip), %rsi      # 0x140fa
leaq -0x5a8(%rbp), %rdi
callq 0x4490
jmp 0x64d0
movq -0x6c0(%rbp), %rdi
movss -0x320(%rbp), %xmm0
leaq -0x5a8(%rbp), %rsi
callq 0x10cc0
jmp 0x64ed
leaq -0x5a8(%rbp), %rdi
callq 0x4200
jmp 0x64fb
leaq -0x5a9(%rbp), %rdi
callq 0x4400
movss -0x320(%rbp), %xmm0
movss 0xdb61(%rip), %xmm1     # 0x14078
ucomiss %xmm1, %xmm0
jne 0x65cb
jp 0x65cb
movss -0x27c(%rbp), %xmm0
movss 0xdb42(%rip), %xmm1     # 0x14078
ucomiss %xmm1, %xmm0
jne 0x65cb
jp 0x65cb
movq -0x5c0(%rbp), %rax
movb $0x1, 0x30(%rax)
jmp 0x66f0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x657f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x580(%rbp), %rdi
callq 0x4200
jmp 0x657d
jmp 0x657f
leaq -0x581(%rbp), %rdi
callq 0x4400
jmp 0x6711
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x65ba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x5a8(%rbp), %rdi
callq 0x4200
jmp 0x65b8
jmp 0x65ba
leaq -0x5a9(%rbp), %rdi
callq 0x4400
jmp 0x6711
movl $0x88, %edi
callq 0x43a0
movq %rax, -0x6d0(%rbp)
movq -0x10(%rbp), %rdi
callq 0x10660
movq %rax, -0x6c8(%rbp)
jmp 0x65ee
movq -0x6c8(%rbp), %rax
movq %rax, -0x5b4(%rbp)
movss -0x14(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movss -0x320(%rbp), %xmm1
cvtss2sd %xmm1, %xmm1
movsd 0xda4f(%rip), %xmm2     # 0x14068
mulsd %xmm2, %xmm1
addsd %xmm1, %xmm0
callq 0x7660
movsd %xmm0, -0x6d8(%rbp)
jmp 0x6630
movsd -0x6d8(%rbp), %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x6dc(%rbp)
movss -0x27c(%rbp), %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0xda18(%rip), %xmm0     # 0x14070
ucomisd %xmm1, %xmm0
seta %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x667f
movss -0x27c(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x6e8(%rbp)
jmp 0x6691
movsd 0xd9e9(%rip), %xmm0     # 0x14070
movsd %xmm0, -0x6e8(%rbp)
jmp 0x6691
movss -0x6dc(%rbp), %xmm0
movq -0x6d0(%rbp), %rdi
movq -0x5c0(%rbp), %rax
movsd -0x6e8(%rbp), %xmm1
cvtsd2ss %xmm1, %xmm1
movq 0x38(%rax), %rdx
movq -0x5b4(%rbp), %rsi
callq 0x7410
jmp 0x66c5
movq -0x5c0(%rbp), %rax
movq -0x6d0(%rbp), %rcx
movq %rcx, 0x50(%rax)
movq 0x50(%rax), %rdi
callq 0xecf0
movq -0x5c0(%rbp), %rdi
movq 0x50(%rdi), %rsi
callq 0x10420
addq $0x6f0, %rsp            # imm = 0x6F0
popq %rbp
retq
movq -0x6d0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
callq 0x4360
movq -0x50(%rbp), %rdi
callq 0x45e0
movq %rax, %rdi
callq 0x4ec0
nopw %cs:(%rax,%rax)