// File: /workspace/github_cpp_makefile_star2_O3/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 0x908f
movl %esi, %r15d
movq %rdi, %r14
movq 0x80(%rdi), %rdi
callq 0x7f60
xorps %xmm1, %xmm1
addss %xmm0, %xmm1
mulss 0x34bf(%rip), %xmm1     # 0xc268
addss 0x60(%r14), %xmm1
movss 0x64(%r14), %xmm0
addss 0x34af(%rip), %xmm0     # 0xc26c
movaps %xmm1, %xmm2
unpcklps %xmm0, %xmm2            # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
movlps %xmm2, 0x60(%r14)
xorps %xmm2, %xmm2
cvtsi2ssl 0x18(%r14), %xmm2
addss %xmm1, %xmm2
cvttss2si %xmm2, %eax
xorps %xmm1, %xmm1
cvtsi2ssl 0x1c(%r14), %xmm1
addss %xmm0, %xmm1
cvttss2si %xmm1, %ebx
movq %rbx, %rcx
shlq $0x20, %rcx
orq %rcx, %rax
movq %rax, 0x18(%r14)
movq 0x80(%r14), %rdi
callq 0x9a66
shrq $0x20, %rax
cmpl %eax, %ebx
movl %r15d, -0x54(%rbp)
jge 0x8f1d
movl 0x18(%r14), %ebx
movq 0x80(%r14), %rdi
callq 0x9a66
cmpl %eax, %ebx
jge 0x8f1d
cmpl $0x0, 0x18(%r14)
jle 0x8f1d
cmpl $0x0, 0x1c(%r14)
jle 0x90a1
movss 0x60(%r14), %xmm0
ucomiss 0x3421(%rip), %xmm0     # 0xc270
jbe 0x90ca
movss 0x64(%r14), %xmm0
ucomiss 0x340e(%rip), %xmm0     # 0xc270
jbe 0x91a3
callq 0x4d8a
movq %rax, %rbx
leaq -0x2c8(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x3418(%rip), %rsi      # 0xc29b
leaq 0x341a(%rip), %rdx      # 0xc2a4
leaq -0x2d8(%rbp), %r15
movq %r15, %rdi
callq 0x574e
movss 0x33eb(%rip), %xmm0     # 0xc28c
movq %rbx, %rdi
movq %r15, %rsi
callq 0x9ca8
movq -0x2d8(%rbp), %rdi
cmpq %r12, %rdi
je 0x8ebd
callq 0x3230
leaq -0x1a8(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x33d6(%rip), %rsi      # 0xc2a5
leaq 0x33da(%rip), %rdx      # 0xc2b0
leaq -0x1b8(%rbp), %rdi
callq 0x574e
leaq -0x50(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0x84ba
leaq 0x38(%r14), %rdi
leaq -0x50(%rbp), %rsi
callq 0x3140
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8f11
callq 0x3230
movq -0x1b8(%rbp), %rdi
jmp 0x9540
movb $0x1, 0x30(%r14)
callq 0x4d8a
movq %rax, %rbx
leaq -0xc8(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x33a9(%rip), %rsi      # 0xc2e5
leaq 0x33af(%rip), %rdx      # 0xc2f2
leaq -0xd8(%rbp), %rdi
callq 0x574e
movq %r14, %rdi
callq 0x9a52
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
leaq -0xd8(%rbp), %rsi
movq %rbx, %rdi
callq 0x9ca8
movq -0xd8(%rbp), %rdi
cmpq %r15, %rdi
je 0x8f7e
callq 0x3230
callq 0x4d8a
movq %rax, %rbx
leaq -0xa8(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x335b(%rip), %rsi      # 0xc2f3
leaq 0x3361(%rip), %rdx      # 0xc300
leaq -0xb8(%rbp), %rdi
callq 0x574e
movq %r14, %rdi
callq 0x9a52
shrq $0x20, %rax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
leaq -0xb8(%rbp), %rsi
movq %rbx, %rdi
callq 0x9ca8
movq -0xb8(%rbp), %rdi
cmpq %r15, %rdi
je 0x8fde
callq 0x3230
callq 0x4d8a
movq %rax, %rbx
leaq -0x1e8(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x3308(%rip), %rsi      # 0xc301
leaq 0x330e(%rip), %rdx      # 0xc30e
leaq -0x1f8(%rbp), %r15
movq %r15, %rdi
callq 0x574e
movss 0x60(%r14), %xmm0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x9ca8
movq -0x1f8(%rbp), %rdi
cmpq %r12, %rdi
je 0x9031
callq 0x3230
callq 0x4d8a
movq %rax, %rbx
leaq -0x1c8(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x32c3(%rip), %rsi      # 0xc30f
leaq 0x32c9(%rip), %rdx      # 0xc31c
leaq -0x1d8(%rbp), %r15
movq %r15, %rdi
callq 0x574e
movss 0x64(%r14), %xmm0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x9ca8
movq -0x1d8(%rbp), %rdi
cmpq %r12, %rdi
je 0x9084
callq 0x3230
movq %r14, %rdi
movl -0x54(%rbp), %esi
callq 0x6940
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 0x31e1(%rip), %rcx      # 0xc299
movl $0x1, %r8d
xorl %esi, %esi
callq 0x3380
jmp 0x8f22
movss 0x31a2(%rip), %xmm1     # 0xc274
ucomiss %xmm0, %xmm1
jbe 0x926f
movss 0x64(%r14), %xmm0
ucomiss 0x3188(%rip), %xmm0     # 0xc270
jbe 0x931f
callq 0x4d8a
movq %rax, %rbx
leaq -0x268(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x3192(%rip), %rsi      # 0xc29b
leaq 0x3194(%rip), %rdx      # 0xc2a4
leaq -0x278(%rbp), %r15
movq %r15, %rdi
callq 0x574e
movss 0x3159(%rip), %xmm0     # 0xc280
movq %rbx, %rdi
movq %r15, %rsi
callq 0x9ca8
movq -0x278(%rbp), %rdi
cmpq %r12, %rdi
je 0x9143
callq 0x3230
leaq -0x148(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x315c(%rip), %rsi      # 0xc2b1
leaq 0x315e(%rip), %rdx      # 0xc2ba
leaq -0x158(%rbp), %rdi
callq 0x574e
leaq -0x50(%rbp), %rdi
leaq -0x158(%rbp), %rsi
callq 0x84ba
leaq 0x38(%r14), %rdi
leaq -0x50(%rbp), %rsi
callq 0x3140
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9197
callq 0x3230
movq -0x158(%rbp), %rdi
jmp 0x9540
movss %xmm0, -0x2c(%rbp)
callq 0x4d8a
movq %rax, %rbx
movss 0x30bc(%rip), %xmm0     # 0xc274
ucomiss -0x2c(%rbp), %xmm0
jbe 0x93eb
leaq -0x2a8(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x30c6(%rip), %rsi      # 0xc29b
leaq 0x30c8(%rip), %rdx      # 0xc2a4
leaq -0x2b8(%rbp), %r15
movq %r15, %rdi
callq 0x574e
movss 0x3095(%rip), %xmm0     # 0xc288
movq %rbx, %rdi
movq %r15, %rsi
callq 0x9ca8
movq -0x2b8(%rbp), %rdi
cmpq %r12, %rdi
je 0x920f
callq 0x3230
leaq -0x188(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x3090(%rip), %rsi      # 0xc2b1
leaq 0x3092(%rip), %rdx      # 0xc2ba
leaq -0x198(%rbp), %rdi
callq 0x574e
leaq -0x50(%rbp), %rdi
leaq -0x198(%rbp), %rsi
callq 0x84ba
leaq 0x38(%r14), %rdi
leaq -0x50(%rbp), %rsi
callq 0x3140
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9263
callq 0x3230
movq -0x198(%rbp), %rdi
jmp 0x9540
callq 0x4d8a
movq %rax, %rbx
leaq -0x208(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x3011(%rip), %rsi      # 0xc29b
leaq 0x3013(%rip), %rdx      # 0xc2a4
leaq -0x218(%rbp), %r15
movq %r15, %rdi
callq 0x574e
xorps %xmm0, %xmm0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x9ca8
movq -0x218(%rbp), %rdi
cmpq %r12, %rdi
je 0x92bf
callq 0x3230
leaq -0xe8(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x2ff6(%rip), %rsi      # 0xc2c7
leaq 0x2ffa(%rip), %rdx      # 0xc2d2
leaq -0xf8(%rbp), %rdi
callq 0x574e
leaq -0x50(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x84ba
leaq 0x38(%r14), %rdi
leaq -0x50(%rbp), %rsi
callq 0x3140
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9313
callq 0x3230
movq -0xf8(%rbp), %rdi
jmp 0x9540
movss %xmm0, -0x2c(%rbp)
callq 0x4d8a
movq %rax, %rbx
movss 0x2f40(%rip), %xmm0     # 0xc274
ucomiss -0x2c(%rbp), %xmm0
jbe 0x9498
leaq -0x248(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x2f4a(%rip), %rsi      # 0xc29b
leaq 0x2f4c(%rip), %rdx      # 0xc2a4
leaq -0x258(%rbp), %r15
movq %r15, %rdi
callq 0x574e
movss 0x2f0d(%rip), %xmm0     # 0xc27c
movq %rbx, %rdi
movq %r15, %rsi
callq 0x9ca8
movq -0x258(%rbp), %rdi
cmpq %r12, %rdi
je 0x938b
callq 0x3230
leaq -0x128(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x2f08(%rip), %rsi      # 0xc2a5
leaq 0x2f0c(%rip), %rdx      # 0xc2b0
leaq -0x138(%rbp), %rdi
callq 0x574e
leaq -0x50(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0x84ba
leaq 0x38(%r14), %rdi
leaq -0x50(%rbp), %rsi
callq 0x3140
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x93df
callq 0x3230
movq -0x138(%rbp), %rdi
jmp 0x9540
leaq -0x288(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x2e9d(%rip), %rsi      # 0xc29b
leaq 0x2e9f(%rip), %rdx      # 0xc2a4
leaq -0x298(%rbp), %r15
movq %r15, %rdi
callq 0x574e
movss 0x2e68(%rip), %xmm0     # 0xc284
movq %rbx, %rdi
movq %r15, %rsi
callq 0x9ca8
movq -0x298(%rbp), %rdi
cmpq %r12, %rdi
je 0x9438
callq 0x3230
leaq -0x168(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x2e71(%rip), %rsi      # 0xc2bb
leaq 0x2e75(%rip), %rdx      # 0xc2c6
leaq -0x178(%rbp), %rdi
callq 0x574e
leaq -0x50(%rbp), %rdi
leaq -0x178(%rbp), %rsi
callq 0x84ba
leaq 0x38(%r14), %rdi
leaq -0x50(%rbp), %rsi
callq 0x3140
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x948c
callq 0x3230
movq -0x178(%rbp), %rdi
jmp 0x9540
leaq -0x228(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x2df0(%rip), %rsi      # 0xc29b
leaq 0x2df2(%rip), %rdx      # 0xc2a4
leaq -0x238(%rbp), %r15
movq %r15, %rdi
callq 0x574e
movss 0x2daf(%rip), %xmm0     # 0xc278
movq %rbx, %rdi
movq %r15, %rsi
callq 0x9ca8
movq -0x238(%rbp), %rdi
cmpq %r12, %rdi
je 0x94e5
callq 0x3230
leaq -0x108(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x2dc4(%rip), %rsi      # 0xc2bb
leaq 0x2dc8(%rip), %rdx      # 0xc2c6
leaq -0x118(%rbp), %rdi
callq 0x574e
leaq -0x50(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0x84ba
leaq 0x38(%r14), %rdi
leaq -0x50(%rbp), %rsi
callq 0x3140
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9539
callq 0x3230
movq -0x118(%rbp), %rdi
cmpq %r15, %rdi
je 0x954a
callq 0x3230
movq 0x80(%r14), %rdi
callq 0x98f4
cmpq $0x0, 0x8(%rax)
je 0x8f22
xorl %r13d, %r13d
movl 0x18(%r14), %esi
movl 0x1c(%r14), %ebx
movq 0x80(%r14), %rdi
callq 0x7ce2
cmpl %eax, %ebx
jl 0x9694
movq 0x80(%r14), %rdi
movl 0x18(%r14), %esi
callq 0x7ce2
movl %eax, 0x1c(%r14)
movq 0x80(%r14), %rbx
movl 0x18(%r14), %r15d
movq %rbx, %rdi
movl %r15d, %esi
callq 0x7ce2
shlq $0x20, %rax
orq %rax, %r15
movq %rbx, %rdi
movq %r15, %rsi
movl $0xa, %edx
callq 0x7d60
testb %al, %al
je 0x9694
callq 0x4d8a
movq %rax, %rbx
leaq -0x88(%rbp), %rax
movq %rax, -0x98(%rbp)
leaq -0x98(%rbp), %r15
movq %r15, %rdi
leaq 0x2ce3(%rip), %rsi      # 0xc2d3
leaq 0x2ce4(%rip), %rdx      # 0xc2db
callq 0x574e
movq %r14, %r12
xorps %xmm0, %xmm0
cvtsi2ssl 0x18(%r14), %xmm0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x9ca8
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
leaq -0x78(%rbp), %r14
je 0x962f
callq 0x3230
callq 0x4d8a
movq %rax, %rbx
leaq -0x68(%rbp), %rax
movq %rax, -0x78(%rbp)
movq %r14, %rdi
leaq 0x2c93(%rip), %rsi      # 0xc2dc
leaq 0x2c94(%rip), %rdx      # 0xc2e4
callq 0x574e
movq 0x80(%r12), %rdi
movl 0x18(%r12), %esi
callq 0x7ce2
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9ca8
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x968b
callq 0x3230
movb $0x1, 0x30(%r12)
movq %r12, %r14
incq %r13
movq 0x80(%r14), %rdi
callq 0x98f4
cmpq 0x8(%rax), %r13
jb 0x9564
jmp 0x8f22
movq %rax, %rbx
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x96e3
callq 0x3230
jmp 0x96e3
movq %rax, %rbx
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x96f2
callq 0x3230
jmp 0x96f2
movq %rax, %rbx
movq -0x118(%rbp), %rdi
jmp 0x988b
movq %rax, %rbx
movq -0x138(%rbp), %rdi
jmp 0x988b
jmp 0x9816
jmp 0x9816
movq %rax, %rbx
movq -0x238(%rbp), %rdi
jmp 0x985c
movq %rax, %rbx
movq -0x258(%rbp), %rdi
jmp 0x985c
movq %rax, %rbx
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x976e
callq 0x3230
jmp 0x976e
movq %rax, %rbx
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x977d
callq 0x3230
jmp 0x977d
movq %rax, %rbx
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x978c
callq 0x3230
jmp 0x978c
movq %rax, %rbx
movq -0x178(%rbp), %rdi
jmp 0x988b
movq %rax, %rbx
movq -0x198(%rbp), %rdi
jmp 0x988b
movq %rax, %rbx
movq -0x158(%rbp), %rdi
jmp 0x988b
jmp 0x9816
jmp 0x9816
jmp 0x9816
movq %rax, %rbx
movq -0x298(%rbp), %rdi
jmp 0x985c
movq %rax, %rbx
movq -0x2b8(%rbp), %rdi
jmp 0x985c
movq %rax, %rbx
movq -0x278(%rbp), %rdi
jmp 0x985c
movq %rax, %rbx
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x97fc
callq 0x3230
jmp 0x97fc
movq %rax, %rbx
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x980b
callq 0x3230
jmp 0x980b
movq %rax, %rbx
movq -0xf8(%rbp), %rdi
jmp 0x988b
movq %rax, %rbx
movq -0x1b8(%rbp), %rdi
jmp 0x988b
jmp 0x9816
movq %rax, %rbx
jmp 0x9895
movq %rax, %rbx
movq -0x218(%rbp), %rdi
jmp 0x985c
movq %rax, %rbx
movq -0x2d8(%rbp), %rdi
jmp 0x985c
movq %rax, %rbx
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
jmp 0x986e
movq %rax, %rbx
movq -0x1d8(%rbp), %rdi
jmp 0x985c
movq %rax, %rbx
movq -0x1f8(%rbp), %rdi
cmpq %r12, %rdi
jne 0x9890
jmp 0x9895
movq %rax, %rbx
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
jne 0x9890
jmp 0x9895
movq %rax, %rbx
movq -0xb8(%rbp), %rdi
jmp 0x988b
movq %rax, %rbx
movq -0xd8(%rbp), %rdi
cmpq %r15, %rdi
je 0x9895
callq 0x3230
movq %rbx, %rdi
callq 0x3430
nop