int operation_exec(unsigned short opcode, unsigned short a, unsigned short b,
                   unsigned short c, int *pc) {
  int halt = 0;
  switch (opcode) {
  case 0:
    halt = 1;
    *pc += 1;
    break;
  case 1:
    reg_write(a, reg_read(b));
    *pc += 3;
    break;
  case 2:
    stack_push(val_get(a));
    *pc += 2;
    break;
  case 3:
    reg_write(a, stack_pop());
    *pc += 2;
    break;
  case 4:
    reg_write(a, val_get(b) == val_get(c) ? 1 : 0);
    *pc += 4;
    break;
  case 5:
    reg_write(a, val_get(b) > val_get(c) ? 1 : 0);
    *pc += 4;
    break;
  case 6:
    *pc = val_get(a);
    break;
  case 7:
    *pc = (val_get(a) != 0) ? val_get(b) : *pc + 3;
    break;
  case 8:
    *pc = (val_get(a) == 0) ? val_get(b) : *pc + 3;
    break;
  case 9:
    reg_write(a, (val_get(b) + val_get(c)) % 32768);
    *pc += 4;
    break;
  case 10:
    reg_write(a, (val_get(b) * val_get(c)) % 32768);
    *pc += 4;
    break;
  case 11:
    reg_write(a, val_get(b) % val_get(c));
    *pc += 4;
    break;
  case 12:
    reg_write(a, val_get(b) & val_get(c));
    *pc += 4;
    break;
  case 13:
    reg_write(a, val_get(b) | val_get(c));
    *pc += 4;
    break;
  case 14:
    reg_write(a, (~val_get(b)) & 0x7fff);
    *pc += 3;
    break;
  case 15:
    reg_write(a, mem_read(val_get(b)));
    *pc += 3;
    break;
  case 16:
    mem_write(val_get(a), val_get(b));
    *pc += 3;
    break;
  case 17:
    stack_push(*pc + 2);
    *pc = val_get(a);
    break;
  case 18:
    *pc = stack_pop();
    break;
  case 19:
    putchar(val_get(a));
    *pc += 2;
    break;
  case 20:
    reg_write(a, getchar());
    *pc += 2;
    break;
  case 21:
    *pc += 1;
    break;
  default:
    vm_fail("Function %s() failed! [opcode:%d] [pc:%d]", __FUNCTION__, opcode,
            *pc);
  }
  return halt;
}


x86 assembly (clang, -O0):
<operation_exec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %cx,%ax
mov    %dx,%cx
mov    %si,%dx
mov    %di,%si
mov    %si,-0x2(%rbp)
mov    %dx,-0x4(%rbp)
mov    %cx,-0x6(%rbp)
mov    %ax,-0x8(%rbp)
mov    %r8,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movzwl -0x2(%rbp),%eax
mov    %rax,-0x20(%rbp)
sub    $0x15,%rax
ja     1651 <operation_exec+0x4b1>
mov    -0x20(%rbp),%rax
lea    0xe11(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
jmp    1670 <operation_exec+0x4d0>
movzwl -0x4(%rbp),%eax
mov    %eax,-0x24(%rbp)
movzwl -0x6(%rbp),%edi
mov    $0x0,%al
call   1060 <reg_read@plt>
mov    -0x24(%rbp),%edi
mov    %eax,%esi
mov    $0x0,%al
call   10b0 <reg_write@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x3,%ecx
mov    %ecx,(%rax)
jmp    1670 <operation_exec+0x4d0>
movzwl -0x4(%rbp),%edi
mov    $0x0,%al
call   1040 <val_get@plt>
mov    %eax,%edi
mov    $0x0,%al
call   1090 <stack_push@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x2,%ecx
mov    %ecx,(%rax)
jmp    1670 <operation_exec+0x4d0>
movzwl -0x4(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    $0x0,%al
call   10c0 <stack_pop@plt>
mov    -0x28(%rbp),%edi
mov    %eax,%esi
mov    $0x0,%al
call   10b0 <reg_write@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x2,%ecx
mov    %ecx,(%rax)
jmp    1670 <operation_exec+0x4d0>
movzwl -0x4(%rbp),%eax
mov    %eax,-0x2c(%rbp)
movzwl -0x6(%rbp),%edi
mov    $0x0,%al
call   1040 <val_get@plt>
mov    %eax,-0x30(%rbp)
movzwl -0x8(%rbp),%edi
mov    $0x0,%al
call   1040 <val_get@plt>
mov    -0x30(%rbp),%ecx
mov    -0x2c(%rbp),%edi
mov    %eax,%edx
xor    %esi,%esi
mov    $0x1,%eax
cmp    %edx,%ecx
cmove  %eax,%esi
mov    $0x0,%al
call   10b0 <reg_write@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x4,%ecx
mov    %ecx,(%rax)
jmp    1670 <operation_exec+0x4d0>
movzwl -0x4(%rbp),%eax
mov    %eax,-0x34(%rbp)
movzwl -0x6(%rbp),%edi
mov    $0x0,%al
call   1040 <val_get@plt>
mov    %eax,-0x38(%rbp)
movzwl -0x8(%rbp),%edi
mov    $0x0,%al
call   1040 <val_get@plt>
mov    -0x38(%rbp),%ecx
mov    -0x34(%rbp),%edi
mov    %eax,%edx
xor    %esi,%esi
mov    $0x1,%eax
cmp    %edx,%ecx
cmovg  %eax,%esi
mov    $0x0,%al
call   10b0 <reg_write@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x4,%ecx
mov    %ecx,(%rax)
jmp    1670 <operation_exec+0x4d0>
movzwl -0x4(%rbp),%edi
mov    $0x0,%al
call   1040 <val_get@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    1670 <operation_exec+0x4d0>
movzwl -0x4(%rbp),%edi
mov    $0x0,%al
call   1040 <val_get@plt>
cmp    $0x0,%eax
je     1360 <operation_exec+0x1c0>
movzwl -0x6(%rbp),%edi
mov    $0x0,%al
call   1040 <val_get@plt>
mov    %eax,-0x3c(%rbp)
jmp    136c <operation_exec+0x1cc>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
add    $0x3,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    1670 <operation_exec+0x4d0>
movzwl -0x4(%rbp),%edi
mov    $0x0,%al
call   1040 <val_get@plt>
cmp    $0x0,%eax
jne    13a1 <operation_exec+0x201>
movzwl -0x6(%rbp),%edi
mov    $0x0,%al
call   1040 <val_get@plt>
mov    %eax,-0x40(%rbp)
jmp    13ad <operation_exec+0x20d>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
add    $0x3,%eax
mov    %eax,-0x40(%rbp)
mov    -0x40(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    1670 <operation_exec+0x4d0>
movzwl -0x4(%rbp),%eax
mov    %eax,-0x48(%rbp)
movzwl -0x6(%rbp),%edi
mov    $0x0,%al
call   1040 <val_get@plt>
mov    %eax,-0x44(%rbp)
movzwl -0x8(%rbp),%edi
mov    $0x0,%al
call   1040 <val_get@plt>
mov    -0x48(%rbp),%edi
mov    %eax,%ecx
mov    -0x44(%rbp),%eax
add    %ecx,%eax
mov    $0x8000,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
mov    $0x0,%al
call   10b0 <reg_write@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x4,%ecx
mov    %ecx,(%rax)
jmp    1670 <operation_exec+0x4d0>
movzwl -0x4(%rbp),%eax
mov    %eax,-0x50(%rbp)
movzwl -0x6(%rbp),%edi
mov    $0x0,%al
call   1040 <val_get@plt>
mov    %eax,-0x4c(%rbp)
movzwl -0x8(%rbp),%edi
mov    $0x0,%al
call   1040 <val_get@plt>
mov    -0x50(%rbp),%edi
mov    %eax,%ecx
mov    -0x4c(%rbp),%eax
imul   %ecx,%eax
mov    $0x8000,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
mov    $0x0,%al
call   10b0 <reg_write@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x4,%ecx
mov    %ecx,(%rax)
jmp    1670 <operation_exec+0x4d0>
movzwl -0x4(%rbp),%eax
mov    %eax,-0x58(%rbp)
movzwl -0x6(%rbp),%edi
mov    $0x0,%al
call   1040 <val_get@plt>
mov    %eax,-0x54(%rbp)
movzwl -0x8(%rbp),%edi
mov    $0x0,%al
call   1040 <val_get@plt>
mov    -0x58(%rbp),%edi
mov    %eax,%ecx
mov    -0x54(%rbp),%eax
cltd
idiv   %ecx
mov    %edx,%esi
mov    $0x0,%al
call   10b0 <reg_write@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x4,%ecx
mov    %ecx,(%rax)
jmp    1670 <operation_exec+0x4d0>
movzwl -0x4(%rbp),%eax
mov    %eax,-0x5c(%rbp)
movzwl -0x6(%rbp),%edi
mov    $0x0,%al
call   1040 <val_get@plt>
mov    %eax,-0x60(%rbp)
movzwl -0x8(%rbp),%edi
mov    $0x0,%al
call   1040 <val_get@plt>
mov    -0x60(%rbp),%esi
mov    -0x5c(%rbp),%edi
and    %eax,%esi
mov    $0x0,%al
call   10b0 <reg_write@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x4,%ecx
mov    %ecx,(%rax)
jmp    1670 <operation_exec+0x4d0>
movzwl -0x4(%rbp),%eax
mov    %eax,-0x64(%rbp)
movzwl -0x6(%rbp),%edi
mov    $0x0,%al
call   1040 <val_get@plt>
mov    %eax,-0x68(%rbp)
movzwl -0x8(%rbp),%edi
mov    $0x0,%al
call   1040 <val_get@plt>
mov    -0x68(%rbp),%esi
mov    -0x64(%rbp),%edi
or     %eax,%esi
mov    $0x0,%al
call   10b0 <reg_write@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x4,%ecx
mov    %ecx,(%rax)
jmp    1670 <operation_exec+0x4d0>
movzwl -0x4(%rbp),%eax
mov    %eax,-0x6c(%rbp)
movzwl -0x6(%rbp),%edi
mov    $0x0,%al
call   1040 <val_get@plt>
mov    -0x6c(%rbp),%edi
mov    %eax,%esi
xor    $0xffffffff,%esi
and    $0x7fff,%esi
mov    $0x0,%al
call   10b0 <reg_write@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x3,%ecx
mov    %ecx,(%rax)
jmp    1670 <operation_exec+0x4d0>
movzwl -0x4(%rbp),%eax
mov    %eax,-0x70(%rbp)
movzwl -0x6(%rbp),%edi
mov    $0x0,%al
call   1040 <val_get@plt>
mov    %eax,%edi
mov    $0x0,%al
call   1080 <mem_read@plt>
mov    -0x70(%rbp),%edi
mov    %eax,%esi
mov    $0x0,%al
call   10b0 <reg_write@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x3,%ecx
mov    %ecx,(%rax)
jmp    1670 <operation_exec+0x4d0>
movzwl -0x4(%rbp),%edi
mov    $0x0,%al
call   1040 <val_get@plt>
mov    %eax,-0x74(%rbp)
movzwl -0x6(%rbp),%edi
mov    $0x0,%al
call   1040 <val_get@plt>
mov    -0x74(%rbp),%edi
mov    %eax,%esi
mov    $0x0,%al
call   10a0 <mem_write@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x3,%ecx
mov    %ecx,(%rax)
jmp    1670 <operation_exec+0x4d0>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
add    $0x2,%edi
mov    $0x0,%al
call   1090 <stack_push@plt>
movzwl -0x4(%rbp),%edi
mov    $0x0,%al
call   1040 <val_get@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    1670 <operation_exec+0x4d0>
mov    $0x0,%al
call   10c0 <stack_pop@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    1670 <operation_exec+0x4d0>
movzwl -0x4(%rbp),%edi
mov    $0x0,%al
call   1040 <val_get@plt>
mov    %eax,%edi
mov    $0x0,%al
call   1050 <putchar@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x2,%ecx
mov    %ecx,(%rax)
jmp    1670 <operation_exec+0x4d0>
movzwl -0x4(%rbp),%eax
mov    %eax,-0x78(%rbp)
mov    $0x0,%al
call   1070 <getchar@plt>
mov    -0x78(%rbp),%edi
mov    %eax,%esi
mov    $0x0,%al
call   10b0 <reg_write@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x2,%ecx
mov    %ecx,(%rax)
jmp    1670 <operation_exec+0x4d0>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
jmp    1670 <operation_exec+0x4d0>
movzwl -0x2(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
lea    0x9f6(%rip),%rdi
lea    0xa19(%rip),%rsi
mov    $0x0,%al
call   1030 <vm_fail@plt>
mov    -0x14(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<operation_exec>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r8,%r14
cmp    $0x15,%di
ja     11d9 <operation_exec+0x39>
mov    %ecx,%r12d
mov    %edx,%ebp
mov    %esi,%ebx
mov    %edi,%eax
lea    0xe3f(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
addl   $0x1,(%r14)
mov    $0x1,%r15d
jmp    14a0 <operation_exec+0x300>
movzwl %di,%edx
mov    (%r14),%ecx
lea    0xe72(%rip),%rdi
lea    0xe95(%rip),%rsi
xor    %r15d,%r15d
xor    %eax,%eax
call   1030 <vm_fail@plt>
jmp    14a0 <operation_exec+0x300>
movzwl %bx,%ebx
movzwl %bp,%edi
xor    %r15d,%r15d
xor    %eax,%eax
call   1060 <reg_read@plt>
jmp    13f7 <operation_exec+0x257>
movzwl %bx,%edi
xor    %r15d,%r15d
xor    %eax,%eax
call   1040 <val_get@plt>
mov    %eax,%edi
xor    %eax,%eax
call   1090 <stack_push@plt>
jmp    149c <operation_exec+0x2fc>
movzwl %bx,%ebx
xor    %r15d,%r15d
xor    %eax,%eax
call   10c0 <stack_pop@plt>
jmp    1470 <operation_exec+0x2d0>
movzwl %bx,%ebx
movzwl %bp,%edi
xor    %r15d,%r15d
xor    %eax,%eax
call   1040 <val_get@plt>
mov    %eax,%ebp
movzwl %r12w,%edi
xor    %eax,%eax
call   1040 <val_get@plt>
xor    %esi,%esi
cmp    %eax,%ebp
sete   %sil
jmp    1308 <operation_exec+0x168>
movzwl %bx,%ebx
movzwl %bp,%edi
xor    %r15d,%r15d
xor    %eax,%eax
call   1040 <val_get@plt>
mov    %eax,%ebp
movzwl %r12w,%edi
xor    %eax,%eax
call   1040 <val_get@plt>
xor    %esi,%esi
cmp    %eax,%ebp
setg   %sil
jmp    1308 <operation_exec+0x168>
movzwl %bx,%edi
xor    %r15d,%r15d
jmp    1448 <operation_exec+0x2a8>
movzwl %bx,%edi
xor    %eax,%eax
call   1040 <val_get@plt>
test   %eax,%eax
je     12c2 <operation_exec+0x122>
movzwl %bp,%edi
xor    %eax,%eax
call   1040 <val_get@plt>
jmp    12c8 <operation_exec+0x128>
movzwl %bx,%edi
xor    %eax,%eax
call   1040 <val_get@plt>
test   %eax,%eax
je     12a8 <operation_exec+0x108>
mov    (%r14),%eax
add    $0x3,%eax
mov    %eax,(%r14)
xor    %r15d,%r15d
jmp    14a0 <operation_exec+0x300>
movzwl %bx,%ebx
movzwl %bp,%edi
xor    %r15d,%r15d
xor    %eax,%eax
call   1040 <val_get@plt>
mov    %eax,%ebp
movzwl %r12w,%edi
xor    %eax,%eax
call   1040 <val_get@plt>
lea    (%rax,%rbp,1),%ecx
add    $0x7fff,%ecx
mov    %eax,%esi
add    %ebp,%esi
cmovns %esi,%ecx
and    $0xffff8000,%ecx
sub    %ecx,%esi
mov    %ebx,%edi
jmp    13b5 <operation_exec+0x215>
movzwl %bx,%ebx
movzwl %bp,%edi
xor    %r15d,%r15d
xor    %eax,%eax
call   1040 <val_get@plt>
mov    %eax,%ebp
movzwl %r12w,%edi
xor    %eax,%eax
call   1040 <val_get@plt>
imul   %eax,%ebp
lea    0x7fff(%rbp),%eax
test   %ebp,%ebp
cmovns %ebp,%eax
and    $0xffff8000,%eax
sub    %eax,%ebp
mov    %ebx,%edi
mov    %ebp,%esi
jmp    13b5 <operation_exec+0x215>
movzwl %bx,%ebx
movzwl %bp,%edi
xor    %r15d,%r15d
xor    %eax,%eax
call   1040 <val_get@plt>
mov    %eax,%ebp
movzwl %r12w,%edi
xor    %eax,%eax
call   1040 <val_get@plt>
mov    %eax,%ecx
mov    %ebp,%eax
cltd
idiv   %ecx
mov    %ebx,%edi
mov    %edx,%esi
jmp    13b5 <operation_exec+0x215>
movzwl %bx,%ebx
movzwl %bp,%edi
xor    %r15d,%r15d
xor    %eax,%eax
call   1040 <val_get@plt>
mov    %eax,%ebp
movzwl %r12w,%edi
xor    %eax,%eax
call   1040 <val_get@plt>
and    %eax,%ebp
jmp    13b1 <operation_exec+0x211>
movzwl %bx,%ebx
movzwl %bp,%edi
xor    %r15d,%r15d
xor    %eax,%eax
call   1040 <val_get@plt>
mov    %eax,%ebp
movzwl %r12w,%edi
xor    %eax,%eax
call   1040 <val_get@plt>
or     %eax,%ebp
mov    %ebx,%edi
mov    %ebp,%esi
xor    %eax,%eax
call   10b0 <reg_write@plt>
addl   $0x4,(%r14)
jmp    14a0 <operation_exec+0x300>
movzwl %bx,%ebx
movzwl %bp,%edi
xor    %r15d,%r15d
xor    %eax,%eax
call   1040 <val_get@plt>
not    %eax
and    $0x7fff,%eax
jmp    13f7 <operation_exec+0x257>
movzwl %bx,%ebx
movzwl %bp,%edi
xor    %r15d,%r15d
xor    %eax,%eax
call   1040 <val_get@plt>
mov    %eax,%edi
xor    %eax,%eax
call   1080 <mem_read@plt>
mov    %ebx,%edi
mov    %eax,%esi
xor    %eax,%eax
call   10b0 <reg_write@plt>
addl   $0x3,(%r14)
jmp    14a0 <operation_exec+0x300>
movzwl %bx,%edi
xor    %r15d,%r15d
xor    %eax,%eax
call   1040 <val_get@plt>
mov    %eax,%ebx
movzwl %bp,%edi
xor    %eax,%eax
call   1040 <val_get@plt>
mov    %ebx,%edi
mov    %eax,%esi
xor    %eax,%eax
call   10a0 <mem_write@plt>
addl   $0x3,(%r14)
jmp    14a0 <operation_exec+0x300>
mov    (%r14),%edi
add    $0x2,%edi
xor    %r15d,%r15d
xor    %eax,%eax
call   1090 <stack_push@plt>
movzwl %bx,%edi
xor    %eax,%eax
call   1040 <val_get@plt>
mov    %eax,(%r14)
jmp    14a0 <operation_exec+0x300>
xor    %r15d,%r15d
xor    %eax,%eax
call   10c0 <stack_pop@plt>
mov    %eax,(%r14)
jmp    14a0 <operation_exec+0x300>
movzwl %bx,%ebx
xor    %r15d,%r15d
xor    %eax,%eax
call   1070 <getchar@plt>
mov    %ebx,%edi
mov    %eax,%esi
xor    %eax,%eax
call   10b0 <reg_write@plt>
jmp    149c <operation_exec+0x2fc>
addl   $0x1,(%r14)
xor    %r15d,%r15d
jmp    14a0 <operation_exec+0x300>
movzwl %bx,%edi
xor    %r15d,%r15d
xor    %eax,%eax
call   1040 <val_get@plt>
mov    %eax,%edi
xor    %eax,%eax
call   1050 <putchar@plt>
addl   $0x2,(%r14)
mov    %r15d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [42 x i8] c"Function %s() failed! [opcode:%d] [pc:%d]\00"
@__FUNCTION__.operation_exec = [15 x i8] c"operation_exec\00"
define i32 @operation_exec(i16 zeroext %0, i16 zeroext %1, i16 zeroext %2, i16 zeroext %3, i32* %4) {
%6 = alloca i16
%7 = alloca i16
%8 = alloca i16
%9 = alloca i16
%10 = alloca i32*
%11 = alloca i32
store i16 %0, i16* %6
store i16 %1, i16* %7
store i16 %2, i16* %8
store i16 %3, i16* %9
store i32* %4, i32** %10
store i32 0, i32* %11
%12 = load i16, i16* %6
%13 = zext i16 %12 to i32
switch i32 %13, label %251 [
i32 0, label %14
i32 1, label %18
i32 2, label %28
i32 3, label %36
i32 4, label %44
i32 5, label %60
i32 6, label %76
i32 7, label %81
i32 8, label %97
i32 9, label %113
i32 10, label %128
i32 11, label %143
i32 12, label %157
i32 13, label %171
i32 14, label %185
i32 15, label %197
i32 16, label %208
i32 17, label %219
i32 18, label %228
i32 19, label %231
i32 20, label %239
i32 21, label %247
]
14: ; preds = %5
store i32 1, i32* %11
%15 = load i32*, i32** %10
%16 = load i32, i32* %15
%17 = add nsw i32 %16, 1
store i32 %17, i32* %15
br label %257
18: ; preds = %5
%19 = load i16, i16* %7
%20 = zext i16 %19 to i32
%21 = load i16, i16* %8
%22 = zext i16 %21 to i32
%23 = call i32 (i32, ...) bitcast (i32 (...)* @reg_read to i32 (i32, ...)*)(i32 %22)
%24 = call i32 (i32, i32, ...) bitcast (i32 (...)* @reg_write to i32 (i32, i32, ...)*)(i32 %20, i32 %23)
%25 = load i32*, i32** %10
%26 = load i32, i32* %25
%27 = add nsw i32 %26, 3
store i32 %27, i32* %25
br label %257
28: ; preds = %5
%29 = load i16, i16* %7
%30 = zext i16 %29 to i32
%31 = call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %30)
%32 = call i32 (i32, ...) bitcast (i32 (...)* @stack_push to i32 (i32, ...)*)(i32 %31)
%33 = load i32*, i32** %10
%34 = load i32, i32* %33
%35 = add nsw i32 %34, 2
store i32 %35, i32* %33
br label %257
36: ; preds = %5
%37 = load i16, i16* %7
%38 = zext i16 %37 to i32
%39 = call i32 (...) @stack_pop()
%40 = call i32 (i32, i32, ...) bitcast (i32 (...)* @reg_write to i32 (i32, i32, ...)*)(i32 %38, i32 %39)
%41 = load i32*, i32** %10
%42 = load i32, i32* %41
%43 = add nsw i32 %42, 2
store i32 %43, i32* %41
br label %257
44: ; preds = %5
%45 = load i16, i16* %7
%46 = zext i16 %45 to i32
%47 = load i16, i16* %8
%48 = zext i16 %47 to i32
%49 = call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %48)
%50 = load i16, i16* %9
%51 = zext i16 %50 to i32
%52 = call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %51)
%53 = icmp eq i32 %49, %52
%54 = zext i1 %53 to i64
%55 = select i1 %53, i32 1, i32 0
%56 = call i32 (i32, i32, ...) bitcast (i32 (...)* @reg_write to i32 (i32, i32, ...)*)(i32 %46, i32 %55)
%57 = load i32*, i32** %10
%58 = load i32, i32* %57
%59 = add nsw i32 %58, 4
store i32 %59, i32* %57
br label %257
60: ; preds = %5
%61 = load i16, i16* %7
%62 = zext i16 %61 to i32
%63 = load i16, i16* %8
%64 = zext i16 %63 to i32
%65 = call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %64)
%66 = load i16, i16* %9
%67 = zext i16 %66 to i32
%68 = call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %67)
%69 = icmp sgt i32 %65, %68
%70 = zext i1 %69 to i64
%71 = select i1 %69, i32 1, i32 0
%72 = call i32 (i32, i32, ...) bitcast (i32 (...)* @reg_write to i32 (i32, i32, ...)*)(i32 %62, i32 %71)
%73 = load i32*, i32** %10
%74 = load i32, i32* %73
%75 = add nsw i32 %74, 4
store i32 %75, i32* %73
br label %257
76: ; preds = %5
%77 = load i16, i16* %7
%78 = zext i16 %77 to i32
%79 = call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %78)
%80 = load i32*, i32** %10
store i32 %79, i32* %80
br label %257
81: ; preds = %5
%82 = load i16, i16* %7
%83 = zext i16 %82 to i32
%84 = call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %83)
%85 = icmp ne i32 %84, 0
br i1 %85, label %86, label %90
86: ; preds = %81
%87 = load i16, i16* %8
%88 = zext i16 %87 to i32
%89 = call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %88)
br label %94
90: ; preds = %81
%91 = load i32*, i32** %10
%92 = load i32, i32* %91
%93 = add nsw i32 %92, 3
br label %94
94: ; preds = %90, %86
%95 = phi i32 [ %89, %86 ], [ %93, %90 ]
%96 = load i32*, i32** %10
store i32 %95, i32* %96
br label %257
97: ; preds = %5
%98 = load i16, i16* %7
%99 = zext i16 %98 to i32
%100 = call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %99)
%101 = icmp eq i32 %100, 0
br i1 %101, label %102, label %106
102: ; preds = %97
%103 = load i16, i16* %8
%104 = zext i16 %103 to i32
%105 = call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %104)
br label %110
106: ; preds = %97
%107 = load i32*, i32** %10
%108 = load i32, i32* %107
%109 = add nsw i32 %108, 3
br label %110
110: ; preds = %106, %102
%111 = phi i32 [ %105, %102 ], [ %109, %106 ]
%112 = load i32*, i32** %10
store i32 %111, i32* %112
br label %257
113: ; preds = %5
%114 = load i16, i16* %7
%115 = zext i16 %114 to i32
%116 = load i16, i16* %8
%117 = zext i16 %116 to i32
%118 = call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %117)
%119 = load i16, i16* %9
%120 = zext i16 %119 to i32
%121 = call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %120)
%122 = add nsw i32 %118, %121
%123 = srem i32 %122, 32768
%124 = call i32 (i32, i32, ...) bitcast (i32 (...)* @reg_write to i32 (i32, i32, ...)*)(i32 %115, i32 %123)
%125 = load i32*, i32** %10
%126 = load i32, i32* %125
%127 = add nsw i32 %126, 4
store i32 %127, i32* %125
br label %257
128: ; preds = %5
%129 = load i16, i16* %7
%130 = zext i16 %129 to i32
%131 = load i16, i16* %8
%132 = zext i16 %131 to i32
%133 = call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %132)
%134 = load i16, i16* %9
%135 = zext i16 %134 to i32
%136 = call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %135)
%137 = mul nsw i32 %133, %136
%138 = srem i32 %137, 32768
%139 = call i32 (i32, i32, ...) bitcast (i32 (...)* @reg_write to i32 (i32, i32, ...)*)(i32 %130, i32 %138)
%140 = load i32*, i32** %10
%141 = load i32, i32* %140
%142 = add nsw i32 %141, 4
store i32 %142, i32* %140
br label %257
143: ; preds = %5
%144 = load i16, i16* %7
%145 = zext i16 %144 to i32
%146 = load i16, i16* %8
%147 = zext i16 %146 to i32
%148 = call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %147)
%149 = load i16, i16* %9
%150 = zext i16 %149 to i32
%151 = call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %150)
%152 = srem i32 %148, %151
%153 = call i32 (i32, i32, ...) bitcast (i32 (...)* @reg_write to i32 (i32, i32, ...)*)(i32 %145, i32 %152)
%154 = load i32*, i32** %10
%155 = load i32, i32* %154
%156 = add nsw i32 %155, 4
store i32 %156, i32* %154
br label %257
157: ; preds = %5
%158 = load i16, i16* %7
%159 = zext i16 %158 to i32
%160 = load i16, i16* %8
%161 = zext i16 %160 to i32
%162 = call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %161)
%163 = load i16, i16* %9
%164 = zext i16 %163 to i32
%165 = call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %164)
%166 = and i32 %162, %165
%167 = call i32 (i32, i32, ...) bitcast (i32 (...)* @reg_write to i32 (i32, i32, ...)*)(i32 %159, i32 %166)
%168 = load i32*, i32** %10
%169 = load i32, i32* %168
%170 = add nsw i32 %169, 4
store i32 %170, i32* %168
br label %257
171: ; preds = %5
%172 = load i16, i16* %7
%173 = zext i16 %172 to i32
%174 = load i16, i16* %8
%175 = zext i16 %174 to i32
%176 = call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %175)
%177 = load i16, i16* %9
%178 = zext i16 %177 to i32
%179 = call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %178)
%180 = or i32 %176, %179
%181 = call i32 (i32, i32, ...) bitcast (i32 (...)* @reg_write to i32 (i32, i32, ...)*)(i32 %173, i32 %180)
%182 = load i32*, i32** %10
%183 = load i32, i32* %182
%184 = add nsw i32 %183, 4
store i32 %184, i32* %182
br label %257
185: ; preds = %5
%186 = load i16, i16* %7
%187 = zext i16 %186 to i32
%188 = load i16, i16* %8
%189 = zext i16 %188 to i32
%190 = call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %189)
%191 = xor i32 %190, -1
%192 = and i32 %191, 32767
%193 = call i32 (i32, i32, ...) bitcast (i32 (...)* @reg_write to i32 (i32, i32, ...)*)(i32 %187, i32 %192)
%194 = load i32*, i32** %10
%195 = load i32, i32* %194
%196 = add nsw i32 %195, 3
store i32 %196, i32* %194
br label %257
197: ; preds = %5
%198 = load i16, i16* %7
%199 = zext i16 %198 to i32
%200 = load i16, i16* %8
%201 = zext i16 %200 to i32
%202 = call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %201)
%203 = call i32 (i32, ...) bitcast (i32 (...)* @mem_read to i32 (i32, ...)*)(i32 %202)
%204 = call i32 (i32, i32, ...) bitcast (i32 (...)* @reg_write to i32 (i32, i32, ...)*)(i32 %199, i32 %203)
%205 = load i32*, i32** %10
%206 = load i32, i32* %205
%207 = add nsw i32 %206, 3
store i32 %207, i32* %205
br label %257
208: ; preds = %5
%209 = load i16, i16* %7
%210 = zext i16 %209 to i32
%211 = call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %210)
%212 = load i16, i16* %8
%213 = zext i16 %212 to i32
%214 = call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %213)
%215 = call i32 (i32, i32, ...) bitcast (i32 (...)* @mem_write to i32 (i32, i32, ...)*)(i32 %211, i32 %214)
%216 = load i32*, i32** %10
%217 = load i32, i32* %216
%218 = add nsw i32 %217, 3
store i32 %218, i32* %216
br label %257
219: ; preds = %5
%220 = load i32*, i32** %10
%221 = load i32, i32* %220
%222 = add nsw i32 %221, 2
%223 = call i32 (i32, ...) bitcast (i32 (...)* @stack_push to i32 (i32, ...)*)(i32 %222)
%224 = load i16, i16* %7
%225 = zext i16 %224 to i32
%226 = call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %225)
%227 = load i32*, i32** %10
store i32 %226, i32* %227
br label %257
228: ; preds = %5
%229 = call i32 (...) @stack_pop()
%230 = load i32*, i32** %10
store i32 %229, i32* %230
br label %257
231: ; preds = %5
%232 = load i16, i16* %7
%233 = zext i16 %232 to i32
%234 = call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %233)
%235 = call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 %234)
%236 = load i32*, i32** %10
%237 = load i32, i32* %236
%238 = add nsw i32 %237, 2
store i32 %238, i32* %236
br label %257
239: ; preds = %5
%240 = load i16, i16* %7
%241 = zext i16 %240 to i32
%242 = call i32 (...) @getchar()
%243 = call i32 (i32, i32, ...) bitcast (i32 (...)* @reg_write to i32 (i32, i32, ...)*)(i32 %241, i32 %242)
%244 = load i32*, i32** %10
%245 = load i32, i32* %244
%246 = add nsw i32 %245, 2
store i32 %246, i32* %244
br label %257
247: ; preds = %5
%248 = load i32*, i32** %10
%249 = load i32, i32* %248
%250 = add nsw i32 %249, 1
store i32 %250, i32* %248
br label %257
251: ; preds = %5
%252 = load i16, i16* %6
%253 = zext i16 %252 to i32
%254 = load i32*, i32** %10
%255 = load i32, i32* %254
%256 = call i32 (i8*, i8*, i32, i32, ...) bitcast (i32 (...)* @vm_fail to i32 (i8*, i8*, i32, i32, ...)*)(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__FUNCTION__.operation_exec, i64 0, i64 0), i32 %253, i32 %255)
br label %257
257: ; preds = %251, %247, %239, %231, %228, %219, %208, %197, %185, %171, %157, %143, %128, %113, %110, %94, %76, %60, %44, %36, %28, %18, %14
%258 = load i32, i32* %11
ret i32 %258
}

LLVM IR (-O2):
@.str = [42 x i8] c"Function %s() failed! [opcode:%d] [pc:%d]\00"
@__FUNCTION__.operation_exec = [15 x i8] c"operation_exec\00"
define i32 @operation_exec(i16 zeroext %0, i16 zeroext %1, i16 zeroext %2, i16 zeroext %3, i32* %4) {
switch i16 %0, label %177 [
i16 0, label %6
i16 1, label %9
i16 2, label %16
i16 3, label %22
i16 4, label %28
i16 5, label %39
i16 6, label %50
i16 7, label %53
i16 8, label %65
i16 9, label %77
i16 10, label %88
i16 11, label %99
i16 12, label %109
i16 13, label %119
i16 14, label %129
i16 15, label %138
i16 16, label %146
i16 17, label %154
i16 18, label %160
i16 19, label %162
i16 20, label %168
i16 21, label %174
]
6: ; preds = %5
%7 = load i32, i32* %4
%8 = add nsw i32 %7, 1
store i32 %8, i32* %4
br label %181
9: ; preds = %5
%10 = zext i16 %1 to i32
%11 = zext i16 %2 to i32
%12 = tail call i32 (i32, ...) bitcast (i32 (...)* @reg_read to i32 (i32, ...)*)(i32 %11)
%13 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @reg_write to i32 (i32, i32, ...)*)(i32 %10, i32 %12)
%14 = load i32, i32* %4
%15 = add nsw i32 %14, 3
store i32 %15, i32* %4
br label %181
16: ; preds = %5
%17 = zext i16 %1 to i32
%18 = tail call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %17)
%19 = tail call i32 (i32, ...) bitcast (i32 (...)* @stack_push to i32 (i32, ...)*)(i32 %18)
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 2
store i32 %21, i32* %4
br label %181
22: ; preds = %5
%23 = zext i16 %1 to i32
%24 = tail call i32 (...) @stack_pop()
%25 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @reg_write to i32 (i32, i32, ...)*)(i32 %23, i32 %24)
%26 = load i32, i32* %4
%27 = add nsw i32 %26, 2
store i32 %27, i32* %4
br label %181
28: ; preds = %5
%29 = zext i16 %1 to i32
%30 = zext i16 %2 to i32
%31 = tail call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %30)
%32 = zext i16 %3 to i32
%33 = tail call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %32)
%34 = icmp eq i32 %31, %33
%35 = zext i1 %34 to i32
%36 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @reg_write to i32 (i32, i32, ...)*)(i32 %29, i32 %35)
%37 = load i32, i32* %4
%38 = add nsw i32 %37, 4
store i32 %38, i32* %4
br label %181
39: ; preds = %5
%40 = zext i16 %1 to i32
%41 = zext i16 %2 to i32
%42 = tail call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %41)
%43 = zext i16 %3 to i32
%44 = tail call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %43)
%45 = icmp sgt i32 %42, %44
%46 = zext i1 %45 to i32
%47 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @reg_write to i32 (i32, i32, ...)*)(i32 %40, i32 %46)
%48 = load i32, i32* %4
%49 = add nsw i32 %48, 4
store i32 %49, i32* %4
br label %181
50: ; preds = %5
%51 = zext i16 %1 to i32
%52 = tail call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %51)
store i32 %52, i32* %4
br label %181
53: ; preds = %5
%54 = zext i16 %1 to i32
%55 = tail call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %54)
%56 = icmp eq i32 %55, 0
br i1 %56, label %60, label %57
57: ; preds = %53
%58 = zext i16 %2 to i32
%59 = tail call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %58)
br label %63
60: ; preds = %53
%61 = load i32, i32* %4
%62 = add nsw i32 %61, 3
br label %63
63: ; preds = %60, %57
%64 = phi i32 [ %59, %57 ], [ %62, %60 ]
store i32 %64, i32* %4
br label %181
65: ; preds = %5
%66 = zext i16 %1 to i32
%67 = tail call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %66)
%68 = icmp eq i32 %67, 0
br i1 %68, label %69, label %72
69: ; preds = %65
%70 = zext i16 %2 to i32
%71 = tail call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %70)
br label %75
72: ; preds = %65
%73 = load i32, i32* %4
%74 = add nsw i32 %73, 3
br label %75
75: ; preds = %72, %69
%76 = phi i32 [ %71, %69 ], [ %74, %72 ]
store i32 %76, i32* %4
br label %181
77: ; preds = %5
%78 = zext i16 %1 to i32
%79 = zext i16 %2 to i32
%80 = tail call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %79)
%81 = zext i16 %3 to i32
%82 = tail call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %81)
%83 = add nsw i32 %82, %80
%84 = srem i32 %83, 32768
%85 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @reg_write to i32 (i32, i32, ...)*)(i32 %78, i32 %84)
%86 = load i32, i32* %4
%87 = add nsw i32 %86, 4
store i32 %87, i32* %4
br label %181
88: ; preds = %5
%89 = zext i16 %1 to i32
%90 = zext i16 %2 to i32
%91 = tail call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %90)
%92 = zext i16 %3 to i32
%93 = tail call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %92)
%94 = mul nsw i32 %93, %91
%95 = srem i32 %94, 32768
%96 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @reg_write to i32 (i32, i32, ...)*)(i32 %89, i32 %95)
%97 = load i32, i32* %4
%98 = add nsw i32 %97, 4
store i32 %98, i32* %4
br label %181
99: ; preds = %5
%100 = zext i16 %1 to i32
%101 = zext i16 %2 to i32
%102 = tail call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %101)
%103 = zext i16 %3 to i32
%104 = tail call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %103)
%105 = srem i32 %102, %104
%106 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @reg_write to i32 (i32, i32, ...)*)(i32 %100, i32 %105)
%107 = load i32, i32* %4
%108 = add nsw i32 %107, 4
store i32 %108, i32* %4
br label %181
109: ; preds = %5
%110 = zext i16 %1 to i32
%111 = zext i16 %2 to i32
%112 = tail call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %111)
%113 = zext i16 %3 to i32
%114 = tail call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %113)
%115 = and i32 %114, %112
%116 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @reg_write to i32 (i32, i32, ...)*)(i32 %110, i32 %115)
%117 = load i32, i32* %4
%118 = add nsw i32 %117, 4
store i32 %118, i32* %4
br label %181
119: ; preds = %5
%120 = zext i16 %1 to i32
%121 = zext i16 %2 to i32
%122 = tail call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %121)
%123 = zext i16 %3 to i32
%124 = tail call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %123)
%125 = or i32 %124, %122
%126 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @reg_write to i32 (i32, i32, ...)*)(i32 %120, i32 %125)
%127 = load i32, i32* %4
%128 = add nsw i32 %127, 4
store i32 %128, i32* %4
br label %181
129: ; preds = %5
%130 = zext i16 %1 to i32
%131 = zext i16 %2 to i32
%132 = tail call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %131)
%133 = and i32 %132, 32767
%134 = xor i32 %133, 32767
%135 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @reg_write to i32 (i32, i32, ...)*)(i32 %130, i32 %134)
%136 = load i32, i32* %4
%137 = add nsw i32 %136, 3
store i32 %137, i32* %4
br label %181
138: ; preds = %5
%139 = zext i16 %1 to i32
%140 = zext i16 %2 to i32
%141 = tail call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %140)
%142 = tail call i32 (i32, ...) bitcast (i32 (...)* @mem_read to i32 (i32, ...)*)(i32 %141)
%143 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @reg_write to i32 (i32, i32, ...)*)(i32 %139, i32 %142)
%144 = load i32, i32* %4
%145 = add nsw i32 %144, 3
store i32 %145, i32* %4
br label %181
146: ; preds = %5
%147 = zext i16 %1 to i32
%148 = tail call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %147)
%149 = zext i16 %2 to i32
%150 = tail call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %149)
%151 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @mem_write to i32 (i32, i32, ...)*)(i32 %148, i32 %150)
%152 = load i32, i32* %4
%153 = add nsw i32 %152, 3
store i32 %153, i32* %4
br label %181
154: ; preds = %5
%155 = load i32, i32* %4
%156 = add nsw i32 %155, 2
%157 = tail call i32 (i32, ...) bitcast (i32 (...)* @stack_push to i32 (i32, ...)*)(i32 %156)
%158 = zext i16 %1 to i32
%159 = tail call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %158)
store i32 %159, i32* %4
br label %181
160: ; preds = %5
%161 = tail call i32 (...) @stack_pop()
store i32 %161, i32* %4
br label %181
162: ; preds = %5
%163 = zext i16 %1 to i32
%164 = tail call i32 (i32, ...) bitcast (i32 (...)* @val_get to i32 (i32, ...)*)(i32 %163)
%165 = tail call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 %164)
%166 = load i32, i32* %4
%167 = add nsw i32 %166, 2
store i32 %167, i32* %4
br label %181
168: ; preds = %5
%169 = zext i16 %1 to i32
%170 = tail call i32 (...) @getchar()
%171 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @reg_write to i32 (i32, i32, ...)*)(i32 %169, i32 %170)
%172 = load i32, i32* %4
%173 = add nsw i32 %172, 2
store i32 %173, i32* %4
br label %181
174: ; preds = %5
%175 = load i32, i32* %4
%176 = add nsw i32 %175, 1
store i32 %176, i32* %4
br label %181
177: ; preds = %5
%178 = zext i16 %0 to i32
%179 = load i32, i32* %4
%180 = tail call i32 (i8*, i8*, i32, i32, ...) bitcast (i32 (...)* @vm_fail to i32 (i8*, i8*, i32, i32, ...)*)(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__FUNCTION__.operation_exec, i64 0, i64 0), i32 %178, i32 %179)
br label %181
181: ; preds = %177, %174, %168, %162, %160, %154, %146, %138, %129, %119, %109, %99, %88, %77, %75, %63, %50, %39, %28, %22, %16, %9, %6
%182 = phi i32 [ 0, %177 ], [ 0, %174 ], [ 0, %168 ], [ 0, %162 ], [ 0, %160 ], [ 0, %154 ], [ 0, %146 ], [ 0, %138 ], [ 0, %129 ], [ 0, %119 ], [ 0, %109 ], [ 0, %99 ], [ 0, %88 ], [ 0, %77 ], [ 0, %75 ], [ 0, %63 ], [ 0, %50 ], [ 0, %39 ], [ 0, %28 ], [ 0, %22 ], [ 0, %16 ], [ 0, %9 ], [ 1, %6 ]
ret i32 %182
}