// File: /workspace/github_cpp_makefile_star2_O3/Jacobious52[P]Tanks/GameView.cpp
// Function: GameView::_init(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void GameView::_init(std::string name1, std::string name2)
{
    ConsoleTools::clear_screen();

    add_child(DebugView::shared_view());

    _position = Point<int>::zero();
    _size = ConsoleTools::get_terminal_size();

    // create tebrrain
    _terrain = new Terrain();
    add_child(_terrain);

    turn = false;

    // create tank 1
    int spawn_x = (rand() % 20) + 5;
    _tank1 = new Tank(name1, TextureTools::get_texture("tank1"), ConsoleTools::red);
    _tank1->set_position(Point<int>(spawn_x, _terrain->get_floor(spawn_x) - _tank1->get_size().y));
    add_child(_tank1);

    // create base for tank 1
    Sprite *base1 = new Sprite("        ");
    base1->set_position(_tank1->get_position() + Point<int>(-2, _tank1->get_size().y));
    base1->set_bcolor(ConsoleTools::white);
    base1->tag = TERRAIN_ROCK;
    _terrain->add_child(base1);

    // create tank 2
    spawn_x = (rand() % 20) + 5;
    _tank2 = new Tank(name2, TextureTools::get_texture("tank2"), ConsoleTools::blue);
    _tank2->set_position(Point<int>(get_size().x - spawn_x, _terrain->get_floor(get_size().x - spawn_x) - _tank2->get_size().y));
    add_child(_tank2);

    // create base for tank 2
    Sprite *base2 = new Sprite("        ");
    base2->set_position(_tank2->get_position() + Point<int>(-1, _tank2->get_size().y));
    base2->set_bcolor(ConsoleTools::white);
    base2->tag = TERRAIN_ROCK;
    _terrain->add_child(base2);

    // create box for input
    _input_box = new Sprite(TextureTools::get_texture("input"));
    _input_box->set_position(Point<int>(get_size().x/2 - _input_box->get_size().x/8, 3));
    _input_box->set_bcolor(ConsoleTools::endc);
    _input_box->set_fcolor(ConsoleTools::magneta);

    // create bullet, don't fire
    _bullet = new Bullet(_tank1->get_position(), 0, 0, _terrain);
    add_child(_bullet);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movq %rdx, %r14
movq %rsi, %r13
movq %rdi, %rbx
callq 0x38c6
callq 0x4d8a
movq %rbx, %rdi
movq %rax, %rsi
callq 0x98fe
movq $0x0, 0x18(%rbx)
callq 0x394e
movq %rax, 0x20(%rbx)
movl $0x38, %edi
callq 0x3260
movq %rax, %r15
movq %rax, %rdi
callq 0x4dd4
movq %r15, 0x38(%rbx)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x98fe
movb $0x0, 0x60(%rbx)
callq 0x30d0
movl %eax, %r12d
movl $0x80, %edi
callq 0x3260
movq %rax, %r15
leaq -0x60(%rbp), %rax
movq %rax, -0x10(%rax)
movq (%r13), %rsi
movq 0x8(%r13), %rdx
addq %rsi, %rdx
leaq -0x70(%rbp), %rdi
callq 0x3b60
leaq -0x100(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0x8412(%rip), %rsi      # 0xc0c0
leaq 0x8410(%rip), %rdx      # 0xc0c5
leaq -0x110(%rbp), %rdi
callq 0x574e
leaq -0x170(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x84ba
movq %r14, -0x30(%rbp)
leaq -0x70(%rbp), %rsi
leaq -0x170(%rbp), %rdx
movq %r15, %rdi
movl $0x1f, %ecx
callq 0x4e1a
movslq %r12d, %rax
imulq $0x66666667, %rax, %rax # imm = 0x66666667
movq %rax, %rcx
shrq $0x3f, %rcx
sarq $0x23, %rax
addl %ecx, %eax
shll $0x2, %eax
leal (%rax,%rax,4), %r14d
negl %r14d
movq %r15, 0x40(%rbx)
leaq -0x160(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3d2a
callq 0x3230
movq -0x110(%rbp), %rdi
cmpq %r13, %rdi
je 0x3d3b
callq 0x3230
leal (%r12,%r14), %r15d
addl $0x5, %r15d
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x3d55
callq 0x3230
movq 0x38(%rbx), %rdi
movq 0x40(%rbx), %r12
movl %r15d, %esi
callq 0x7ce2
movl %eax, %r13d
movq 0x40(%rbx), %rdi
callq 0x9a66
shrq $0x20, %rax
subl %eax, %r13d
shlq $0x20, %r13
movl %r15d, %esi
orq %r13, %rsi
movq %r12, %rdi
callq 0x9a5c
movq 0x40(%rbx), %rsi
movq %rbx, %rdi
callq 0x98fe
movl $0x60, %edi
callq 0x3260
movq %rax, %r15
leaq -0xe0(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x8310(%rip), %rsi      # 0xc0c6
leaq 0x8311(%rip), %rdx      # 0xc0ce
leaq -0xf0(%rbp), %rdi
callq 0x574e
movq -0x30(%rbp), %r14
leaq -0xf0(%rbp), %rsi
movq %r15, %rdi
callq 0x4ef4
movq -0xf0(%rbp), %rdi
cmpq %r12, %rdi
je 0x3ded
callq 0x3230
movabsq $-0x100000000, %r13     # imm = 0xFFFFFFFF00000000
movq 0x40(%rbx), %rdi
callq 0x9a52
movq %rax, %r12
movq 0x40(%rbx), %rdi
callq 0x9a66
andq %r13, %rax
movl $0xfffffffe, %edx       # imm = 0xFFFFFFFE
leal (%r12,%rdx), %esi
addq %rax, %r12
andq %r13, %r12
orq %r12, %rsi
movq %r15, %rdi
callq 0x9a5c
movq %r15, %rdi
movl $0x25, %esi
callq 0x68fa
movl $0xb, 0x8(%r15)
movq 0x38(%rbx), %rdi
movq %r15, %rsi
callq 0x98fe
callq 0x30d0
movl %eax, %r12d
movl $0x80, %edi
callq 0x3260
movq %rax, %r15
leaq -0xc0(%rbp), %r13
movq %r13, -0x10(%r13)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq -0xd0(%rbp), %rdi
callq 0x3b60
leaq -0x40(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x8240(%rip), %rsi      # 0xc0cf
leaq 0x823e(%rip), %rdx      # 0xc0d4
leaq -0x50(%rbp), %rdi
callq 0x574e
leaq -0x150(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x84ba
movq %r13, %r14
leaq -0xd0(%rbp), %rsi
leaq -0x150(%rbp), %rdx
movq %r15, %rdi
movl $0x22, %ecx
callq 0x4e1a
movslq %r12d, %rax
imulq $0x66666667, %rax, %rax # imm = 0x66666667
movq %rax, %rcx
shrq $0x3f, %rcx
sarq $0x23, %rax
addl %ecx, %eax
shll $0x2, %eax
leal (%rax,%rax,4), %r13d
negl %r13d
movq %r15, 0x48(%rbx)
leaq -0x140(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3f07
callq 0x3230
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x3f19
callq 0x3230
addl %r12d, %r13d
addl $0x5, %r13d
movq -0xd0(%rbp), %rdi
cmpq %r14, %rdi
je 0x3f31
callq 0x3230
movq 0x48(%rbx), %r14
movq %rbx, %rdi
callq 0x9a66
movq %rax, %r15
subl %r13d, %r15d
movq 0x38(%rbx), %r12
movq %rbx, %rdi
callq 0x9a66
subl %r13d, %eax
movq %r12, %rdi
movl %eax, %esi
callq 0x7ce2
movl %eax, %r12d
movq 0x48(%rbx), %rdi
callq 0x9a66
shrq $0x20, %rax
subl %eax, %r12d
shlq $0x20, %r12
orq %r12, %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x9a5c
movq 0x48(%rbx), %rsi
movq %rbx, %rdi
callq 0x98fe
movl $0x60, %edi
callq 0x3260
movq %rax, %r14
leaq -0xa0(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x811a(%rip), %rsi      # 0xc0c6
leaq 0x811b(%rip), %rdx      # 0xc0ce
leaq -0xb0(%rbp), %rdi
callq 0x574e
leaq -0xb0(%rbp), %rsi
movq %r14, %rdi
callq 0x4ef4
movabsq $-0x100000000, %r12     # imm = 0xFFFFFFFF00000000
movq -0xb0(%rbp), %rdi
cmpq %r15, %rdi
je 0x3fe9
callq 0x3230
movq 0x48(%rbx), %rdi
callq 0x9a52
movq %rax, %r15
movq 0x48(%rbx), %rdi
callq 0x9a66
andq %r12, %rax
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
leal (%rcx,%r15), %esi
incl %esi
addq %rax, %r15
andq %r12, %r15
orq %r15, %rsi
movq %r14, %rdi
callq 0x9a5c
movq %r14, %rdi
movl $0x25, %esi
callq 0x68fa
movl $0xb, 0x8(%r14)
movq 0x38(%rbx), %rdi
movq %r14, %rsi
callq 0x98fe
movl $0x60, %edi
callq 0x3260
movq %rax, %r14
leaq -0x80(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x807b(%rip), %rsi      # 0xc0d5
leaq 0x8079(%rip), %rdx      # 0xc0da
leaq -0x90(%rbp), %rdi
callq 0x574e
leaq -0x130(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x84ba
leaq -0x130(%rbp), %rsi
movq %r14, %rdi
callq 0x4ef4
movq %r14, 0x58(%rbx)
leaq -0x120(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x40a8
callq 0x3230
movq -0x90(%rbp), %rdi
cmpq %r15, %rdi
je 0x40b9
callq 0x3230
movq 0x58(%rbx), %r14
movq %rbx, %rdi
callq 0x9a66
movl %eax, %r15d
shrl $0x1f, %r15d
addl %eax, %r15d
sarl %r15d
movq 0x58(%rbx), %rdi
callq 0x9a66
leal 0x7(%rax), %ecx
testl %eax, %eax
cmovnsl %eax, %ecx
sarl $0x3, %ecx
subl %ecx, %r15d
movabsq $0x300000000, %rsi      # imm = 0x300000000
orq %r15, %rsi
movq %r14, %rdi
callq 0x9a5c
movq 0x58(%rbx), %rdi
xorl %esi, %esi
callq 0x68fa
movq 0x58(%rbx), %rdi
movl $0x23, %esi
callq 0x68e6
movl $0x88, %edi
callq 0x3260
movq %rax, %r14
movq 0x40(%rbx), %rdi
callq 0x9a52
movq 0x38(%rbx), %rdx
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
movq %r14, %rdi
movq %rax, %rsi
callq 0x4fce
movq %r14, 0x50(%rbx)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x98fe
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x120(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4180
callq 0x3230
jmp 0x4180
movq %rax, %rbx
movq -0x90(%rbp), %rdi
jmp 0x4198
jmp 0x425e
movq %rax, %rbx
movq -0xb0(%rbp), %rdi
cmpq %r15, %rdi
je 0x4261
callq 0x3230
jmp 0x4261
jmp 0x425e
movq %rax, %rbx
leaq -0x140(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x41d0
callq 0x3230
jmp 0x41d0
movq %r13, %r14
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x41ea
callq 0x3230
jmp 0x41ea
movq %r13, %r14
movq %rax, %rbx
movq -0xd0(%rbp), %rdi
cmpq %r14, %rdi
jne 0x424d
jmp 0x4259
jmp 0x4256
movq %rax, %rbx
movq -0xf0(%rbp), %rdi
cmpq %r12, %rdi
jne 0x424d
jmp 0x4259
jmp 0x4256
movq %rax, %rbx
leaq -0x160(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x422a
callq 0x3230
jmp 0x422a
movq %rax, %rbx
movq -0x110(%rbp), %rdi
cmpq %r13, %rdi
je 0x4240
callq 0x3230
jmp 0x4240
movq %rax, %rbx
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x4259
callq 0x3230
jmp 0x4259
jmp 0x4256
movq %rax, %rbx
movq %r15, %rdi
jmp 0x4264
movq %rax, %rbx
movq %r14, %rdi
callq 0x3230
movq %rbx, %rdi
callq 0x3430
nop