// File: eschwabe[P]interview-practice/src/anagrams.cpp
// Function: SortAnagramList(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>*)
void SortAnagramList(vector<string>* list) {
    if(list == nullptr) {
        return;
    }
    unordered_map<string, vector<string>> table;
    for(auto s : (*list)) {
        string tmp(s);
        sort(tmp.begin(), tmp.end());
        table[tmp].push_back(s);
    }
    int index = 0;
    for(auto anagrams : table) {
        for(auto astr : anagrams.second) {
            (*list)[index++] = astr;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x160, %rsp            # imm = 0x160
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x242b
jmp 0x26ff
leaq -0x40(%rbp), %rdi
callq 0x2c30
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
callq 0x2c50
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rdi
callq 0x2c80
movq %rax, -0x58(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x2cb0
testb $0x1, %al
jne 0x246c
jmp 0x2573
leaq -0x50(%rbp), %rdi
callq 0x2cf0
movq %rax, %rsi
leaq -0x78(%rbp), %rdi
callq 0x2090
jmp 0x2483
leaq -0xa8(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x2090
jmp 0x2495
leaq -0xa8(%rbp), %rdi
movq %rdi, -0x150(%rbp)
callq 0x2170
movq -0x150(%rbp), %rdi
movq %rax, -0xb0(%rbp)
callq 0x20e0
movq %rax, -0xb8(%rbp)
movq -0xb0(%rbp), %rdi
movq -0xb8(%rbp), %rsi
callq 0x2d10
jmp 0x24d7
leaq -0x40(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x2d50
movq %rax, -0x158(%rbp)
jmp 0x24f0
movq -0x158(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x2d80
jmp 0x2502
leaq -0xa8(%rbp), %rdi
callq 0x2100
leaq -0x78(%rbp), %rdi
callq 0x2100
leaq -0x50(%rbp), %rdi
callq 0x2df0
jmp 0x2456
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x2708
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x2565
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x2100
leaq -0x78(%rbp), %rdi
callq 0x2100
jmp 0x2708
movl $0x0, -0xbc(%rbp)
leaq -0x40(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0xc8(%rbp), %rdi
callq 0x2e10
movq %rax, -0xd0(%rbp)
movq -0xc8(%rbp), %rdi
callq 0x2e40
movq %rax, -0xd8(%rbp)
leaq -0xd0(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x2e70
testb $0x1, %al
jne 0x25ca
jmp 0x26f6
leaq -0xd0(%rbp), %rdi
callq 0x2ea0
movq %rax, %rsi
leaq -0x110(%rbp), %rdi
callq 0x2ed0
jmp 0x25e7
leaq -0x110(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x118(%rbp)
movq -0x118(%rbp), %rdi
callq 0x2c50
movq %rax, -0x120(%rbp)
movq -0x118(%rbp), %rdi
callq 0x2c80
movq %rax, -0x128(%rbp)
leaq -0x120(%rbp), %rdi
leaq -0x128(%rbp), %rsi
callq 0x2cb0
testb $0x1, %al
jne 0x263b
jmp 0x26cb
leaq -0x120(%rbp), %rdi
callq 0x2cf0
movq %rax, %rsi
leaq -0x148(%rbp), %rdi
callq 0x2090
jmp 0x2658
movq -0x8(%rbp), %rdi
movslq -0xbc(%rbp), %rsi
movl %esi, %eax
incl %eax
movl %eax, -0xbc(%rbp)
callq 0x2f30
movq %rax, %rdi
leaq -0x148(%rbp), %rsi
callq 0x2030
jmp 0x2683
leaq -0x148(%rbp), %rdi
callq 0x2100
leaq -0x120(%rbp), %rdi
callq 0x2df0
jmp 0x261f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x26e8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x148(%rbp), %rdi
callq 0x2100
jmp 0x26e8
leaq -0x110(%rbp), %rdi
callq 0x2f50
leaq -0xd0(%rbp), %rdi
callq 0x2f80
jmp 0x25ae
leaq -0x110(%rbp), %rdi
callq 0x2f50
jmp 0x2708
leaq -0x40(%rbp), %rdi
callq 0x2fb0
addq $0x160, %rsp            # imm = 0x160
popq %rbp
retq
leaq -0x40(%rbp), %rdi
callq 0x2fb0
movq -0x80(%rbp), %rdi
callq 0x2290
nopw (%rax,%rax)