// File: /workspace/github_cpp_makefile_star2_O3/ariannagavioli[P]ALU/ExampleModule.cpp
// Function: ExampleModule::onNotify(message*)
void ExampleModule::onNotify(message* m) {
	//Don't forget to check if the message was for me since we are in a broadcast environment
	if(m->dest == getName()){
		string Fetch = "Fetch";
		
		// cout << "Message " << m->id << ": Sent at " << m->timestamp << ", current timestamp " << getTime() << ". My name is " << getName() << "." << endl;
		
		//Send some test messages
		if(m->timestamp < 50) {
			if(getName() == Fetch){
				message* myMessage = new message();
				myMessage->valid = 1;
				myMessage->timestamp = getTime();
				strcpy(myMessage->source, getName().c_str());
				strcpy(myMessage->dest, "Alu");
				myMessage->magic_struct = NULL;
				
				sendWithDelay(myMessage, 10);
			}
			else{
				message* myMessage = new message();
				myMessage->valid = 1;
				myMessage->timestamp = getTime();
				strcpy(myMessage->source, getName().c_str());
				strcpy(myMessage->dest, "Fetch");
				myMessage->magic_struct = NULL;
				
				sendWithDelay(myMessage, 10);
			}
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x16(%rsi), %r15
leaq 0x28(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x468c
movq %r12, %rdi
movq %r15, %rsi
callq 0x2040
movl %eax, %ebp
movq (%r12), %rdi
leaq 0x38(%rsp), %r12
cmpq %r12, %rdi
je 0x386c
callq 0x2120
testl %ebp, %ebp
jne 0x3a02
leaq 0x28(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x1880(%rip), %rsi      # 0x5103
leaq 0x187e(%rip), %rdx      # 0x5108
callq 0x3588
cmpl $0x31, 0x8(%r14)
jg 0x39f3
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x468c
movq 0x10(%rsp), %rdx
cmpq 0x30(%rsp), %rdx
jne 0x38d2
movq 0x8(%rsp), %r14
testq %rdx, %rdx
je 0x38db
movq 0x28(%rsp), %rsi
movq %r14, %rdi
callq 0x2150
testl %eax, %eax
sete %bpl
jmp 0x38de
movq 0x8(%rsp), %r14
xorl %ebp, %ebp
jmp 0x38de
movb $0x1, %bpl
leaq 0x18(%rsp), %r13
cmpq %r13, %r14
je 0x38f0
movq %r14, %rdi
callq 0x2120
testb %bpl, %bpl
je 0x3973
movl $0x30, %edi
callq 0x2140
movq %rax, %r14
xorps %xmm0, %xmm0
movaps %xmm0, (%rax)
movaps %xmm0, 0x20(%rax)
movaps %xmm0, 0x10(%rax)
movb $0x1, 0x4(%rax)
movq %rbx, %rdi
callq 0x4720
movl %eax, 0x8(%r14)
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x468c
movq %r14, %rdi
addq $0xc, %rdi
movq 0x8(%rsp), %r15
movq %r15, %rsi
callq 0x2110
cmpq %r13, %r15
je 0x394e
movq %r15, %rdi
callq 0x2120
movl $0x756c41, 0x16(%r14)   # imm = 0x756C41
movq $0x0, 0x20(%r14)
movq %rbx, %rdi
movq %r14, %rsi
movl $0xa, %edx
callq 0x4724
jmp 0x39f3
movl $0x30, %edi
callq 0x2140
movq %rax, %r14
xorps %xmm0, %xmm0
movaps %xmm0, (%rax)
movaps %xmm0, 0x20(%rax)
movaps %xmm0, 0x10(%rax)
movb $0x1, 0x4(%rax)
movq %rbx, %rdi
callq 0x4720
movl %eax, 0x8(%r14)
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x468c
movq %r14, %rdi
addq $0xc, %rdi
movq 0x8(%rsp), %r15
movq %r15, %rsi
callq 0x2110
cmpq %r13, %r15
je 0x39cc
movq %r15, %rdi
callq 0x2120
movw $0x68, 0x1a(%r14)
movl $0x63746546, 0x16(%r14) # imm = 0x63746546
movq $0x0, 0x20(%r14)
movq %rbx, %rdi
movq %r14, %rsi
movl $0xa, %edx
callq 0x4724
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x3a02
callq 0x2120
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3a19
jmp 0x3a19
jmp 0x3a19
jmp 0x3a19
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x3a2b
callq 0x2120
movq %rbx, %rdi
callq 0x21c0
nop