// File: /workspace/github_cpp_makefile_star2_O3/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 $0x88, %rsp
movq %r8, %r14
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, 0x20(%rdi)
movq %rdi, -0x30(%rbp)
movq %rdx, %rsi
movq %rcx, %rdx
callq 0x7ea8
movq 0x217a3(%rip), %r13     # 0x28fd0
leaq 0x15927(%rip), %rsi     # 0x1d15b
movl $0x21, %edx
movq %r13, %rdi
callq 0x7280
testq %r12, %r12
je 0x7862
movq %r12, %rdi
callq 0x7100
movq 0x2177b(%rip), %rdi     # 0x28fd0
movq %r12, %rsi
movq %rax, %rdx
callq 0x7280
jmp 0x787b
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 0x15851(%rip), %rsi     # 0x1d0f0
movq 0x2172a(%rip), %rbx     # 0x28fd0
leaq 0x15841(%rip), %r13     # 0x1d0ee
testb %cl, %cl
cmoveq %rax, %r12
movl $0x1, %edx
movq %rbx, %rdi
callq 0x7280
movq %rbx, %rdi
movq %r15, %rsi
callq 0x7170
movl $0x1, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x7280
movq -0x30(%rbp), %rbx
movq %r14, 0x18(%rbx)
movq %r12, %rdi
callq 0x7030
movq %r14, (%rax)
leaq 0x8(%rax), %rcx
testq %r14, %r14
je 0x7a05
leaq (,%r14,8), %rdx
leaq (%rdx,%rdx,4), %rdx
xorl %esi, %esi
leaq 0x1fa48(%rip), %rdi     # 0x27358
movq $0x0, 0x10(%rax,%rsi)
movq %rdi, 0x8(%rax,%rsi)
addq $0x28, %rsi
cmpq %rsi, %rdx
jne 0x7910
leaq 0x10(%rbx), %rdx
movq %rdx, -0x38(%rbp)
movq %rcx, 0x10(%rbx)
testq %r14, %r14
je 0x7a11
movq %rax, %rcx
addq $0x18, %rcx
movq %r14, %rdx
movq $0x0, (%rcx)
addq $0x28, %rcx
decq %rdx
jne 0x7946
movups 0x2c(%rbx), %xmm0
movups %xmm0, 0x20(%rax)
movq $0x0, 0x18(%rax)
movl $0x1, %r15d
cmpq $0x1, %r14
je 0x7a24
decq %r14
leaq 0x1f998(%rip), %r15     # 0x27318
leaq 0x1f9a9(%rip), %r12     # 0x27330
movq -0x38(%rbp), %rbx
movq -0x30(%rbp), %rdi
movq (%rdi), %rax
callq *0x58(%rax)
testq %rax, %rax
je 0x79af
movq %rax, %rdi
movq %r15, %rsi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x7270
movq %rax, %r13
jmp 0x79b2
xorl %r13d, %r13d
movq 0x18(%r13), %rax
movq (%rbx), %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 (%rbx), %rcx
movq 0x18(%r13), %rdx
leaq (%rdx,%rdx,4), %rdx
movw %ax, 0x1a(%rcx,%rdx,8)
decq %r14
jne 0x798b
movq -0x30(%rbp), %rax
movq 0x18(%rax), %r15
jmp 0x7a24
leaq 0x10(%rbx), %rdx
movq %rdx, -0x38(%rbp)
movq %rcx, 0x10(%rbx)
movups 0x2c(%rbx), %xmm0
movups %xmm0, 0x20(%rax)
movq $0x0, 0x18(%rax)
xorl %r15d, %r15d
movq %r15, %rax
shrq $0x3d, %rax
leaq (,%r15,8), %rcx
xorl %r13d, %r13d
negq %rax
movl $0x0, %ebx
sbbq %rbx, %rbx
orq %rcx, %rbx
movq %rbx, %rdi
callq 0x7030
movq %rax, -0x48(%rbp)
movq %rbx, %rdi
callq 0x7030
movq %rax, -0x40(%rbp)
testq %r15, %r15
je 0x7b25
movl $0x1c, %ecx
xorl %r12d, %r12d
movq -0x38(%rbp), %rax
movq (%rax), %rsi
movzwl -0x2(%rsi,%rcx), %eax
movq %rcx, -0x50(%rbp)
addq %rcx, %rsi
rolw $0x8, %ax
movzwl %ax, %eax
movq -0x48(%rbp), %rcx
movq %rax, (%rcx,%r12,8)
movl $0x2, %edi
leaq -0xa0(%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 0x1f8f1(%rip), %rax     # 0x273c0
movq %rax, (%r13)
movq %r14, 0x10(%r13)
leaq 0x1(%r14), %r15
movq %r15, %rdi
callq 0x7030
movq %rax, %rbx
movq %rax, 0x18(%r13)
movq %rax, %rdi
leaq -0xa0(%rbp), %rsi
movq %r15, %rdx
callq 0x71a0
movb $0x0, (%rbx,%r14)
movq -0x40(%rbp), %rax
movq %r13, (%rax,%r12,8)
incq %r12
movq -0x30(%rbp), %rax
movq 0x18(%rax), %r13
movq -0x50(%rbp), %rcx
addq $0x28, %rcx
cmpq %r13, %r12
jb 0x7a6d
movq -0x30(%rbp), %r15
movq 0x20(%r15), %rsi
movq 0x40(%r15), %rcx
movq -0x40(%rbp), %rax
movq %rax, (%rsp)
leaq -0xa0(%rbp), %rdi
xorl %edx, %edx
movq %r13, %r8
movq -0x48(%rbp), %r9
callq 0x7fae
cmpq $0x2, 0x18(%r15)
jb 0x7b7a
movl $0x1, %ebx
leaq -0xa0(%rbp), %r14
movq %rbx, -0x80(%rbp)
movq (%r15), %rax
movq %r15, %rdi
movq %r14, %rsi
callq *0x50(%rax)
incq %rbx
cmpq 0x18(%r15), %rbx
jb 0x7b61
addq $0x88, %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