// File: MPSLab-ASU[P]DiRAC/./src/pe.cc
// Function: PE::compute_addition()
void PE::compute_addition()
{
  data_type add_Op1;
  data_type add_Op2;

  add_Op1 = temp_reg_add_Op1[adder_stages-1];

  if(temp_sel_sig_adder_is_Op2_self[multiplier_stages+adder_stages-1] == false) // (zero_initialize_Op_current_RF_Pass)
  // case 0:
  {
    add_Op2 = out_MAC;
  }
  else  // case 1:
  {
    add_Op2 = temp_reg_add_Op2[(multiplier_stages+adder_stages-1) - 1];
  }

  if(state_adder_stages[adder_stages-1])
    out_MAC = add_Op1 + add_Op2;

  // Update FFs for propagating input Operand2 for adder
  for(auto it1=(multiplier_stages+adder_stages-1) - 1; it1>0; it1--)
    temp_reg_add_Op2[it1] = temp_reg_add_Op2[it1-1];

  // pipelined in parallel with first stage of multiplier
  if(temp_sel_sig_adder_Op2_zero_initialize_current_RF_Pass[2] == 0)
  // case 0:
    temp_reg_add_Op2[0] = in3;
  else  // case 1:
    temp_reg_add_Op2[0] = 0;

  // Update FFs for propagating input Operand1 for adder
  for(auto it1=adder_stages-1; it1>0; it1--)
    temp_reg_add_Op1[it1] = temp_reg_add_Op1[it1-1];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movq 0x110(%rax), %rcx
movq $0x61c155, %rdx         # imm = 0x61C155
movzbl (%rdx), %edx
subl $0x1, %edx
movslq %edx, %rdx
movw (%rcx,%rdx,2), %cx
movw %cx, -0xa(%rbp)
movq 0x140(%rax), %rax
movq $0x61c154, %rcx         # imm = 0x61C154
movzbl (%rcx), %ecx
movq $0x61c155, %rdx         # imm = 0x61C155
movzbl (%rdx), %edx
addl %edx, %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x42415d
movq -0x20(%rbp), %rax
movw 0x42(%rax), %ax
movw %ax, -0xc(%rbp)
jmp 0x42418f
movq -0x20(%rbp), %rax
movq 0x118(%rax), %rax
movq $0x61c154, %rcx         # imm = 0x61C154
movzbl (%rcx), %ecx
movq $0x61c155, %rdx         # imm = 0x61C155
movzbl (%rdx), %edx
addl %edx, %ecx
subl $0x1, %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movw (%rax,%rcx,2), %ax
movw %ax, -0xc(%rbp)
movq -0x20(%rbp), %rax
movq 0x90(%rax), %rax
movq $0x61c155, %rcx         # imm = 0x61C155
movzbl (%rcx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
testb $0x1, (%rax,%rcx)
je 0x4241c2
movq -0x20(%rbp), %rax
movzwl -0xa(%rbp), %ecx
movzwl -0xc(%rbp), %edx
addl %edx, %ecx
movw %cx, 0x42(%rax)
movq $0x61c154, %rax         # imm = 0x61C154
movzbl (%rax), %eax
movq $0x61c155, %rcx         # imm = 0x61C155
movzbl (%rcx), %ecx
addl %ecx, %eax
subl $0x1, %eax
subl $0x1, %eax
movl %eax, -0x10(%rbp)
cmpl $0x0, -0x10(%rbp)
jle 0x424219
movq -0x20(%rbp), %rax
movq 0x118(%rax), %rcx
movl -0x10(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
movw (%rcx,%rdx,2), %dx
movq 0x118(%rax), %rax
movslq -0x10(%rbp), %rcx
movw %dx, (%rax,%rcx,2)
movl -0x10(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x4241e1
movq -0x20(%rbp), %rax
movq 0x130(%rax), %rax
movb 0x2(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x424245
movq -0x20(%rbp), %rax
movw 0x3e(%rax), %cx
movq 0x118(%rax), %rax
movw %cx, (%rax)
jmp 0x424255
movq -0x20(%rbp), %rax
movq 0x118(%rax), %rax
movw $0x0, (%rax)
movq $0x61c155, %rax         # imm = 0x61C155
movzbl (%rax), %eax
subl $0x1, %eax
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jle 0x42429d
movq -0x20(%rbp), %rax
movq 0x110(%rax), %rcx
movl -0x14(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
movw (%rcx,%rdx,2), %dx
movq 0x110(%rax), %rax
movslq -0x14(%rbp), %rcx
movw %dx, (%rax,%rcx,2)
movl -0x14(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x424265
popq %rbp
retq
nop