// File: /workspace/github_cpp_makefile_star2_O1/Matteo-Grellier[P]RPG/Menu.cpp
// Function: Menu::turn()
void Menu::turn() {

    vector<Character*> charactersList = Character::charactersList;
    vector<int> speedList;
    vector<Character*> charactersOrdered;


    for (Character* c : Character::charactersList) {
        speedList.push_back(c->speed);

    }

    sort(speedList.begin() , speedList.end(), greater<int>());

    for (int speed : speedList) {

        for (Character* c : Character::charactersList) {

            if (c->speed == speed ) {

                charactersOrdered.push_back(c);

            }
        }

    }  

    for (Character* c : charactersOrdered) {

        if (!isEndOfCombat() && c->getCurrentHp() != 0) {
            actions(*c);
        } else {
            return;
        }       
    }
    return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
leaq 0x5d52(%rip), %rbx      # 0xd190
leaq -0x88(%rbp), %rdi
movq %rbx, %rsi
callq 0x85c6
xorl %eax, %eax
movq %rax, -0x30(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x40(%rbp)
movq %rax, -0x50(%rbp)
movaps %xmm0, -0x60(%rbp)
movq (%rbx), %r15
movq 0x8(%rbx), %rbx
cmpq %rbx, %r15
je 0x74a2
leaq -0x40(%rbp), %r14
movq (%r15), %rdx
addq $0x28, %rdx
movq -0x38(%rbp), %rsi
cmpq -0x30(%rbp), %rsi
je 0x7491
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x38(%rbp)
jmp 0x7499
movq %r14, %rdi
callq 0x8646
addq $0x8, %r15
cmpq %rbx, %r15
jne 0x7472
movq -0x40(%rbp), %r14
movq -0x38(%rbp), %r15
cmpq %r15, %r14
je 0x74dc
movq %r15, %rax
subq %r14, %rax
sarq $0x2, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x8786
movq %r14, %rdi
movq %r15, %rsi
callq 0x8867
movq -0x40(%rbp), %r12
movq -0x38(%rbp), %rax
movq %rax, -0x68(%rbp)
cmpq %rax, %r12
je 0x7548
leaq -0x70(%rbp), %r15
leaq 0x5c98(%rip), %rax      # 0xd190
movq (%rax), %rbx
movq 0x8(%rax), %r13
cmpq %r13, %rbx
je 0x753e
movl (%r12), %r14d
movq (%rbx), %rax
movq %rax, -0x70(%rbp)
cmpl %r14d, 0x28(%rax)
jne 0x7535
movq -0x58(%rbp), %rsi
cmpq -0x50(%rbp), %rsi
je 0x7529
movq %rax, (%rsi)
addq $0x8, -0x58(%rbp)
jmp 0x7535
leaq -0x60(%rbp), %rdi
movq %r15, %rdx
callq 0x8afe
addq $0x8, %rbx
cmpq %r13, %rbx
jne 0x7508
addq $0x4, %r12
cmpq -0x68(%rbp), %r12
jne 0x74f1
movq -0x60(%rbp), %r14
movq -0x58(%rbp), %r15
cmpq %r15, %r14
je 0x757b
movq (%r14), %rbx
callq 0x7620
testb %al, %al
jne 0x757b
movq %rbx, %rdi
callq 0x3d64
testl %eax, %eax
je 0x757b
movq %rbx, %rdi
callq 0x77c8
addq $0x8, %r14
jmp 0x7550
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x7590
movq -0x50(%rbp), %rsi
subq %rdi, %rsi
callq 0x21c0
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x75a5
movq -0x30(%rbp), %rsi
subq %rdi, %rsi
callq 0x21c0
movq -0x88(%rbp), %rdi
testq %rdi, %rdi
je 0x75bd
movq -0x78(%rbp), %rsi
subq %rdi, %rsi
callq 0x21c0
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x75d2
jmp 0x75d2
jmp 0x75d2
movq %rax, %rbx
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x75ea
movq -0x50(%rbp), %rsi
subq %rdi, %rsi
callq 0x21c0
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x75ff
movq -0x30(%rbp), %rsi
subq %rdi, %rsi
callq 0x21c0
movq -0x88(%rbp), %rdi
testq %rdi, %rdi
je 0x7617
movq -0x78(%rbp), %rsi
subq %rdi, %rsi
callq 0x21c0
movq %rbx, %rdi
callq 0x2270
nop