// File: yasz24[P]eau2/src/network/server.cpp
// Function: main
int main(int argc , char *argv[]) {
	char *ip;
	size_t port;
	size_t num_nodes;

	if (argc != 5  || (strcmp(argv[1], "-ip") != 0) || (strcmp(argv[3], "-nodes") != 0)) {
	    fprintf(stderr,"usage: server -ip <host-ip-address>:PORT -nodes <num_nodes>\n");
	    _exit(1);
	} 
	ip = strtok(argv[2], ":");
    port = std::stoi(strtok(NULL, ":"));
    //std::cout << "port:"<< port << "\n";
	num_nodes = std::stoi(argv[4]);
    //std::cout << "nodes:"<< num_nodes << "\n";

    NetworkIP* client_ = new NetworkIP();

    client_->server_init(0, ip, port, num_nodes);
	Demo* demo = new Demo(0, client_);
	demo->start_kv();
	demo->run_();
	while (true) {

	}
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x5, -0x8(%rbp)
jne 0x8631
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x23ade(%rip), %rsi     # 0x2c0ec
callq 0x8310
cmpl $0x0, %eax
jne 0x8631
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
leaq 0x23ac9(%rip), %rsi     # 0x2c0f0
callq 0x8310
cmpl $0x0, %eax
je 0x8653
movq 0x33998(%rip), %rax     # 0x3bfd0
movq (%rax), %rdi
leaq 0x23ab5(%rip), %rsi     # 0x2c0f7
movb $0x0, %al
callq 0x8330
movl $0x1, %edi
callq 0x83a0
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
leaq 0x23ad2(%rip), %rsi     # 0x2c134
movq %rsi, -0xb0(%rbp)
callq 0x8390
movq -0xb0(%rbp), %rsi
movq %rax, -0x18(%rbp)
xorl %eax, %eax
movl %eax, %edi
callq 0x8390
movq %rax, -0xa8(%rbp)
leaq -0x49(%rbp), %rdi
movq %rdi, -0xa0(%rbp)
callq 0x83f0
movq -0xa8(%rbp), %rsi
movq -0xa0(%rbp), %rdx
leaq -0x48(%rbp), %rdi
callq 0x8300
jmp 0x86b2
xorl %eax, %eax
movl %eax, %esi
leaq -0x48(%rbp), %rdi
movl $0xa, %edx
callq 0x8950
movl %eax, -0xb4(%rbp)
jmp 0x86cc
movl -0xb4(%rbp), %eax
cltq
movq %rax, -0x20(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x8190
leaq -0x49(%rbp), %rdi
callq 0x82c0
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0xc8(%rbp)
leaq -0x81(%rbp), %rdi
movq %rdi, -0xc0(%rbp)
callq 0x83f0
movq -0xc8(%rbp), %rsi
movq -0xc0(%rbp), %rdx
leaq -0x80(%rbp), %rdi
callq 0x8300
jmp 0x8725
xorl %eax, %eax
movl %eax, %esi
leaq -0x80(%rbp), %rdi
movl $0xa, %edx
callq 0x8950
movl %eax, -0xcc(%rbp)
jmp 0x873f
movl -0xcc(%rbp), %eax
cltq
movq %rax, -0x28(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x8190
leaq -0x81(%rbp), %rdi
callq 0x82c0
movl $0x48, %edi
callq 0x8290
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xd8(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rdi)
movaps %xmm0, 0x20(%rdi)
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, (%rdi)
movq $0x0, 0x40(%rdi)
callq 0x8990
jmp 0x8798
movq -0xd8(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rdi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %r8
xorl %eax, %eax
movl %eax, %esi
movq %rsi, -0xe8(%rbp)
callq 0x89e0
movl $0x38, %edi
callq 0x8290
movq -0xe8(%rbp), %rsi
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xe0(%rbp)
movq -0x90(%rbp), %rdx
callq 0x8fc0
jmp 0x87f5
movq -0xe0(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rdi
callq 0x9120
movq -0x98(%rbp), %rdi
movq (%rdi), %rax
callq *0x40(%rax)
jmp 0x881c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x8841
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x8190
leaq -0x49(%rbp), %rdi
callq 0x82c0
jmp 0x88af
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x886f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x8190
leaq -0x81(%rbp), %rdi
callq 0x82c0
jmp 0x88af
movq -0xd8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
callq 0x8260
jmp 0x88af
movq -0xe0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
callq 0x8260
movq -0x58(%rbp), %rdi
callq 0x83e0
nopl (%rax,%rax)