// File: /workspace/github_cpp_makefile_star2_O2/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 $0x158, %rsp            # imm = 0x158
movq %rdx, %r14
movq %rsi, %r13
movq %rdi, %rbx
callq 0x38f2
callq 0x4aac
movq %rbx, %rdi
movq %rax, %rsi
callq 0x8c32
andq $0x0, 0x18(%rbx)
callq 0x3970
movq %rax, 0x20(%rbx)
pushq $0x38
popq %rdi
callq 0x32d0
movq %rax, %r15
movq %rax, %rdi
callq 0x4af4
movq %r15, 0x38(%rbx)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x8c32
movb $0x0, 0x60(%rbx)
callq 0x30d0
pushq $0x14
popq %rcx
cltd
idivl %ecx
movl %edx, %r12d
movl $0x80, %edi
callq 0x32d0
movq %rax, %r15
leaq -0x178(%rbp), %rdi
movq %r13, %rsi
callq 0x3360
movb $0x1, %r13b
leaq 0x747a(%rip), %rsi      # 0xb090
leaq -0x138(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x3120
movb $0x1, %r13b
leaq -0x158(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0x79ee
leaq -0x178(%rbp), %rsi
leaq -0x158(%rbp), %rdx
pushq $0x1f
popq %rcx
movq %r15, %rdi
callq 0x4b3a
movq %r15, 0x40(%rbx)
xorl %r13d, %r13d
leaq -0x158(%rbp), %rdi
callq 0x3340
xorl %r13d, %r13d
leaq -0x138(%rbp), %rdi
callq 0x3340
addl $0x5, %r12d
leaq -0x178(%rbp), %rdi
callq 0x3340
movq 0x38(%rbx), %rdi
movq 0x40(%rbx), %r15
movl %r12d, %esi
callq 0x7410
movl %eax, %r13d
movq 0x40(%rbx), %rdi
callq 0x8d2e
shrq $0x20, %rax
subl %eax, %r13d
shlq $0x20, %r13
movl %r12d, %esi
orq %r13, %rsi
movq %r15, %rdi
callq 0x8d24
movq 0x40(%rbx), %rsi
movq %rbx, %rdi
callq 0x8c32
pushq $0x60
popq %rdi
callq 0x32d0
movq %rax, %r15
leaq 0x73bc(%rip), %rsi      # 0xb096
leaq -0x118(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x3120
movq %r14, -0x38(%rbp)
leaq -0x118(%rbp), %rsi
movq %r15, %rdi
callq 0x4be2
movabsq $-0x100000000, %r13     # imm = 0xFFFFFFFF00000000
movl $0xfffffffe, %r14d      # imm = 0xFFFFFFFE
leaq -0x118(%rbp), %rdi
callq 0x3340
movq 0x40(%rbx), %rdi
callq 0x8d1a
movq %rax, %r12
movq 0x40(%rbx), %rdi
callq 0x8d2e
andq %r13, %rax
leal (%r12,%r14), %esi
addq %rax, %r12
andq %r13, %r12
orq %r12, %rsi
movq %r15, %rdi
callq 0x8d24
pushq $0x25
popq %rsi
movq %r15, %rdi
callq 0x638e
movl $0xb, 0x8(%r15)
movq 0x38(%rbx), %rdi
movq %r15, %rsi
callq 0x8c32
callq 0x30d0
cltd
pushq $0x14
popq %rcx
idivl %ecx
movl %edx, %r12d
movl $0x80, %edi
callq 0x32d0
movq %rax, %r15
leaq -0xf8(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x3360
movb $0x1, %r14b
leaq 0x7305(%rip), %rsi      # 0xb09f
leaq -0xb8(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x3120
movb $0x1, %r14b
leaq -0xd8(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x79ee
leaq -0xf8(%rbp), %rsi
leaq -0xd8(%rbp), %rdx
pushq $0x22
popq %rcx
movq %r15, %rdi
callq 0x4b3a
movq %r15, 0x48(%rbx)
xorl %r14d, %r14d
leaq -0xd8(%rbp), %rdi
callq 0x3340
xorl %r14d, %r14d
leaq -0xb8(%rbp), %rdi
callq 0x3340
addl $0x5, %r12d
leaq -0xf8(%rbp), %rdi
callq 0x3340
movq 0x48(%rbx), %r14
movq %rbx, %rdi
callq 0x8d2e
movq %rax, %r15
subl %r12d, %r15d
movq 0x38(%rbx), %r13
movq %rbx, %rdi
callq 0x8d2e
subl %r12d, %eax
movq %r13, %rdi
movl %eax, %esi
callq 0x7410
movl %eax, %r12d
movq 0x48(%rbx), %rdi
callq 0x8d2e
shrq $0x20, %rax
subl %eax, %r12d
shlq $0x20, %r12
orq %r12, %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x8d24
movq 0x48(%rbx), %rsi
movq %rbx, %rdi
callq 0x8c32
pushq $0x60
popq %rdi
callq 0x32d0
movq %rax, %r14
leaq 0x721d(%rip), %rsi      # 0xb096
leaq -0x98(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x3120
leaq -0x98(%rbp), %rsi
movq %r14, %rdi
callq 0x4be2
movabsq $-0x100000000, %r12     # imm = 0xFFFFFFFF00000000
leaq -0x98(%rbp), %rdi
callq 0x3340
movq 0x48(%rbx), %rdi
callq 0x8d1a
movq %rax, %r15
movq 0x48(%rbx), %rdi
callq 0x8d2e
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 0x8d24
pushq $0x25
popq %rsi
movq %r14, %rdi
callq 0x638e
movl $0xb, 0x8(%r14)
movq 0x38(%rbx), %rdi
movq %r14, %rsi
callq 0x8c32
pushq $0x60
popq %rdi
callq 0x32d0
movq %rax, %r14
leaq 0x7192(%rip), %rsi      # 0xb0a5
leaq -0x58(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x3120
movb $0x1, %r15b
leaq -0x78(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x79ee
leaq -0x78(%rbp), %rsi
movq %r14, %rdi
callq 0x4be2
movq %r14, 0x58(%rbx)
xorl %r15d, %r15d
leaq -0x78(%rbp), %rdi
callq 0x3340
leaq -0x58(%rbp), %rdi
callq 0x3340
movq 0x58(%rbx), %r14
movq %rbx, %rdi
callq 0x8d2e
pushq $0x2
popq %rcx
cltd
idivl %ecx
movl %eax, %r15d
movq 0x58(%rbx), %rdi
callq 0x8d2e
pushq $-0x8
popq %rcx
cltd
idivl %ecx
addl %eax, %r15d
movabsq $0x300000000, %rsi      # imm = 0x300000000
orq %r15, %rsi
movq %r14, %rdi
callq 0x8d24
movq 0x58(%rbx), %rdi
xorl %esi, %esi
callq 0x638e
movq 0x58(%rbx), %rdi
pushq $0x23
popq %rsi
callq 0x637a
movl $0x88, %edi
callq 0x32d0
movq %rax, %r14
movq 0x40(%rbx), %rdi
callq 0x8d1a
movq 0x38(%rbx), %rdx
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
movq %r14, %rdi
movq %rax, %rsi
callq 0x4c92
movq %r14, 0x50(%rbx)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x8c32
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x3340
movb $0x1, %r15b
jmp 0x4077
jmp 0x4061
movq %rax, %rbx
leaq -0x98(%rbp), %rdi
callq 0x3340
jmp 0x4064
jmp 0x4061
movq %rax, %rbx
leaq -0xd8(%rbp), %rdi
callq 0x3340
movb $0x1, %r14b
jmp 0x408f
jmp 0x4059
movq %rax, %rbx
leaq -0x118(%rbp), %rdi
callq 0x3340
jmp 0x405c
jmp 0x4059
movq %rax, %rbx
leaq -0x158(%rbp), %rdi
callq 0x3340
movb $0x1, %r13b
jmp 0x40b6
jmp 0x4059
movq %rax, %rbx
movq %r15, %rdi
jmp 0x4067
movq %rax, %rbx
movq %r14, %rdi
callq 0x32a0
movq %rbx, %rdi
callq 0x3450
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x3340
testb %r15b, %r15b
jne 0x4064
jmp 0x406c
movq %rax, %rbx
jmp 0x409b
movq %rax, %rbx
leaq -0xb8(%rbp), %rdi
callq 0x3340
leaq -0xf8(%rbp), %rdi
callq 0x3340
testb %r14b, %r14b
jne 0x405c
jmp 0x406c
movq %rax, %rbx
jmp 0x40c2
movq %rax, %rbx
leaq -0x138(%rbp), %rdi
callq 0x3340
leaq -0x178(%rbp), %rdi
callq 0x3340
testb %r13b, %r13b
je 0x406c
jmp 0x405c
movq %rax, %rdi
callq 0x3aae
nop