// File: zkl94[P]distributed-key-value-store/Params.cpp
// Function: Params::setparams(char*)
void Params::setparams(char *config_file) {
	//trace.funcEntry("Params::setparams");
	char CRUD[10];
	FILE *fp = fopen(config_file,"r");

	fscanf(fp,"MAX_NNB: %d", &MAX_NNB);
	fscanf(fp,"\nSINGLE_FAILURE: %d", &SINGLE_FAILURE);
	fscanf(fp,"\nDROP_MSG: %d", &DROP_MSG);
	fscanf(fp,"\nMSG_DROP_PROB: %lf", &MSG_DROP_PROB);
	fscanf(fp,"\nCRUD_TEST: %s", CRUD);

	if ( 0 == strcmp(CRUD, "CREATE") ) {
		this->CRUDTEST = CREATE_TEST;
	}
	else if ( 0 == strcmp(CRUD, "READ") ) {
		this->CRUDTEST = READ_TEST;
	}
	else if ( 0 == strcmp(CRUD, "UPDATE") ) {
		this->CRUDTEST = UPDATE_TEST;
	}
	else if ( 0 == strcmp(CRUD, "DELETE") ) {
		this->CRUDTEST = DELETE_TEST;
	}

	//printf("Parameters of the test case: %d %d %d %lf\n", MAX_NNB, SINGLE_FAILURE, DROP_MSG, MSG_DROP_PROB);

	EN_GPSZ = MAX_NNB;
	STEP_RATE=.25;
	MAX_MSG_SIZE = 4000;
	globaltime = 0;
	dropmsg = 0;
	allNodesJoined = 0;
	for ( unsigned int i = 0; i < EN_GPSZ; i++ ) {
		allNodesJoined += i;
	}
	fclose(fp);
	//trace.funcExit("Params::setparams", SUCCESS);
	return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x12ac5(%rip), %rsi     # 0x27958
callq 0x43d0
movq -0x38(%rbp), %rdx
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
leaq 0x12c75(%rip), %rsi     # 0x27b20
movb $0x0, %al
callq 0x4590
movq -0x38(%rbp), %rdx
movq -0x28(%rbp), %rdi
addq $0x4, %rdx
leaq 0x12c67(%rip), %rsi     # 0x27b2c
movb $0x0, %al
callq 0x4590
movq -0x38(%rbp), %rdx
movq -0x28(%rbp), %rdi
addq $0x20, %rdx
leaq 0x12c61(%rip), %rsi     # 0x27b40
movb $0x0, %al
callq 0x4590
movq -0x38(%rbp), %rdx
movq -0x28(%rbp), %rdi
addq $0x8, %rdx
leaq 0x12c55(%rip), %rsi     # 0x27b4e
movb $0x0, %al
callq 0x4590
movq -0x28(%rbp), %rdi
leaq -0x1a(%rbp), %rdx
leaq 0x12c53(%rip), %rsi     # 0x27b62
movb $0x0, %al
callq 0x4590
leaq -0x1a(%rbp), %rdi
leaq 0x12c50(%rip), %rsi     # 0x27b71
callq 0x4470
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x14f3b
movq -0x38(%rbp), %rax
movl $0x0, 0x34(%rax)
jmp 0x14fae
leaq -0x1a(%rbp), %rdi
leaq 0x12c32(%rip), %rsi     # 0x27b78
callq 0x4470
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x14f60
movq -0x38(%rbp), %rax
movl $0x1, 0x34(%rax)
jmp 0x14fac
leaq -0x1a(%rbp), %rdi
leaq 0x12c12(%rip), %rsi     # 0x27b7d
callq 0x4470
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x14f85
movq -0x38(%rbp), %rax
movl $0x2, 0x34(%rax)
jmp 0x14faa
leaq -0x1a(%rbp), %rdi
leaq 0x12bf4(%rip), %rsi     # 0x27b84
callq 0x4470
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x14fa8
movq -0x38(%rbp), %rax
movl $0x3, 0x34(%rax)
jmp 0x14faa
jmp 0x14fac
jmp 0x14fae
movq -0x38(%rbp), %rax
movl (%rax), %ecx
movl %ecx, 0x18(%rax)
movsd 0x12b59(%rip), %xmm0    # 0x27b18
movsd %xmm0, 0x10(%rax)
movl $0xfa0, 0x1c(%rax)      # imm = 0xFA0
movl $0x0, 0x28(%rax)
movl $0x0, 0x24(%rax)
movl $0x0, 0x2c(%rax)
movl $0x0, -0x2c(%rbp)
movq -0x38(%rbp), %rcx
movl -0x2c(%rbp), %eax
cmpl 0x18(%rcx), %eax
jae 0x1500b
movq -0x38(%rbp), %rax
movl -0x2c(%rbp), %ecx
addl 0x2c(%rax), %ecx
movl %ecx, 0x2c(%rax)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x14fe7
movq -0x28(%rbp), %rdi
callq 0x4300
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)