// File: 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
subq $0x110, %rsp            # imm = 0x110
leaq -0x18(%rbp), %rdi
leaq 0xab72(%rip), %rsi      # 0x14248
callq 0xaac0
leaq -0x30(%rbp), %rdi
callq 0xabb0
leaq -0x48(%rbp), %rdi
callq 0x4400
leaq 0xab54(%rip), %rax      # 0x14248
movq %rax, -0x50(%rbp)
leaq 0xab49(%rip), %rdi      # 0x14248
callq 0x6e60
movq %rax, -0x58(%rbp)
leaq 0xab39(%rip), %rdi      # 0x14248
callq 0x6cb0
movq %rax, -0x60(%rbp)
leaq -0x58(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x8ce0
testb $0x1, %al
jne 0x972b
jmp 0x9787
leaq -0x58(%rbp), %rdi
callq 0x7240
movq (%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rsi
addq $0x28, %rsi
leaq -0x30(%rbp), %rdi
callq 0xabd0
jmp 0x974e
jmp 0x9750
leaq -0x58(%rbp), %rdi
callq 0x8d20
jmp 0x9718
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x4420
leaq -0x30(%rbp), %rdi
callq 0xadd0
leaq -0x18(%rbp), %rdi
callq 0x4420
jmp 0x99c2
leaq -0x30(%rbp), %rdi
movq %rdi, -0x100(%rbp)
callq 0xac80
movq -0x100(%rbp), %rdi
movq %rax, -0x80(%rbp)
callq 0xacb0
movq %rax, -0x88(%rbp)
movq -0x80(%rbp), %rdi
movq -0x88(%rbp), %rsi
callq 0xac40
jmp 0x97c0
leaq -0x30(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rdi
callq 0xac80
movq %rax, -0xa0(%rbp)
movq -0x98(%rbp), %rdi
callq 0xacb0
movq %rax, -0xa8(%rbp)
leaq -0xa0(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0xace0
testb $0x1, %al
jne 0x980d
jmp 0x98cd
leaq -0xa0(%rbp), %rdi
callq 0xad20
movl (%rax), %eax
movl %eax, -0xac(%rbp)
leaq 0xaa20(%rip), %rax      # 0x14248
movq %rax, -0xb8(%rbp)
leaq 0xaa12(%rip), %rdi      # 0x14248
callq 0x6e60
movq %rax, -0xc0(%rbp)
leaq 0xa9ff(%rip), %rdi      # 0x14248
callq 0x6cb0
movq %rax, -0xc8(%rbp)
leaq -0xc0(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x8ce0
testb $0x1, %al
jne 0x986e
jmp 0x98ba
leaq -0xc0(%rbp), %rdi
callq 0x7240
movq (%rax), %rax
movq %rax, -0xd0(%rbp)
movq -0xd0(%rbp), %rax
movl 0x28(%rax), %eax
cmpl -0xac(%rbp), %eax
jne 0x98aa
leaq -0x48(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0xad40
jmp 0x98a8
jmp 0x98aa
jmp 0x98ac
leaq -0xc0(%rbp), %rdi
callq 0x8d20
jmp 0x9855
jmp 0x98bc
leaq -0xa0(%rbp), %rdi
callq 0xadb0
jmp 0x97f1
leaq -0x48(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0xd8(%rbp), %rdi
callq 0x6e60
movq %rax, -0xe0(%rbp)
movq -0xd8(%rbp), %rdi
callq 0x6cb0
movq %rax, -0xe8(%rbp)
leaq -0xe0(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x8ce0
testb $0x1, %al
jne 0x9917
jmp 0x9994
leaq -0xe0(%rbp), %rdi
callq 0x7240
movq (%rax), %rax
movq %rax, -0xf0(%rbp)
callq 0x99d0
movb %al, -0x101(%rbp)
jmp 0x993a
movb -0x101(%rbp), %al
testb $0x1, %al
jne 0x9975
jmp 0x9946
movq -0xf0(%rbp), %rdi
callq 0x5da0
movl %eax, -0x108(%rbp)
jmp 0x995a
movl -0x108(%rbp), %eax
cmpl $0x0, %eax
je 0x9975
movq -0xf0(%rbp), %rdi
callq 0x9cc0
jmp 0x9973
jmp 0x9981
movl $0x1, -0xf4(%rbp)
jmp 0x999e
jmp 0x9983
leaq -0xe0(%rbp), %rdi
callq 0x8d20
jmp 0x98fe
movl $0x1, -0xf4(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x4420
leaq -0x30(%rbp), %rdi
callq 0xadd0
leaq -0x18(%rbp), %rdi
callq 0x4420
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
movq -0x70(%rbp), %rdi
callq 0x3390
nopl (%rax,%rax)