// File: /workspace/github_cpp_makefile_star2_O3/ariannagavioli[P]ALU/AluModule.cpp
// Function: AluModule::onNotify(message*)
void AluModule::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 Alu = "Alu";
		
		
		// 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() == Alu){
				message* myMessage = new message();
				myMessage->valid = 1;
				myMessage->timestamp = getTime();
				strcpy(myMessage->source, getName().c_str());
				strcpy(myMessage->dest, "Fetch");

				/*** OUR CODE ***/
				operate();

				myMessage->magic_struct = NULL;
				
				sendWithDelay(myMessage, delay);
			}
			else{
				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);
			}
		}
	}
}

// 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 0x259e
callq 0x2120
testl %ebp, %ebp
jne 0x273b
leaq 0x28(%rsp), %rdi
movq %r12, (%rdi)
leaq 0x2b4a(%rip), %rsi      # 0x50ff
leaq 0x2b46(%rip), %rdx      # 0x5102
callq 0x3588
cmpl $0x31, 0x8(%r14)
jg 0x272c
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x468c
movq 0x10(%rsp), %rdx
cmpq 0x30(%rsp), %rdx
jne 0x2604
movq 0x8(%rsp), %r14
testq %rdx, %rdx
je 0x260d
movq 0x28(%rsp), %rsi
movq %r14, %rdi
callq 0x2150
testl %eax, %eax
sete %bpl
jmp 0x2610
movq 0x8(%rsp), %r14
xorl %ebp, %ebp
jmp 0x2610
movb $0x1, %bpl
leaq 0x18(%rsp), %r13
cmpq %r13, %r14
je 0x2622
movq %r14, %rdi
callq 0x2120
testb %bpl, %bpl
je 0x26b3
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 0x2684
movq %r15, %rdi
callq 0x2120
movw $0x68, 0x1a(%r14)
movl $0x63746546, 0x16(%r14) # imm = 0x63746546
movq %rbx, %rdi
callq 0x276c
movq $0x0, 0x20(%r14)
movl 0x64(%rbx), %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4724
jmp 0x272c
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 0x270c
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
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x273b
callq 0x2120
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2752
jmp 0x2752
jmp 0x2752
jmp 0x2752
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x2764
callq 0x2120
movq %rbx, %rdi
callq 0x21c0