// File: andyn[P]libdlmm/dltest.cc
// Function: main
int main(void) {
    Dl dl("./libuseless.so");

    // Reading variables from a dynamic library

    std::cout << "Reading and modifying a local copy of variable in library..."
              << std::endl;
    int my_answer =
        dl.symbol<int>("answer_to_life_the_universe_and_everything");
    my_answer = -1;
    (void)my_answer;
    if (dl.symbol<int>("answer_to_life_the_universe_and_everything") != 42) {
        std::cout << "TEST FAILED: variable was changed inside library."
                  << std::endl;
        return -1;
    }

    std::cout << "Reading and changing a referenced variable in library..."
              << std::endl;
    int &my_better_answer =
        dl.symbol<int>("answer_to_life_the_universe_and_everything");
    if (my_better_answer != 42) {
        std::cout << "TEST FAILED: Expected 42, got " << my_better_answer
                  << std::endl;
        return -1;
    }
    my_better_answer = 11; // This one goes to eleven!
    if (dl.symbol<int>("answer_to_life_the_universe_and_everything") != 11) {
        std::cout << "TEST FAILED: could not change variable inside library."
                  << std::endl;
        return -1;
    }

    // Calling functions from a dynamic library

    std::cout << "Calling function in library... " << std::endl;
    auto print_and_increment =
        dl.symbol<int(std::ostringstream &, std::string const &, int)>(
            "print_and_increment");

    std::string input_string = "Hello World!";
    std::ostringstream output_string;
    int incremented_via_reference =
        print_and_increment(output_string, input_string, 100);
    if (output_string.str() != input_string) {
        std::cout << "TEST FAILED: function did not stream correct value "
                  << "(expected " << input_string << ", got "
                  << output_string.str() << ")." << std::endl;
        return -1;
    }
    if (101 != incremented_via_reference) {
        std::cout << "TEST FAILED: function did not return correct value "
                  << "(expected " << 101 << ", got "
                  << incremented_via_reference << ")." << std::endl;
        return -1;
    }

    // Catching exceptions

    std::cout << "Loading nonexistent library..." << std::endl;
    try {
        Dl dl2("DOES_NOT_EXIST");
        std::cout << "TEST FAILED: nonexistent library did not throw."
                  << std::endl;
        return -1;
    } catch (std::runtime_error &) {
    }

    std::cout << "Loading nonexistent symbol..." << std::endl;
    try {
        std::cout << dl.symbol<int>("DOES_NOT_EXIST");
        std::cout << "TEST FAILED: nonexistent symbol did not throw."
                  << std::endl;
        return -1;
    } catch (std::runtime_error &) {
    }

    std::cout << "Loading nonexistent version of an existing symbol..."
              << std::endl;
    try {
        std::cout << dl.symbol<int>(
            "answer_to_life_the_universe_and_everything", "DOES_NOT_EXIST");
        std::cout << "TEST FAILED: nonexistent version of existing symbol did "
                     "not throw."
                  << std::endl;
        return -1;
    } catch (std::runtime_error &) {
    }

    std::cout << "Done testing." << std::endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x550, %rsp            # imm = 0x550
movl $0x0, -0x4(%rbp)
leaq -0x31(%rbp), %rdi
movq %rdi, -0x3d0(%rbp)
callq 0x2300
movq -0x3d0(%rbp), %rdx
leaq 0x1b44(%rip), %rsi      # 0x4004
leaq -0x30(%rbp), %rdi
callq 0x3230
jmp 0x24cb
leaq -0x10(%rbp), %rdi
leaq -0x30(%rbp), %rsi
movl $0x1, %edx
callq 0x32e0
jmp 0x24df
leaq -0x30(%rbp), %rdi
callq 0x20f0
leaq -0x31(%rbp), %rdi
callq 0x2200
movq 0x3ad8(%rip), %rdi      # 0x5fd0
leaq 0x1b15(%rip), %rsi      # 0x4014
callq 0x21c0
movq %rax, -0x3d8(%rbp)
jmp 0x250d
movq -0x3d8(%rbp), %rdi
movq 0x3a9d(%rip), %rsi      # 0x5fb8
callq 0x21e0
jmp 0x2522
leaq -0x69(%rbp), %rdi
movq %rdi, -0x3e0(%rbp)
callq 0x2300
movq -0x3e0(%rbp), %rdx
leaq 0x1b11(%rip), %rsi      # 0x4051
leaq -0x68(%rbp), %rdi
callq 0x3230
jmp 0x254b
leaq -0x10(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x3450
movq %rax, -0x3e8(%rbp)
jmp 0x2561
movq -0x3e8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x3f4(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x20f0
leaq -0x69(%rbp), %rdi
callq 0x2200
movl -0x3f4(%rbp), %eax
movl %eax, -0x48(%rbp)
movl $0xffffffff, -0x48(%rbp) # imm = 0xFFFFFFFF
leaq -0x91(%rbp), %rdi
movq %rdi, -0x3f0(%rbp)
callq 0x2300
movq -0x3f0(%rbp), %rdx
leaq 0x1a9e(%rip), %rsi      # 0x4051
leaq -0x90(%rbp), %rdi
callq 0x3230
jmp 0x25c1
leaq -0x10(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x3450
movq %rax, -0x400(%rbp)
jmp 0x25da
movq -0x400(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x404(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x20f0
leaq -0x91(%rbp), %rdi
callq 0x2200
movl -0x404(%rbp), %eax
cmpl $0x2a, %eax
je 0x2701
movq 0x39b9(%rip), %rdi      # 0x5fd0
leaq 0x1a5e(%rip), %rsi      # 0x407c
callq 0x21c0
movq %rax, -0x410(%rbp)
jmp 0x262c
movq -0x410(%rbp), %rdi
movq 0x397e(%rip), %rsi      # 0x5fb8
callq 0x21e0
jmp 0x2641
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x98(%rbp)
jmp 0x31eb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x267a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x20f0
leaq -0x31(%rbp), %rdi
callq 0x2200
jmp 0x3221
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x3218
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x26bc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x20f0
leaq -0x69(%rbp), %rdi
callq 0x2200
jmp 0x3218
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x26f0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x20f0
leaq -0x91(%rbp), %rdi
callq 0x2200
jmp 0x3218
movq 0x38c8(%rip), %rdi      # 0x5fd0
leaq 0x199f(%rip), %rsi      # 0x40ae
callq 0x21c0
movq %rax, -0x418(%rbp)
jmp 0x271d
movq -0x418(%rbp), %rdi
movq 0x388d(%rip), %rsi      # 0x5fb8
callq 0x21e0
jmp 0x2732
leaq -0xc1(%rbp), %rdi
movq %rdi, -0x420(%rbp)
callq 0x2300
movq -0x420(%rbp), %rdx
leaq 0x18fe(%rip), %rsi      # 0x4051
leaq -0xc0(%rbp), %rdi
callq 0x3230
jmp 0x2761
leaq -0x10(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x3450
movq %rax, -0x428(%rbp)
jmp 0x277a
leaq -0xc0(%rbp), %rdi
callq 0x20f0
leaq -0xc1(%rbp), %rdi
callq 0x2200
movq -0x428(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rax
cmpl $0x2a, (%rax)
je 0x284c
movq 0x3819(%rip), %rdi      # 0x5fd0
leaq 0x1929(%rip), %rsi      # 0x40e7
callq 0x21c0
movq %rax, -0x430(%rbp)
jmp 0x27cc
movq -0x430(%rbp), %rdi
movq -0xa0(%rbp), %rax
movl (%rax), %esi
callq 0x22e0
movq %rax, -0x438(%rbp)
jmp 0x27ea
movq -0x438(%rbp), %rdi
movq 0x37c0(%rip), %rsi      # 0x5fb8
callq 0x21e0
jmp 0x27ff
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x98(%rbp)
jmp 0x31eb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x283b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x20f0
leaq -0xc1(%rbp), %rdi
callq 0x2200
jmp 0x3218
movq -0xa0(%rbp), %rax
movl $0xb, (%rax)
leaq -0xe9(%rbp), %rdi
movq %rdi, -0x440(%rbp)
callq 0x2300
movq -0x440(%rbp), %rdx
leaq 0x17d7(%rip), %rsi      # 0x4051
leaq -0xe8(%rbp), %rdi
callq 0x3230
jmp 0x2888
leaq -0x10(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x3450
movq %rax, -0x448(%rbp)
jmp 0x28a1
movq -0x448(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x44c(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x20f0
leaq -0xe9(%rbp), %rdi
callq 0x2200
movl -0x44c(%rbp), %eax
cmpl $0xb, %eax
je 0x2951
movq 0x36f6(%rip), %rdi      # 0x5fd0
leaq 0x1825(%rip), %rsi      # 0x4106
callq 0x21c0
movq %rax, -0x458(%rbp)
jmp 0x28ef
movq -0x458(%rbp), %rdi
movq 0x36bb(%rip), %rsi      # 0x5fb8
callq 0x21e0
jmp 0x2904
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x98(%rbp)
jmp 0x31eb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x2940
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x20f0
leaq -0xe9(%rbp), %rdi
callq 0x2200
jmp 0x3218
movq 0x3678(%rip), %rdi      # 0x5fd0
leaq 0x17de(%rip), %rsi      # 0x413d
callq 0x21c0
movq %rax, -0x460(%rbp)
jmp 0x296d
movq -0x460(%rbp), %rdi
movq 0x363d(%rip), %rsi      # 0x5fb8
callq 0x21e0
jmp 0x2982
leaq -0x119(%rbp), %rdi
movq %rdi, -0x468(%rbp)
callq 0x2300
movq -0x468(%rbp), %rdx
leaq 0x17ba(%rip), %rsi      # 0x415d
leaq -0x118(%rbp), %rdi
callq 0x3230
jmp 0x29b1
leaq -0x10(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0x35c0
movq %rax, -0x470(%rbp)
jmp 0x29ca
leaq -0x118(%rbp), %rdi
callq 0x20f0
leaq -0x119(%rbp), %rdi
callq 0x2200
movq -0x470(%rbp), %rax
movq %rax, -0xf8(%rbp)
leaq -0x141(%rbp), %rdi
movq %rdi, -0x478(%rbp)
callq 0x2300
movq -0x478(%rbp), %rdx
leaq 0x1760(%rip), %rsi      # 0x4171
leaq -0x140(%rbp), %rdi
callq 0x3230
jmp 0x2a1f
leaq -0x141(%rbp), %rdi
callq 0x2200
leaq -0x2c0(%rbp), %rdi
callq 0x2250
jmp 0x2a39
movq -0xf8(%rbp), %rax
leaq -0x2c0(%rbp), %rdi
leaq -0x140(%rbp), %rsi
movl $0x64, %edx
callq *%rax
movl %eax, -0x47c(%rbp)
jmp 0x2a5d
movl -0x47c(%rbp), %eax
movl %eax, -0x2c4(%rbp)
leaq -0x2e8(%rbp), %rdi
leaq -0x2c0(%rbp), %rsi
callq 0x21d0
jmp 0x2a7e
leaq -0x2e8(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0x3730
movb %al, -0x47d(%rbp)
leaq -0x2e8(%rbp), %rdi
callq 0x20f0
movb -0x47d(%rbp), %al
testb $0x1, %al
jne 0x2ab2
jmp 0x2c39
movq 0x3517(%rip), %rdi      # 0x5fd0
leaq 0x16be(%rip), %rsi      # 0x417e
callq 0x21c0
movq %rax, -0x488(%rbp)
jmp 0x2ace
movq -0x488(%rbp), %rdi
leaq 0x16d6(%rip), %rsi      # 0x41b2
callq 0x21c0
movq %rax, -0x490(%rbp)
jmp 0x2aea
movq -0x490(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0x2190
movq %rax, -0x498(%rbp)
jmp 0x2b06
movq -0x498(%rbp), %rdi
leaq 0x15eb(%rip), %rsi      # 0x40ff
callq 0x21c0
movq %rax, -0x4a0(%rbp)
jmp 0x2b22
leaq -0x308(%rbp), %rdi
leaq -0x2c0(%rbp), %rsi
callq 0x21d0
jmp 0x2b37
movq -0x4a0(%rbp), %rdi
leaq -0x308(%rbp), %rsi
callq 0x2190
movq %rax, -0x4a8(%rbp)
jmp 0x2b53
movq -0x4a8(%rbp), %rdi
leaq 0x165c(%rip), %rsi      # 0x41bd
callq 0x21c0
movq %rax, -0x4b0(%rbp)
jmp 0x2b6f
movq -0x4b0(%rbp), %rdi
movq 0x343b(%rip), %rsi      # 0x5fb8
callq 0x21e0
jmp 0x2b84
leaq -0x308(%rbp), %rdi
callq 0x20f0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x98(%rbp)
jmp 0x31d3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x2bcc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x118(%rbp), %rdi
callq 0x20f0
leaq -0x119(%rbp), %rdi
callq 0x2200
jmp 0x3218
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x141(%rbp), %rdi
callq 0x2200
jmp 0x3218
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x320c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x3200
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x308(%rbp), %rdi
callq 0x20f0
jmp 0x3200
movl $0x65, %eax
cmpl -0x2c4(%rbp), %eax
je 0x2d1a
movq 0x337f(%rip), %rdi      # 0x5fd0
leaq 0x1568(%rip), %rsi      # 0x41c0
callq 0x21c0
movq %rax, -0x4b8(%rbp)
jmp 0x2c66
movq -0x4b8(%rbp), %rdi
leaq 0x153e(%rip), %rsi      # 0x41b2
callq 0x21c0
movq %rax, -0x4c0(%rbp)
jmp 0x2c82
movq -0x4c0(%rbp), %rdi
movl $0x65, %esi
callq 0x22e0
movq %rax, -0x4c8(%rbp)
jmp 0x2c9c
movq -0x4c8(%rbp), %rdi
leaq 0x1455(%rip), %rsi      # 0x40ff
callq 0x21c0
movq %rax, -0x4d0(%rbp)
jmp 0x2cb8
movq -0x4d0(%rbp), %rdi
movl -0x2c4(%rbp), %esi
callq 0x22e0
movq %rax, -0x4d8(%rbp)
jmp 0x2cd3
movq -0x4d8(%rbp), %rdi
leaq 0x14dc(%rip), %rsi      # 0x41bd
callq 0x21c0
movq %rax, -0x4e0(%rbp)
jmp 0x2cef
movq -0x4e0(%rbp), %rdi
movq 0x32bb(%rip), %rsi      # 0x5fb8
callq 0x21e0
jmp 0x2d04
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x98(%rbp)
jmp 0x31d3
movq 0x32af(%rip), %rdi      # 0x5fd0
leaq 0x14cc(%rip), %rsi      # 0x41f4
callq 0x21c0
movq %rax, -0x4e8(%rbp)
jmp 0x2d36
movq -0x4e8(%rbp), %rdi
movq 0x3274(%rip), %rsi      # 0x5fb8
callq 0x21e0
jmp 0x2d4b
leaq -0x331(%rbp), %rdi
movq %rdi, -0x4f0(%rbp)
callq 0x2300
movq -0x4f0(%rbp), %rdx
leaq 0x14a7(%rip), %rsi      # 0x4213
leaq -0x330(%rbp), %rdi
callq 0x3230
jmp 0x2d7a
leaq -0x310(%rbp), %rdi
leaq -0x330(%rbp), %rsi
movl $0x1, %edx
callq 0x32e0
jmp 0x2d94
leaq -0x330(%rbp), %rdi
callq 0x20f0
leaq -0x331(%rbp), %rdi
callq 0x2200
movq 0x321d(%rip), %rdi      # 0x5fd0
leaq 0x1468(%rip), %rsi      # 0x4222
callq 0x21c0
movq %rax, -0x4f8(%rbp)
jmp 0x2dc8
movq -0x4f8(%rbp), %rdi
movq 0x31e2(%rip), %rsi      # 0x5fb8
callq 0x21e0
jmp 0x2ddd
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x98(%rbp)
leaq -0x310(%rbp), %rdi
callq 0x3760
jmp 0x31d3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x2e25
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x330(%rbp), %rdi
callq 0x20f0
leaq -0x331(%rbp), %rdi
callq 0x2200
jmp 0x2e4b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x310(%rbp), %rdi
callq 0x3760
movl -0x44(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x3200
movq -0x40(%rbp), %rdi
callq 0x2080
movq %rax, -0x340(%rbp)
callq 0x22b0
jmp 0x2e72
jmp 0x2e74
movq 0x3155(%rip), %rdi      # 0x5fd0
leaq 0x13d0(%rip), %rsi      # 0x4252
callq 0x21c0
movq %rax, -0x500(%rbp)
jmp 0x2e90
movq -0x500(%rbp), %rdi
movq 0x311a(%rip), %rsi      # 0x5fb8
callq 0x21e0
jmp 0x2ea5
leaq -0x361(%rbp), %rdi
movq %rdi, -0x508(%rbp)
callq 0x2300
movq -0x508(%rbp), %rdx
leaq 0x134d(%rip), %rsi      # 0x4213
leaq -0x360(%rbp), %rdi
callq 0x3230
jmp 0x2ed4
leaq -0x10(%rbp), %rdi
leaq -0x360(%rbp), %rsi
callq 0x3450
movq %rax, -0x510(%rbp)
jmp 0x2eed
movq -0x510(%rbp), %rax
movl (%rax), %esi
movq 0x30d3(%rip), %rdi      # 0x5fd0
callq 0x22e0
jmp 0x2f04
leaq -0x360(%rbp), %rdi
callq 0x20f0
leaq -0x361(%rbp), %rdi
callq 0x2200
movq 0x30ad(%rip), %rdi      # 0x5fd0
leaq 0x1346(%rip), %rsi      # 0x4270
callq 0x21c0
movq %rax, -0x518(%rbp)
jmp 0x2f38
movq -0x518(%rbp), %rdi
movq 0x3072(%rip), %rsi      # 0x5fb8
callq 0x21e0
jmp 0x2f4d
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x98(%rbp)
jmp 0x31d3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x2f89
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x360(%rbp), %rdi
callq 0x20f0
leaq -0x361(%rbp), %rdi
callq 0x2200
jmp 0x2fa3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x3200
movq -0x40(%rbp), %rdi
callq 0x2080
movq %rax, -0x370(%rbp)
callq 0x22b0
jmp 0x2fca
jmp 0x2fcc
movq 0x2ffd(%rip), %rdi      # 0x5fd0
leaq 0x12c5(%rip), %rsi      # 0x429f
callq 0x21c0
movq %rax, -0x520(%rbp)
jmp 0x2fe8
movq -0x520(%rbp), %rdi
movq 0x2fc2(%rip), %rsi      # 0x5fb8
callq 0x21e0
jmp 0x2ffd
leaq -0x391(%rbp), %rdi
movq %rdi, -0x528(%rbp)
callq 0x2300
movq -0x528(%rbp), %rdx
leaq 0x1033(%rip), %rsi      # 0x4051
leaq -0x390(%rbp), %rdi
callq 0x3230
jmp 0x302c
leaq -0x3b9(%rbp), %rdi
movq %rdi, -0x530(%rbp)
callq 0x2300
movq -0x530(%rbp), %rdx
leaq 0x11c6(%rip), %rsi      # 0x4213
leaq -0x3b8(%rbp), %rdi
callq 0x3230
jmp 0x305b
leaq -0x10(%rbp), %rdi
leaq -0x390(%rbp), %rsi
leaq -0x3b8(%rbp), %rdx
callq 0x3780
movq %rax, -0x538(%rbp)
jmp 0x307b
movq -0x538(%rbp), %rax
movl (%rax), %esi
movq 0x2f45(%rip), %rdi      # 0x5fd0
callq 0x22e0
jmp 0x3092
leaq -0x3b8(%rbp), %rdi
callq 0x20f0
leaq -0x3b9(%rbp), %rdi
callq 0x2200
leaq -0x390(%rbp), %rdi
callq 0x20f0
leaq -0x391(%rbp), %rdi
callq 0x2200
movq 0x2f07(%rip), %rdi      # 0x5fd0
leaq 0x1204(%rip), %rsi      # 0x42d4
callq 0x21c0
movq %rax, -0x540(%rbp)
jmp 0x30de
movq -0x540(%rbp), %rdi
movq 0x2ecc(%rip), %rsi      # 0x5fb8
callq 0x21e0
jmp 0x30f3
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x98(%rbp)
jmp 0x31d3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x3155
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x313d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x3b8(%rbp), %rdi
callq 0x20f0
leaq -0x3b9(%rbp), %rdi
callq 0x2200
leaq -0x390(%rbp), %rdi
callq 0x20f0
leaq -0x391(%rbp), %rdi
callq 0x2200
jmp 0x316f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x3200
movq -0x40(%rbp), %rdi
callq 0x2080
movq %rax, -0x3c8(%rbp)
callq 0x22b0
jmp 0x3196
jmp 0x3198
movq 0x2e31(%rip), %rdi      # 0x5fd0
leaq 0x1171(%rip), %rsi      # 0x4317
callq 0x21c0
movq %rax, -0x548(%rbp)
jmp 0x31b4
movq -0x548(%rbp), %rdi
movq 0x2df6(%rip), %rsi      # 0x5fb8
callq 0x21e0
jmp 0x31c9
movl $0x0, -0x98(%rbp)
leaq -0x2c0(%rbp), %rdi
callq 0x2050
leaq -0x140(%rbp), %rdi
callq 0x20f0
leaq -0x10(%rbp), %rdi
callq 0x3760
movl -0x4(%rbp), %eax
addq $0x550, %rsp            # imm = 0x550
popq %rbp
retq
leaq -0x2c0(%rbp), %rdi
callq 0x2050
leaq -0x140(%rbp), %rdi
callq 0x20f0
leaq -0x10(%rbp), %rdi
callq 0x3760
movq -0x40(%rbp), %rdi
callq 0x22f0
nopw (%rax,%rax)