// File: csMOOC[P]UIUC/Application.cpp
// Function: Application::fail()
void Application::fail() {
	int i, removed;

	// fail half the members at time t=400
	if( par->DROP_MSG && par->getcurrtime() == 50 ) {
		par->dropmsg = 1;
	}

	if( par->SINGLE_FAILURE && par->getcurrtime() == 100 ) {
		removed = (rand() % par->EN_GPSZ);
		#ifdef DEBUGLOG
		log->LOG(&mp1[removed]->getMemberNode()->addr, "Node failed at time=%d", par->getcurrtime());
		#endif
		mp1[removed]->getMemberNode()->bFailed = true;
	}
	else if( par->getcurrtime() == 100 ) {
		removed = rand() % par->EN_GPSZ/2;
		for ( i = removed; i < removed + par->EN_GPSZ/2; i++ ) {
			#ifdef DEBUGLOG
			log->LOG(&mp1[i]->getMemberNode()->addr, "Node failed at time = %d", par->getcurrtime());
			#endif
			mp1[i]->getMemberNode()->bFailed = true;
		}
	}

	if( par->DROP_MSG && par->getcurrtime() == 300) {
		par->dropmsg=0;
	}

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movq 0x40(%rax), %rax
cmpl $0x0, 0x20(%rax)
je 0x7fef
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rdi
callq 0x99f0
cmpl $0x32, %eax
jne 0x7fef
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rax
movl $0x1, 0x24(%rax)
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rax
cmpl $0x0, 0x4(%rax)
je 0x8092
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rdi
callq 0x99f0
cmpl $0x64, %eax
jne 0x8092
callq 0x3070
movq -0x18(%rbp), %rcx
movq 0x40(%rcx), %rcx
cltd
idivl 0x18(%rcx)
movq -0x18(%rbp), %rax
movl %edx, -0x10(%rbp)
movq 0x30(%rax), %rcx
movq %rcx, -0x28(%rbp)
movq 0x38(%rax), %rax
movslq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x8260
movq %rax, %rcx
movq -0x18(%rbp), %rax
addq $0x8, %rcx
movq %rcx, -0x20(%rbp)
movq 0x40(%rax), %rdi
callq 0x99f0
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl %eax, %ecx
leaq 0x727b(%rip), %rdx      # 0xf2e8
movb $0x0, %al
callq 0x9090
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x8260
movb $0x1, 0x10(%rax)
jmp 0x816b
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rdi
callq 0x99f0
cmpl $0x64, %eax
jne 0x8169
callq 0x3070
movq -0x18(%rbp), %rcx
movq 0x40(%rcx), %rcx
cltd
idivl 0x18(%rcx)
movl %edx, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
movl %eax, -0xc(%rbp)
movq -0x18(%rbp), %rax
movl -0xc(%rbp), %ecx
movl %ecx, -0x2c(%rbp)
movl -0x10(%rbp), %ecx
movq 0x40(%rax), %rax
movl 0x18(%rax), %eax
movl $0x2, %esi
cltd
idivl %esi
movl %eax, %edx
movl -0x2c(%rbp), %eax
addl %edx, %ecx
cmpl %ecx, %eax
jge 0x8167
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rcx
movq %rcx, -0x40(%rbp)
movq 0x38(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x8260
movq %rax, %rcx
movq -0x18(%rbp), %rax
addq $0x8, %rcx
movq %rcx, -0x38(%rbp)
movq 0x40(%rax), %rdi
callq 0x99f0
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rsi
movl %eax, %ecx
leaq 0x71c6(%rip), %rdx      # 0xf2ff
movb $0x0, %al
callq 0x9090
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x8260
movb $0x1, 0x10(%rax)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x80cc
jmp 0x8169
jmp 0x816b
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rax
cmpl $0x0, 0x20(%rax)
je 0x819c
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rdi
callq 0x99f0
cmpl $0x12c, %eax            # imm = 0x12C
jne 0x819c
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rax
movl $0x0, 0x24(%rax)
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)