// File: /workspace/github_cpp_makefile_star2_O2/bchu7796[P]p2p-file-sharing/server.cpp
// Function: server::location_reply(int)
int server::location_reply(int process_fd){
    std::string file_name;
    recv(process_fd, &file_name, sizeof(file_name), 0);
    int i;
    for(i = 0; i < files.size(); i++){
        if(files[i].file_name == file_name){
            uint16_t number_of_address = files[i].peers.size();
            send(process_fd, &number_of_address, sizeof(number_of_address), 0);
            send(process_fd, &files[i].file_length, sizeof(files[i].file_length), 0);
            for(int j=0; j<number_of_address; j++){
                send(process_fd, &files[i].peers[j].address, sizeof(files[i].peers[j].address), 0);
                send(process_fd, &files[i].peers[j].port, sizeof(files[i].peers[j].port), 0);
                uint16_t number_of_chunks = files[i].peers[j].chunks.size();
                send(process_fd, &number_of_chunks, sizeof(number_of_chunks), 0);
                for(int k = 0; k < number_of_chunks; k++){
                    send(process_fd, &files[i].peers[j].chunks[k], sizeof(files[i].peers[j].chunks[k]), 0);
                }
            }
        }
    }
    if( i == files.size()){
        uint16_t number_of_address = 0;
        send(process_fd, &number_of_address, sizeof(number_of_address), 0);
    }
    close(process_fd);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %esi, %ebx
leaq 0x28(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x18(%rsp), %rsi
pushq $0x20
popq %rdx
movl %ebx, %edi
xorl %ecx, %ecx
callq 0x2070
xorl %ecx, %ecx
pushq $0x2
popq %r12
pushq $0x4
popq %r13
movq 0x58dd(%rip), %rax      # 0x81a0
movq 0x58ce(%rip), %rdi      # 0x8198
subq %rdi, %rax
sarq $0x6, %rax
cmpq %rcx, %rax
jbe 0x2a22
movq %rcx, %r14
movq %rcx, %r15
shlq $0x6, %r15
addq %r15, %rdi
leaq 0x18(%rsp), %rsi
callq 0x304f
testb %al, %al
je 0x2a17
movq %r14, 0x8(%rsp)
movq 0x5893(%rip), %rax      # 0x8198
movl 0x30(%rax,%r15), %ecx
subl 0x28(%rax,%r15), %ecx
shrl $0x5, %ecx
movw %cx, 0x4(%rsp)
movl %ebx, %edi
leaq 0x4(%rsp), %rsi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x2100
movq 0x5869(%rip), %rax      # 0x8198
leaq (%rax,%r15), %rsi
addq $0x20, %rsi
movl %ebx, %edi
movq %r13, %rdx
xorl %ecx, %ecx
callq 0x2100
xorl %ebp, %ebp
movzwl 0x4(%rsp), %eax
cmpq %rax, %rbp
jae 0x2a12
movq 0x583e(%rip), %rax      # 0x8198
movq %rbp, %r14
shlq $0x5, %r14
movq 0x28(%rax,%r15), %rsi
addq %r14, %rsi
movl %ebx, %edi
movq %r13, %rdx
xorl %ecx, %ecx
callq 0x2100
movq 0x581c(%rip), %rax      # 0x8198
movq 0x28(%rax,%r15), %rax
leaq (%rax,%r14), %rsi
addq $0x4, %rsi
movl %ebx, %edi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x2100
movq 0x57fc(%rip), %rax      # 0x8198
movq 0x28(%rax,%r15), %rax
movl 0x10(%rax,%r14), %ecx
subl 0x8(%rax,%r14), %ecx
shrl $0x2, %ecx
movw %cx, 0x6(%rsp)
movl %ebx, %edi
leaq 0x6(%rsp), %rsi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x2100
movq %rbp, 0x10(%rsp)
xorl %r12d, %r12d
xorl %ebp, %ebp
movzwl 0x6(%rsp), %eax
cmpq %rax, %rbp
jae 0x2a01
movq 0x57b9(%rip), %rax      # 0x8198
movq 0x28(%rax,%r15), %rax
movq 0x8(%rax,%r14), %rsi
addq %r12, %rsi
movl %ebx, %edi
movq %r13, %rdx
xorl %ecx, %ecx
callq 0x2100
incq %rbp
addq $0x4, %r12
jmp 0x29ce
movq 0x10(%rsp), %rbp
incq %rbp
pushq $0x2
popq %r12
jmp 0x2945
movq 0x8(%rsp), %r14
incq %r14
movq %r14, %rcx
jmp 0x28bc
jne 0x2a39
leaq 0x4(%rsp), %rsi
andw $0x0, (%rsi)
pushq $0x2
popq %rdx
movl %ebx, %edi
xorl %ecx, %ecx
callq 0x2100
movl %ebx, %edi
callq 0x22d0
leaq 0x18(%rsp), %rdi
callq 0x20d0
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2a67
jmp 0x2a67
jmp 0x2a67
jmp 0x2a67
jmp 0x2a67
jmp 0x2a67
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x20d0
movq %rbx, %rdi
callq 0x22b0