// File: /workspace/github_cpp_makefile_star2_O2/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 $0x68, %rsp
movq %r8, %r14
movq %rcx, %r15
movq %rdx, %r13
movq %rdi, %rbx
pushq $0x28
popq %rcx
movq %r8, %rax
mulq %rcx
seto %cl
addq $0x8, %rax
pushq $-0x1
popq %r12
cmovbq %r12, %rax
movq %rsi, 0x20(%rdi)
testb %cl, %cl
cmoveq %rax, %r12
movq %r13, %rsi
movq %r15, %rdx
callq 0x7d30
movq 0x1d88f(%rip), %rdi     # 0x24fc0
leaq 0x10a23(%rip), %rsi     # 0x1815b
callq 0x7240
movq %rax, %rdi
movq %r13, %rsi
callq 0x7240
movq %rax, %rdi
leaq 0x1099e(%rip), %rsi     # 0x180f0
callq 0x7240
movq %rax, %rdi
movq %r15, %rsi
callq 0x7190
movq %rax, %rdi
leaq 0x10982(%rip), %rsi     # 0x180ee
callq 0x7240
movq %r14, 0x18(%rbx)
movq %r12, %rdi
callq 0x7030
movq %r14, (%rax)
leaq 0x8(%rax), %rcx
testq %r14, %r14
je 0x77aa
imulq $0x28, %r14, %rdx
xorl %esi, %esi
leaq 0x1bb9a(%rip), %rdi     # 0x23330
andq $0x0, 0x10(%rax,%rsi)
movq %rdi, 0x8(%rax,%rsi)
addq $0x28, %rsi
cmpq %rsi, %rdx
jne 0x7796
movq %rcx, 0x10(%rbx)
movq %rax, %rcx
addq $0x18, %rcx
movq %r14, %rdx
subq $0x1, %rdx
jb 0x77c8
andq $0x0, (%rcx)
addq $0x28, %rcx
jmp 0x77b8
movups 0x2c(%rbx), %xmm0
movups %xmm0, 0x20(%rax)
andq $0x0, 0x18(%rax)
pushq $0x1
popq %r13
pushq $0x2
popq %r15
cmpq %r14, %r13
jae 0x7859
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x58(%rax)
testq %rax, %rax
je 0x780d
movq %rax, %rdi
leaq 0x1baf6(%rip), %rsi     # 0x232f0
leaq 0x1bb07(%rip), %rdx     # 0x23308
xorl %ecx, %ecx
callq 0x7290
movq %rax, %r12
jmp 0x7810
xorl %r12d, %r12d
movq 0x18(%r12), %rax
movq 0x10(%rbx), %rcx
imulq $0x28, %rax, %rdx
addq %rcx, %rdx
addq $0x1c, %rdx
movq %rax, -0xc(%rdx)
movw $0x2, -0x4(%rdx)
movq 0x30(%r12), %rsi
movl %r15d, %edi
callq 0x73a0
movzwl 0x38(%r12), %eax
rolw $0x8, %ax
movq 0x10(%rbx), %rcx
imulq $0x28, 0x18(%r12), %rdx
movw %ax, 0x1a(%rcx,%rdx)
incq %r13
jmp 0x77dd
movq 0x18(%rbx), %r12
movq %r12, %rax
shrq $0x3d, %rax
leaq (,%r12,8), %rcx
xorl %r14d, %r14d
negq %rax
movl $0x0, %r15d
sbbq %r15, %r15
orq %rcx, %r15
movq %r15, %rdi
callq 0x7030
movq %rax, -0x38(%rbp)
movq %r15, %rdi
callq 0x7030
movq %rax, -0x30(%rbp)
pushq $0x1c
popq %r15
leaq -0x80(%rbp), %r13
cmpq %r12, %r14
jae 0x78f8
movq 0x10(%rbx), %rsi
movzwl -0x2(%rsi,%r15), %eax
addq %r15, %rsi
rolw $0x8, %ax
movzwl %ax, %eax
movq -0x38(%rbp), %rcx
movq %rax, (%rcx,%r14,8)
pushq $0x2
popq %rdi
movq %r13, %rdx
pushq $0x10
popq %rcx
callq 0x7270
pushq $0x20
popq %rdi
callq 0x7250
movq %rax, %r12
movq %rax, %rdi
movq %r13, %rsi
callq 0x7e20
movq -0x30(%rbp), %rax
movq %r12, (%rax,%r14,8)
incq %r14
movq 0x18(%rbx), %r12
addq $0x28, %r15
jmp 0x789e
movq 0x20(%rbx), %rsi
movq 0x40(%rbx), %rcx
movq -0x30(%rbp), %rax
movq %rax, (%rsp)
leaq -0x80(%rbp), %r15
movq %r15, %rdi
xorl %edx, %edx
movq %r12, %r8
movq -0x38(%rbp), %r9
callq 0x7e48
pushq $0x1
popq %r14
cmpq 0x18(%rbx), %r14
jae 0x793c
movq %r14, -0x60(%rbp)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r15, %rsi
callq *0x50(%rax)
incq %r14
jmp 0x7921
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %r12, %rdi
callq 0x7220
movq %rbx, %rdi
callq 0x7370