// File: hunterlxt[P]swim-membership-protocol/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 0x95ef
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rdi
callq 0xae20
cmpl $0x32, %eax
jne 0x95ef
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 0x9692
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rdi
callq 0xae20
cmpl $0x64, %eax
jne 0x9692
callq 0x3060
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 0x9860
movq %rax, %rcx
movq -0x18(%rbp), %rax
addq $0x8, %rcx
movq %rcx, -0x20(%rbp)
movq 0x40(%rax), %rdi
callq 0xae20
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl %eax, %ecx
leaq 0x5c93(%rip), %rdx      # 0xf300
movb $0x0, %al
callq 0xa4c0
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x9860
movb $0x1, 0x10(%rax)
jmp 0x976b
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rdi
callq 0xae20
cmpl $0x64, %eax
jne 0x9769
callq 0x3060
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 0x9767
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 0x9860
movq %rax, %rcx
movq -0x18(%rbp), %rax
addq $0x8, %rcx
movq %rcx, -0x38(%rbp)
movq 0x40(%rax), %rdi
callq 0xae20
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rsi
movl %eax, %ecx
leaq 0x5bde(%rip), %rdx      # 0xf317
movb $0x0, %al
callq 0xa4c0
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x9860
movb $0x1, 0x10(%rax)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x96cc
jmp 0x9769
jmp 0x976b
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rax
cmpl $0x0, 0x20(%rax)
je 0x979c
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rdi
callq 0xae20
cmpl $0x12c, %eax            # imm = 0x12C
jne 0x979c
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rax
movl $0x0, 0x24(%rax)
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)