// File: /workspace/github_cpp_makefile_star2_O1/jmbjorndalen[P]Malbolge-gen/interp-orig.c
// Function: main
int main( int argc, char **argv )
{
  FILE *f;
  unsigned short i = 0, j;
  int x;
  unsigned short *mem;
  if ( argc != 2 )
  {
    fputs( "invalid command line\n", stderr );
    return ( 1 );
  }
  if ( ( f = fopen( argv[1], "r" ) ) == NULL )
  {
    fputs( "can't open file\n", stderr );
    return ( 1 );
  }
#ifdef _MSC_VER
  mem = (unsigned short *)_halloc( 59049, sizeof(unsigned short) );
#else
  mem = (unsigned short *)malloc( sizeof(unsigned short) * 59049 );
#endif
  if ( mem == NULL )
  {
    fclose( f );
    fputs( "can't allocate memory\n", stderr );
    return ( 1 );
  }
  while ( ( x = getc( f ) ) != EOF )
  {
    if ( isspace( x ) ) continue;
    if ( x < 127 && x > 32 )
    {
      if ( strchr( "ji*p</vo", xlat1[( x - 33 + i ) % 94] ) == NULL )
      {
        fputs( "invalid character in source file\n", stderr );
        free( mem );
        fclose( f );
        return ( 1 );
      }
    }
    if ( i == 59049 )
    {
      fputs( "input file too long\n", stderr );
      free( mem );
      fclose( f );
      return ( 1 );
    }
    mem[i++] = x;
  }
  fclose( f );
  while ( i < 59049 ) mem[i] = op( mem[i - 1], mem[i - 2] ), i++;
  exec( mem );
  free( mem );
  // This printf added by John Markus Bj�rndalen. Output without newline tends to disappear under the shell prompt. This will prevent some 
  // confusion.
  printf("\n");  
  return ( 0 );
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x2, %edi
jne 0x401b95
movq 0x8(%rsi), %rdi
leaq 0xadc80(%rip), %rsi     # 0x4af487
callq 0x40c580
testq %rax, %rax
je 0x401b9c
movq %rax, %r14
movl $0x1cd52, %edi          # imm = 0x1CD52
callq 0x419fa0
testq %rax, %rax
je 0x401ba3
movq %rax, %rbx
xorl %r13d, %r13d
movl $0xae4c415d, %ebp       # imm = 0xAE4C415D
leaq 0x96983(%rip), %r15     # 0x4981c0
movq %r14, %rdi
callq 0x40e820
cmpl $-0x1, %eax
je 0x4018b4
movl %eax, %r12d
callq 0x4048c0
movq (%rax), %rax
movslq %r12d, %rcx
testb $0x20, 0x1(%rax,%rcx,2)
jne 0x40183d
leal -0x21(%r12), %eax
cmpl $0x5d, %eax
ja 0x40189d
addl %r13d, %eax
movq %rax, %rcx
imulq %rbp, %rcx
shrq $0x26, %rcx
imull $0x5e, %ecx, %ecx
subl %ecx, %eax
leaq 0x9678d(%rip), %rcx     # 0x498010
movsbl (%rax,%rcx), %esi
movl $0x9, %edx
movq %r15, %rdi
callq 0x401068
testq %rax, %rax
je 0x401bcc
cmpq $0xe6a9, %r13           # imm = 0xE6A9
je 0x401bbf
movw %r12w, (%rbx,%r13,2)
incq %r13
jmp 0x40183d
movq %r14, %rdi
callq 0x40c140
leaq 0x9680d(%rip), %r14     # 0x4980d0
cmpq $0xe6a8, %r13           # imm = 0xE6A8
ja 0x40195d
movl $0xffff, %r8d           # imm = 0xFFFF
leaq 0x96803(%rip), %r9      # 0x4980e0
movzwl -0x4(%rbx,%r13,2), %ecx
movzwl -0x2(%rbx,%r13,2), %esi
xorl %r10d, %r10d
xorl %r11d, %r11d
movzwl (%r10,%r14), %ebp
movl %ecx, %eax
xorl %edx, %edx
divw %bp
movl %eax, %edi
movzwl %ax, %eax
imull $0xe38f, %eax, %eax     # imm = 0xE38F
shrl $0x13, %eax
leal (%rax,%rax,8), %r15d
movl %esi, %eax
xorl %edx, %edx
divw %bp
subl %r15d, %edi
movzwl %ax, %edx
imull $0xe38f, %edx, %edx     # imm = 0xE38F
andl %r8d, %edi
shrl $0x13, %edx
leal (%rdx,%rdx,8), %edx
leaq (%rdi,%rdi,8), %rdi
subl %edx, %eax
leaq (%r9,%rdi,2), %rdx
andl %r8d, %eax
imulw (%rdx,%rax,2), %bp
addl %ebp, %r11d
addq $0x2, %r10
cmpq $0xa, %r10
jne 0x4018ef
movw %r11w, (%rbx,%r13,2)
leaq 0x1(%r13), %rax
cmpq $0xe6a8, %r13           # imm = 0xE6A8
movq %rax, %r13
jb 0x4018dd
movzwl (%rbx), %eax
leal -0x7f(%rax), %ecx
cmpw $-0x5e, %cx
leaq 0x966a2(%rip), %rdi     # 0x498010
jae 0x401972
jmp 0x401970
xorl %r8d, %r8d
movl $0xae4c415d, %r9d       # imm = 0xAE4C415D
movl $0xe6a8, %r10d          # imm = 0xE6A8
leaq 0x966e8(%rip), %r11     # 0x498070
movl $0xffff, %r12d          # imm = 0xFFFF
xorl %ebp, %ebp
xorl %r13d, %r13d
xorl %r15d, %r15d
movzwl %ax, %eax
movzwl %r15w, %ecx
addl %ecx, %eax
addl $-0x21, %eax
movq %rax, %rcx
imulq %r9, %rcx
shrq $0x26, %rcx
imull $0x5e, %ecx, %ecx
subl %ecx, %eax
movzbl (%rax,%rdi), %eax
cmpl $0x68, %eax
jle 0x4019e0
cmpl $0x6f, %eax
jg 0x401a2f
cmpl $0x69, %eax
je 0x401ad0
cmpl $0x6a, %eax
jne 0x401b34
movzwl %r13w, %eax
movzwl (%rbx,%rax,2), %r13d
jmp 0x401b34
cmpl $0x2a, %eax
je 0x401adb
cmpl $0x2f, %eax
je 0x401aff
cmpl $0x3c, %eax
jne 0x401b34
movzwl %bp, %edi
movq $0x4c86f0, %rax         # imm = 0x4C86F0
movq (%rax), %rsi
callq 0x40e940
leaq 0x9665c(%rip), %r11     # 0x498070
movl $0xe6a8, %r10d          # imm = 0xE6A8
movl $0xae4c415d, %r9d       # imm = 0xAE4C415D
xorl %r8d, %r8d
leaq 0x965e6(%rip), %rdi     # 0x498010
jmp 0x401b34
cmpl $0x70, %eax
jne 0x401b7a
movzwl %r13w, %edi
movzwl (%rbx,%rdi,2), %ecx
xorl %r9d, %r9d
xorl %r8d, %r8d
movzwl (%r9,%r14), %r10d
movl %ecx, %eax
xorl %edx, %edx
divw %r10w
movl %eax, %esi
movzwl %ax, %eax
imull $0xe38f, %eax, %eax     # imm = 0xE38F
shrl $0x13, %eax
leal (%rax,%rax,8), %r11d
movl %ebp, %eax
xorl %edx, %edx
divw %r10w
subl %r11d, %esi
movzwl %ax, %edx
imull $0xe38f, %edx, %edx     # imm = 0xE38F
andl %r12d, %esi
shrl $0x13, %edx
leal (%rdx,%rdx,8), %edx
leaq (%rsi,%rsi,8), %rsi
subl %edx, %eax
leaq 0x96651(%rip), %rdx     # 0x4980e0
leaq (%rdx,%rsi,2), %rdx
andl %r12d, %eax
imulw (%rdx,%rax,2), %r10w
addl %r10d, %r8d
addq $0x2, %r9
cmpq $0xa, %r9
jne 0x401a46
movw %r8w, (%rbx,%rdi,2)
movl %r8d, %ebp
leaq 0x96558(%rip), %rdi     # 0x498010
xorl %r8d, %r8d
movl $0xae4c415d, %r9d       # imm = 0xAE4C415D
movl $0xe6a8, %r10d          # imm = 0xE6A8
leaq 0x965a2(%rip), %r11     # 0x498070
jmp 0x401b34
movzwl %r13w, %eax
movzwl (%rbx,%rax,2), %r15d
jmp 0x401b34
movzwl %r13w, %eax
movzwl (%rbx,%rax,2), %ecx
imull $0xaaab, %ecx, %edx     # imm = 0xAAAB
shrl $0x11, %edx
leal (%rdx,%rdx,2), %esi
subl %esi, %ecx
imull $0x4ce3, %ecx, %ebp     # imm = 0x4CE3
addl %edx, %ebp
movw %bp, (%rbx,%rax,2)
jmp 0x401b34
movq $0x4c86f8, %rax         # imm = 0x4C86F8
movq (%rax), %rdi
callq 0x40e820
leaq 0x9655b(%rip), %r11     # 0x498070
movl $0xe6a8, %r10d          # imm = 0xE6A8
movl $0xae4c415d, %r9d       # imm = 0xAE4C415D
xorl %r8d, %r8d
leaq 0x964e5(%rip), %rdi     # 0x498010
movl %eax, %ebp
cmpl $-0x1, %eax
cmovel %r10d, %ebp
movzwl %r15w, %eax
movzwl (%rbx,%rax,2), %ecx
movsbl -0x21(%rcx,%r11), %ecx
movw %cx, (%rbx,%rax,2)
incl %r15d
cmpl %r10d, %eax
cmovel %r8d, %r15d
movzwl %r13w, %eax
incl %r13d
cmpl %r10d, %eax
cmovel %r8d, %r13d
movzwl %r15w, %eax
movzwl (%rbx,%rax,2), %eax
movl %eax, %ecx
addl $-0x7f, %ecx
cmpw $-0x5e, %cx
jae 0x401996
jmp 0x401970
cmpl $0x76, %eax
jne 0x401b34
movq %rbx, %rdi
callq 0x41a2e0
movl $0xa, %edi
callq 0x40c7b0
xorl %eax, %eax
jmp 0x401bb0
callq 0x401100
jmp 0x401bab
callq 0x4011a1
jmp 0x401bab
movq %r14, %rdi
callq 0x401184
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
movq %r14, %rsi
callq 0x401116
jmp 0x401bab
movq %rbx, %rdi
movq %r14, %rsi
callq 0x40114d
jmp 0x401bab
nopl (%rax)