// File: /workspace/github_cpp_makefile_star2_O1/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 0x456c
movq %r12, %rdi
movq %r15, %rsi
callq 0x2040
movl %eax, %ebp
movq (%r12), %rdi
leaq 0x38(%rsp), %r12
cmpq %r12, %rdi
je 0x372c
callq 0x2120
testl %ebp, %ebp
jne 0x38bb
leaq 0x28(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x19c0(%rip), %rsi      # 0x5103
leaq 0x19be(%rip), %rdx      # 0x5108
callq 0x3456
cmpl $0x31, 0x8(%r14)
jg 0x38ac
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x456c
movq 0x10(%rsp), %rdx
cmpq 0x30(%rsp), %rdx
jne 0x378f
testq %rdx, %rdx
je 0x3793
movq 0x28(%rsp), %rsi
movq 0x8(%rsp), %rdi
callq 0x2150
testl %eax, %eax
sete %bpl
jmp 0x3796
xorl %ebp, %ebp
jmp 0x3796
movb $0x1, %bpl
leaq 0x18(%rsp), %r13
movq -0x10(%r13), %rdi
cmpq %r13, %rdi
je 0x37a9
callq 0x2120
testb %bpl, %bpl
je 0x382c
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 0x4600
movl %eax, 0x8(%r14)
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x456c
movq %r14, %rdi
addq $0xc, %rdi
movq 0x8(%rsp), %r15
movq %r15, %rsi
callq 0x2110
cmpq %r13, %r15
je 0x3807
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 0x4604
jmp 0x38ac
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 0x4600
movl %eax, 0x8(%r14)
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x456c
movq %r14, %rdi
addq $0xc, %rdi
movq 0x8(%rsp), %r15
movq %r15, %rsi
callq 0x2110
cmpq %r13, %r15
je 0x3885
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 0x4604
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x38bb
callq 0x2120
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x38d2
jmp 0x38d2
jmp 0x38d2
jmp 0x38d2
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x38e4
callq 0x2120
movq %rbx, %rdi
callq 0x21c0