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

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

	std::cout<< "port is: "<<port << "\n";
	NetworkIP* client_ = new NetworkIP();

	client_->client_init(node_idx, ip, port, SERVER_IP, PORT);
	Demo* demo = new Demo(node_idx, client_);
	demo->start_kv();
	demo->run_();
	while (true) {
		
	}
	return 0; 
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x5, -0x8(%rbp)
jne 0x8651
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x23abe(%rip), %rsi     # 0x2c0ec
callq 0x8320
cmpl $0x0, %eax
jne 0x8651
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
leaq 0x23aa9(%rip), %rsi     # 0x2c0f0
callq 0x8320
cmpl $0x0, %eax
je 0x8673
movq 0x33978(%rip), %rax     # 0x3bfd0
movq (%rax), %rdi
leaq 0x23a93(%rip), %rsi     # 0x2c0f5
movb $0x0, %al
callq 0x8340
movl $0x1, %edi
callq 0x83b0
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
leaq 0x23b91(%rip), %rsi     # 0x2c213
movq %rsi, -0xb0(%rbp)
callq 0x83a0
movq -0xb0(%rbp), %rsi
movq %rax, -0x18(%rbp)
xorl %eax, %eax
movl %eax, %edi
callq 0x83a0
movq %rax, -0xa8(%rbp)
leaq -0x49(%rbp), %rdi
movq %rdi, -0xa0(%rbp)
callq 0x8410
movq -0xa8(%rbp), %rsi
movq -0xa0(%rbp), %rdx
leaq -0x48(%rbp), %rdi
callq 0x8310
jmp 0x86d2
xorl %eax, %eax
movl %eax, %esi
leaq -0x48(%rbp), %rdi
movl $0xa, %edx
callq 0x89a0
movl %eax, -0xb4(%rbp)
jmp 0x86ec
movl -0xb4(%rbp), %eax
cltq
movq %rax, -0x20(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x8190
leaq -0x49(%rbp), %rdi
callq 0x82d0
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0xc8(%rbp)
leaq -0x81(%rbp), %rdi
movq %rdi, -0xc0(%rbp)
callq 0x8410
movq -0xc8(%rbp), %rsi
movq -0xc0(%rbp), %rdx
leaq -0x80(%rbp), %rdi
callq 0x8310
jmp 0x8745
xorl %eax, %eax
movl %eax, %esi
leaq -0x80(%rbp), %rdi
movl $0xa, %edx
callq 0x89a0
movl %eax, -0xcc(%rbp)
jmp 0x875f
movl -0xcc(%rbp), %eax
cltq
movq %rax, -0x28(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x8190
leaq -0x81(%rbp), %rdi
callq 0x82d0
movq 0x33839(%rip), %rdi     # 0x3bfc0
leaq 0x239a1(%rip), %rsi     # 0x2c12f
callq 0x8280
movq %rax, %rdi
movq -0x20(%rbp), %rsi
callq 0x80a0
movq %rax, %rdi
leaq 0x23984(%rip), %rsi     # 0x2c12d
callq 0x8280
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 0x89e0
jmp 0x87e6
movq -0xd8(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
leaq 0x2392b(%rip), %r8      # 0x2c139
movl $0xbb8, %r9d            # imm = 0xBB8
callq 0x8a30
movl $0x38, %edi
callq 0x8290
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xe0(%rbp)
movq -0x28(%rbp), %rsi
movq -0x90(%rbp), %rdx
callq 0x9090
jmp 0x8842
movq -0xe0(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rdi
callq 0x91f0
movq -0x98(%rbp), %rdi
movq (%rdi), %rax
callq *0x40(%rax)
jmp 0x8869
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x888e
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 0x82d0
jmp 0x88fc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x88bc
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 0x82d0
jmp 0x88fc
movq -0xd8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
callq 0x8260
jmp 0x88fc
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 0x8400
nopw %cs:(%rax,%rax)