#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 int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int /*<<< orphan*/ exit(int);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  int i, c;
  FILE *in;
  int k, j, jj;
  short memory[100][160];
  in = fopen(argv[1], "r");
  if (in == NULL) {
    printf("Input file error\n");
    exit(1);
  }
  k = 0;
  j = 0;
  while (1) {
    for (i = 0; i < 160; i++) {
      c = fgetc(in);
      memory[k][i] = c;
    }
    k++;
    if (c == EOF)
      break;
  }
  printf("char memory[]={\n");
  for (j = 0; j < k - 1; j++) {
    for (jj = 0; jj < 160; jj++)
      printf("%d, ", memory[j][jj]);
    printf("\n");
  }
  for (jj = 0; jj < i - 1; jj++)
    printf("%d, ", memory[k - 1][jj]);
  printf("%d", memory[k - 1][i - 1]);
  printf("\n};\n");
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x7d30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe98(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1194 <main+0x54>
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0xa0,-0x14(%rbp)
jge    11f3 <main+0xb3>
mov    -0x20(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %ax,%dx
movslq -0x24(%rbp),%rcx
lea    -0x7d30(%rbp),%rax
imul   $0x140,%rcx,%rcx
add    %rcx,%rax
movslq -0x14(%rbp),%rcx
mov    %dx,(%rax,%rcx,2)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11a9 <main+0x69>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%eax
mov    0x2de2(%rip),%rcx
cmp    (%rcx),%eax
jne    1213 <main+0xd3>
jmp    1218 <main+0xd8>
jmp    11a2 <main+0x62>
lea    0xdf5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    12a7 <main+0x167>
movl   $0x0,-0x2c(%rbp)
cmpl   $0xa0,-0x2c(%rbp)
jge    128b <main+0x14b>
movslq -0x28(%rbp),%rcx
lea    -0x7d30(%rbp),%rax
imul   $0x140,%rcx,%rcx
add    %rcx,%rax
movslq -0x2c(%rbp),%rcx
movswl (%rax,%rcx,2),%esi
lea    0xdaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1245 <main+0x105>
lea    0xd9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    122d <main+0xed>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    12fd <main+0x1bd>
mov    -0x24(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    -0x7d30(%rbp),%rax
imul   $0x140,%rcx,%rcx
add    %rcx,%rax
movslq -0x2c(%rbp),%rcx
movswl (%rax,%rcx,2),%esi
lea    0xd3d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    12ae <main+0x16e>
mov    -0x24(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    -0x7d30(%rbp),%rax
imul   $0x140,%rcx,%rcx
add    %rcx,%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movswl (%rax,%rcx,2),%esi
lea    0xcff(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xcf4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x7d30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x7d18,%rsp
mov    0x8(%rsi),%rdi
lea    0xeaf(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     12ed <main+0x18d>
mov    %rax,%r13
mov    $0xffffffff,%r12d
lea    0x10(%rsp),%rbp
xor    %ecx,%ecx
mov    0x2e47(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rcx,%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r13,%rdi
call   1060 <fgetc@plt>
mov    %ax,0x0(%rbp,%rbx,2)
add    $0x1,%rbx
cmp    $0xa0,%rbx
jne    11c0 <main+0x60>
lea    0x1(%r14),%rcx
add    $0x1,%r12d
add    $0x140,%rbp
cmp    (%r15),%eax
jne    11b0 <main+0x50>
lea    0xe13(%rip),%rdi
call   1040 <puts@plt>
test   %r14d,%r14d
je     1269 <main+0x109>
mov    %r14d,%eax
mov    %rax,0x8(%rsp)
lea    0x10(%rsp),%rbp
lea    0xded(%rip),%rbx
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movswl 0x0(%rbp,%r15,2),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r15
cmp    $0xa0,%r15
jne    1230 <main+0xd0>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r13
add    $0x140,%rbp
cmp    0x8(%rsp),%r13
jne    1220 <main+0xc0>
mov    %r14d,%r14d
mov    %r12d,%eax
lea    (%rax,%rax,4),%rax
shl    $0x6,%rax
lea    (%rsp,%rax,1),%rbp
add    $0x10,%rbp
lea    0xd7a(%rip),%r15
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
movswl 0x0(%rbp,%rbx,2),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    $0x9f,%rbx
jne    1290 <main+0x130>
lea    (%r14,%r14,4),%rax
shl    $0x6,%rax
movswl 0x14e(%rsp,%rax,1),%esi
lea    0xd42(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd47(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%eax
add    $0x7d18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd28(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [18 x i8] c"Input file error\0A\00"
@EOF = global i32 0
@.str.2 = [17 x i8] c"char memory[]={\0A\00"
@.str.3 = [5 x i8] c"%d, \00"
@.str.4 = [2 x i8] c"\0A\00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [5 x i8] c"\0A};\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca [100 x [160 x i16]]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %16, i32** %8
%17 = load i32*, i32** %8
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %22
19: ; preds = %2
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %2
store i32 0, i32* %9
store i32 0, i32* %10
br label %23
23: ; preds = %22, %48
store i32 0, i32* %6
br label %24
24: ; preds = %38, %23
%25 = load i32, i32* %6
%26 = icmp slt i32 %25, 160
br i1 %26, label %27, label %41
27: ; preds = %24
%28 = load i32*, i32** %8
%29 = call i32 @fgetc(i32* %28)
store i32 %29, i32* %7
%30 = load i32, i32* %7
%31 = trunc i32 %30 to i16
%32 = load i32, i32* %9
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [100 x [160 x i16]], [100 x [160 x i16]]* %12, i64 0, i64 %33
%35 = load i32, i32* %6
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [160 x i16], [160 x i16]* %34, i64 0, i64 %36
store i16 %31, i16* %37
br label %38
38: ; preds = %27
%39 = load i32, i32* %6
%40 = add nsw i32 %39, 1
store i32 %40, i32* %6
br label %24
41: ; preds = %24
%42 = load i32, i32* %9
%43 = add nsw i32 %42, 1
store i32 %43, i32* %9
%44 = load i32, i32* %7
%45 = load i32, i32* @EOF
%46 = icmp eq i32 %44, %45
br i1 %46, label %47, label %48
47: ; preds = %41
br label %49
48: ; preds = %41
br label %23
49: ; preds = %47
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %10
br label %51
51: ; preds = %75, %49
%52 = load i32, i32* %10
%53 = load i32, i32* %9
%54 = sub nsw i32 %53, 1
%55 = icmp slt i32 %52, %54
br i1 %55, label %56, label %78
56: ; preds = %51
store i32 0, i32* %11
br label %57
57: ; preds = %70, %56
%58 = load i32, i32* %11
%59 = icmp slt i32 %58, 160
br i1 %59, label %60, label %73
60: ; preds = %57
%61 = load i32, i32* %10
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [100 x [160 x i16]], [100 x [160 x i16]]* %12, i64 0, i64 %62
%64 = load i32, i32* %11
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [160 x i16], [160 x i16]* %63, i64 0, i64 %65
%67 = load i16, i16* %66
%68 = sext i16 %67 to i32
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %68)
br label %70
70: ; preds = %60
%71 = load i32, i32* %11
%72 = add nsw i32 %71, 1
store i32 %72, i32* %11
br label %57
73: ; preds = %57
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %75
75: ; preds = %73
%76 = load i32, i32* %10
%77 = add nsw i32 %76, 1
store i32 %77, i32* %10
br label %51
78: ; preds = %51
store i32 0, i32* %11
br label %79
79: ; preds = %95, %78
%80 = load i32, i32* %11
%81 = load i32, i32* %6
%82 = sub nsw i32 %81, 1
%83 = icmp slt i32 %80, %82
br i1 %83, label %84, label %98
84: ; preds = %79
%85 = load i32, i32* %9
%86 = sub nsw i32 %85, 1
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds [100 x [160 x i16]], [100 x [160 x i16]]* %12, i64 0, i64 %87
%89 = load i32, i32* %11
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds [160 x i16], [160 x i16]* %88, i64 0, i64 %90
%92 = load i16, i16* %91
%93 = sext i16 %92 to i32
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %93)
br label %95
95: ; preds = %84
%96 = load i32, i32* %11
%97 = add nsw i32 %96, 1
store i32 %97, i32* %11
br label %79
98: ; preds = %79
%99 = load i32, i32* %9
%100 = sub nsw i32 %99, 1
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds [100 x [160 x i16]], [100 x [160 x i16]]* %12, i64 0, i64 %101
%103 = load i32, i32* %6
%104 = sub nsw i32 %103, 1
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds [160 x i16], [160 x i16]* %102, i64 0, i64 %105
%107 = load i16, i16* %106
%108 = sext i16 %107 to i32
%109 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 %108)
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
ret i32 1
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@EOF = global i32 0
@.str.3 = [5 x i8] c"%d, \00"
@.str.5 = [3 x i8] c"%d\00"
@str = [16 x i8] c"char memory[]={\00"
@str.7 = [4 x i8] c"\0A};\00"
@str.8 = [17 x i8] c"Input file error\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [100 x [160 x i16]]
%4 = bitcast [100 x [160 x i16]]* %3 to i8*
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32* @fopen(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.8, i64 0, i64 0))
%11 = tail call i32 @exit(i32 1)
unreachable
12: ; preds = %2, %21
%13 = phi i64 [ %22, %21 ], [ 0, %2 ]
br label %14
14: ; preds = %12, %14
%15 = phi i64 [ 0, %12 ], [ %19, %14 ]
%16 = tail call i32 @fgetc(i32* %7)
%17 = trunc i32 %16 to i16
%18 = getelementptr inbounds [100 x [160 x i16]], [100 x [160 x i16]]* %3, i64 0, i64 %13, i64 %15
store i16 %17, i16* %18
%19 = add nuw nsw i64 %15, 1
%20 = icmp eq i64 %19, 160
br i1 %20, label %21, label %14
21: ; preds = %14
%22 = add nuw i64 %13, 1
%23 = load i32, i32* @EOF
%24 = icmp eq i32 %16, %23
br i1 %24, label %25, label %12
25: ; preds = %21
%26 = trunc i64 %13 to i32
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%28 = icmp eq i32 %26, 0
br i1 %28, label %33, label %29
29: ; preds = %25
%30 = and i64 %13, 4294967295
br label %31
31: ; preds = %29, %43
%32 = phi i64 [ 0, %29 ], [ %45, %43 ]
br label %35
33: ; preds = %43, %25
%34 = and i64 %13, 4294967295
br label %47
35: ; preds = %31, %35
%36 = phi i64 [ 0, %31 ], [ %41, %35 ]
%37 = getelementptr inbounds [100 x [160 x i16]], [100 x [160 x i16]]* %3, i64 0, i64 %32, i64 %36
%38 = load i16, i16* %37
%39 = sext i16 %38 to i32
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %39)
%41 = add nuw nsw i64 %36, 1
%42 = icmp eq i64 %41, 160
br i1 %42, label %43, label %35
43: ; preds = %35
%44 = tail call i32 @putchar(i32 10)
%45 = add nuw nsw i64 %32, 1
%46 = icmp eq i64 %45, %30
br i1 %46, label %33, label %31
47: ; preds = %33, %47
%48 = phi i64 [ 0, %33 ], [ %53, %47 ]
%49 = getelementptr inbounds [100 x [160 x i16]], [100 x [160 x i16]]* %3, i64 0, i64 %34, i64 %48
%50 = load i16, i16* %49
%51 = sext i16 %50 to i32
%52 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %51)
%53 = add nuw nsw i64 %48, 1
%54 = icmp eq i64 %53, 159
br i1 %54, label %55, label %47
55: ; preds = %47
%56 = getelementptr inbounds [100 x [160 x i16]], [100 x [160 x i16]]* %3, i64 0, i64 %34, i64 159
%57 = load i16, i16* %56
%58 = sext i16 %57 to i32
%59 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 %58)
%60 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.7, i64 0, i64 0))
ret i32 1
}