// File: /workspace/github_cpp_makefile_star2_O1/yasz24[P]eau2/src/network/./network_ip.h
// Function: NetworkIP::server_init(unsigned long, char*, unsigned long, unsigned long)
void server_init(size_t idx, char* ip, size_t port, size_t num_nodes) {
        this_node_ = idx;
        init_sock_(ip, port);
        std::cout << "initialized socket, listening on " << ip << ":" << port << "\n";
        num_nodes_ = num_nodes;
        nodes_ = new NodeInfo[num_nodes];
        for (size_t i = 0; i < num_nodes_; i++) nodes_[i].id = 0;
        nodes_[0].address = ip_;
        nodes_[0].id = 0;
        for (size_t i = 1; i < num_nodes; i++) {
            Register* msg = dynamic_cast<Register*>(recv_msg());
            //std::cout  << "Registration msg received, " << "client: " << msg->client << ":" << msg->port_ <<"\n";
            nodes_[msg->sender()].id = msg->sender();
            nodes_[msg->sender()].address.sin_family = AF_INET;
            inet_pton(AF_INET, msg->client, &nodes_[msg->sender()].address.sin_addr);
            nodes_[msg->sender()].address.sin_port = htons(msg->port_);
        }
        size_t *ports = new size_t[num_nodes_];
        String** addresses = new String*[num_nodes_];
        for (size_t i = 0; i < num_nodes_; i++) {
            ports[i] = ntohs(nodes_[i].address.sin_port);
            char client_ip[INET_ADDRSTRLEN];
            inet_ntop(AF_INET, &nodes_[i].address.sin_addr, client_ip, INET_ADDRSTRLEN);
            addresses[i] = new String(client_ip);
        }
        Directory ipd(this_node_, 0, msg_id, num_nodes_, ports, addresses);

        for (size_t i = 1; i < num_nodes_; i++) {
            ipd.target_ = i;
            send_msg(&ipd);
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %r8, %r14
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, 0x20(%rdi)
movq %rdi, %r15
movq %rdx, %rsi
movq %rcx, %rdx
callq 0x7e82
movq 0x2278d(%rip), %r13     # 0x29fd0
leaq 0x15911(%rip), %rsi     # 0x1d15b
movl $0x21, %edx
movq %r13, %rdi
callq 0x7280
testq %r12, %r12
je 0x7878
movq %r12, %rdi
callq 0x7100
movq 0x22765(%rip), %rdi     # 0x29fd0
movq %r12, %rsi
movq %rax, %rdx
callq 0x7280
jmp 0x7891
movq (%r13), %rax
movq -0x18(%rax), %rax
leaq (%rax,%r13), %rdi
movl 0x20(%r13,%rax), %esi
orl $0x1, %esi
callq 0x7370
movl $0x28, %ecx
movq %r14, %rax
mulq %rcx
seto %cl
addq $0x8, %rax
movq $-0x1, %r12
cmovbq %r12, %rax
leaq 0x1583b(%rip), %rsi     # 0x1d0f0
movq 0x22714(%rip), %r13     # 0x29fd0
testb %cl, %cl
cmoveq %rax, %r12
movl $0x1, %edx
movq %r13, %rdi
callq 0x7280
movq %r13, %rdi
movq %rbx, %rsi
callq 0x7170
movl $0x1, %edx
movq %rax, %rdi
leaq 0x15805(%rip), %rsi     # 0x1d0ee
callq 0x7280
movq %r15, %rbx
movq %r14, 0x18(%r15)
movq %r12, %rdi
callq 0x7030
movq %r14, (%rax)
leaq 0x8(%rax), %rcx
testq %r14, %r14
je 0x7934
leaq (,%r14,8), %rdx
leaq (%rdx,%rdx,4), %rdx
xorl %esi, %esi
leaq 0x20a02(%rip), %rdi     # 0x28320
movq $0x0, 0x8(%rcx,%rsi)
movq %rdi, (%rcx,%rsi)
addq $0x28, %rsi
cmpq %rsi, %rdx
jne 0x791e
movq %rcx, 0x10(%rbx)
testq %r14, %r14
je 0x7957
movq %rax, %rcx
addq $0x18, %rcx
movq %r14, %rdx
movq $0x0, (%rcx)
addq $0x28, %rcx
decq %rdx
jne 0x7947
movups 0x2c(%rbx), %xmm0
movups %xmm0, 0x20(%rax)
movq $0x0, 0x18(%rax)
cmpq $0x2, %r14
jb 0x79f3
decq %r14
leaq 0x2097d(%rip), %r12     # 0x282f8
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x58(%rax)
testq %rax, %rax
je 0x79a2
movq %rax, %rdi
leaq 0x2094d(%rip), %rsi     # 0x282e0
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x7270
movq %rax, %r13
jmp 0x79a5
xorl %r13d, %r13d
movq 0x18(%r13), %rax
movq %r15, %rbx
movq 0x10(%r15), %rcx
leaq (%rax,%rax,4), %rdx
leaq (%rcx,%rdx,8), %rdx
addq $0x1c, %rdx
movq %rax, -0xc(%rdx)
movw $0x2, -0x4(%rdx)
movq 0x30(%r13), %rsi
movl $0x2, %edi
callq 0x73c0
movzwl 0x38(%r13), %eax
rolw $0x8, %ax
movq 0x10(%r15), %rcx
movq 0x18(%r13), %rdx
leaq (%rdx,%rdx,4), %rdx
movw %ax, 0x1a(%rcx,%rdx,8)
decq %r14
jne 0x797b
movq 0x18(%rbx), %r13
movq %r13, %rax
shrq $0x3d, %rax
leaq (,%r13,8), %rcx
xorl %r14d, %r14d
negq %rax
sbbq %r14, %r14
orq %rcx, %r14
movq %r14, %rdi
callq 0x7030
movq %rax, -0x38(%rbp)
movq %r14, %rdi
callq 0x7030
movq %rax, -0x30(%rbp)
testq %r13, %r13
movq %rbx, %r15
je 0x7afc
movl $0x1c, %ecx
xorl %edx, %edx
movq 0x10(%r15), %rsi
movzwl -0x2(%rsi,%rcx), %eax
movq %rcx, -0x48(%rbp)
addq %rcx, %rsi
rolw $0x8, %ax
movzwl %ax, %eax
movq -0x38(%rbp), %rcx
movq %rdx, -0x40(%rbp)
movq %rax, (%rcx,%rdx,8)
movl $0x2, %edi
leaq -0x90(%rbp), %rbx
movq %rbx, %rdx
movl $0x10, %ecx
callq 0x7250
movl $0x20, %edi
callq 0x7230
movq %rax, %r13
movq %rbx, %rdi
callq 0x7100
movq %rax, %r14
movq $0x0, 0x8(%r13)
leaq 0x208e8(%rip), %rax     # 0x28388
movq %rax, (%r13)
movq %r14, 0x10(%r13)
movq %r15, %rbx
leaq 0x1(%r14), %r15
movq %r15, %rdi
callq 0x7030
movq %rax, %r12
movq %rax, 0x18(%r13)
movq %rax, %rdi
leaq -0x90(%rbp), %rsi
movq %r15, %rdx
callq 0x71a0
movb $0x0, (%r12,%r14)
movq -0x30(%rbp), %rax
movq -0x40(%rbp), %rdx
movq %r13, (%rax,%rdx,8)
incq %rdx
movq 0x18(%rbx), %r13
movq -0x48(%rbp), %rcx
addq $0x28, %rcx
cmpq %r13, %rdx
movq %rbx, %r15
jb 0x7a3d
movq 0x20(%r15), %rsi
movq 0x40(%r15), %rcx
movq -0x30(%rbp), %rax
movq %rax, (%rsp)
leaq -0x90(%rbp), %rdi
xorl %edx, %edx
movq %r13, %r8
movq -0x38(%rbp), %r9
callq 0x7f88
cmpq $0x2, 0x18(%r15)
jb 0x7b4d
movl $0x1, %ebx
leaq -0x90(%rbp), %r14
movq %rbx, -0x70(%rbp)
movq (%r15), %rax
movq %r15, %rdi
movq %r14, %rsi
callq *0x50(%rax)
incq %rbx
cmpq 0x18(%r15), %rbx
jb 0x7b34
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %r13, %rdi
callq 0x7200
movq %rbx, %rdi
callq 0x7390
nop