// File: eschwabe[P]interview-practice/src/stringpermutations.cpp
// Function: GenerateStrings(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
vector<string> GenerateStrings(string source, string target) {
    vector<string> results;
    if(source.size() == 0) {
        results.push_back(target);
    }
    for(size_t i = 0; i < source.size(); ++i) {
        string new_source(source);
        string new_target(target);
        new_source.erase(i, 1);
        new_target.push_back(source.at(i));
        vector<string> tmp_results = GenerateStrings(new_source, new_target);
        results.insert(results.end(), tmp_results.begin(), tmp_results.end());
    }
    return results;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdx, -0x118(%rbp)
movq %rsi, -0x100(%rbp)
movq %rdi, -0x110(%rbp)
movq %rdi, %rax
movq %rax, -0x108(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movb $0x0, -0x19(%rbp)
callq 0x2c20
movq -0x100(%rbp), %rdi
callq 0x20f0
cmpq $0x0, %rax
jne 0x25f9
movq -0x118(%rbp), %rsi
movq -0x110(%rbp), %rdi
callq 0x2c40
jmp 0x25e6
jmp 0x25f9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x2845
movq $0x0, -0x38(%rbp)
movq -0x100(%rbp), %rdi
movq -0x38(%rbp), %rax
movq %rax, -0x120(%rbp)
callq 0x20f0
movq %rax, %rcx
movq -0x120(%rbp), %rax
cmpq %rcx, %rax
jae 0x281f
movq -0x100(%rbp), %rsi
leaq -0x58(%rbp), %rdi
callq 0x2090
jmp 0x263d
movq -0x118(%rbp), %rsi
leaq -0x78(%rbp), %rdi
callq 0x2090
jmp 0x264f
movq -0x38(%rbp), %rsi
leaq -0x58(%rbp), %rdi
movl $0x1, %edx
callq 0x2050
jmp 0x2663
movq -0x100(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x2260
movq %rax, -0x128(%rbp)
jmp 0x267c
movq -0x128(%rbp), %rax
movsbl (%rax), %esi
leaq -0x78(%rbp), %rdi
callq 0x2140
jmp 0x2691
leaq -0xb0(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x2090
jmp 0x26a3
leaq -0xd0(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x2090
jmp 0x26b5
leaq -0x90(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
leaq -0xd0(%rbp), %rdx
callq 0x2580
jmp 0x26d1
leaq -0xd0(%rbp), %rdi
callq 0x20d0
leaq -0xb0(%rbp), %rdi
callq 0x20d0
movq -0x110(%rbp), %rdi
callq 0x2d60
movq %rax, -0xe0(%rbp)
leaq -0xd8(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x2d90
leaq -0x90(%rbp), %rdi
movq %rdi, -0x138(%rbp)
callq 0x2dd0
movq -0x138(%rbp), %rdi
movq %rax, -0xe8(%rbp)
callq 0x2d60
movq -0x110(%rbp), %rdi
movq %rax, -0xf0(%rbp)
movq -0xd8(%rbp), %rsi
movq -0xe8(%rbp), %rdx
movq -0xf0(%rbp), %rcx
callq 0x2cb0
movq %rax, -0x130(%rbp)
jmp 0x2766
movq -0x130(%rbp), %rax
movq %rax, -0xf8(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x2e00
leaq -0x78(%rbp), %rdi
callq 0x20d0
leaq -0x58(%rbp), %rdi
callq 0x20d0
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x2601
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x2814
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x280b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x27e5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x20d0
leaq -0xb0(%rbp), %rdi
callq 0x20d0
jmp 0x280b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x2e00
leaq -0x78(%rbp), %rdi
callq 0x20d0
leaq -0x58(%rbp), %rdi
callq 0x20d0
jmp 0x2845
movb $0x1, -0x19(%rbp)
testb $0x1, -0x19(%rbp)
jne 0x2835
movq -0x110(%rbp), %rdi
callq 0x2e00
movq -0x108(%rbp), %rax
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
movq -0x110(%rbp), %rdi
callq 0x2e00
movq -0x28(%rbp), %rdi
callq 0x2230
nopw (%rax,%rax)