// File: /workspace/github_cpp_makefile_star2_O3/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 %rbx
subq $0x18, %rsp
movl %esi, %ebp
movslq %edx, %rsi
movq (%rdi), %rax
movq 0x8(%rdi), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq %rsi, %rdx
jbe 0x4845
movq %rdi, %rbx
movq (%rax,%rsi,8), %rax
movq %rax, (%rsp)
movq 0x68de(%rip), %rdi      # 0xafc8
leaq 0x29ed(%rip), %rsi      # 0x70de
movl $0xa, %edx
callq 0x2200
movq 0x68c6(%rip), %rdi      # 0xafc8
callq 0x2120
cmpl $0xd, %ebp
ja 0x4836
movl %ebp, %eax
leaq 0x2923(%rip), %rcx      # 0x703c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rsp, %rdi
callq 0x6390
movq %rbx, %rdi
movl %eax, %esi
callq 0x359e
jmp 0x4836
movq (%rsp), %rax
leaq 0x8(%rsp), %rsi
movq %rax, (%rsi)
movq %rbx, %rdi
callq 0x4358
leaq 0x8(%rsp), %rdi
jmp 0x47cd
movq %rbx, %rdi
callq 0x352e
jmp 0x4836
movq %rsp, %rdi
callq 0x6390
movq %rbx, %rdi
movl %eax, %esi
callq 0x3cae
jmp 0x4836
movq %rsp, %rdi
callq 0x6390
movq %rbx, %rdi
movl %eax, %esi
callq 0x2e9a
jmp 0x4836
leaq 0x38(%rbx), %rdi
movq 0x40(%rbx), %rdx
leaq 0x2908(%rip), %rcx      # 0x70a6
movl $0x4, %r8d
xorl %esi, %esi
callq 0x2290
movb $0x1, 0x79(%rbx)
jmp 0x4836
movq (%rsp), %rax
leaq 0x10(%rsp), %rsi
movq %rax, (%rsi)
movq %rbx, %rdi
callq 0x31d4
leaq 0x10(%rsp), %rdi
callq 0x6242
jmp 0x4836
movq %rsp, %rdi
callq 0x6380
movq %rbx, %rdi
movl %eax, %esi
callq 0x2826
jmp 0x4836
movq %rsp, %rdi
callq 0x6380
movq %rbx, %rdi
movl %eax, %esi
callq 0x2b5a
jmp 0x4836
movq %rbx, %rdi
callq 0x3566
jmp 0x4836
movq %rbx, %rdi
callq 0x3738
jmp 0x4836
movq %rsp, %rdi
callq 0x6390
movq %rbx, %rdi
movl %eax, %esi
callq 0x4006
jmp 0x4836
movq %rsp, %rdi
callq 0x6390
movq %rbx, %rdi
movl %eax, %esi
callq 0x395c
movq %rsp, %rdi
callq 0x6242
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
leaq 0x2b29(%rip), %rdi      # 0x7375
xorl %eax, %eax
callq 0x2270
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
jmp 0x4865
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x6242
jmp 0x486f
movq %rax, %rbx
movq %rsp, %rdi
callq 0x6242
movq %rbx, %rdi
callq 0x2300
nop