// File: /workspace/github_cpp_makefile_star2_O1/Jacobious52[P]Tanks/Bullet.cpp
// Function: Bullet::update(int)
void Bullet::update(int t)
{
    // don't update unless launched
    if (_launched == false)
    {
        return;
    }

    // increment velocity and position
    // vel += (gravity + wind) * slowdownfactor
    // pos += vel
    _velocity = _velocity + (Point<float>(0, GRAVITY) + Point<float>(_terrain->get_wind_speed(), 0)) * Point<float>(0.1, 0.1);
    _position = Point<int>(static_cast<int>(_position.x + _velocity.x), static_cast<int>(_position.y + _velocity.y));

    // remove if outside of view
    if (_position.y >= _terrain->get_size().y
        || _position.x >= _terrain->get_size().x
        || _position.x <= 0)
    {
        _should_remove_from_parent = true;
    }
    else if (_position.y <= 0)
    {
        // show ^ for above screen
        _position.y = 0;
        _texture = "^";
    }
    else
    {
        // going left to right
        if (_velocity.x > 0.5)
        {
            // going down
            if (_velocity.y > 0.5)
            {
                DebugView::shared_view()->watch("direction", 1);
                _texture = TextureTools::get_texture("bullet_down");
            }
            else if (_velocity.y < -0.5)
            {
                // going up
                DebugView::shared_view()->watch("direction", 2);
                _texture = TextureTools::get_texture("bullet_up");
            }
            else
            {
                // going horrizontal
                DebugView::shared_view()->watch("direction", 3);
                _texture = TextureTools::get_texture("bullet_flat");
            }
        }
        else if (_velocity.x < -0.5)
        {
            if (_velocity.y > 0.5)
            {
                // going down
                DebugView::shared_view()->watch("direction", 4);
                _texture = TextureTools::get_texture("bullet_up");
            }
            else if (_velocity.y < -0.5)
            {
                // going up
                DebugView::shared_view()->watch("direction", 5);
                _texture = TextureTools::get_texture("bullet_down");
            }
            else
            {
                // horizontal
                DebugView::shared_view()->watch("direction", 6);
                _texture = TextureTools::get_texture("bullet_flat");
            }
        }
        else
        {
            // vertical
            DebugView::shared_view()->watch("direction", 0);
            _texture = TextureTools::get_texture("bullet_vert");
        }

        LOOPV(i, _terrain)
        {
            if (_position.y >= _terrain->get_floor(_position.x))
            {
                // bullet hit ground.. remove it
                _position.y = _terrain->get_floor(_position.x);
                if (_terrain->impact(Point<int>(_position.x, _terrain->get_floor(_position.x)), 10))
                {
                    DebugView::shared_view()->watch("impact x", _position.x);
                    DebugView::shared_view()->watch("impact y", _terrain->get_floor(_position.x));
                    _should_remove_from_parent = true;
                }
            }
        }
    }

    // update debug watch vars
    DebugView::shared_view()->watch("bullet pos x ", static_cast<float>(get_position().x));
    DebugView::shared_view()->watch("bullet pos y ", static_cast<float>(get_position().y));
    DebugView::shared_view()->watch("bullet vel x ", _velocity.x);
    DebugView::shared_view()->watch("bullet vel y ", _velocity.y);

    Sprite::update(t);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2b8, %rsp            # imm = 0x2B8
cmpb $0x0, 0x70(%rdi)
je 0x9085
movl %esi, %r15d
movq %rdi, %r14
movq 0x80(%rdi), %rdi
callq 0x7f4e
xorps %xmm1, %xmm1
addss %xmm0, %xmm1
mulss 0x34d3(%rip), %xmm1     # 0xc270
addss 0x60(%r14), %xmm1
movss 0x64(%r14), %xmm0
addss 0x34c3(%rip), %xmm0     # 0xc274
unpcklps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movlps %xmm1, 0x60(%r14)
xorps %xmm0, %xmm0
cvtsi2ssl 0x18(%r14), %xmm0
addss 0x60(%r14), %xmm0
xorps %xmm1, %xmm1
cvtsi2ssl 0x1c(%r14), %xmm1
cvttss2si %xmm0, %eax
addss 0x64(%r14), %xmm1
cvttss2si %xmm1, %ecx
shlq $0x20, %rcx
orq %rcx, %rax
movq %rax, 0x18(%r14)
movl 0x1c(%r14), %ebx
movq 0x80(%r14), %rdi
callq 0x9a56
shrq $0x20, %rax
cmpl %eax, %ebx
movl %r15d, -0x54(%rbp)
jge 0x8f13
movl 0x18(%r14), %ebx
movq 0x80(%r14), %rdi
callq 0x9a56
cmpl %eax, %ebx
jge 0x8f13
cmpl $0x0, 0x18(%r14)
jle 0x8f13
cmpl $0x0, 0x1c(%r14)
jle 0x9097
movss 0x60(%r14), %xmm0
ucomiss 0x3433(%rip), %xmm0     # 0xc278
jbe 0x90c0
movss 0x64(%r14), %xmm0
ucomiss 0x3420(%rip), %xmm0     # 0xc278
jbe 0x9199
callq 0x4d7e
movq %rax, %rbx
leaq -0x2c8(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x342a(%rip), %rsi      # 0xc2a3
leaq 0x342c(%rip), %rdx      # 0xc2ac
leaq -0x2d8(%rbp), %r15
movq %r15, %rdi
callq 0x5744
movss 0x33fd(%rip), %xmm0     # 0xc294
movq %rbx, %rdi
movq %r15, %rsi
callq 0x9c98
movq -0x2d8(%rbp), %rdi
cmpq %r12, %rdi
je 0x8eb3
callq 0x3240
leaq -0x1a8(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x33e8(%rip), %rsi      # 0xc2ad
leaq 0x33ec(%rip), %rdx      # 0xc2b8
leaq -0x1b8(%rbp), %rdi
callq 0x5744
leaq -0x50(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0x84aa
leaq 0x38(%r14), %rdi
leaq -0x50(%rbp), %rsi
callq 0x3140
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8f07
callq 0x3240
movq -0x1b8(%rbp), %rdi
jmp 0x9536
movb $0x1, 0x30(%r14)
callq 0x4d7e
movq %rax, %rbx
leaq -0xc8(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x33bb(%rip), %rsi      # 0xc2ed
leaq 0x33c1(%rip), %rdx      # 0xc2fa
leaq -0xd8(%rbp), %rdi
callq 0x5744
movq %r14, %rdi
callq 0x9a42
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
leaq -0xd8(%rbp), %rsi
movq %rbx, %rdi
callq 0x9c98
movq -0xd8(%rbp), %rdi
cmpq %r15, %rdi
je 0x8f74
callq 0x3240
callq 0x4d7e
movq %rax, %rbx
leaq -0xa8(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x336d(%rip), %rsi      # 0xc2fb
leaq 0x3373(%rip), %rdx      # 0xc308
leaq -0xb8(%rbp), %rdi
callq 0x5744
movq %r14, %rdi
callq 0x9a42
shrq $0x20, %rax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
leaq -0xb8(%rbp), %rsi
movq %rbx, %rdi
callq 0x9c98
movq -0xb8(%rbp), %rdi
cmpq %r15, %rdi
je 0x8fd4
callq 0x3240
callq 0x4d7e
movq %rax, %rbx
leaq -0x1e8(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x331a(%rip), %rsi      # 0xc309
leaq 0x3320(%rip), %rdx      # 0xc316
leaq -0x1f8(%rbp), %r15
movq %r15, %rdi
callq 0x5744
movss 0x60(%r14), %xmm0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x9c98
movq -0x1f8(%rbp), %rdi
cmpq %r12, %rdi
je 0x9027
callq 0x3240
callq 0x4d7e
movq %rax, %rbx
leaq -0x1c8(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x32d5(%rip), %rsi      # 0xc317
leaq 0x32db(%rip), %rdx      # 0xc324
leaq -0x1d8(%rbp), %r15
movq %r15, %rdi
callq 0x5744
movss 0x64(%r14), %xmm0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x9c98
movq -0x1d8(%rbp), %rdi
cmpq %r12, %rdi
je 0x907a
callq 0x3240
movq %r14, %rdi
movl -0x54(%rbp), %esi
callq 0x6944
addq $0x2b8, %rsp            # imm = 0x2B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x0, 0x1c(%r14)
leaq 0x38(%r14), %rdi
movq 0x40(%r14), %rdx
leaq 0x31f3(%rip), %rcx      # 0xc2a1
movl $0x1, %r8d
xorl %esi, %esi
callq 0x3390
jmp 0x8f18
movss 0x31b4(%rip), %xmm1     # 0xc27c
ucomiss %xmm0, %xmm1
jbe 0x9265
movss 0x64(%r14), %xmm0
ucomiss 0x319a(%rip), %xmm0     # 0xc278
jbe 0x9315
callq 0x4d7e
movq %rax, %rbx
leaq -0x268(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x31a4(%rip), %rsi      # 0xc2a3
leaq 0x31a6(%rip), %rdx      # 0xc2ac
leaq -0x278(%rbp), %r15
movq %r15, %rdi
callq 0x5744
movss 0x316b(%rip), %xmm0     # 0xc288
movq %rbx, %rdi
movq %r15, %rsi
callq 0x9c98
movq -0x278(%rbp), %rdi
cmpq %r12, %rdi
je 0x9139
callq 0x3240
leaq -0x148(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x316e(%rip), %rsi      # 0xc2b9
leaq 0x3170(%rip), %rdx      # 0xc2c2
leaq -0x158(%rbp), %rdi
callq 0x5744
leaq -0x50(%rbp), %rdi
leaq -0x158(%rbp), %rsi
callq 0x84aa
leaq 0x38(%r14), %rdi
leaq -0x50(%rbp), %rsi
callq 0x3140
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x918d
callq 0x3240
movq -0x158(%rbp), %rdi
jmp 0x9536
movss %xmm0, -0x2c(%rbp)
callq 0x4d7e
movq %rax, %rbx
movss 0x30ce(%rip), %xmm0     # 0xc27c
ucomiss -0x2c(%rbp), %xmm0
jbe 0x93e1
leaq -0x2a8(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x30d8(%rip), %rsi      # 0xc2a3
leaq 0x30da(%rip), %rdx      # 0xc2ac
leaq -0x2b8(%rbp), %r15
movq %r15, %rdi
callq 0x5744
movss 0x30a7(%rip), %xmm0     # 0xc290
movq %rbx, %rdi
movq %r15, %rsi
callq 0x9c98
movq -0x2b8(%rbp), %rdi
cmpq %r12, %rdi
je 0x9205
callq 0x3240
leaq -0x188(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x30a2(%rip), %rsi      # 0xc2b9
leaq 0x30a4(%rip), %rdx      # 0xc2c2
leaq -0x198(%rbp), %rdi
callq 0x5744
leaq -0x50(%rbp), %rdi
leaq -0x198(%rbp), %rsi
callq 0x84aa
leaq 0x38(%r14), %rdi
leaq -0x50(%rbp), %rsi
callq 0x3140
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9259
callq 0x3240
movq -0x198(%rbp), %rdi
jmp 0x9536
callq 0x4d7e
movq %rax, %rbx
leaq -0x208(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x3023(%rip), %rsi      # 0xc2a3
leaq 0x3025(%rip), %rdx      # 0xc2ac
leaq -0x218(%rbp), %r15
movq %r15, %rdi
callq 0x5744
xorps %xmm0, %xmm0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x9c98
movq -0x218(%rbp), %rdi
cmpq %r12, %rdi
je 0x92b5
callq 0x3240
leaq -0xe8(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x3008(%rip), %rsi      # 0xc2cf
leaq 0x300c(%rip), %rdx      # 0xc2da
leaq -0xf8(%rbp), %rdi
callq 0x5744
leaq -0x50(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x84aa
leaq 0x38(%r14), %rdi
leaq -0x50(%rbp), %rsi
callq 0x3140
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9309
callq 0x3240
movq -0xf8(%rbp), %rdi
jmp 0x9536
movss %xmm0, -0x2c(%rbp)
callq 0x4d7e
movq %rax, %rbx
movss 0x2f52(%rip), %xmm0     # 0xc27c
ucomiss -0x2c(%rbp), %xmm0
jbe 0x948e
leaq -0x248(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x2f5c(%rip), %rsi      # 0xc2a3
leaq 0x2f5e(%rip), %rdx      # 0xc2ac
leaq -0x258(%rbp), %r15
movq %r15, %rdi
callq 0x5744
movss 0x2f1f(%rip), %xmm0     # 0xc284
movq %rbx, %rdi
movq %r15, %rsi
callq 0x9c98
movq -0x258(%rbp), %rdi
cmpq %r12, %rdi
je 0x9381
callq 0x3240
leaq -0x128(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x2f1a(%rip), %rsi      # 0xc2ad
leaq 0x2f1e(%rip), %rdx      # 0xc2b8
leaq -0x138(%rbp), %rdi
callq 0x5744
leaq -0x50(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0x84aa
leaq 0x38(%r14), %rdi
leaq -0x50(%rbp), %rsi
callq 0x3140
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x93d5
callq 0x3240
movq -0x138(%rbp), %rdi
jmp 0x9536
leaq -0x288(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x2eaf(%rip), %rsi      # 0xc2a3
leaq 0x2eb1(%rip), %rdx      # 0xc2ac
leaq -0x298(%rbp), %r15
movq %r15, %rdi
callq 0x5744
movss 0x2e7a(%rip), %xmm0     # 0xc28c
movq %rbx, %rdi
movq %r15, %rsi
callq 0x9c98
movq -0x298(%rbp), %rdi
cmpq %r12, %rdi
je 0x942e
callq 0x3240
leaq -0x168(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x2e83(%rip), %rsi      # 0xc2c3
leaq 0x2e87(%rip), %rdx      # 0xc2ce
leaq -0x178(%rbp), %rdi
callq 0x5744
leaq -0x50(%rbp), %rdi
leaq -0x178(%rbp), %rsi
callq 0x84aa
leaq 0x38(%r14), %rdi
leaq -0x50(%rbp), %rsi
callq 0x3140
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9482
callq 0x3240
movq -0x178(%rbp), %rdi
jmp 0x9536
leaq -0x228(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x2e02(%rip), %rsi      # 0xc2a3
leaq 0x2e04(%rip), %rdx      # 0xc2ac
leaq -0x238(%rbp), %r15
movq %r15, %rdi
callq 0x5744
movss 0x2dc1(%rip), %xmm0     # 0xc280
movq %rbx, %rdi
movq %r15, %rsi
callq 0x9c98
movq -0x238(%rbp), %rdi
cmpq %r12, %rdi
je 0x94db
callq 0x3240
leaq -0x108(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x2dd6(%rip), %rsi      # 0xc2c3
leaq 0x2dda(%rip), %rdx      # 0xc2ce
leaq -0x118(%rbp), %rdi
callq 0x5744
leaq -0x50(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0x84aa
leaq 0x38(%r14), %rdi
leaq -0x50(%rbp), %rsi
callq 0x3140
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x952f
callq 0x3240
movq -0x118(%rbp), %rdi
cmpq %r15, %rdi
je 0x9540
callq 0x3240
movq 0x80(%r14), %rdi
callq 0x98e8
cmpq $0x0, 0x8(%rax)
je 0x8f18
xorl %r13d, %r13d
movl 0x18(%r14), %esi
movl 0x1c(%r14), %ebx
movq 0x80(%r14), %rdi
callq 0x7cd2
cmpl %eax, %ebx
jl 0x968a
movq 0x80(%r14), %rdi
movl 0x18(%r14), %esi
callq 0x7cd2
movl %eax, 0x1c(%r14)
movq 0x80(%r14), %rbx
movl 0x18(%r14), %r15d
movq %rbx, %rdi
movl %r15d, %esi
callq 0x7cd2
shlq $0x20, %rax
orq %rax, %r15
movq %rbx, %rdi
movq %r15, %rsi
movl $0xa, %edx
callq 0x7d50
testb %al, %al
je 0x968a
callq 0x4d7e
movq %rax, %rbx
leaq -0x88(%rbp), %rax
movq %rax, -0x98(%rbp)
leaq -0x98(%rbp), %r15
movq %r15, %rdi
leaq 0x2cf5(%rip), %rsi      # 0xc2db
leaq 0x2cf6(%rip), %rdx      # 0xc2e3
callq 0x5744
movq %r14, %r12
xorps %xmm0, %xmm0
cvtsi2ssl 0x18(%r14), %xmm0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x9c98
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
leaq -0x78(%rbp), %r14
je 0x9625
callq 0x3240
callq 0x4d7e
movq %rax, %rbx
leaq -0x68(%rbp), %rax
movq %rax, -0x78(%rbp)
movq %r14, %rdi
leaq 0x2ca5(%rip), %rsi      # 0xc2e4
leaq 0x2ca6(%rip), %rdx      # 0xc2ec
callq 0x5744
movq 0x80(%r12), %rdi
movl 0x18(%r12), %esi
callq 0x7cd2
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9c98
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x9681
callq 0x3240
movb $0x1, 0x30(%r12)
movq %r12, %r14
incq %r13
movq 0x80(%r14), %rdi
callq 0x98e8
cmpq 0x8(%rax), %r13
jb 0x955a
jmp 0x8f18
movq %rax, %rbx
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x96d9
callq 0x3240
jmp 0x96d9
movq %rax, %rbx
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x96e8
callq 0x3240
jmp 0x96e8
movq %rax, %rbx
movq -0x118(%rbp), %rdi
jmp 0x9881
movq %rax, %rbx
movq -0x138(%rbp), %rdi
jmp 0x9881
jmp 0x980c
jmp 0x980c
movq %rax, %rbx
movq -0x238(%rbp), %rdi
jmp 0x9852
movq %rax, %rbx
movq -0x258(%rbp), %rdi
jmp 0x9852
movq %rax, %rbx
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9764
callq 0x3240
jmp 0x9764
movq %rax, %rbx
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9773
callq 0x3240
jmp 0x9773
movq %rax, %rbx
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9782
callq 0x3240
jmp 0x9782
movq %rax, %rbx
movq -0x178(%rbp), %rdi
jmp 0x9881
movq %rax, %rbx
movq -0x198(%rbp), %rdi
jmp 0x9881
movq %rax, %rbx
movq -0x158(%rbp), %rdi
jmp 0x9881
jmp 0x980c
jmp 0x980c
jmp 0x980c
movq %rax, %rbx
movq -0x298(%rbp), %rdi
jmp 0x9852
movq %rax, %rbx
movq -0x2b8(%rbp), %rdi
jmp 0x9852
movq %rax, %rbx
movq -0x278(%rbp), %rdi
jmp 0x9852
movq %rax, %rbx
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x97f2
callq 0x3240
jmp 0x97f2
movq %rax, %rbx
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9801
callq 0x3240
jmp 0x9801
movq %rax, %rbx
movq -0xf8(%rbp), %rdi
jmp 0x9881
movq %rax, %rbx
movq -0x1b8(%rbp), %rdi
jmp 0x9881
jmp 0x980c
movq %rax, %rbx
jmp 0x988b
movq %rax, %rbx
movq -0x218(%rbp), %rdi
jmp 0x9852
movq %rax, %rbx
movq -0x2d8(%rbp), %rdi
jmp 0x9852
movq %rax, %rbx
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
jmp 0x9864
movq %rax, %rbx
movq -0x1d8(%rbp), %rdi
jmp 0x9852
movq %rax, %rbx
movq -0x1f8(%rbp), %rdi
cmpq %r12, %rdi
jne 0x9886
jmp 0x988b
movq %rax, %rbx
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
jne 0x9886
jmp 0x988b
movq %rax, %rbx
movq -0xb8(%rbp), %rdi
jmp 0x9881
movq %rax, %rbx
movq -0xd8(%rbp), %rdi
cmpq %r15, %rdi
je 0x988b
callq 0x3240
movq %rbx, %rdi
callq 0x3440
nop