// File: /workspace/github_cpp_makefile_star2_O3/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 $0x108, %rsp            # imm = 0x108
movq %rdi, %r15
movl $0x60, %edi
callq 0x3110
movq %rax, %rbx
movabsq $0x100000001, %r12      # imm = 0x100000001
movq %r12, 0x8(%rax)
leaq 0x80fe(%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 0x60(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x58(%rsp), %rsi
leaq 0x30(%rsp), %rdx
callq 0x910e
leaq 0x28(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x20(%rsp), %rsi
leaq 0x30(%rsp), %rdx
callq 0x946a
leaq 0x18(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x10(%rsp), %rsi
leaq 0x30(%rsp), %rdx
callq 0x9688
movl $0x60, %edi
callq 0x3110
movq %rax, %r14
movq %r12, 0x8(%rax)
leaq 0x81b8(%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, 0x10(%r14)
movups %xmm0, 0x50(%r14)
movq %rax, 0x28(%r14)
movq %rax, 0x30(%r14)
leaq 0x50(%r14), %rax
movq %rax, 0x40(%r14)
leaq 0x90(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x88(%rsp), %rsi
leaq 0x30(%rsp), %rdx
callq 0x989e
leaq 0x80(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x78(%rsp), %rsi
leaq 0x30(%rsp), %rdx
callq 0x9b7c
leaq 0x70(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x68(%rsp), %rsi
leaq 0x30(%rsp), %rdx
callq 0x9dca
leaq 0x40(%rbx), %r12
leaq 0xf0(%rsp), %rdi
movq %r12, %rsi
callq 0x7734
leaq 0x10(%rbx), %rax
movq %rax, 0x50(%rsp)
movq %r14, 0x8(%rsp)
addq $0x10, %r14
movq %r14, 0x48(%rsp)
leaq 0xf0(%rsp), %rdi
callq 0x8f00
movq %rbx, %rax
addq $0x28, %rax
movq %rax, 0x98(%rsp)
leaq 0x2f12(%rip), %r13      # 0xba60
movl $0x0, 0x4(%r15)
movq 0x58(%rsp), %rdi
callq 0x7404
movq 0x58(%rsp), %rdi
callq 0x757e
movl %eax, 0x4(%r15)
decl %eax
cmpl $0x7, %eax
ja 0x8db9
movslq (%r13,%rax,4), %rax
addq %r13, %rax
jmpq *%rax
movq 0x20(%rsp), %rdi
callq 0x7404
movq 0x20(%rsp), %rdi
callq 0x757e
movl %eax, (%r15)
movq 0x20(%rsp), %rsi
leaq 0xd8(%rsp), %rdi
movq 0x50(%rsp), %rdx
movq %r15, %rcx
callq 0x5e64
leaq 0xd8(%rsp), %rdi
callq 0x8f4e
movq 0x18(%rbx), %rax
subq 0x10(%rbx), %rax
shrq $0x4, %rax
decl %eax
movl %eax, 0x58(%rbx)
jmp 0x8dae
movq 0x10(%rbx), %rsi
cmpq 0x18(%rbx), %rsi
je 0x8b4e
movq 0x88(%rsp), %rdi
movslq 0x58(%rbx), %rax
shlq $0x4, %rax
addq %rax, %rsi
callq 0x67b8
jmp 0x8dae
movq 0x10(%rbx), %rsi
cmpq 0x18(%rbx), %rsi
je 0x8b4e
movslq 0x58(%rbx), %rax
shlq $0x4, %rax
addq %rax, %rsi
movq 0x48(%rsp), %rdi
callq 0x6eb4
movslq 0x58(%rbx), %rsi
shlq $0x4, %rsi
addq 0x10(%rbx), %rsi
movq 0x48(%rsp), %rdi
movq %r12, %rdx
callq 0x722a
jmp 0x8dae
movq 0x10(%rbx), %rax
cmpq 0x18(%rbx), %rax
je 0x8b4e
leaq 0xc0(%rsp), %rbp
movq %rbp, %rdi
movq 0x98(%rsp), %rsi
callq 0x8f9c
leaq 0xa0(%rsp), %r14
movq %r14, %rdi
movq %rbp, %rsi
callq 0x5530
movq 0x38(%rbx), %rax
movaps 0xa0(%rsp), %xmm0
movq 0xb0(%rsp), %rcx
movq %rcx, 0x38(%rbx)
movups 0x28(%rbx), %xmm1
movups %xmm0, 0x28(%rbx)
movaps %xmm1, 0x30(%rsp)
movq %rax, 0x40(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0xa0(%rsp)
movq $0x0, 0xb0(%rsp)
leaq 0x30(%rsp), %rdi
callq 0x903a
movq %r14, %rdi
callq 0x903a
movq %rbp, %rdi
callq 0x903a
movslq 0x58(%rbx), %rdi
shlq $0x4, %rdi
addq 0x10(%rbx), %rdi
movq 0x30(%rbx), %rsi
addq $-0x10, %rsi
movq %r12, %rdx
callq 0x508a
jmp 0x8dae
movq 0x10(%rbx), %rax
cmpq 0x18(%rbx), %rax
je 0x8b4e
movq %r12, %rdi
callq 0x7c6e
jmp 0x8dae
movq 0x10(%rbx), %rax
cmpq 0x18(%rbx), %rax
je 0x8b4e
movq 0x10(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0x638c
movq 0x10(%rsp), %rdi
callq 0x757e
movl %eax, (%r15)
testl %eax, %eax
je 0x8dae
movslq %eax, %rcx
movq 0x18(%rbx), %rdx
subq 0x10(%rbx), %rdx
sarq $0x4, %rdx
cmpq %rcx, %rdx
jbe 0x8dae
movq 0x10(%rsp), %rdi
movl %eax, %esi
callq 0x6516
jmp 0x8bcf
movq 0x10(%rbx), %rsi
cmpq 0x18(%rbx), %rsi
je 0x8b4e
movq 0x78(%rsp), %rdi
movslq 0x58(%rbx), %rax
shlq $0x4, %rax
addq %rax, %rsi
callq 0x730c
jmp 0x8dae
movq 0x10(%rbx), %rsi
cmpq 0x18(%rbx), %rsi
je 0x8b4e
movq 0x68(%rsp), %rdi
movslq 0x58(%rbx), %rax
shlq $0x4, %rax
addq %rax, %rsi
callq 0x6170
cmpl $0x0, 0x4(%r15)
jne 0x8b4e
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x8dc8
callq 0x5c3c
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
movq 0x8(%rsp), %r14
je 0x8ddf
callq 0x5c3c
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x8df1
callq 0x5c3c
movq %r14, %rdi
callq 0x5c3c
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x8e08
callq 0x5c3c
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x8e17
callq 0x5c3c
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x8e26
callq 0x5c3c
movq %rbx, %rdi
callq 0x5c3c
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r15
jmp 0x8e87
movq %rax, %r15
jmp 0x8e96
movq %rax, %r15
jmp 0x8ea8
movq %rax, %r15
jmp 0x8eba
movq %rax, %r15
jmp 0x8ec2
movq %rax, %r15
jmp 0x8ed1
movq %rax, %r15
jmp 0x8ee0
movq %rax, %r15
jmp 0x8eef
movq %rax, %r15
leaq 0xc0(%rsp), %rdi
callq 0x903a
jmp 0x8e82
jmp 0x8e7f
movq %rax, %r15
movq 0x8(%rsp), %r14
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x8e96
callq 0x5c3c
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x8ea8
callq 0x5c3c
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x8eba
callq 0x5c3c
movq %r14, %rdi
callq 0x5c3c
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x8ed1
callq 0x5c3c
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x8ee0
callq 0x5c3c
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x8eef
callq 0x5c3c
movq %rbx, %rdi
callq 0x5c3c
movq %r15, %rdi
callq 0x31c0
nop