// File: MechaDragonX[P]CPPCollections/queue.cpp
// Function: Queue<int>::toString[abi:cxx11]()
std::string Queue<T>::toString() {
    DoubleListNode<T>* current = tail_;
    std::string output = "";
    // Print each element backwards so it looks like the back is facing the element in front of it
    while(current != nullptr) {
        if(current->previous != nullptr) {
            // If type is Student
            if constexpr (std::is_same<T, Student>::value)
                output += current->value.toString(false) + " => ";
            // If type is std::string
            else if constexpr (std::is_same<T, std::string>::value)
                output += current->value + " => ";
            // Otherwise, it's a primitive
            else
                output += std::to_string(current->value) + " => ";
        }
        else {
            // If type is Student
            if constexpr (std::is_same<T, Student>::value)
                output += current->value.toString(false);
            // If type is std::string
            else if constexpr (std::is_same<T, std::string>::value)
                output += current->value;
            // Otherwise, it's a primitive
            else
                output += std::to_string(current->value);
        }

        current = current->previous;
    }
    return output;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0xa0(%rbp)
movq %rdi, %rax
movq %rax, -0xa8(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x18(%rbp)
movb $0x0, -0x19(%rbp)
leaq -0x1a(%rbp), %rdi
movq %rdi, -0x98(%rbp)
callq 0x4310
movq -0xa0(%rbp), %rdi
movq -0x98(%rbp), %rdx
leaq 0x96f5(%rip), %rsi      # 0x153be
callq 0x4b60
jmp 0xbcd0
leaq -0x1a(%rbp), %rdi
callq 0x4210
cmpq $0x0, -0x18(%rbp)
je 0xbe01
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0xbd9f
movq -0x18(%rbp), %rax
movl (%rax), %esi
leaq -0x70(%rbp), %rdi
callq 0x4c60
jmp 0xbd04
leaq 0x92f9(%rip), %rdx      # 0x15004
leaq -0x50(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x4c10
jmp 0xbd1a
movq -0xa0(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x4270
jmp 0xbd2c
leaq -0x50(%rbp), %rdi
callq 0x4120
leaq -0x70(%rbp), %rdi
callq 0x4120
jmp 0xbdf0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x1a(%rbp), %rdi
callq 0x4210
jmp 0xbe33
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0xbe27
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0xbd91
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x4120
leaq -0x70(%rbp), %rdi
callq 0x4120
jmp 0xbe27
movq -0x18(%rbp), %rax
movl (%rax), %esi
leaq -0x90(%rbp), %rdi
callq 0x4c60
jmp 0xbdb3
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x4270
jmp 0xbdc8
leaq -0x90(%rbp), %rdi
callq 0x4120
jmp 0xbdf0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x4120
jmp 0xbe27
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0xbcd9
movb $0x1, -0x19(%rbp)
testb $0x1, -0x19(%rbp)
jne 0xbe17
movq -0xa0(%rbp), %rdi
callq 0x4120
movq -0xa8(%rbp), %rax
addq $0xb0, %rsp
popq %rbp
retq
movq -0xa0(%rbp), %rdi
callq 0x4120
movq -0x28(%rbp), %rdi
callq 0x4300
nopl (%rax)