// File: /workspace/github_cpp_makefile_star2_O2/czmccrory[P]ManchesterBaby/baby.cpp
// Function: ManchesterBaby::immediateEx(int, int)
void ManchesterBaby::immediateEx(int opcode, int operand){
  Line value = store.at(operand);
  clrscr();
  //Process the opcode
  switch(opcode){
    case 0: 
    //Set CI to content of Store location
      imjmp(value.getDecOperand());
      break;
    case 1:
    //Add content of Store location to CI
      imjrp(value.getDecOperand());
      break;
    case 2:
    //Load Accumulator with negative form of Store contents
      imldn(value.getDecVector());
      break;
    case 3:
    //Copy Accumulator to Store location
      imsto(value);
      break;
    case 4:
    //Subtract content of Store location from Accumulator
      imsub(value.getDecVector());
      break;
    case 5:
    //Subtract content of Store location from Accumulator
      imsub(value.getDecVector());
      break;
    case 6:
    //Increment CI if Accumulator value negative, otherwise do nothing
      cmp();
      break;
    case 7:
    //Halt the Baby and light the 'stop lamp'
      stp();
      break;
    case 8:
    //Multiply content of Store and Accumulator
      immul(value.getDecVector());
      break;
    case 9:
    //Load Accumulator with (positive form of) Store contents
      imldp(value.getDecVector());
      break;
    case 10:
    //Add content of Store and Accumulator
      imadd(value.getDecVector());
      break;
    case 11:
    //Copy negative form of Accumulator to Store location
      imnegsto(value);
      break;
    case 12:
    	inc();
    	break;
    case 13:
    	dec();
    	break;
    default:
      break;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movl %esi, %ebp
movq %rdi, %rbx
movslq %edx, %rsi
callq 0x3c8a
movq (%rax), %r15
movq %r15, (%rsp)
callq 0x3110
cmpl $0xd, %ebp
ja 0x325c
movl %ebp, %eax
leaq 0x1ed9(%rip), %rcx      # 0x503c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rsp, %rdi
callq 0x46f0
movq %rbx, %rdi
movl %eax, %esi
callq 0x2aca
jmp 0x325c
leaq 0x8(%rsp), %r14
movq %r15, (%r14)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2f6e
jmp 0x31f0
movq %rbx, %rdi
callq 0x2a72
jmp 0x325c
movq %rsp, %rdi
callq 0x46f0
movq %rbx, %rdi
movl %eax, %esi
callq 0x2d3e
jmp 0x325c
movq %rsp, %rdi
callq 0x46f0
movq %rbx, %rdi
movl %eax, %esi
callq 0x2858
jmp 0x325c
movq %rbx, %rdi
callq 0x2b72
jmp 0x325c
leaq 0x10(%rsp), %r14
movq %r15, (%r14)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2950
movq %r14, %rdi
callq 0x45ae
jmp 0x325c
movq %rsp, %rdi
callq 0x46e0
movq %rbx, %rdi
movl %eax, %esi
callq 0x266c
jmp 0x325c
movq %rsp, %rdi
callq 0x46e0
movq %rbx, %rdi
movl %eax, %esi
callq 0x275c
jmp 0x325c
movq %rbx, %rdi
callq 0x2a9e
jmp 0x325c
movq %rbx, %rdi
callq 0x2b4c
jmp 0x325c
movq %rsp, %rdi
callq 0x46f0
movq %rbx, %rdi
movl %eax, %esi
callq 0x2e5c
jmp 0x325c
movq %rsp, %rdi
callq 0x46f0
movq %rbx, %rdi
movl %eax, %esi
callq 0x2c30
movq %rsp, %rdi
callq 0x45ae
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
jmp 0x3281
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x45ae
jmp 0x328b
movq %rax, %rbx
movq %rsp, %rdi
callq 0x45ae
movq %rbx, %rdi
callq 0x2320
nop