// File: /workspace/github_cpp_makefile_star2_O3/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 0x5d6a(%rip), %rbx      # 0xd190
leaq -0x88(%rbp), %rdi
movq %rbx, %rsi
callq 0x85ac
xorl %r14d, %r14d
movq %r14, -0x30(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x40(%rbp)
movq %r14, -0x50(%rbp)
movaps %xmm0, -0x60(%rbp)
movq (%rbx), %r15
movq 0x8(%rbx), %r12
cmpq %r12, %r15
je 0x74c9
leaq -0x40(%rbp), %r14
movq (%r15), %rdx
addq $0x28, %rdx
movq -0x38(%rbp), %rsi
cmpq -0x30(%rbp), %rsi
je 0x747a
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x38(%rbp)
jmp 0x7482
movq %r14, %rdi
callq 0x862c
addq $0x8, %r15
cmpq %r12, %r15
jne 0x745b
movq -0x40(%rbp), %r14
movq -0x38(%rbp), %r15
cmpq %r15, %r14
je 0x74c9
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 0x876c
movq %r14, %rdi
movq %r15, %rsi
callq 0x884d
movq -0x40(%rbp), %r14
movq -0x38(%rbp), %rax
movq %rax, -0x68(%rbp)
cmpq %rax, %r14
je 0x7530
leaq -0x70(%rbp), %r12
leaq 0x5caf(%rip), %rax      # 0xd190
movq (%rax), %rbx
movq 0x8(%rax), %r13
cmpq %r13, %rbx
je 0x7526
movl (%r14), %r15d
movq (%rbx), %rax
movq %rax, -0x70(%rbp)
cmpl %r15d, 0x28(%rax)
jne 0x751d
movq -0x58(%rbp), %rsi
cmpq -0x50(%rbp), %rsi
je 0x7511
movq %rax, (%rsi)
addq $0x8, -0x58(%rbp)
jmp 0x751d
leaq -0x60(%rbp), %rdi
movq %r12, %rdx
callq 0x8ac0
addq $0x8, %rbx
cmpq %r13, %rbx
jne 0x74f0
addq $0x4, %r14
cmpq -0x68(%rbp), %r14
jne 0x74da
movq -0x60(%rbp), %rbx
movq -0x58(%rbp), %r15
cmpq %r15, %rbx
je 0x756a
movq (%rbx), %r14
callq 0x760e
testb %al, %al
jne 0x7566
movq %r14, %rdi
callq 0x3d5c
testl %eax, %eax
je 0x7566
movq %r14, %rdi
callq 0x77ae
addq $0x8, %rbx
cmpq %r15, %rbx
jne 0x753d
movq -0x60(%rbp), %rbx
testq %rbx, %rbx
je 0x757e
movq -0x50(%rbp), %rsi
subq %rbx, %rsi
movq %rbx, %rdi
callq 0x21c0
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x7593
movq -0x30(%rbp), %rsi
subq %rdi, %rsi
callq 0x21c0
movq -0x88(%rbp), %rdi
testq %rdi, %rdi
je 0x75ab
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 0x75c0
jmp 0x75c0
jmp 0x75c0
movq %rax, %rbx
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x75d8
movq -0x50(%rbp), %rsi
subq %rdi, %rsi
callq 0x21c0
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x75ed
movq -0x30(%rbp), %rsi
subq %rdi, %rsi
callq 0x21c0
movq -0x88(%rbp), %rdi
testq %rdi, %rdi
je 0x7605
movq -0x78(%rbp), %rsi
subq %rdi, %rsi
callq 0x21c0
movq %rbx, %rdi
callq 0x2270
nop