// File: /workspace/github_cpp_makefile_star2_O3/Jacobious52[P]Tanks/GameView.cpp
// Function: GameView::update(int)
void GameView::update(int t)
{
    // bullet needs firing
    DebugView::shared_view()->watch("terrain count", _terrain->get_children()->get_count());

    View::update(t);

    // check if bullet is inside tank1
    if (_bullet->get_position().x >= _tank1->get_position().x
        && _bullet->get_position().x <= _tank1->get_position().x + _tank1->get_size().x
        && _bullet->get_position().y > _tank1->get_position().y
        && _bullet->get_position().y <= _tank1->get_position().y + _tank1->get_size().y)
    {
        _winner = _tank2->get_name();
        ConsoleTools::play_music("boom.wav");
        _should_remove_from_parent = true;
        return;
    }
    // check if bullet is inside tank2
    else if (_bullet->get_position().x >= _tank2->get_position().x
        && _bullet->get_position().x <= _tank2->get_position().x + _tank2->get_size().x
        && _bullet->get_position().y > _tank2->get_position().y
        && _bullet->get_position().y <= _tank2->get_position().y + _tank2->get_size().y)
    {
        _winner = _tank1->get_name();
        ConsoleTools::play_music("boom.wav");
        _should_remove_from_parent = true;
        return;
    }
    // bullet has hit. next turn
    if (_bullet->get_launched() == false || _bullet->should_remove_from_parent() == true)
    {
        _terrain->shuffle_wind_speed();
        DebugView::shared_view()->watch("wind speed", _terrain->get_wind_speed());
        draw();
       _get_input();
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xa0, %rsp
movl %esi, %r14d
movq %rdi, %rbx
callq 0x4d8a
movq %rax, %r15
leaq -0x70(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x7878(%rip), %rsi      # 0xc120
leaq 0x787e(%rip), %rdx      # 0xc12d
leaq -0x80(%rbp), %rdi
callq 0x574e
movq 0x38(%rbx), %rdi
callq 0x98f4
movq 0x8(%rax), %rax
testq %rax, %rax
js 0x48d1
cvtsi2ss %rax, %xmm0
jmp 0x48e6
movq %rax, %rcx
shrq %rcx
andl $0x1, %eax
orq %rcx, %rax
cvtsi2ss %rax, %xmm0
addss %xmm0, %xmm0
leaq -0x80(%rbp), %rsi
movq %r15, %rdi
callq 0x9ca8
movq -0x80(%rbp), %rdi
cmpq %r12, %rdi
je 0x4900
callq 0x3230
movq %rbx, %rdi
movl %r14d, %esi
callq 0x9972
movq 0x50(%rbx), %rdi
callq 0x9a52
movq %rax, %r14
movq 0x40(%rbx), %rdi
callq 0x9a52
cmpl %eax, %r14d
jl 0x49ad
movq 0x50(%rbx), %rdi
callq 0x9a52
movq %rax, %r14
movq 0x40(%rbx), %rdi
callq 0x9a52
movq %rax, %r15
movq 0x40(%rbx), %rdi
callq 0x9a66
addl %r15d, %eax
cmpl %r14d, %eax
jl 0x49ad
movq 0x50(%rbx), %rdi
callq 0x9a52
movq %rax, %r14
shrq $0x20, %r14
movq 0x40(%rbx), %rdi
callq 0x9a52
shrq $0x20, %rax
cmpl %eax, %r14d
jle 0x49ad
movq 0x50(%rbx), %rdi
callq 0x9a52
movq %rax, %r14
shrq $0x20, %r14
movq 0x40(%rbx), %rdi
callq 0x9a52
movq %rax, %r15
shrq $0x20, %r15
movq 0x40(%rbx), %rdi
callq 0x9a66
shrq $0x20, %rax
addl %r15d, %eax
cmpl %r14d, %eax
jge 0x4add
movq 0x50(%rbx), %rdi
callq 0x9a52
movq %rax, %r14
movq 0x48(%rbx), %rdi
callq 0x9a52
cmpl %eax, %r14d
jl 0x4a4f
movq 0x50(%rbx), %rdi
callq 0x9a52
movq %rax, %r14
movq 0x48(%rbx), %rdi
callq 0x9a52
movq %rax, %r15
movq 0x48(%rbx), %rdi
callq 0x9a66
addl %r15d, %eax
cmpl %r14d, %eax
jl 0x4a4f
movq 0x50(%rbx), %rdi
callq 0x9a52
movq %rax, %r14
shrq $0x20, %r14
movq 0x48(%rbx), %rdi
callq 0x9a52
shrq $0x20, %rax
cmpl %eax, %r14d
jle 0x4a4f
movq 0x50(%rbx), %rdi
callq 0x9a52
movq %rax, %r14
shrq $0x20, %r14
movq 0x48(%rbx), %rdi
callq 0x9a52
movq %rax, %r15
shrq $0x20, %r15
movq 0x48(%rbx), %rdi
callq 0x9a66
shrq $0x20, %rax
addl %r15d, %eax
cmpl %r14d, %eax
jge 0x4b44
movq 0x50(%rbx), %rdi
callq 0x8d60
testb %al, %al
je 0x4a69
movq 0x50(%rbx), %rdi
callq 0x9a10
testb %al, %al
je 0x4acd
movq 0x38(%rbx), %rdi
callq 0x7b12
callq 0x4d8a
movq %rax, %r14
leaq -0x50(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x76ae(%rip), %rsi      # 0xc137
leaq 0x76b1(%rip), %rdx      # 0xc141
leaq -0x60(%rbp), %rdi
callq 0x574e
movq 0x38(%rbx), %rdi
callq 0x7f60
leaq -0x60(%rbp), %rsi
movq %r14, %rdi
callq 0x9ca8
movq -0x60(%rbp), %rdi
cmpq %r15, %rdi
je 0x4abc
callq 0x3230
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x18(%rax)
movq %rbx, %rdi
callq 0x4272
addq $0xa0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x48(%rbx), %rsi
leaq -0x40(%rbp), %r14
movq %r14, %rdi
callq 0x9c02
leaq 0x68(%rbx), %rdi
movq %r14, %rsi
callq 0x3140
leaq -0x30(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4b0b
callq 0x3230
leaq -0xb0(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x7611(%rip), %rsi      # 0xc12e
leaq 0x7612(%rip), %rdx      # 0xc136
leaq -0xc0(%rbp), %r14
movq %r14, %rdi
callq 0x574e
movq %r14, %rdi
callq 0x399e
movq -0xc0(%rbp), %rdi
jmp 0x4ba9
movq 0x40(%rbx), %rsi
leaq -0x40(%rbp), %r14
movq %r14, %rdi
callq 0x9c02
leaq 0x68(%rbx), %rdi
movq %r14, %rsi
callq 0x3140
leaq -0x30(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4b72
callq 0x3230
leaq -0x90(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x75aa(%rip), %rsi      # 0xc12e
leaq 0x75ab(%rip), %rdx      # 0xc136
leaq -0xa0(%rbp), %r14
movq %r14, %rdi
callq 0x574e
movq %r14, %rdi
callq 0x399e
movq -0xa0(%rbp), %rdi
cmpq %r15, %rdi
je 0x4bb3
callq 0x3230
movb $0x1, 0x30(%rbx)
jmp 0x4acd
movq %rax, %rbx
movq -0xa0(%rbp), %rdi
jmp 0x4bef
jmp 0x4bd6
movq %rax, %rbx
movq -0xc0(%rbp), %rdi
jmp 0x4bef
movq %rax, %rbx
leaq -0x30(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x4c02
jmp 0x4c07
movq %rax, %rbx
movq -0x60(%rbp), %rdi
cmpq %r15, %rdi
jne 0x4c02
jmp 0x4c07
movq %rax, %rbx
movq -0x80(%rbp), %rdi
cmpq %r12, %rdi
je 0x4c07
callq 0x3230
movq %rbx, %rdi
callq 0x3430
nop