// File: MechaDragonX[P]CPPCollections/linked_list.cpp
// Function: LinkedList<int>::toString[abi:cxx11]()
std::string LinkedList<T>::toString() {
    ListNode<T>* current = head_;
    std::string output = "";
    while(current != nullptr) {
        if(current->next != 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->next;
    }
    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 0x8(%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 0xc3d5(%rip), %rsi      # 0x153be
callq 0x4b60
jmp 0x8ff0
leaq -0x1a(%rbp), %rdi
callq 0x4210
cmpq $0x0, -0x18(%rbp)
je 0x9121
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x90bf
movq -0x18(%rbp), %rax
movl (%rax), %esi
leaq -0x70(%rbp), %rdi
callq 0x4c60
jmp 0x9024
leaq 0xbfd9(%rip), %rdx      # 0x15004
leaq -0x50(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x4c10
jmp 0x903a
movq -0xa0(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x4270
jmp 0x904c
leaq -0x50(%rbp), %rdi
callq 0x4120
leaq -0x70(%rbp), %rdi
callq 0x4120
jmp 0x9110
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x1a(%rbp), %rdi
callq 0x4210
jmp 0x9153
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x9147
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x90b1
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 0x9147
movq -0x18(%rbp), %rax
movl (%rax), %esi
leaq -0x90(%rbp), %rdi
callq 0x4c60
jmp 0x90d3
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x4270
jmp 0x90e8
leaq -0x90(%rbp), %rdi
callq 0x4120
jmp 0x9110
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x4120
jmp 0x9147
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x8ff9
movb $0x1, -0x19(%rbp)
testb $0x1, -0x19(%rbp)
jne 0x9137
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)