// File: /workspace/github_cpp_makefile_star2_O1/rozpo[P]enemy/Loop.cpp
// Function: Loop::mainLoop()
void Loop::mainLoop()
{
    std::shared_ptr<Data>       data        = std::make_shared <Data>();
    std::shared_ptr<Menu>       menu        = std::make_shared <Menu>();
    std::shared_ptr<Create>     create      = std::make_shared <Create>();
    std::shared_ptr<Select>     select      = std::make_shared <Select>();
    std::shared_ptr<Stats>      stats       = std::make_shared <Stats>();
    std::shared_ptr<Shop>       shop        = std::make_shared <Shop>();
    std::shared_ptr<Training>   training    = std::make_shared <Training>();
    std::shared_ptr<Item>       items       = std::make_shared <Item>();
    Skill::createSkills (data->skills);
    do
    {
        status = e_loop_cancel;

        menu->print();
        status = menu->choice();

        switch(status)
        {
            case e_loop_create:
            {
                create->print();
                set = create->choice();
                create->createPlayer(data->players,set);
                data->activeplayer = data->players.size ()-1;
            }
                break;

            case e_loop_select:
            {
                if(data->players.empty() == 0)
                {
                    select->print(data->players);
                    set = select->choice();
                    if(set !=0 && set < data->players.size ())
                        data->activeplayer = select->selectPlayer(set);
                }


            }
                break;

            case e_loop_stats:
            {
                if(data->players.empty() == 0)
                {
                    stats->print(data->players[data->activeplayer]);
                    stats->printMoves (data->players[data->activeplayer],data->skills);
                }
            }
                break;

            case e_loop_battle:
            {
                if(data->players.empty() == 0)
                {
                    data->enemies = Battle::createEnemy(data->enemies);
                    Battle::doBattle(data->players[data->activeplayer],
                                     data->enemies[data->enemies.size()-1],
                                     data->skills);
                }
            }
                break;

            case e_loop_shop:
            {
                if(data->players.empty() == 0)
                {
                    shop->openShop(data->players[data->activeplayer]);
                }
            }
                break;

            case e_loop_training:
            {
                if(data->players.empty() == 0)
                {
                    training->openTraining(data->players[data->activeplayer]);
                }
            }
                break;

            case e_loop_skills:
            {
                if(data->players.empty() == 0)
                {
                    Skill::printSkills(data->skills);
                }
            }
                break;

            case e_loop_items:
            {
                if(data->players.empty() == 0)
                {
                    items->openItem(data->players[data->activeplayer]);
                }
            }
                break;

            default:
                return;
        }
    }while(status != e_loop_cancel);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rdi, %r15
movl $0x60, %edi
callq 0x3110
movq %rax, %rbx
movabsq $0x100000001, %r12      # imm = 0x100000001
movq %r12, 0x8(%rax)
leaq 0x8016(%rip), %rax      # 0x10ae8
movq %rax, (%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movups %xmm0, 0x20(%rbx)
movups %xmm0, 0x30(%rbx)
movups %xmm0, 0x40(%rbx)
movups %xmm0, 0x50(%rbx)
leaq 0x58(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x50(%rsp), %rsi
movq %rsp, %rdx
callq 0x91f6
leaq 0x38(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x30(%rsp), %rsi
movq %rsp, %rdx
callq 0x9558
leaq 0x28(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x20(%rsp), %rsi
movq %rsp, %rdx
callq 0x977c
movl $0x60, %edi
callq 0x3110
movq %rax, %r14
movq %r12, 0x8(%rax)
leaq 0x80d6(%rip), %rax      # 0x10c28
movq %rax, (%r14)
leaq 0x18(%r14), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%r14)
movups %xmm0, 0x30(%r14)
movups %xmm0, 0x40(%r14)
movups %xmm0, 0x50(%r14)
movups %xmm0, 0x10(%r14)
movq %rax, 0x28(%r14)
movq %rax, 0x30(%r14)
xorl %eax, %eax
movq %rax, 0x38(%r14)
leaq 0x50(%r14), %rcx
movq %rcx, 0x40(%r14)
movq %rax, 0x48(%r14)
movb $0x0, 0x50(%r14)
leaq 0x88(%rsp), %rdi
movq %rax, -0x8(%rdi)
leaq 0x80(%rsp), %rsi
movq %rsp, %rdx
callq 0x999e
leaq 0x78(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x70(%rsp), %rsi
movq %rsp, %rdx
callq 0x9c82
leaq 0x68(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x60(%rsp), %rsi
movq %rsp, %rdx
callq 0x9ed6
leaq 0x40(%rbx), %rsi
leaq 0xe0(%rsp), %rdi
movq %rsi, 0x18(%rsp)
callq 0x77a0
leaq 0x10(%rbx), %rax
movq %rax, 0x48(%rsp)
movq %r14, %rax
addq $0x10, %rax
movq %rax, 0x40(%rsp)
leaq 0xe0(%rsp), %rdi
callq 0x8ff4
movq %rbx, %rax
addq $0x28, %rax
movq %rax, 0xa8(%rsp)
leaq 0x2dee(%rip), %r13      # 0xba20
movl $0x0, 0x4(%r15)
movq 0x50(%rsp), %rdi
callq 0x7470
movq 0x50(%rsp), %rdi
callq 0x75ea
movl %eax, 0x4(%r15)
decl %eax
cmpl $0x7, %eax
ja 0x8ec3
movslq (%r13,%rax,4), %rax
addq %r13, %rax
jmpq *%rax
movq 0x30(%rsp), %rdi
callq 0x7470
movq 0x30(%rsp), %rdi
callq 0x75ea
movl %eax, (%r15)
movq 0x30(%rsp), %rsi
leaq 0xc8(%rsp), %rdi
movq 0x48(%rsp), %rdx
movq %r15, %rcx
callq 0x5ec4
leaq 0xc8(%rsp), %rdi
callq 0x903c
movq 0x18(%rbx), %rax
subq 0x10(%rbx), %rax
shrq $0x4, %rax
decl %eax
movl %eax, 0x58(%rbx)
jmp 0x8eb8
movq 0x10(%rbx), %rsi
cmpq 0x18(%rbx), %rsi
je 0x8eb8
movq 0x80(%rsp), %rdi
movslq 0x58(%rbx), %rax
shlq $0x4, %rax
addq %rax, %rsi
callq 0x6828
jmp 0x8eb8
movq 0x10(%rbx), %rsi
cmpq 0x18(%rbx), %rsi
je 0x8eb8
movslq 0x58(%rbx), %rax
shlq $0x4, %rax
addq %rax, %rsi
movq 0x40(%rsp), %rdi
callq 0x6f2c
movslq 0x58(%rbx), %rsi
shlq $0x4, %rsi
addq 0x10(%rbx), %rsi
movq 0x40(%rsp), %rdi
movq 0x18(%rsp), %rdx
callq 0x72a2
jmp 0x8eb8
movq 0x10(%rbx), %rax
cmpq 0x18(%rbx), %rax
je 0x8eb8
leaq 0xb0(%rsp), %rbp
movq %rbp, %rdi
movq 0xa8(%rsp), %rsi
callq 0x9084
leaq 0x90(%rsp), %r12
movq %r12, %rdi
movq %rbp, %rsi
callq 0x5574
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movq 0x28(%rbx), %rax
movups 0x30(%rbx), %xmm0
movq 0x90(%rsp), %rcx
movq %rcx, 0x28(%rbx)
movq 0x98(%rsp), %rcx
movq %rcx, 0x30(%rbx)
movq 0xa0(%rsp), %rcx
movq %rcx, 0x38(%rbx)
movq (%rsp), %rcx
movq 0x8(%rsp), %rdx
movq 0x10(%rsp), %rsi
movq %rax, (%rsp)
movups %xmm0, 0x8(%rsp)
movq %rcx, 0x90(%rsp)
movq %rdx, 0x98(%rsp)
movq %rsi, 0xa0(%rsp)
movq %rsp, %rdi
callq 0x9122
movq %r12, %rdi
callq 0x9122
movq %rbp, %rdi
callq 0x9122
movslq 0x58(%rbx), %rdi
shlq $0x4, %rdi
addq 0x10(%rbx), %rdi
movq 0x30(%rbx), %rsi
addq $-0x10, %rsi
movq 0x18(%rsp), %rdx
callq 0x50ce
jmp 0x8eb8
movq 0x10(%rbx), %rax
cmpq 0x18(%rbx), %rax
je 0x8eb8
movq 0x18(%rsp), %rdi
callq 0x7cda
jmp 0x8eb8
movq 0x10(%rbx), %rax
cmpq 0x18(%rbx), %rax
je 0x8eb8
movq 0x20(%rsp), %rdi
movq 0x48(%rsp), %rsi
callq 0x63fc
movq 0x20(%rsp), %rdi
callq 0x75ea
movl %eax, (%r15)
testl %eax, %eax
je 0x8eb8
movslq %eax, %rcx
movq 0x18(%rbx), %rdx
subq 0x10(%rbx), %rdx
sarq $0x4, %rdx
cmpq %rcx, %rdx
jbe 0x8eb8
movq 0x20(%rsp), %rdi
movl %eax, %esi
callq 0x6586
movl %eax, 0x58(%rbx)
jmp 0x8eb8
movq 0x10(%rbx), %rsi
cmpq 0x18(%rbx), %rsi
je 0x8eb8
movq 0x70(%rsp), %rdi
movslq 0x58(%rbx), %rax
shlq $0x4, %rax
addq %rax, %rsi
callq 0x7380
jmp 0x8eb8
movq 0x10(%rbx), %rsi
cmpq 0x18(%rbx), %rsi
je 0x8eb8
movq 0x60(%rsp), %rdi
movslq 0x58(%rbx), %rax
shlq $0x4, %rax
addq %rax, %rsi
callq 0x61e4
cmpl $0x0, 0x4(%r15)
jne 0x8c32
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x8ed2
callq 0x5c88
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x8ee1
callq 0x5c88
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x8ef3
callq 0x5c88
movq %r14, %rdi
callq 0x5c88
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x8f0a
callq 0x5c88
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x8f19
callq 0x5c88
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x8f28
callq 0x5c88
movq %rbx, %rdi
callq 0x5c88
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x8f7b
movq %rax, %r15
jmp 0x8f8d
movq %rax, %r15
jmp 0x8f9c
movq %rax, %r15
jmp 0x8fae
movq %rax, %r15
jmp 0x8fb6
movq %rax, %r15
jmp 0x8fc5
movq %rax, %r15
jmp 0x8fd4
movq %rax, %r15
jmp 0x8fe3
movq %rax, %r15
leaq 0xb0(%rsp), %rdi
callq 0x9122
jmp 0x8f7e
jmp 0x8f7b
movq %rax, %r15
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x8f8d
callq 0x5c88
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x8f9c
callq 0x5c88
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x8fae
callq 0x5c88
movq %r14, %rdi
callq 0x5c88
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x8fc5
callq 0x5c88
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x8fd4
callq 0x5c88
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x8fe3
callq 0x5c88
movq %rbx, %rdi
callq 0x5c88
movq %r15, %rdi
callq 0x31c0
nop