// File: AraKhachatryan[P]messenger/server.cpp
// Function: client_thread(void*)
void * client_thread ( void * client_socket_fd )
{
    char client_name[50];
    bzero(client_name, sizeof(client_name));

    char encoded_message[512];
    std::vector<std::string> dest_names;
    std::string message_info;
    std::string message;
    char output[512];


    int fd = *(int *)client_socket_fd;

    recv(fd, client_name, sizeof(client_name), 0);


    // Notify to all clients that this connection is online
    std::string active_clients;
    size_t clinets_count = 0;
    for( const auto& client: clients_list )
    {
        active_clients += client.first;
        ++clinets_count;
        if ( clinets_count < clients_list.size() ) {
            active_clients += ",";
        }

        make_encoded_message(client_name, "Server:online", std::string(" is online"), sizeof(output), output);
        //print_encoded_message(output, sizeof(output));

        send(client.second, output, sizeof(output), 0);
    }

    // Notify to this connection for available online clients
    if ( !clients_list.empty() )
    {
        std::string is_are;
        if( clinets_count > 1 )
        {
            is_are = std::string(" are online");
        } else {
            is_are = std::string(" is online");
        }
        make_encoded_message(active_clients.c_str(), "Server:online", is_are, sizeof(output), output);
        //print_encoded_message(output, sizeof(output));

        send(fd, output, sizeof(output), 0);
    }


    clients_list.insert(std::pair<std::string, int>(std::string(client_name), fd));


    std::cout << "Thread ID: " << pthread_self() << " socket_fd: " << fd << " Name: " << client_name << std::endl;

    while(1)
    {

        bzero(encoded_message, sizeof(encoded_message));
        dest_names.clear();
        message_info.clear();
        message.clear();
        bzero(output, sizeof(output));


        int rv = recv(fd, encoded_message, sizeof(encoded_message), 0);
        if ( rv  == -1 )
        {
            std::cerr << "Error reading from client: " << std::strerror(errno) << std::endl;
            break;
        } else if ( rv  == 0 ) {
            break;
        }

        //print_encoded_message(encoded_message, sizeof(encoded_message));

        decode_message(encoded_message, sizeof(encoded_message), dest_names, message_info, message);


        // Private messages
        if ( !dest_names.empty() )
        {
            // for each destination names in encoded_message do
            for( const auto& d_name: dest_names )
            {
                int dest_socket_desc;

                // find dest_socket_desc
                std::map <std::string, int>::iterator it = clients_list.find(d_name);
                if (it != clients_list.end()) {
                    dest_socket_desc = it->second;
                } else {
                    std::cout << "From \"" << client_name << "\": destination name \"" << d_name << "\" not found" << std::endl;
                    continue;
                }

                std::cout << client_name << " -> " << d_name << ": " << message << std::endl;

                make_encoded_message(client_name, "Private", message, sizeof(output), output);

                // and send message to destination
                send(dest_socket_desc, output, sizeof(output), 0);

            }
        // Public messages
        } else {
            for( const auto& client: clients_list )
            {
                // send message to all except sender
                if ( client.first.compare(client_name) == 0 )
                {
                    continue;
                }
                std::cout << client_name << " -> " << client.first << ": " << message << std::endl;

                make_encoded_message(client_name, "Public", message, sizeof(output), output);

                send(client.second, output, sizeof(output), 0);
            }
        }

    }

    // removing connection information from clients_list
    clients_list.erase(client_name);

    // Notify to all clients that this connection is leaving
    for( const auto& client: clients_list )
    {
        make_encoded_message(client_name, "Server:online", std::string(" left the chat"), sizeof(output), output);
        //print_encoded_message(output, sizeof(output));

        send(client.second, output, sizeof(output), 0);
    }

    std::cout << "Closing connection with socket_fd: " << fd << ".  Name: " << client_name
                << ".  Exiting the thread." << std::endl;

    close(fd);
    pthread_exit(NULL);

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x830, %rsp            # imm = 0x830
movq %rdi, -0x8(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x20(%rbp)
movaps %xmm0, -0x30(%rbp)
movaps %xmm0, -0x40(%rbp)
movw $0x0, -0x10(%rbp)
leaq -0x258(%rbp), %rdi
callq 0x3790
leaq -0x278(%rbp), %rdi
callq 0x2370
leaq -0x298(%rbp), %rdi
callq 0x2370
movq -0x8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4a4(%rbp)
movl -0x4a4(%rbp), %edi
leaq -0x40(%rbp), %rsi
movl $0x32, %edx
xorl %ecx, %ecx
callq 0x20e0
jmp 0x29cc
leaq -0x4d8(%rbp), %rdi
callq 0x2370
movq $0x0, -0x4e0(%rbp)
leaq 0x8866(%rip), %rax      # 0xb250
movq %rax, -0x4e8(%rbp)
leaq 0x8858(%rip), %rdi      # 0xb250
callq 0x37b0
movq %rax, -0x4f0(%rbp)
leaq 0x8845(%rip), %rdi      # 0xb250
callq 0x37e0
movq %rax, -0x4f8(%rbp)
leaq -0x4f0(%rbp), %rdi
leaq -0x4f8(%rbp), %rsi
callq 0x3810
testb $0x1, %al
jne 0x2a33
jmp 0x2bca
leaq -0x4f0(%rbp), %rdi
callq 0x3840
movq %rax, -0x500(%rbp)
movq -0x500(%rbp), %rsi
leaq -0x4d8(%rbp), %rdi
callq 0x2350
jmp 0x2a5b
movq -0x4e0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x4e0(%rbp)
movq -0x4e0(%rbp), %rax
movq %rax, -0x6d0(%rbp)
leaq 0x87ce(%rip), %rdi      # 0xb250
callq 0x3860
movq %rax, %rcx
movq -0x6d0(%rbp), %rax
cmpq %rcx, %rax
jae 0x2adb
leaq 0x4613(%rip), %rsi      # 0x70b0
leaq -0x4d8(%rbp), %rdi
callq 0x2250
jmp 0x2aab
jmp 0x2adb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x4b0(%rbp)
movl %eax, -0x4b4(%rbp)
jmp 0x371b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x4b0(%rbp)
movl %eax, -0x4b4(%rbp)
jmp 0x370f
leaq -0x40(%rbp), %rax
movq %rax, -0x6e0(%rbp)
leaq -0x521(%rbp), %rdi
movq %rdi, -0x6d8(%rbp)
callq 0x23e0
movq -0x6d8(%rbp), %rdx
leaq 0x45b9(%rip), %rsi      # 0x70c0
leaq -0x520(%rbp), %rdi
callq 0x3880
jmp 0x2b15
movq -0x6e0(%rbp), %rdi
leaq 0x458f(%rip), %rsi      # 0x70b2
leaq -0x520(%rbp), %rdx
movl $0x200, %ecx            # imm = 0x200
leaq -0x4a0(%rbp), %r8
callq 0x5b10
jmp 0x2b3d
leaq -0x520(%rbp), %rdi
callq 0x21a0
leaq -0x521(%rbp), %rdi
callq 0x22c0
movq -0x500(%rbp), %rax
movl 0x20(%rax), %edi
leaq -0x4a0(%rbp), %rsi
movl $0x200, %edx            # imm = 0x200
xorl %ecx, %ecx
callq 0x2150
jmp 0x2b74
jmp 0x2b76
leaq -0x4f0(%rbp), %rdi
callq 0x3930
jmp 0x2a17
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x4b0(%rbp)
movl %eax, -0x4b4(%rbp)
jmp 0x2bb9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x4b0(%rbp)
movl %eax, -0x4b4(%rbp)
leaq -0x520(%rbp), %rdi
callq 0x21a0
leaq -0x521(%rbp), %rdi
callq 0x22c0
jmp 0x370f
leaq 0x867f(%rip), %rdi      # 0xb250
callq 0x3960
testb $0x1, %al
jne 0x2d72
leaq -0x548(%rbp), %rdi
callq 0x2370
cmpq $0x1, -0x4e0(%rbp)
jbe 0x2c7a
leaq -0x569(%rbp), %rdi
movq %rdi, -0x6e8(%rbp)
callq 0x23e0
movq -0x6e8(%rbp), %rdx
leaq 0x44b2(%rip), %rsi      # 0x70cb
leaq -0x568(%rbp), %rdi
callq 0x3880
jmp 0x2c27
leaq -0x548(%rbp), %rdi
leaq -0x568(%rbp), %rsi
callq 0x2330
leaq -0x568(%rbp), %rdi
callq 0x21a0
leaq -0x569(%rbp), %rdi
callq 0x22c0
jmp 0x2cf6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x4b0(%rbp)
movl %eax, -0x4b4(%rbp)
leaq -0x569(%rbp), %rdi
callq 0x22c0
jmp 0x2d61
leaq -0x591(%rbp), %rdi
movq %rdi, -0x6f0(%rbp)
callq 0x23e0
movq -0x6f0(%rbp), %rdx
leaq 0x4425(%rip), %rsi      # 0x70c0
leaq -0x590(%rbp), %rdi
callq 0x3880
jmp 0x2ca9
leaq -0x548(%rbp), %rdi
leaq -0x590(%rbp), %rsi
callq 0x2330
leaq -0x590(%rbp), %rdi
callq 0x21a0
leaq -0x591(%rbp), %rdi
callq 0x22c0
jmp 0x2cf6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x4b0(%rbp)
movl %eax, -0x4b4(%rbp)
leaq -0x591(%rbp), %rdi
callq 0x22c0
jmp 0x2d61
leaq -0x4d8(%rbp), %rdi
callq 0x2120
movq %rax, %rdi
leaq 0x43a6(%rip), %rsi      # 0x70b2
leaq -0x548(%rbp), %rdx
movl $0x200, %ecx            # imm = 0x200
leaq -0x4a0(%rbp), %r8
callq 0x5b10
jmp 0x2d26
movl -0x4a4(%rbp), %edi
leaq -0x4a0(%rbp), %rsi
movl $0x200, %edx            # imm = 0x200
xorl %ecx, %ecx
callq 0x2150
jmp 0x2d41
leaq -0x548(%rbp), %rdi
callq 0x21a0
jmp 0x2d72
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x4b0(%rbp)
movl %eax, -0x4b4(%rbp)
leaq -0x548(%rbp), %rdi
callq 0x21a0
jmp 0x370f
leaq -0x5e1(%rbp), %rdi
movq %rdi, -0x6f8(%rbp)
callq 0x23e0
movq -0x6f8(%rbp), %rdx
leaq -0x5e0(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x3880
jmp 0x2d9e
leaq -0x5c0(%rbp), %rdi
leaq -0x5e0(%rbp), %rsi
leaq -0x4a4(%rbp), %rdx
callq 0x39c0
jmp 0x2dba
leaq 0x848f(%rip), %rdi      # 0xb250
leaq -0x5c0(%rbp), %rsi
callq 0x3980
movb %dl, -0x701(%rbp)
movq %rax, -0x700(%rbp)
jmp 0x2ddc
movb -0x701(%rbp), %al
movq -0x700(%rbp), %rcx
movq %rcx, -0x5f8(%rbp)
movb %al, -0x5f0(%rbp)
leaq -0x5c0(%rbp), %rdi
callq 0x3a00
leaq -0x5e0(%rbp), %rdi
callq 0x21a0
leaq -0x5e1(%rbp), %rdi
callq 0x22c0
movq 0x81af(%rip), %rdi      # 0xafd0
leaq 0x42af(%rip), %rsi      # 0x70d7
callq 0x2260
movq %rax, -0x710(%rbp)
jmp 0x2e36
callq 0x2230
movq -0x710(%rbp), %rdi
movq %rax, %rsi
callq 0x2090
movq %rax, -0x718(%rbp)
jmp 0x2e53
movq -0x718(%rbp), %rdi
leaq 0x4301(%rip), %rsi      # 0x7162
callq 0x2260
movq %rax, -0x720(%rbp)
jmp 0x2e6f
movq -0x720(%rbp), %rdi
movl -0x4a4(%rbp), %esi
callq 0x23b0
movq %rax, -0x728(%rbp)
jmp 0x2e8a
movq -0x728(%rbp), %rdi
leaq 0x42d9(%rip), %rsi      # 0x7171
callq 0x2260
movq %rax, -0x730(%rbp)
jmp 0x2ea6
movq -0x730(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x2260
movq %rax, -0x738(%rbp)
jmp 0x2ebf
movq -0x738(%rbp), %rdi
movq 0x80f3(%rip), %rsi      # 0xafc0
callq 0x22a0
jmp 0x2ed4
jmp 0x2ed6
jmp 0x2ed8
leaq -0x240(%rbp), %rdi
movq %rdi, -0x758(%rbp)
xorl %esi, %esi
movl %esi, -0x744(%rbp)
movl $0x200, %edx            # imm = 0x200
movq %rdx, -0x750(%rbp)
callq 0x2170
leaq -0x258(%rbp), %rdi
callq 0x3a20
leaq -0x278(%rbp), %rdi
callq 0x2360
leaq -0x298(%rbp), %rdi
callq 0x2360
movq -0x750(%rbp), %rdx
movl -0x744(%rbp), %esi
leaq -0x4a0(%rbp), %rdi
callq 0x2170
movq -0x758(%rbp), %rsi
movq -0x750(%rbp), %rdx
movl -0x744(%rbp), %ecx
movl -0x4a4(%rbp), %edi
callq 0x20e0
movq %rax, -0x740(%rbp)
jmp 0x2f64
movq -0x740(%rbp), %rax
movl %eax, -0x5fc(%rbp)
cmpl $-0x1, -0x5fc(%rbp)
jne 0x303b
movq 0x806b(%rip), %rdi      # 0xaff0
leaq 0x4157(%rip), %rsi      # 0x70e3
callq 0x2260
movq %rax, -0x760(%rbp)
jmp 0x2f9a
callq 0x2040
movl (%rax), %edi
callq 0x20f0
movq -0x760(%rbp), %rdi
movq %rax, %rsi
callq 0x2260
movq %rax, -0x768(%rbp)
jmp 0x2fbe
movq -0x768(%rbp), %rdi
movq 0x7ff4(%rip), %rsi      # 0xafc0
callq 0x22a0
jmp 0x2fd3
jmp 0x346c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x4b0(%rbp)
movl %eax, -0x4b4(%rbp)
jmp 0x302a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x4b0(%rbp)
movl %eax, -0x4b4(%rbp)
jmp 0x301e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x4b0(%rbp)
movl %eax, -0x4b4(%rbp)
leaq -0x5c0(%rbp), %rdi
callq 0x3a00
leaq -0x5e0(%rbp), %rdi
callq 0x21a0
leaq -0x5e1(%rbp), %rdi
callq 0x22c0
jmp 0x370f
cmpl $0x0, -0x5fc(%rbp)
jne 0x3049
jmp 0x346c
jmp 0x304b
leaq -0x240(%rbp), %rdi
movl $0x200, %esi            # imm = 0x200
leaq -0x258(%rbp), %rdx
leaq -0x278(%rbp), %rcx
leaq -0x298(%rbp), %r8
callq 0x5cb0
jmp 0x3073
leaq -0x258(%rbp), %rdi
callq 0x3a40
testb $0x1, %al
jne 0x32f3
leaq -0x258(%rbp), %rax
movq %rax, -0x608(%rbp)
movq -0x608(%rbp), %rdi
callq 0x3a80
movq %rax, -0x610(%rbp)
movq -0x608(%rbp), %rdi
callq 0x3ab0
movq %rax, -0x618(%rbp)
leaq -0x610(%rbp), %rdi
leaq -0x618(%rbp), %rsi
callq 0x3ae0
testb $0x1, %al
jne 0x30d7
jmp 0x32ee
leaq -0x610(%rbp), %rdi
callq 0x3b20
movq %rax, -0x620(%rbp)
movq -0x620(%rbp), %rsi
leaq 0x8158(%rip), %rdi      # 0xb250
callq 0x3b40
movq %rax, -0x770(%rbp)
jmp 0x3106
movq -0x770(%rbp), %rax
movq %rax, -0x630(%rbp)
leaq 0x8135(%rip), %rdi      # 0xb250
callq 0x37e0
movq %rax, -0x638(%rbp)
leaq -0x630(%rbp), %rdi
leaq -0x638(%rbp), %rsi
callq 0x3810
testb $0x1, %al
jne 0x3140
jmp 0x315a
leaq -0x630(%rbp), %rdi
callq 0x3b70
movl 0x20(%rax), %eax
movl %eax, -0x624(%rbp)
jmp 0x31fd
movq 0x7e6f(%rip), %rdi      # 0xafd0
leaq 0x3f97(%rip), %rsi      # 0x70ff
callq 0x2260
movq %rax, -0x778(%rbp)
jmp 0x3176
movq -0x778(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x2260
movq %rax, -0x780(%rbp)
jmp 0x318f
movq -0x780(%rbp), %rdi
leaq 0x3f69(%rip), %rsi      # 0x7106
callq 0x2260
movq %rax, -0x788(%rbp)
jmp 0x31ab
movq -0x788(%rbp), %rdi
movq -0x620(%rbp), %rsi
callq 0x2220
movq %rax, -0x790(%rbp)
jmp 0x31c7
movq -0x790(%rbp), %rdi
leaq 0x3f47(%rip), %rsi      # 0x711c
callq 0x2260
movq %rax, -0x798(%rbp)
jmp 0x31e3
movq -0x798(%rbp), %rdi
movq 0x7dcf(%rip), %rsi      # 0xafc0
callq 0x22a0
jmp 0x31f8
jmp 0x32dd
movq 0x7dcc(%rip), %rdi      # 0xafd0
leaq -0x40(%rbp), %rsi
callq 0x2260
movq %rax, -0x7a0(%rbp)
jmp 0x3216
movq -0x7a0(%rbp), %rdi
leaq 0x3f04(%rip), %rsi      # 0x7128
callq 0x2260
movq %rax, -0x7a8(%rbp)
jmp 0x3232
movq -0x7a8(%rbp), %rdi
movq -0x620(%rbp), %rsi
callq 0x2220
movq %rax, -0x7b0(%rbp)
jmp 0x324e
movq -0x7b0(%rbp), %rdi
leaq 0x3e84(%rip), %rsi      # 0x70e0
callq 0x2260
movq %rax, -0x7b8(%rbp)
jmp 0x326a
movq -0x7b8(%rbp), %rdi
leaq -0x298(%rbp), %rsi
callq 0x2220
movq %rax, -0x7c0(%rbp)
jmp 0x3286
movq -0x7c0(%rbp), %rdi
movq 0x7d2c(%rip), %rsi      # 0xafc0
callq 0x22a0
jmp 0x329b
leaq 0x3e8b(%rip), %rsi      # 0x712d
leaq -0x40(%rbp), %rdi
leaq -0x298(%rbp), %rdx
movl $0x200, %ecx            # imm = 0x200
leaq -0x4a0(%rbp), %r8
callq 0x5b10
jmp 0x32c0
movl -0x624(%rbp), %edi
leaq -0x4a0(%rbp), %rsi
movl $0x200, %edx            # imm = 0x200
xorl %ecx, %ecx
callq 0x2150
jmp 0x32db
jmp 0x32dd
leaq -0x610(%rbp), %rdi
callq 0x3b90
jmp 0x30bb
jmp 0x3467
leaq 0x7f56(%rip), %rax      # 0xb250
movq %rax, -0x640(%rbp)
leaq 0x7f48(%rip), %rdi      # 0xb250
callq 0x37b0
movq %rax, -0x648(%rbp)
leaq 0x7f35(%rip), %rdi      # 0xb250
callq 0x37e0
movq %rax, -0x650(%rbp)
leaq -0x648(%rbp), %rdi
leaq -0x650(%rbp), %rsi
callq 0x3810
testb $0x1, %al
jne 0x3343
jmp 0x3465
leaq -0x648(%rbp), %rdi
callq 0x3840
movq %rax, -0x658(%rbp)
movq -0x658(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x20c0
cmpl $0x0, %eax
jne 0x3370
jmp 0x3454
movq 0x7c59(%rip), %rdi      # 0xafd0
leaq -0x40(%rbp), %rsi
callq 0x2260
movq %rax, -0x7c8(%rbp)
jmp 0x3389
movq -0x7c8(%rbp), %rdi
leaq 0x3d91(%rip), %rsi      # 0x7128
callq 0x2260
movq %rax, -0x7d0(%rbp)
jmp 0x33a5
movq -0x7d0(%rbp), %rdi
movq -0x658(%rbp), %rsi
callq 0x2220
movq %rax, -0x7d8(%rbp)
jmp 0x33c1
movq -0x7d8(%rbp), %rdi
leaq 0x3d11(%rip), %rsi      # 0x70e0
callq 0x2260
movq %rax, -0x7e0(%rbp)
jmp 0x33dd
movq -0x7e0(%rbp), %rdi
leaq -0x298(%rbp), %rsi
callq 0x2220
movq %rax, -0x7e8(%rbp)
jmp 0x33f9
movq -0x7e8(%rbp), %rdi
movq 0x7bb9(%rip), %rsi      # 0xafc0
callq 0x22a0
jmp 0x340e
leaq 0x3d20(%rip), %rsi      # 0x7135
leaq -0x40(%rbp), %rdi
leaq -0x298(%rbp), %rdx
movl $0x200, %ecx            # imm = 0x200
leaq -0x4a0(%rbp), %r8
callq 0x5b10
jmp 0x3433
movq -0x658(%rbp), %rax
movl 0x20(%rax), %edi
leaq -0x4a0(%rbp), %rsi
movl $0x200, %edx            # imm = 0x200
xorl %ecx, %ecx
callq 0x2150
jmp 0x3452
jmp 0x3454
leaq -0x648(%rbp), %rdi
callq 0x3930
jmp 0x3327
jmp 0x3467
jmp 0x2ed6
leaq -0x679(%rbp), %rdi
movq %rdi, -0x7f0(%rbp)
callq 0x23e0
movq -0x7f0(%rbp), %rdx
leaq -0x678(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x3880
jmp 0x3498
leaq 0x7db1(%rip), %rdi      # 0xb250
leaq -0x678(%rbp), %rsi
callq 0x3bb0
jmp 0x34ad
leaq -0x678(%rbp), %rdi
callq 0x21a0
leaq -0x679(%rbp), %rdi
callq 0x22c0
leaq 0x7d84(%rip), %rax      # 0xb250
movq %rax, -0x688(%rbp)
leaq 0x7d76(%rip), %rdi      # 0xb250
callq 0x37b0
movq %rax, -0x690(%rbp)
leaq 0x7d63(%rip), %rdi      # 0xb250
callq 0x37e0
movq %rax, -0x698(%rbp)
leaq -0x690(%rbp), %rdi
leaq -0x698(%rbp), %rsi
callq 0x3810
testb $0x1, %al
jne 0x3515
jmp 0x365a
leaq -0x690(%rbp), %rdi
callq 0x3840
movq %rax, -0x6a0(%rbp)
leaq -0x40(%rbp), %rax
movq %rax, -0x800(%rbp)
leaq -0x6c1(%rbp), %rdi
movq %rdi, -0x7f8(%rbp)
callq 0x23e0
movq -0x7f8(%rbp), %rdx
leaq 0x3be8(%rip), %rsi      # 0x713c
leaq -0x6c0(%rbp), %rdi
callq 0x3880
jmp 0x3562
movq -0x800(%rbp), %rdi
leaq 0x3b42(%rip), %rsi      # 0x70b2
leaq -0x6c0(%rbp), %rdx
movl $0x200, %ecx            # imm = 0x200
leaq -0x4a0(%rbp), %r8
callq 0x5b10
jmp 0x358a
leaq -0x6c0(%rbp), %rdi
callq 0x21a0
leaq -0x6c1(%rbp), %rdi
callq 0x22c0
movq -0x6a0(%rbp), %rax
movl 0x20(%rax), %edi
leaq -0x4a0(%rbp), %rsi
movl $0x200, %edx            # imm = 0x200
xorl %ecx, %ecx
callq 0x2150
jmp 0x35c1
jmp 0x35c3
leaq -0x690(%rbp), %rdi
callq 0x3930
jmp 0x34f9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x4b0(%rbp)
movl %eax, -0x4b4(%rbp)
jmp 0x3606
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x4b0(%rbp)
movl %eax, -0x4b4(%rbp)
leaq -0x678(%rbp), %rdi
callq 0x21a0
leaq -0x679(%rbp), %rdi
callq 0x22c0
jmp 0x370f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x4b0(%rbp)
movl %eax, -0x4b4(%rbp)
jmp 0x3649
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x4b0(%rbp)
movl %eax, -0x4b4(%rbp)
leaq -0x6c0(%rbp), %rdi
callq 0x21a0
leaq -0x6c1(%rbp), %rdi
callq 0x22c0
jmp 0x370f
movq 0x796f(%rip), %rdi      # 0xafd0
leaq 0x3ae3(%rip), %rsi      # 0x714b
callq 0x2260
movq %rax, -0x808(%rbp)
jmp 0x3676
movq -0x808(%rbp), %rdi
movl -0x4a4(%rbp), %esi
callq 0x23b0
movq %rax, -0x810(%rbp)
jmp 0x3691
movq -0x810(%rbp), %rdi
leaq 0x3ad0(%rip), %rsi      # 0x716f
callq 0x2260
movq %rax, -0x818(%rbp)
jmp 0x36ad
movq -0x818(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x2260
movq %rax, -0x820(%rbp)
jmp 0x36c6
movq -0x820(%rbp), %rdi
leaq 0x3aa5(%rip), %rsi      # 0x7179
callq 0x2260
movq %rax, -0x828(%rbp)
jmp 0x36e2
movq -0x828(%rbp), %rdi
movq 0x78d0(%rip), %rsi      # 0xafc0
callq 0x22a0
jmp 0x36f7
movl -0x4a4(%rbp), %edi
callq 0x2430
jmp 0x3704
xorl %eax, %eax
movl %eax, %edi
callq 0x23d0
jmp 0x370f
leaq -0x4d8(%rbp), %rdi
callq 0x21a0
leaq -0x298(%rbp), %rdi
callq 0x21a0
leaq -0x278(%rbp), %rdi
callq 0x21a0
leaq -0x258(%rbp), %rdi
callq 0x3be0
movq -0x4b0(%rbp), %rdi
callq 0x23c0
nopl (%rax,%rax)