#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef size_t uint16_t;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int get_s(char *, int);
char getchar();
scalar_t__ getcode(size_t *, int);
int /*<<< orphan*/ greeting();
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
size_t strtol(char *, int /*<<< orphan*/ *, int);
int main() {
  uint16_t *mem;
  if ((mem = (uint16_t *)malloc(sizeof(uint16_t) * 65536)) == NULL) {
    puts("Error allocating memory.\n press enter to continue...");
    getchar();
    exit(1);
  }
  uint16_t ax, ex, ip;
  for (ip = 65536 - 1; ip >= 0; ip--)
    mem[ip] = 0;
  greeting();
  if (getcode(mem, 65536) != 0)
    exit(1);
  puts("+------------------------+");
  puts("| program excution starts|");
  puts("+------------------------+");
  ip = 0;
  ax = 0;
  ex = 0;
  while (mem[ip] != 0x100) {
    switch (mem[ip]) {
    case 0x1000:
      ip++;
      char opcode[5];
      if (get_s(opcode, 4) == -1 || mem[ip] >= 65536) {
        puts("Fatal Error: Memory overflow ");
        return 1;
      }
      mem[mem[ip]] = strtol(opcode, NULL, 16);
      break;
    case 0x1100:
      ip++;
      ax = mem[ip];
      break;
    case 0x2000:
      ip++;
      printf("%04x\n", mem[mem[ip]]);
      break;
    case 0x2100:
      ip++;
      ax = mem[mem[ip]];
      break;
    case 0x2200:
      ip++;
      mem[mem[ip]] = ax;
      break;
    case 0x2201:
      ip++;
      mem[mem[ip]] = ex;
      break;
    case 0x3000:
      ip++;
      ax += mem[mem[ip]];
      break;
    case 0x3001:
      ip++;
      ax += mem[ip];
      break;
    case 0x3100:
      ip++;
      ax -= mem[mem[ip]];
      break;
    case 0x3101:
      ip++;
      ax += mem[ip];
      break;
    case 0x3200:
      ip++;
      ax = ax / mem[mem[ip]];
      ex = ax - mem[mem[ip]] * ax;
      break;
    case 0x3201:
      ip++;
      ax = ax / mem[ip];
      ex = ax - mem[ip] * ax;
      break;
    case 0x3300: {
      ip++;
      int temp = ax * mem[mem[ip]];
      ax = temp & 0xFFFF;
      ex = temp & 0xFFFF0000;
      break;
    }
    case 0x3301: {
      ip++;
      int temp = ax * mem[ip];
      ax = temp & 0xFFFF;
      ex = temp & 0xFFFF0000;
      break;
    }
    case 0x4000:
      ip++;
      ip = mem[ip] * 2 - 1;
      break;
    case 0x4100:
      ip++;
      if (ax < 0)
        ip = mem[ip] * 2 - 1;
      break;
    case 0x4200:
      ip++;
      if (ax == 0)
        ip = mem[ip] * 2 - 1;
      break;
    case 0x4300:
      ip++;
      if (ax > 0)
        ip = mem[ip] * 2 - 1;
      break;
    case 0x6100:
      ip++;
      ax = ax >> mem[mem[ip]];
      break;
    case 0x6200:
      ip++;
      ax = ax << mem[mem[ip]];
      break;
    case 0x7000:
      ip++;
      ax = ax & mem[mem[ip]];
      break;
    case 0x7100:
      ip++;
      ax = ax | mem[mem[ip]];
      break;
    case 0x7200:
      ip++;
      ax = ax ^ mem[mem[ip]];
      break;
    };
    ip++;
  }
  puts("Simpletron Halts!");
  char a = 'a';
  do {
    printf("Dump registers ? (y or n)");
    a = getchar();
    getchar();
  } while (a != 'y' && a != 'n' && a != 'Y' && a != 'N');
  if (a == 'y' || a == 'Y') {
    puts("register dump");
    printf("ax\t%04x\nex\t%04x\n", ax, ex);
  }
  do {
    printf("Dump memory? (y or n)");
    a = getchar();
    getchar();
  } while (a != 'y' && a != 'n' && a != 'Y' && a != 'N');
  if (a == 'y' || a == 'Y') {
    puts("\t0\t1\t2\t3\t4\t5\t6\t7\t8\t9\tA\tB\tC\tD\tE\tF\n");
    for (ip = 0; ip < 0xFFF; ip++) {
      printf("%03x\t", ip);
      for (ex = 0; ex <= 0xF; ex++)
        printf("%04x\t", mem[ip * 10 + ex]);
      puts("");
    }
    printf("FFF\t");
    for (ex = 0; ex < 0xF; ex++)
      printf("%04x\t", mem[0xFFF0 + ex]);
    puts("");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x80000,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    11d4 <main+0x44>
lea    0xe42(%rip),%rdi
call   1040 <puts@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
movq   $0xffff,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jb     1208 <main+0x78>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
movq   $0x0,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x28(%rbp)
jmp    11dc <main+0x4c>
mov    $0x0,%al
call   1070 <greeting@plt>
mov    -0x10(%rbp),%rdi
mov    $0x10000,%esi
call   1090 <getcode@plt>
cmp    $0x0,%rax
je     1231 <main+0xa1>
mov    $0x1,%edi
call   10b0 <exit@plt>
lea    0xdfd(%rip),%rdi
call   1040 <puts@plt>
lea    0xe0c(%rip),%rdi
call   1040 <puts@plt>
lea    0xde5(%rip),%rdi
call   1040 <puts@plt>
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
cmpq   $0x100,(%rax,%rcx,8)
je     193f <main+0x7af>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x48(%rbp)
sub    $0x1000,%rax
je     1472 <main+0x2e2>
jmp    12a4 <main+0x114>
mov    -0x48(%rbp),%rax
sub    $0x1100,%rax
je     14f1 <main+0x361>
jmp    12b9 <main+0x129>
mov    -0x48(%rbp),%rax
sub    $0x2000,%rax
je     1512 <main+0x382>
jmp    12ce <main+0x13e>
mov    -0x48(%rbp),%rax
sub    $0x2100,%rax
je     1545 <main+0x3b5>
jmp    12e3 <main+0x153>
mov    -0x48(%rbp),%rax
sub    $0x2200,%rax
je     156e <main+0x3de>
jmp    12f8 <main+0x168>
mov    -0x48(%rbp),%rax
sub    $0x2201,%rax
je     1597 <main+0x407>
jmp    130d <main+0x17d>
mov    -0x48(%rbp),%rax
sub    $0x3000,%rax
je     15c0 <main+0x430>
jmp    1322 <main+0x192>
mov    -0x48(%rbp),%rax
sub    $0x3001,%rax
je     15ed <main+0x45d>
jmp    1337 <main+0x1a7>
mov    -0x48(%rbp),%rax
sub    $0x3100,%rax
je     1612 <main+0x482>
jmp    134c <main+0x1bc>
mov    -0x48(%rbp),%rax
sub    $0x3101,%rax
je     1642 <main+0x4b2>
jmp    1361 <main+0x1d1>
mov    -0x48(%rbp),%rax
sub    $0x3200,%rax
je     1667 <main+0x4d7>
jmp    1376 <main+0x1e6>
mov    -0x48(%rbp),%rax
sub    $0x3201,%rax
je     16ba <main+0x52a>
jmp    138b <main+0x1fb>
mov    -0x48(%rbp),%rax
sub    $0x3300,%rax
je     16fd <main+0x56d>
jmp    13a0 <main+0x210>
mov    -0x48(%rbp),%rax
sub    $0x3301,%rax
je     1746 <main+0x5b6>
jmp    13b5 <main+0x225>
mov    -0x48(%rbp),%rax
sub    $0x4000,%rax
je     1787 <main+0x5f7>
jmp    13ca <main+0x23a>
mov    -0x48(%rbp),%rax
sub    $0x4100,%rax
je     17b0 <main+0x620>
jmp    13df <main+0x24f>
mov    -0x48(%rbp),%rax
sub    $0x4200,%rax
je     17e4 <main+0x654>
jmp    13f4 <main+0x264>
mov    -0x48(%rbp),%rax
sub    $0x4300,%rax
je     1818 <main+0x688>
jmp    1409 <main+0x279>
mov    -0x48(%rbp),%rax
sub    $0x6100,%rax
je     184c <main+0x6bc>
jmp    141e <main+0x28e>
mov    -0x48(%rbp),%rax
sub    $0x6200,%rax
je     187c <main+0x6ec>
jmp    1433 <main+0x2a3>
mov    -0x48(%rbp),%rax
sub    $0x7000,%rax
je     18ac <main+0x71c>
jmp    1448 <main+0x2b8>
mov    -0x48(%rbp),%rax
sub    $0x7100,%rax
je     18d9 <main+0x749>
jmp    145d <main+0x2cd>
mov    -0x48(%rbp),%rax
sub    $0x7200,%rax
je     1906 <main+0x776>
jmp    192e <main+0x79e>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
lea    -0x2d(%rbp),%rdi
mov    $0x4,%esi
call   1030 <get_s@plt>
cmp    $0xffffffff,%eax
je     14ab <main+0x31b>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
cmpq   $0x10000,(%rax,%rcx,8)
jb     14c3 <main+0x333>
lea    0xbb9(%rip),%rdi
call   1040 <puts@plt>
movl   $0x1,-0x4(%rbp)
jmp    1b7e <main+0x9ee>
lea    -0x2d(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   1080 <strtol@plt>
mov    %rax,%rdx
mov    -0x10(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    -0x28(%rbp),%rsi
mov    (%rcx,%rsi,8),%rcx
mov    %rdx,(%rax,%rcx,8)
jmp    192e <main+0x79e>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x18(%rbp)
jmp    192e <main+0x79e>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    -0x28(%rbp),%rdx
mov    (%rcx,%rdx,8),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xb95(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    192e <main+0x79e>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    -0x28(%rbp),%rdx
mov    (%rcx,%rdx,8),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x18(%rbp)
jmp    192e <main+0x79e>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    -0x28(%rbp),%rsi
mov    (%rcx,%rsi,8),%rcx
mov    %rdx,(%rax,%rcx,8)
jmp    192e <main+0x79e>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdx
mov    -0x10(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    -0x28(%rbp),%rsi
mov    (%rcx,%rsi,8),%rcx
mov    %rdx,(%rax,%rcx,8)
jmp    192e <main+0x79e>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    -0x28(%rbp),%rdx
mov    (%rcx,%rdx,8),%rcx
mov    (%rax,%rcx,8),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    192e <main+0x79e>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    192e <main+0x79e>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    -0x28(%rbp),%rdx
mov    (%rcx,%rdx,8),%rcx
mov    (%rax,%rcx,8),%rcx
mov    -0x18(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x18(%rbp)
jmp    192e <main+0x79e>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    192e <main+0x79e>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    -0x10(%rbp),%rdx
mov    -0x28(%rbp),%rsi
mov    (%rdx,%rsi,8),%rsi
xor    %edx,%edx
divq   (%rcx,%rsi,8)
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    -0x10(%rbp),%rdx
mov    -0x28(%rbp),%rsi
mov    (%rdx,%rsi,8),%rdx
mov    (%rcx,%rdx,8),%rcx
imul   -0x18(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x20(%rbp)
jmp    192e <main+0x79e>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    -0x28(%rbp),%rsi
xor    %edx,%edx
divq   (%rcx,%rsi,8)
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    -0x28(%rbp),%rdx
mov    (%rcx,%rdx,8),%rcx
imul   -0x18(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x20(%rbp)
jmp    192e <main+0x79e>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    -0x10(%rbp),%rdx
mov    -0x28(%rbp),%rsi
mov    (%rdx,%rsi,8),%rdx
imul   (%rcx,%rdx,8),%rax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
and    $0xffff,%eax
cltq
mov    %rax,-0x18(%rbp)
mov    -0x34(%rbp),%eax
and    $0xffff0000,%eax
mov    %eax,%eax
mov    %rax,-0x20(%rbp)
jmp    192e <main+0x79e>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    -0x28(%rbp),%rdx
imul   (%rcx,%rdx,8),%rax
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%eax
and    $0xffff,%eax
cltq
mov    %rax,-0x18(%rbp)
mov    -0x38(%rbp),%eax
and    $0xffff0000,%eax
mov    %eax,%eax
mov    %rax,-0x20(%rbp)
jmp    192e <main+0x79e>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
shl    $0x1,%rax
sub    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    192e <main+0x79e>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x18(%rbp)
jae    17df <main+0x64f>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
shl    $0x1,%rax
sub    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    192e <main+0x79e>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1813 <main+0x683>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
shl    $0x1,%rax
sub    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    192e <main+0x79e>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x18(%rbp)
jbe    1847 <main+0x6b7>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
shl    $0x1,%rax
sub    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    192e <main+0x79e>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    -0x10(%rbp),%rdx
mov    -0x28(%rbp),%rsi
mov    (%rdx,%rsi,8),%rdx
mov    (%rcx,%rdx,8),%rcx
shr    %cl,%rax
mov    %rax,-0x18(%rbp)
jmp    192e <main+0x79e>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    -0x10(%rbp),%rdx
mov    -0x28(%rbp),%rsi
mov    (%rdx,%rsi,8),%rdx
mov    (%rcx,%rdx,8),%rcx
shl    %cl,%rax
mov    %rax,-0x18(%rbp)
jmp    192e <main+0x79e>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    -0x10(%rbp),%rdx
mov    -0x28(%rbp),%rsi
mov    (%rdx,%rsi,8),%rdx
and    (%rcx,%rdx,8),%rax
mov    %rax,-0x18(%rbp)
jmp    192e <main+0x79e>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    -0x10(%rbp),%rdx
mov    -0x28(%rbp),%rsi
mov    (%rdx,%rsi,8),%rdx
or     (%rcx,%rdx,8),%rax
mov    %rax,-0x18(%rbp)
jmp    192e <main+0x79e>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    -0x10(%rbp),%rdx
mov    -0x28(%rbp),%rsi
mov    (%rdx,%rsi,8),%rdx
xor    (%rcx,%rdx,8),%rax
mov    %rax,-0x18(%rbp)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    126d <main+0xdd>
lea    0x743(%rip),%rdi
call   1040 <puts@plt>
movb   $0x61,-0x39(%rbp)
lea    0x745(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
mov    %al,-0x39(%rbp)
mov    $0x0,%al
call   1060 <getchar@plt>
movsbl -0x39(%rbp),%ecx
xor    %eax,%eax
cmp    $0x79,%ecx
mov    %al,-0x49(%rbp)
je     19b1 <main+0x821>
movsbl -0x39(%rbp),%ecx
xor    %eax,%eax
cmp    $0x6e,%ecx
mov    %al,-0x49(%rbp)
je     19b1 <main+0x821>
movsbl -0x39(%rbp),%ecx
xor    %eax,%eax
cmp    $0x59,%ecx
mov    %al,-0x49(%rbp)
je     19b1 <main+0x821>
movsbl -0x39(%rbp),%eax
cmp    $0x4e,%eax
setne  %al
mov    %al,-0x49(%rbp)
mov    -0x49(%rbp),%al
test   $0x1,%al
jne    194f <main+0x7bf>
movsbl -0x39(%rbp),%eax
cmp    $0x79,%eax
je     19d6 <main+0x846>
movsbl -0x39(%rbp),%eax
cmp    $0x59,%eax
jne    19f8 <main+0x868>
lea    0x6d8(%rip),%rdi
call   1040 <puts@plt>
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0x6d2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    19fd <main+0x86d>
lea    0x6d0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
mov    %al,-0x39(%rbp)
mov    $0x0,%al
call   1060 <getchar@plt>
movsbl -0x39(%rbp),%ecx
xor    %eax,%eax
cmp    $0x79,%ecx
mov    %al,-0x4a(%rbp)
je     1a5f <main+0x8cf>
movsbl -0x39(%rbp),%ecx
xor    %eax,%eax
cmp    $0x6e,%ecx
mov    %al,-0x4a(%rbp)
je     1a5f <main+0x8cf>
movsbl -0x39(%rbp),%ecx
xor    %eax,%eax
cmp    $0x59,%ecx
mov    %al,-0x4a(%rbp)
je     1a5f <main+0x8cf>
movsbl -0x39(%rbp),%eax
cmp    $0x4e,%eax
setne  %al
mov    %al,-0x4a(%rbp)
mov    -0x4a(%rbp),%al
test   $0x1,%al
jne    19fd <main+0x86d>
movsbl -0x39(%rbp),%eax
cmp    $0x79,%eax
je     1a84 <main+0x8f4>
movsbl -0x39(%rbp),%eax
cmp    $0x59,%eax
jne    1b77 <main+0x9e7>
lea    0x65f(%rip),%rdi
call   1040 <puts@plt>
movq   $0x0,-0x28(%rbp)
cmpq   $0xfff,-0x28(%rbp)
jae    1b18 <main+0x988>
mov    -0x28(%rbp),%rsi
lea    0x65b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movq   $0x0,-0x20(%rbp)
cmpq   $0xf,-0x20(%rbp)
ja     1afb <main+0x96b>
mov    -0x10(%rbp),%rax
imul   $0xa,-0x28(%rbp),%rcx
add    -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0x62f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1ac0 <main+0x930>
lea    0x61a(%rip),%rdi
call   1040 <puts@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1a98 <main+0x908>
lea    0x5f9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movq   $0x0,-0x20(%rbp)
cmpq   $0xf,-0x20(%rbp)
jae    1b6b <main+0x9db>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
add    $0xfff0,%rcx
mov    (%rax,%rcx,8),%rsi
lea    0x5bf(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1b2e <main+0x99e>
lea    0x5aa(%rip),%rdi
call   1040 <puts@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x80000,%edi
call   1050 <malloc@plt>
test   %rax,%rax
je     116d <main+0x2d>
add    $0x7fff8,%rax
cs nopw 0x0(%rax,%rax,1)
movq   $0x0,(%rax)
add    $0xfffffffffffffff8,%rax
jmp    1160 <main+0x20>
lea    0xe8c(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [53 x i8] c"Error allocating memory.\0A press enter to continue...\00"
@.str.1 = [27 x i8] c"+------------------------+\00"
@.str.2 = [27 x i8] c"| program excution starts|\00"
@.str.3 = [30 x i8] c"Fatal Error: Memory overflow \00"
@.str.4 = [6 x i8] c"%04x\0A\00"
@.str.5 = [18 x i8] c"Simpletron Halts!\00"
@.str.6 = [26 x i8] c"Dump registers ? (y or n)\00"
@.str.7 = [14 x i8] c"register dump\00"
@.str.8 = [17 x i8] c"ax\09%04x\0Aex\09%04x\0A\00"
@.str.9 = [22 x i8] c"Dump memory? (y or n)\00"
@.str.10 = [34 x i8] c"\090\091\092\093\094\095\096\097\098\099\09A\09B\09C\09D\09E\09F\0A\00"
@.str.11 = [6 x i8] c"%03x\09\00"
@.str.12 = [6 x i8] c"%04x\09\00"
@.str.13 = [1 x i8] zeroinitializer
@.str.14 = [5 x i8] c"FFF\09\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64*
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca [5 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8
store i32 0, i32* %1
%10 = call i64 @malloc(i32 524288)
%11 = inttoptr i64 %10 to i64*
store i64* %11, i64** %2
%12 = icmp eq i64* %11, null
br i1 %12, label %13, label %17
13: ; preds = %0
%14 = call i32 @puts(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%15 = call signext i8 (...) @getchar()
%16 = call i32 @exit(i32 1)
unreachable
17: ; preds = %0
store i64 65535, i64* %5
br label %18
18: ; preds = %25, %17
%19 = load i64, i64* %5
%20 = icmp uge i64 %19, 0
br i1 %20, label %21, label %28
21: ; preds = %18
%22 = load i64*, i64** %2
%23 = load i64, i64* %5
%24 = getelementptr inbounds i64, i64* %22, i64 %23
store i64 0, i64* %24
br label %25
25: ; preds = %21
%26 = load i64, i64* %5
%27 = add i64 %26, -1
store i64 %27, i64* %5
br label %18
28: ; preds = %18
%29 = call i32 (...) @greeting()
%30 = load i64*, i64** %2
%31 = call i64 @getcode(i64* %30, i32 65536)
%32 = icmp ne i64 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %28
%34 = call i32 @exit(i32 1)
unreachable
35: ; preds = %28
%36 = call i32 @puts(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%37 = call i32 @puts(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%38 = call i32 @puts(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
store i64 0, i64* %5
store i64 0, i64* %3
store i64 0, i64* %4
br label %39
39: ; preds = %346, %35
%40 = load i64*, i64** %2
%41 = load i64, i64* %5
%42 = getelementptr inbounds i64, i64* %40, i64 %41
%43 = load i64, i64* %42
%44 = icmp ne i64 %43, 256
br i1 %44, label %45, label %349
45: ; preds = %39
%46 = load i64*, i64** %2
%47 = load i64, i64* %5
%48 = getelementptr inbounds i64, i64* %46, i64 %47
%49 = load i64, i64* %48
switch i64 %49, label %346 [
i64 4096, label %50
i64 4352, label %73
i64 8192, label %80
i64 8448, label %91
i64 8704, label %101
i64 8705, label %111
i64 12288, label %121
i64 12289, label %133
i64 12544, label %142
i64 12545, label %154
i64 12800, label %163
i64 12801, label %186
i64 13056, label %203
i64 13057, label %222
i64 16384, label %238
i64 16640, label %247
i64 16896, label %260
i64 17152, label %273
i64 24832, label %286
i64 25088, label %298
i64 28672, label %310
i64 28928, label %322
i64 29184, label %334
]
50: ; preds = %45
%51 = load i64, i64* %5
%52 = add i64 %51, 1
store i64 %52, i64* %5
%53 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
%54 = call i32 @get_s(i8* %53, i32 4)
%55 = icmp eq i32 %54, -1
br i1 %55, label %62, label %56
56: ; preds = %50
%57 = load i64*, i64** %2
%58 = load i64, i64* %5
%59 = getelementptr inbounds i64, i64* %57, i64 %58
%60 = load i64, i64* %59
%61 = icmp uge i64 %60, 65536
br i1 %61, label %62, label %64
62: ; preds = %56, %50
%63 = call i32 @puts(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %1
br label %463
64: ; preds = %56
%65 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
%66 = call i64 @strtol(i8* %65, i32* null, i32 16)
%67 = load i64*, i64** %2
%68 = load i64*, i64** %2
%69 = load i64, i64* %5
%70 = getelementptr inbounds i64, i64* %68, i64 %69
%71 = load i64, i64* %70
%72 = getelementptr inbounds i64, i64* %67, i64 %71
store i64 %66, i64* %72
br label %346
73: ; preds = %45
%74 = load i64, i64* %5
%75 = add i64 %74, 1
store i64 %75, i64* %5
%76 = load i64*, i64** %2
%77 = load i64, i64* %5
%78 = getelementptr inbounds i64, i64* %76, i64 %77
%79 = load i64, i64* %78
store i64 %79, i64* %3
br label %346
80: ; preds = %45
%81 = load i64, i64* %5
%82 = add i64 %81, 1
store i64 %82, i64* %5
%83 = load i64*, i64** %2
%84 = load i64*, i64** %2
%85 = load i64, i64* %5
%86 = getelementptr inbounds i64, i64* %84, i64 %85
%87 = load i64, i64* %86
%88 = getelementptr inbounds i64, i64* %83, i64 %87
%89 = load i64, i64* %88
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i64 %89)
br label %346
91: ; preds = %45
%92 = load i64, i64* %5
%93 = add i64 %92, 1
store i64 %93, i64* %5
%94 = load i64*, i64** %2
%95 = load i64*, i64** %2
%96 = load i64, i64* %5
%97 = getelementptr inbounds i64, i64* %95, i64 %96
%98 = load i64, i64* %97
%99 = getelementptr inbounds i64, i64* %94, i64 %98
%100 = load i64, i64* %99
store i64 %100, i64* %3
br label %346
101: ; preds = %45
%102 = load i64, i64* %5
%103 = add i64 %102, 1
store i64 %103, i64* %5
%104 = load i64, i64* %3
%105 = load i64*, i64** %2
%106 = load i64*, i64** %2
%107 = load i64, i64* %5
%108 = getelementptr inbounds i64, i64* %106, i64 %107
%109 = load i64, i64* %108
%110 = getelementptr inbounds i64, i64* %105, i64 %109
store i64 %104, i64* %110
br label %346
111: ; preds = %45
%112 = load i64, i64* %5
%113 = add i64 %112, 1
store i64 %113, i64* %5
%114 = load i64, i64* %4
%115 = load i64*, i64** %2
%116 = load i64*, i64** %2
%117 = load i64, i64* %5
%118 = getelementptr inbounds i64, i64* %116, i64 %117
%119 = load i64, i64* %118
%120 = getelementptr inbounds i64, i64* %115, i64 %119
store i64 %114, i64* %120
br label %346
121: ; preds = %45
%122 = load i64, i64* %5
%123 = add i64 %122, 1
store i64 %123, i64* %5
%124 = load i64*, i64** %2
%125 = load i64*, i64** %2
%126 = load i64, i64* %5
%127 = getelementptr inbounds i64, i64* %125, i64 %126
%128 = load i64, i64* %127
%129 = getelementptr inbounds i64, i64* %124, i64 %128
%130 = load i64, i64* %129
%131 = load i64, i64* %3
%132 = add i64 %131, %130
store i64 %132, i64* %3
br label %346
133: ; preds = %45
%134 = load i64, i64* %5
%135 = add i64 %134, 1
store i64 %135, i64* %5
%136 = load i64*, i64** %2
%137 = load i64, i64* %5
%138 = getelementptr inbounds i64, i64* %136, i64 %137
%139 = load i64, i64* %138
%140 = load i64, i64* %3
%141 = add i64 %140, %139
store i64 %141, i64* %3
br label %346
142: ; preds = %45
%143 = load i64, i64* %5
%144 = add i64 %143, 1
store i64 %144, i64* %5
%145 = load i64*, i64** %2
%146 = load i64*, i64** %2
%147 = load i64, i64* %5
%148 = getelementptr inbounds i64, i64* %146, i64 %147
%149 = load i64, i64* %148
%150 = getelementptr inbounds i64, i64* %145, i64 %149
%151 = load i64, i64* %150
%152 = load i64, i64* %3
%153 = sub i64 %152, %151
store i64 %153, i64* %3
br label %346
154: ; preds = %45
%155 = load i64, i64* %5
%156 = add i64 %155, 1
store i64 %156, i64* %5
%157 = load i64*, i64** %2
%158 = load i64, i64* %5
%159 = getelementptr inbounds i64, i64* %157, i64 %158
%160 = load i64, i64* %159
%161 = load i64, i64* %3
%162 = add i64 %161, %160
store i64 %162, i64* %3
br label %346
163: ; preds = %45
%164 = load i64, i64* %5
%165 = add i64 %164, 1
store i64 %165, i64* %5
%166 = load i64, i64* %3
%167 = load i64*, i64** %2
%168 = load i64*, i64** %2
%169 = load i64, i64* %5
%170 = getelementptr inbounds i64, i64* %168, i64 %169
%171 = load i64, i64* %170
%172 = getelementptr inbounds i64, i64* %167, i64 %171
%173 = load i64, i64* %172
%174 = udiv i64 %166, %173
store i64 %174, i64* %3
%175 = load i64, i64* %3
%176 = load i64*, i64** %2
%177 = load i64*, i64** %2
%178 = load i64, i64* %5
%179 = getelementptr inbounds i64, i64* %177, i64 %178
%180 = load i64, i64* %179
%181 = getelementptr inbounds i64, i64* %176, i64 %180
%182 = load i64, i64* %181
%183 = load i64, i64* %3
%184 = mul i64 %182, %183
%185 = sub i64 %175, %184
store i64 %185, i64* %4
br label %346
186: ; preds = %45
%187 = load i64, i64* %5
%188 = add i64 %187, 1
store i64 %188, i64* %5
%189 = load i64, i64* %3
%190 = load i64*, i64** %2
%191 = load i64, i64* %5
%192 = getelementptr inbounds i64, i64* %190, i64 %191
%193 = load i64, i64* %192
%194 = udiv i64 %189, %193
store i64 %194, i64* %3
%195 = load i64, i64* %3
%196 = load i64*, i64** %2
%197 = load i64, i64* %5
%198 = getelementptr inbounds i64, i64* %196, i64 %197
%199 = load i64, i64* %198
%200 = load i64, i64* %3
%201 = mul i64 %199, %200
%202 = sub i64 %195, %201
store i64 %202, i64* %4
br label %346
203: ; preds = %45
%204 = load i64, i64* %5
%205 = add i64 %204, 1
store i64 %205, i64* %5
%206 = load i64, i64* %3
%207 = load i64*, i64** %2
%208 = load i64*, i64** %2
%209 = load i64, i64* %5
%210 = getelementptr inbounds i64, i64* %208, i64 %209
%211 = load i64, i64* %210
%212 = getelementptr inbounds i64, i64* %207, i64 %211
%213 = load i64, i64* %212
%214 = mul i64 %206, %213
%215 = trunc i64 %214 to i32
store i32 %215, i32* %7
%216 = load i32, i32* %7
%217 = and i32 %216, 65535
%218 = sext i32 %217 to i64
store i64 %218, i64* %3
%219 = load i32, i32* %7
%220 = and i32 %219, -65536
%221 = zext i32 %220 to i64
store i64 %221, i64* %4
br label %346
222: ; preds = %45
%223 = load i64, i64* %5
%224 = add i64 %223, 1
store i64 %224, i64* %5
%225 = load i64, i64* %3
%226 = load i64*, i64** %2
%227 = load i64, i64* %5
%228 = getelementptr inbounds i64, i64* %226, i64 %227
%229 = load i64, i64* %228
%230 = mul i64 %225, %229
%231 = trunc i64 %230 to i32
store i32 %231, i32* %8
%232 = load i32, i32* %8
%233 = and i32 %232, 65535
%234 = sext i32 %233 to i64
store i64 %234, i64* %3
%235 = load i32, i32* %8
%236 = and i32 %235, -65536
%237 = zext i32 %236 to i64
store i64 %237, i64* %4
br label %346
238: ; preds = %45
%239 = load i64, i64* %5
%240 = add i64 %239, 1
store i64 %240, i64* %5
%241 = load i64*, i64** %2
%242 = load i64, i64* %5
%243 = getelementptr inbounds i64, i64* %241, i64 %242
%244 = load i64, i64* %243
%245 = mul i64 %244, 2
%246 = sub i64 %245, 1
store i64 %246, i64* %5
br label %346
247: ; preds = %45
%248 = load i64, i64* %5
%249 = add i64 %248, 1
store i64 %249, i64* %5
%250 = load i64, i64* %3
%251 = icmp ult i64 %250, 0
br i1 %251, label %252, label %259
252: ; preds = %247
%253 = load i64*, i64** %2
%254 = load i64, i64* %5
%255 = getelementptr inbounds i64, i64* %253, i64 %254
%256 = load i64, i64* %255
%257 = mul i64 %256, 2
%258 = sub i64 %257, 1
store i64 %258, i64* %5
br label %259
259: ; preds = %252, %247
br label %346
260: ; preds = %45
%261 = load i64, i64* %5
%262 = add i64 %261, 1
store i64 %262, i64* %5
%263 = load i64, i64* %3
%264 = icmp eq i64 %263, 0
br i1 %264, label %265, label %272
265: ; preds = %260
%266 = load i64*, i64** %2
%267 = load i64, i64* %5
%268 = getelementptr inbounds i64, i64* %266, i64 %267
%269 = load i64, i64* %268
%270 = mul i64 %269, 2
%271 = sub i64 %270, 1
store i64 %271, i64* %5
br label %272
272: ; preds = %265, %260
br label %346
273: ; preds = %45
%274 = load i64, i64* %5
%275 = add i64 %274, 1
store i64 %275, i64* %5
%276 = load i64, i64* %3
%277 = icmp ugt i64 %276, 0
br i1 %277, label %278, label %285
278: ; preds = %273
%279 = load i64*, i64** %2
%280 = load i64, i64* %5
%281 = getelementptr inbounds i64, i64* %279, i64 %280
%282 = load i64, i64* %281
%283 = mul i64 %282, 2
%284 = sub i64 %283, 1
store i64 %284, i64* %5
br label %285
285: ; preds = %278, %273
br label %346
286: ; preds = %45
%287 = load i64, i64* %5
%288 = add i64 %287, 1
store i64 %288, i64* %5
%289 = load i64, i64* %3
%290 = load i64*, i64** %2
%291 = load i64*, i64** %2
%292 = load i64, i64* %5
%293 = getelementptr inbounds i64, i64* %291, i64 %292
%294 = load i64, i64* %293
%295 = getelementptr inbounds i64, i64* %290, i64 %294
%296 = load i64, i64* %295
%297 = lshr i64 %289, %296
store i64 %297, i64* %3
br label %346
298: ; preds = %45
%299 = load i64, i64* %5
%300 = add i64 %299, 1
store i64 %300, i64* %5
%301 = load i64, i64* %3
%302 = load i64*, i64** %2
%303 = load i64*, i64** %2
%304 = load i64, i64* %5
%305 = getelementptr inbounds i64, i64* %303, i64 %304
%306 = load i64, i64* %305
%307 = getelementptr inbounds i64, i64* %302, i64 %306
%308 = load i64, i64* %307
%309 = shl i64 %301, %308
store i64 %309, i64* %3
br label %346
310: ; preds = %45
%311 = load i64, i64* %5
%312 = add i64 %311, 1
store i64 %312, i64* %5
%313 = load i64, i64* %3
%314 = load i64*, i64** %2
%315 = load i64*, i64** %2
%316 = load i64, i64* %5
%317 = getelementptr inbounds i64, i64* %315, i64 %316
%318 = load i64, i64* %317
%319 = getelementptr inbounds i64, i64* %314, i64 %318
%320 = load i64, i64* %319
%321 = and i64 %313, %320
store i64 %321, i64* %3
br label %346
322: ; preds = %45
%323 = load i64, i64* %5
%324 = add i64 %323, 1
store i64 %324, i64* %5
%325 = load i64, i64* %3
%326 = load i64*, i64** %2
%327 = load i64*, i64** %2
%328 = load i64, i64* %5
%329 = getelementptr inbounds i64, i64* %327, i64 %328
%330 = load i64, i64* %329
%331 = getelementptr inbounds i64, i64* %326, i64 %330
%332 = load i64, i64* %331
%333 = or i64 %325, %332
store i64 %333, i64* %3
br label %346
334: ; preds = %45
%335 = load i64, i64* %5
%336 = add i64 %335, 1
store i64 %336, i64* %5
%337 = load i64, i64* %3
%338 = load i64*, i64** %2
%339 = load i64*, i64** %2
%340 = load i64, i64* %5
%341 = getelementptr inbounds i64, i64* %339, i64 %340
%342 = load i64, i64* %341
%343 = getelementptr inbounds i64, i64* %338, i64 %342
%344 = load i64, i64* %343
%345 = xor i64 %337, %344
store i64 %345, i64* %3
br label %346
346: ; preds = %45, %334, %322, %310, %298, %286, %285, %272, %259, %238, %222, %203, %186, %163, %154, %142, %133, %121, %111, %101, %91, %80, %73, %64
%347 = load i64, i64* %5
%348 = add i64 %347, 1
store i64 %348, i64* %5
br label %39
349: ; preds = %39
%350 = call i32 @puts(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
store i8 97, i8* %9
br label %351
351: ; preds = %371, %349
%352 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0))
%353 = call signext i8 (...) @getchar()
store i8 %353, i8* %9
%354 = call signext i8 (...) @getchar()
br label %355
355: ; preds = %351
%356 = load i8, i8* %9
%357 = sext i8 %356 to i32
%358 = icmp ne i32 %357, 121
br i1 %358, label %359, label %371
359: ; preds = %355
%360 = load i8, i8* %9
%361 = sext i8 %360 to i32
%362 = icmp ne i32 %361, 110
br i1 %362, label %363, label %371
363: ; preds = %359
%364 = load i8, i8* %9
%365 = sext i8 %364 to i32
%366 = icmp ne i32 %365, 89
br i1 %366, label %367, label %371
367: ; preds = %363
%368 = load i8, i8* %9
%369 = sext i8 %368 to i32
%370 = icmp ne i32 %369, 78
br label %371
371: ; preds = %367, %363, %359, %355
%372 = phi i1 [ false, %363 ], [ false, %359 ], [ false, %355 ], [ %370, %367 ]
br i1 %372, label %351, label %373
373: ; preds = %371
%374 = load i8, i8* %9
%375 = sext i8 %374 to i32
%376 = icmp eq i32 %375, 121
br i1 %376, label %381, label %377
377: ; preds = %373
%378 = load i8, i8* %9
%379 = sext i8 %378 to i32
%380 = icmp eq i32 %379, 89
br i1 %380, label %381, label %386
381: ; preds = %377, %373
%382 = call i32 @puts(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0))
%383 = load i64, i64* %3
%384 = load i64, i64* %4
%385 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i64 %383, i64 %384)
br label %386
386: ; preds = %381, %377
br label %387
387: ; preds = %407, %386
%388 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0))
%389 = call signext i8 (...) @getchar()
store i8 %389, i8* %9
%390 = call signext i8 (...) @getchar()
br label %391
391: ; preds = %387
%392 = load i8, i8* %9
%393 = sext i8 %392 to i32
%394 = icmp ne i32 %393, 121
br i1 %394, label %395, label %407
395: ; preds = %391
%396 = load i8, i8* %9
%397 = sext i8 %396 to i32
%398 = icmp ne i32 %397, 110
br i1 %398, label %399, label %407
399: ; preds = %395
%400 = load i8, i8* %9
%401 = sext i8 %400 to i32
%402 = icmp ne i32 %401, 89
br i1 %402, label %403, label %407
403: ; preds = %399
%404 = load i8, i8* %9
%405 = sext i8 %404 to i32
%406 = icmp ne i32 %405, 78
br label %407
407: ; preds = %403, %399, %395, %391
%408 = phi i1 [ false, %399 ], [ false, %395 ], [ false, %391 ], [ %406, %403 ]
br i1 %408, label %387, label %409
409: ; preds = %407
%410 = load i8, i8* %9
%411 = sext i8 %410 to i32
%412 = icmp eq i32 %411, 121
br i1 %412, label %417, label %413
413: ; preds = %409
%414 = load i8, i8* %9
%415 = sext i8 %414 to i32
%416 = icmp eq i32 %415, 89
br i1 %416, label %417, label %462
417: ; preds = %413, %409
%418 = call i32 @puts(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.10, i64 0, i64 0))
store i64 0, i64* %5
br label %419
419: ; preds = %442, %417
%420 = load i64, i64* %5
%421 = icmp ult i64 %420, 4095
br i1 %421, label %422, label %445
422: ; preds = %419
%423 = load i64, i64* %5
%424 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), i64 %423)
store i64 0, i64* %4
br label %425
425: ; preds = %437, %422
%426 = load i64, i64* %4
%427 = icmp ule i64 %426, 15
br i1 %427, label %428, label %440
428: ; preds = %425
%429 = load i64*, i64** %2
%430 = load i64, i64* %5
%431 = mul i64 %430, 10
%432 = load i64, i64* %4
%433 = add i64 %431, %432
%434 = getelementptr inbounds i64, i64* %429, i64 %433
%435 = load i64, i64* %434
%436 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), i64 %435)
br label %437
437: ; preds = %428
%438 = load i64, i64* %4
%439 = add i64 %438, 1
store i64 %439, i64* %4
br label %425
440: ; preds = %425
%441 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.13, i64 0, i64 0))
br label %442
442: ; preds = %440
%443 = load i64, i64* %5
%444 = add i64 %443, 1
store i64 %444, i64* %5
br label %419
445: ; preds = %419
%446 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0))
store i64 0, i64* %4
br label %447
447: ; preds = %457, %445
%448 = load i64, i64* %4
%449 = icmp ult i64 %448, 15
br i1 %449, label %450, label %460
450: ; preds = %447
%451 = load i64*, i64** %2
%452 = load i64, i64* %4
%453 = add i64 65520, %452
%454 = getelementptr inbounds i64, i64* %451, i64 %453
%455 = load i64, i64* %454
%456 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), i64 %455)
br label %457
457: ; preds = %450
%458 = load i64, i64* %4
%459 = add i64 %458, 1
store i64 %459, i64* %4
br label %447
460: ; preds = %447
%461 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.13, i64 0, i64 0))
br label %462
462: ; preds = %460, %413
store i32 0, i32* %1
br label %463
463: ; preds = %462, %62
%464 = load i32, i32* %1
ret i32 %464
}

LLVM IR (-O2):
@.str = [53 x i8] c"Error allocating memory.\0A press enter to continue...\00"
define i32 @main() {
%1 = tail call i64 @malloc(i32 524288)
%2 = inttoptr i64 %1 to i64*
%3 = icmp eq i64 %1, 0
br i1 %3, label %4, label %8
4: ; preds = %0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%6 = tail call signext i8 (...) @getchar()
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %0, %8
%9 = phi i64 [ %11, %8 ], [ 65535, %0 ]
%10 = getelementptr inbounds i64, i64* %2, i64 %9
store i64 0, i64* %10
%11 = add i64 %9, -1
br label %8
}