int main(argc, argv)
int argc;
char *argv[];
{
  char in_name[80];
  char response[80];
  int ie, il, not_done, temp_ie, temp_il;
  long height, width;
  short **the_image;
  if (argc != 4) {
    printf("\nusage: showi input-image il ie\n");
    exit(0);
  }
  strcpy(in_name, argv[1]);
  il = atoi(argv[2]);
  ie = atoi(argv[3]);
  if (does_not_exist(in_name)) {
    printf("\nERROR input file %s does not exist", in_name);
    exit(0);
  }
  get_image_size(in_name, &height, &width);
  the_image = allocate_image_array(height, width);
  read_image_array(in_name, the_image);
  temp_il = il;
  temp_ie = ie;
  not_done = 1;
  while (not_done) {
    if (is_in_image(temp_il, temp_ie, height, width)) {
      il = temp_il;
      ie = temp_ie;
      show_screen(the_image, il, ie);
    }
    printf("\n\n x=quit j=down k=up h=left l=right"
           "\nEnter choice and press Enter:  ");
    gets(response);
    if (response[0] == 'x' || response[0] == 'X')
      not_done = 0;
    if (response[0] == 'j' || response[0] == 'J')
      temp_il = temp_il + ((3 * 20) / 4);
    if (response[0] == 'k' || response[0] == 'K')
      temp_il = temp_il - ((3 * 20) / 4);
    if (response[0] == 'h' || response[0] == 'H')
      temp_ie = temp_ie - ((3 * 15) / 4);
    if (response[0] == 'l' || response[0] == 'L')
      temp_ie = temp_ie + ((3 * 15) / 4);
  }
  free_image_array(the_image, height);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     11f8 <main+0x38>
lea    0xe16(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %edi,%edi
call   10c0 <exit@plt>
lea    -0x60(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    $0x0,%al
call   10b0 <atoi@plt>
mov    %eax,-0xb8(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
mov    $0x0,%al
call   10b0 <atoi@plt>
mov    %eax,-0xb4(%rbp)
lea    -0x60(%rbp),%rdi
mov    $0x0,%al
call   1090 <does_not_exist@plt>
cmp    $0x0,%eax
je     1260 <main+0xa0>
lea    -0x60(%rbp),%rsi
lea    0xdcf(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %edi,%edi
call   10c0 <exit@plt>
lea    -0x60(%rbp),%rdi
lea    -0xd0(%rbp),%rsi
lea    -0xd8(%rbp),%rdx
mov    $0x0,%al
call   1070 <get_image_size@plt>
mov    -0xd0(%rbp),%rdi
mov    -0xd8(%rbp),%rsi
mov    $0x0,%al
call   10d0 <allocate_image_array@plt>
cltq
mov    %rax,-0xe0(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0xe0(%rbp),%rsi
mov    $0x0,%al
call   10a0 <read_image_array@plt>
mov    -0xb8(%rbp),%eax
mov    %eax,-0xc4(%rbp)
mov    -0xb4(%rbp),%eax
mov    %eax,-0xc0(%rbp)
movl   $0x1,-0xbc(%rbp)
cmpl   $0x0,-0xbc(%rbp)
je     143b <main+0x27b>
mov    -0xc4(%rbp),%edi
mov    -0xc0(%rbp),%esi
mov    -0xd0(%rbp),%rdx
mov    -0xd8(%rbp),%rcx
mov    $0x0,%al
call   1040 <is_in_image@plt>
cmp    $0x0,%eax
je     1334 <main+0x174>
mov    -0xc4(%rbp),%eax
mov    %eax,-0xb8(%rbp)
mov    -0xc0(%rbp),%eax
mov    %eax,-0xb4(%rbp)
mov    -0xe0(%rbp),%rdi
mov    -0xb8(%rbp),%esi
mov    -0xb4(%rbp),%edx
mov    $0x0,%al
call   1060 <show_screen@plt>
lea    0xd0a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0xb0(%rbp),%rdi
mov    $0x0,%al
call   1080 <gets@plt>
movsbl -0xb0(%rbp),%eax
cmp    $0x78,%eax
je     1370 <main+0x1b0>
movsbl -0xb0(%rbp),%eax
cmp    $0x58,%eax
jne    137a <main+0x1ba>
movl   $0x0,-0xbc(%rbp)
movsbl -0xb0(%rbp),%eax
cmp    $0x6a,%eax
je     139a <main+0x1da>
movsbl -0xb0(%rbp),%eax
cmp    $0x4a,%eax
jne    13a9 <main+0x1e9>
mov    -0xc4(%rbp),%eax
add    $0xf,%eax
mov    %eax,-0xc4(%rbp)
movsbl -0xb0(%rbp),%eax
cmp    $0x6b,%eax
je     13c9 <main+0x209>
movsbl -0xb0(%rbp),%eax
cmp    $0x4b,%eax
jne    13d8 <main+0x218>
mov    -0xc4(%rbp),%eax
sub    $0xf,%eax
mov    %eax,-0xc4(%rbp)
movsbl -0xb0(%rbp),%eax
cmp    $0x68,%eax
je     13f8 <main+0x238>
movsbl -0xb0(%rbp),%eax
cmp    $0x48,%eax
jne    1407 <main+0x247>
mov    -0xc0(%rbp),%eax
sub    $0xb,%eax
mov    %eax,-0xc0(%rbp)
movsbl -0xb0(%rbp),%eax
cmp    $0x6c,%eax
je     1427 <main+0x267>
movsbl -0xb0(%rbp),%eax
cmp    $0x4c,%eax
jne    1436 <main+0x276>
mov    -0xc0(%rbp),%eax
add    $0xb,%eax
mov    %eax,-0xc0(%rbp)
jmp    12cb <main+0x10b>
mov    -0xe0(%rbp),%rdi
mov    -0xd0(%rbp),%rsi
mov    $0x0,%al
call   10e0 <free_image_array@plt>
mov    -0x4(%rbp),%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb0,%rsp
cmp    $0x4,%edi
jne    12fe <main+0x12e>
mov    %rsi,%rbx
mov    0x8(%rsi),%rsi
lea    0x10(%rsp),%r15
mov    %r15,%rdi
call   1030 <strcpy@plt>
mov    0x10(%rbx),%rdi
xor    %eax,%eax
call   10c0 <atoi@plt>
mov    %eax,%r14d
mov    0x18(%rbx),%rdi
xor    %eax,%eax
call   10c0 <atoi@plt>
mov    %eax,%ebx
mov    %r15,%rdi
xor    %eax,%eax
call   10a0 <does_not_exist@plt>
test   %eax,%eax
jne    1311 <main+0x141>
lea    0x10(%rsp),%r12
mov    %rsp,%rsi
lea    0x8(%rsp),%rdx
mov    %r12,%rdi
xor    %eax,%eax
call   1080 <get_image_size@plt>
mov    (%rsp),%rdi
mov    0x8(%rsp),%rsi
xor    %eax,%eax
call   10e0 <allocate_image_array@plt>
movslq %eax,%r15
mov    %r12,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   10b0 <read_image_array@plt>
lea    0xdbc(%rip),%r12
lea    0x60(%rsp),%r13
jmp    12b3 <main+0xe3>
nop
mov    %r12,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r13,%rdi
xor    %eax,%eax
call   1090 <gets@plt>
movzbl 0x60(%rsp),%eax
and    $0xdf,%al
lea    0xf(%r14),%ecx
cmp    $0x4a,%al
cmovne %r14d,%ecx
lea    -0xf(%rcx),%r14d
cmp    $0x4b,%al
cmovne %ecx,%r14d
lea    -0xb(%rbx),%ecx
cmp    $0x48,%al
cmovne %ebx,%ecx
lea    0xb(%rcx),%ebx
cmp    $0x4c,%al
cmovne %ecx,%ebx
cmp    $0x58,%al
je     12dd <main+0x10d>
mov    (%rsp),%rdx
mov    0x8(%rsp),%rcx
mov    %r14d,%edi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <is_in_image@plt>
test   %eax,%eax
je     1270 <main+0xa0>
mov    %r15,%rdi
mov    %r14d,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1070 <show_screen@plt>
jmp    1270 <main+0xa0>
mov    (%rsp),%rsi
mov    %r15,%rdi
xor    %eax,%eax
call   10f0 <free_image_array@plt>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
lea    0xd64(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   10d0 <exit@plt>
lea    0xce8(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %edi,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"\0Ausage: showi input-image il ie\0A\00"
@.str.1 = [36 x i8] c"\0AERROR input file %s does not exist\00"
@.str.2 = [69 x i8] c"\0A\0A x=quit j=down k=up h=left l=right\0AEnter choice and press Enter: \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [80 x i8]
%7 = alloca [80 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i64
%14 = alloca i64
%15 = alloca i16**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%16 = load i32, i32* %4
%17 = icmp ne i32 %16, 4
br i1 %17, label %18, label %20
18: ; preds = %2
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
unreachable
20: ; preds = %2
%21 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i8* @strcpy(i8* %21, i8* %24)
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 2
%28 = load i8*, i8** %27
%29 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %28)
store i32 %29, i32* %9
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 3
%32 = load i8*, i8** %31
%33 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %32)
store i32 %33, i32* %8
%34 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%35 = call i32 (i8*, ...) bitcast (i32 (...)* @does_not_exist to i32 (i8*, ...)*)(i8* %34)
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %40
37: ; preds = %20
%38 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i8* %38)
unreachable
40: ; preds = %20
%41 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%42 = call i32 (i8*, i64*, i64*, ...) bitcast (i32 (...)* @get_image_size to i32 (i8*, i64*, i64*, ...)*)(i8* %41, i64* %13, i64* %14)
%43 = load i64, i64* %13
%44 = load i64, i64* %14
%45 = call i32 (i64, i64, ...) bitcast (i32 (...)* @allocate_image_array to i32 (i64, i64, ...)*)(i64 %43, i64 %44)
%46 = sext i32 %45 to i64
%47 = inttoptr i64 %46 to i16**
store i16** %47, i16*** %15
%48 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%49 = load i16**, i16*** %15
%50 = call i32 (i8*, i16**, ...) bitcast (i32 (...)* @read_image_array to i32 (i8*, i16**, ...)*)(i8* %48, i16** %49)
%51 = load i32, i32* %9
store i32 %51, i32* %12
%52 = load i32, i32* %8
store i32 %52, i32* %11
store i32 1, i32* %10
br label %53
53: ; preds = %136, %40
%54 = load i32, i32* %10
%55 = icmp ne i32 %54, 0
br i1 %55, label %56, label %137
56: ; preds = %53
%57 = load i32, i32* %12
%58 = load i32, i32* %11
%59 = load i64, i64* %13
%60 = load i64, i64* %14
%61 = call i32 (i32, i32, i64, i64, ...) bitcast (i32 (...)* @is_in_image to i32 (i32, i32, i64, i64, ...)*)(i32 %57, i32 %58, i64 %59, i64 %60)
%62 = icmp ne i32 %61, 0
br i1 %62, label %63, label %70
63: ; preds = %56
%64 = load i32, i32* %12
store i32 %64, i32* %9
%65 = load i32, i32* %11
store i32 %65, i32* %8
%66 = load i16**, i16*** %15
%67 = load i32, i32* %9
%68 = load i32, i32* %8
%69 = call i32 (i16**, i32, i32, ...) bitcast (i32 (...)* @show_screen to i32 (i16**, i32, i32, ...)*)(i16** %66, i32 %67, i32 %68)
br label %70
70: ; preds = %63, %56
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.2, i64 0, i64 0))
%72 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%73 = call i32 (i8*, ...) bitcast (i32 (...)* @gets to i32 (i8*, ...)*)(i8* %72)
%74 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%75 = load i8, i8* %74
%76 = sext i8 %75 to i32
%77 = icmp eq i32 %76, 120
br i1 %77, label %83, label %78
78: ; preds = %70
%79 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%80 = load i8, i8* %79
%81 = sext i8 %80 to i32
%82 = icmp eq i32 %81, 88
br i1 %82, label %83, label %84
83: ; preds = %78, %70
store i32 0, i32* %10
br label %84
84: ; preds = %83, %78
%85 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%86 = load i8, i8* %85
%87 = sext i8 %86 to i32
%88 = icmp eq i32 %87, 106
br i1 %88, label %94, label %89
89: ; preds = %84
%90 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%91 = load i8, i8* %90
%92 = sext i8 %91 to i32
%93 = icmp eq i32 %92, 74
br i1 %93, label %94, label %97
94: ; preds = %89, %84
%95 = load i32, i32* %12
%96 = add nsw i32 %95, 15
store i32 %96, i32* %12
br label %97
97: ; preds = %94, %89
%98 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%99 = load i8, i8* %98
%100 = sext i8 %99 to i32
%101 = icmp eq i32 %100, 107
br i1 %101, label %107, label %102
102: ; preds = %97
%103 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%104 = load i8, i8* %103
%105 = sext i8 %104 to i32
%106 = icmp eq i32 %105, 75
br i1 %106, label %107, label %110
107: ; preds = %102, %97
%108 = load i32, i32* %12
%109 = sub nsw i32 %108, 15
store i32 %109, i32* %12
br label %110
110: ; preds = %107, %102
%111 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%112 = load i8, i8* %111
%113 = sext i8 %112 to i32
%114 = icmp eq i32 %113, 104
br i1 %114, label %120, label %115
115: ; preds = %110
%116 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%117 = load i8, i8* %116
%118 = sext i8 %117 to i32
%119 = icmp eq i32 %118, 72
br i1 %119, label %120, label %123
120: ; preds = %115, %110
%121 = load i32, i32* %11
%122 = sub nsw i32 %121, 11
store i32 %122, i32* %11
br label %123
123: ; preds = %120, %115
%124 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%125 = load i8, i8* %124
%126 = sext i8 %125 to i32
%127 = icmp eq i32 %126, 108
br i1 %127, label %133, label %128
128: ; preds = %123
%129 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%130 = load i8, i8* %129
%131 = sext i8 %130 to i32
%132 = icmp eq i32 %131, 76
br i1 %132, label %133, label %136
133: ; preds = %128, %123
%134 = load i32, i32* %11
%135 = add nsw i32 %134, 11
store i32 %135, i32* %11
br label %136
136: ; preds = %133, %128
br label %53
137: ; preds = %53
%138 = load i16**, i16*** %15
%139 = load i64, i64* %13
%140 = call i32 (i16**, i64, ...) bitcast (i32 (...)* @free_image_array to i32 (i16**, i64, ...)*)(i16** %138, i64 %139)
%141 = load i32, i32* %3
ret i32 %141
}

LLVM IR (-O2):
@.str.1 = [36 x i8] c"\0AERROR input file %s does not exist\00"
@.str.2 = [69 x i8] c"\0A\0A x=quit j=down k=up h=left l=right\0AEnter choice and press Enter: \00"
@str = [32 x i8] c"\0Ausage: showi input-image il ie\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [80 x i8]
%4 = alloca [80 x i8]
%5 = alloca i64
%6 = alloca i64
%7 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%9 = bitcast i64* %5 to i8*
%10 = bitcast i64* %6 to i8*
%11 = icmp eq i32 %0, 4
br i1 %11, label %14, label %12
12: ; preds = %2
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
tail call void @exit(i32 0)
unreachable
14: ; preds = %2
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = call i8* @strcpy(i8* %7, i8* dereferenceable(1) %16)
%18 = getelementptr inbounds i8*, i8** %1, i64 2
%19 = load i8*, i8** %18
%20 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %19)
%21 = getelementptr inbounds i8*, i8** %1, i64 3
%22 = load i8*, i8** %21
%23 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %22)
%24 = call i32 (i8*, ...) bitcast (i32 (...)* @does_not_exist to i32 (i8*, ...)*)(i8* %7)
%25 = icmp eq i32 %24, 0
br i1 %25, label %28, label %26
26: ; preds = %14
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i8* %7)
unreachable
28: ; preds = %14
%29 = call i32 (i8*, i64*, i64*, ...) bitcast (i32 (...)* @get_image_size to i32 (i8*, i64*, i64*, ...)*)(i8* %7, i64* %5, i64* %6)
%30 = load i64, i64* %5
%31 = load i64, i64* %6
%32 = call i32 (i64, i64, ...) bitcast (i32 (...)* @allocate_image_array to i32 (i64, i64, ...)*)(i64 %30, i64 %31)
%33 = sext i32 %32 to i64
%34 = inttoptr i64 %33 to i16**
%35 = call i32 (i8*, i16**, ...) bitcast (i32 (...)* @read_image_array to i32 (i8*, i16**, ...)*)(i8* %7, i16** %34)
br label %36
36: ; preds = %28, %45
%37 = phi i32 [ %20, %28 ], [ %56, %45 ]
%38 = phi i32 [ %23, %28 ], [ %62, %45 ]
%39 = load i64, i64* %5
%40 = load i64, i64* %6
%41 = call i32 (i32, i32, i64, i64, ...) bitcast (i32 (...)* @is_in_image to i32 (i32, i32, i64, i64, ...)*)(i32 %37, i32 %38, i64 %39, i64 %40)
%42 = icmp eq i32 %41, 0
br i1 %42, label %45, label %43
43: ; preds = %36
%44 = call i32 (i16**, i32, i32, ...) bitcast (i32 (...)* @show_screen to i32 (i16**, i32, i32, ...)*)(i16** %34, i32 %37, i32 %38)
br label %45
45: ; preds = %43, %36
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @.str.2, i64 0, i64 0))
%47 = call i32 (i8*, ...) bitcast (i32 (...)* @gets to i32 (i8*, ...)*)(i8* %8)
%48 = load i8, i8* %8
%49 = and i8 %48, -33
%50 = icmp eq i8 %49, 88
%51 = icmp eq i8 %49, 74
%52 = add nsw i32 %37, 15
%53 = select i1 %51, i32 %52, i32 %37
%54 = icmp eq i8 %49, 75
%55 = add nsw i32 %53, -15
%56 = select i1 %54, i32 %55, i32 %53
%57 = icmp eq i8 %49, 72
%58 = add nsw i32 %38, -11
%59 = select i1 %57, i32 %58, i32 %38
%60 = icmp eq i8 %49, 76
%61 = add nsw i32 %59, 11
%62 = select i1 %60, i32 %61, i32 %59
br i1 %50, label %63, label %36
63: ; preds = %45
%64 = load i64, i64* %5
%65 = call i32 (i16**, i64, ...) bitcast (i32 (...)* @free_image_array to i32 (i16**, i64, ...)*)(i16** %34, i64 %64)
ret i32 0
}