// File: /workspace/github_cpp_makefile_star2_O1/tonymuu[P]distributed-kv-store/Application.cpp
// Function: Application::Application(char*)
Application::Application(char *infile) {
	int i;
	par = new Params();
	srand (time(NULL));
	par->setparams(infile);
	log = new Log(par);
	en = new EmulNet(par);
	en1 = new EmulNet(par);
	mp1 = (MP1Node **) malloc(par->EN_GPSZ * sizeof(MP1Node *));
	mp2 = (MP2Node **) malloc(par->EN_GPSZ * sizeof(MP2Node *));
    members = (Member** ) malloc(par->EN_GPSZ * sizeof(Member *));

	/*
	 * Init all nodes
	 */
	for( i = 0; i < par->EN_GPSZ; i++ ) {
		members[i] = new Member;
		members[i]->inited = false;
		Address *addressOfMemberNode = new Address();
		Address joinaddr;
		joinaddr = getjoinaddr();
		addressOfMemberNode = (Address *) en->ENinit(addressOfMemberNode, par->PORTNUM);
		mp1[i] = new MP1Node(members[i], par, en, log, addressOfMemberNode);
		mp2[i] = new MP2Node(members[i], par, en1, log, addressOfMemberNode);
		log->LOG(&(mp1[i]->getMemberNode()->addr), "APP");
		log->LOG(&(mp2[i]->getMemberNode()->addr), "APP MP2");
		delete addressOfMemberNode;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x19f1b(%rip), %rax     # 0x20cf0
movq %rax, (%rdi)
leaq 0x68(%rdi), %rax
movl $0x0, 0x68(%rdi)
xorl %ecx, %ecx
movq %rcx, 0x70(%rdi)
movq %rax, 0x78(%rdi)
movq %rax, 0x80(%rdi)
movq %rcx, 0x88(%rdi)
movl $0x38, %edi
callq 0x32b0
movq %rax, %r12
movq %rax, %rdi
callq 0xc7b4
movq %r12, 0x58(%rbx)
xorl %edi, %edi
callq 0x3250
movl %eax, %edi
callq 0x3270
movq 0x58(%rbx), %rdi
movq %r14, %rsi
callq 0xc7bc
movl $0x18, %edi
callq 0x32b0
movq %rax, %r14
movq 0x58(%rbx), %rsi
movq %rax, %rdi
callq 0xbc00
movq %r14, 0x38(%rbx)
movl $0x1bb8e30, %edi        # imm = 0x1BB8E30
callq 0x32b0
movq %rax, %r14
movq 0x58(%rbx), %rsi
movq %rax, %rdi
callq 0x64c8
movq %r14, 0x28(%rbx)
movl $0x1bb8e30, %edi        # imm = 0x1BB8E30
callq 0x32b0
movq %rax, %r14
movq 0x58(%rbx), %rsi
movq %rax, %rdi
callq 0x64c8
movq %r14, 0x30(%rbx)
movq 0x58(%rbx), %rax
movslq 0x18(%rax), %r14
shlq $0x3, %r14
movq %r14, %rdi
callq 0x33a0
movq %rax, 0x40(%rbx)
movq %r14, %rdi
callq 0x33a0
movq %rax, 0x48(%rbx)
movq %r14, %rdi
callq 0x33a0
movq %rax, 0x50(%rbx)
movq 0x58(%rbx), %rax
cmpl $0x0, 0x18(%rax)
jle 0x701b
xorl %r15d, %r15d
leaq 0x113d6(%rip), %r13     # 0x182a3
xorl %r12d, %r12d
movl $0xe8, %edi
callq 0x32b0
movq %rax, %r14
movq %rax, %rdi
callq 0x4f72
movq 0x50(%rbx), %rax
movq %r14, (%rax,%r12,8)
movq 0x50(%rbx), %rax
movq (%rax,%r12,8), %rax
movb $0x0, 0xe(%rax)
movl $0x6, %edi
callq 0x32b0
movq %rax, %r14
movl %r15d, (%rax)
movw %r15w, 0x4(%rax)
movw %r15w, 0x14(%rsp)
movl %r15d, 0x10(%rsp)
movw %r15w, 0xc(%rsp)
movl $0x1, 0x8(%rsp)
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0xc9b6
movq 0x28(%rbx), %rdi
movq 0x58(%rbx), %rax
movswl 0x30(%rax), %edx
movq %r14, %rsi
callq 0x66b4
movq %rax, %rbp
movl $0x40, %edi
callq 0x32b0
movq %rax, %r14
movq 0x50(%rbx), %rax
movq (%rax,%r12,8), %rsi
movq 0x58(%rbx), %rdx
movq 0x28(%rbx), %rcx
movq 0x38(%rbx), %r8
movq %r14, %rdi
movq %rbp, %r9
callq 0x4482
movq 0x40(%rbx), %rax
movq %r14, (%rax,%r12,8)
movl $0xf0, %edi
callq 0x32b0
movq %rax, %r14
movq 0x50(%rbx), %rax
movq (%rax,%r12,8), %rsi
movq 0x58(%rbx), %rdx
movq 0x30(%rbx), %rcx
movq 0x38(%rbx), %r8
movq %r14, %rdi
movq %rbp, %r9
callq 0xe728
movq 0x48(%rbx), %rax
movq %r14, (%rax,%r12,8)
movq 0x38(%rbx), %rdi
movq 0x40(%rbx), %rax
movq (%rax,%r12,8), %rax
movq 0x20(%rax), %rsi
addq $0x8, %rsi
leaq 0x112cf(%rip), %rdx     # 0x1829f
xorl %eax, %eax
callq 0xbc4c
movq 0x38(%rbx), %rdi
movq 0x48(%rbx), %rax
movq (%rax,%r12,8), %rax
movq 0x50(%rax), %rsi
addq $0x8, %rsi
movq %r13, %rdx
xorl %eax, %eax
callq 0xbc4c
testq %rbp, %rbp
je 0x7007
movl $0x6, %esi
movq %rbp, %rdi
callq 0x32c0
incq %r12
movq 0x58(%rbx), %rax
movslq 0x18(%rax), %rax
cmpq %rax, %r12
jl 0x6ed0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x702c
movq %rax, %r15
movl $0x1bb8e30, %esi        # imm = 0x1BB8E30
jmp 0x7071
movq %rax, %r15
movl $0x18, %esi
jmp 0x7071
movq %rax, %r15
movl $0x38, %esi
movq %r12, %rdi
jmp 0x7074
jmp 0x707b
jmp 0x707b
movq %rax, %r15
movl $0xe8, %esi
jmp 0x7071
jmp 0x707b
jmp 0x707b
movq %rax, %r15
movl $0x40, %esi
jmp 0x7071
movq %rax, %r15
movl $0xf0, %esi
movq %r14, %rdi
callq 0x32c0
jmp 0x707e
movq %rax, %r15
addq $0x60, %rbx
movq %rbx, %rdi
callq 0xb586
movq %r15, %rdi
callq 0x34b0