#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 clip(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, char **, int *, int *,
                          int *);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  FILE *fp, *out_fp, *mono_fp;
  int x, y, x_size, y_size, depth;
  int yc, uc, vc, r, g, b, C, D, E;
  char type[32];
  out_fp = fopen("rgb.ppm", "w");
  mono_fp = fopen("mono.ppm", "w");
  fp = fopen("out.ppm", "r");
  if (fp == NULL) {
    printf("File not found\n");
    exit(0);
  }
  fscanf(fp, "%s\n%d %d\n%d\n", &type, &x_size, &y_size, &depth);
  printf("type: %s\nSize: %d, %d\nDepth: %d\n", type, x_size, y_size, depth);
  fprintf(out_fp, "%s\n%d %d\n%d\n", type, x_size, y_size, depth);
  fprintf(mono_fp, "%s\n%d %d\n%d\n", type, x_size, y_size, depth);
  for (x = 0; x < x_size; x++)
    for (y = 0; y < y_size; y++) {
      yc = fgetc(fp);
      uc = fgetc(fp);
      vc = fgetc(fp);
      C = yc - 16;
      D = uc - 128;
      E = vc - 128;
      r = (298 * C + 409 * E + 128) >> 8;
      g = (298 * C - 100 * D - 208 * E + 128) >> 8;
      b = (298 * C + 516 * D + 128) >> 8;
      r = clip(r);
      g = clip(g);
      b = clip(b);
      fprintf(out_fp, "%c%c%c", r, g, b);
      fprintf(mono_fp, "%c%c%c", yc, yc, yc);
    }
  fclose(mono_fp);
  fclose(out_fp);
  fclose(fp);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe67(%rip),%rdi
lea    0xe68(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
lea    0xe5a(%rip),%rdi
lea    0xe51(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x20(%rbp)
lea    0xe4c(%rip),%rdi
lea    0xe4d(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11f7 <main+0x77>
lea    0xe34(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %edi,%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rdi
lea    -0x80(%rbp),%rdx
lea    0xe27(%rip),%rsi
lea    -0x2c(%rbp),%rcx
lea    -0x30(%rbp),%r8
lea    -0x34(%rbp),%r9
call   1060 <fscanf@plt>
lea    -0x80(%rbp),%rsi
mov    -0x2c(%rbp),%edx
mov    -0x30(%rbp),%ecx
mov    -0x34(%rbp),%r8d
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x80(%rbp),%rdx
mov    -0x2c(%rbp),%ecx
mov    -0x30(%rbp),%r8d
mov    -0x34(%rbp),%r9d
lea    0xde0(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    -0x80(%rbp),%rdx
mov    -0x2c(%rbp),%ecx
mov    -0x30(%rbp),%r8d
mov    -0x34(%rbp),%r9d
lea    0xdbf(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    13af <main+0x22f>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    139c <main+0x21c>
mov    -0x10(%rbp),%rdi
call   1070 <fgetc@plt>
mov    %eax,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <fgetc@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <fgetc@plt>
mov    %eax,-0x40(%rbp)
mov    -0x38(%rbp),%eax
sub    $0x10,%eax
mov    %eax,-0x50(%rbp)
mov    -0x3c(%rbp),%eax
sub    $0x80,%eax
mov    %eax,-0x54(%rbp)
mov    -0x40(%rbp),%eax
sub    $0x80,%eax
mov    %eax,-0x58(%rbp)
imul   $0x12a,-0x50(%rbp),%eax
imul   $0x199,-0x58(%rbp),%ecx
add    %ecx,%eax
add    $0x80,%eax
sar    $0x8,%eax
mov    %eax,-0x44(%rbp)
imul   $0x12a,-0x50(%rbp),%eax
imul   $0x64,-0x54(%rbp),%ecx
sub    %ecx,%eax
imul   $0xd0,-0x58(%rbp),%ecx
sub    %ecx,%eax
add    $0x80,%eax
sar    $0x8,%eax
mov    %eax,-0x48(%rbp)
imul   $0x12a,-0x50(%rbp),%eax
imul   $0x204,-0x54(%rbp),%ecx
add    %ecx,%eax
add    $0x80,%eax
sar    $0x8,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x44(%rbp),%edi
call   1030 <clip@plt>
mov    %eax,-0x44(%rbp)
mov    -0x48(%rbp),%edi
call   1030 <clip@plt>
mov    %eax,-0x48(%rbp)
mov    -0x4c(%rbp),%edi
call   1030 <clip@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x44(%rbp),%edx
mov    -0x48(%rbp),%ecx
mov    -0x4c(%rbp),%r8d
lea    0xcf0(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x38(%rbp),%edx
mov    -0x38(%rbp),%ecx
mov    -0x38(%rbp),%r8d
lea    0xcd4(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    128f <main+0x10f>
jmp    13a1 <main+0x221>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    127c <main+0xfc>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
lea    0xe5b(%rip),%rdi
lea    0xe5c(%rip),%rbx
mov    %rbx,%rsi
call   10a0 <fopen@plt>
mov    %rax,0x10(%rsp)
lea    0xe4a(%rip),%rdi
mov    %rbx,%rsi
call   10a0 <fopen@plt>
mov    %rax,%rbx
lea    0xe41(%rip),%rdi
lea    0xe42(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     13c5 <main+0x235>
mov    %rax,%rbp
lea    0xe2c(%rip),%r12
lea    0x30(%rsp),%r14
lea    0x8(%rsp),%rcx
lea    0x4(%rsp),%r8
lea    0xc(%rsp),%r9
mov    %rax,%rdi
mov    %r12,%rsi
mov    %r14,%rdx
call   1070 <fscanf@plt>
mov    0x8(%rsp),%edx
mov    0x4(%rsp),%ecx
mov    0xc(%rsp),%r8d
lea    0xe03(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x8(%rsp),%ecx
mov    0x4(%rsp),%r8d
mov    0xc(%rsp),%r9d
mov    0x10(%rsp),%rdi
mov    %r12,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    0x8(%rsp),%ecx
mov    0x4(%rsp),%r8d
mov    0xc(%rsp),%r9d
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    0x8(%rsp),%ecx
test   %ecx,%ecx
jle    139a <main+0x20a>
mov    0x4(%rsp),%eax
xor    %esi,%esi
mov    %rbx,0x28(%rsp)
mov    %rbp,0x20(%rsp)
jmp    129b <main+0x10b>
nopl   (%rax)
add    $0x1,%esi
cmp    %ecx,%esi
jge    139a <main+0x20a>
test   %eax,%eax
jle    1290 <main+0x100>
mov    %esi,0x18(%rsp)
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
mov    %rbp,%rdi
call   1080 <fgetc@plt>
mov    %eax,%r12d
mov    %rbp,%rdi
call   1080 <fgetc@plt>
mov    %eax,%ebx
mov    %rbp,%rdi
call   1080 <fgetc@plt>
lea    -0x80(%rbx),%ecx
add    $0xffffff80,%eax
imul   $0x12a,%r12d,%edx
imul   $0x199,%eax,%esi
lea    (%rdx,%rsi,1),%edi
add    $0xffffede0,%edi
sar    $0x8,%edi
imul   $0xffffff9c,%ecx,%esi
imul   $0xffffff30,%eax,%eax
lea    (%rdx,%rsi,1),%r14d
add    $0xffffede0,%r14d
add    %eax,%r14d
sar    $0x8,%r14d
shl    $0x9,%ecx
lea    (%rcx,%rbx,4),%eax
add    $0xfffffe00,%eax
lea    (%rdx,%rax,1),%ebx
add    $0xffffede0,%ebx
sar    $0x8,%ebx
call   1040 <clip@plt>
mov    %eax,0x1c(%rsp)
mov    %r14d,%edi
mov    0x10(%rsp),%rbp
call   1040 <clip@plt>
mov    %eax,%r15d
mov    %ebx,%edi
mov    0x28(%rsp),%rbx
call   1040 <clip@plt>
mov    %rbp,%rdi
lea    0xcfe(%rip),%r14
mov    %r14,%rsi
mov    0x1c(%rsp),%edx
mov    0x20(%rsp),%rbp
mov    %r15d,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r12d,%edx
mov    %r12d,%ecx
mov    %r12d,%r8d
xor    %eax,%eax
call   1090 <fprintf@plt>
add    $0x1,%r13d
mov    0x4(%rsp),%eax
cmp    %eax,%r13d
jl     12b0 <main+0x120>
mov    0x8(%rsp),%ecx
mov    0x18(%rsp),%esi
jmp    1290 <main+0x100>
mov    %rbx,%rdi
call   1050 <fclose@plt>
mov    0x10(%rsp),%rdi
call   1050 <fclose@plt>
mov    %rbp,%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc86(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"rgb.ppm\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [9 x i8] c"mono.ppm\00"
@.str.3 = [8 x i8] c"out.ppm\00"
@.str.4 = [2 x i8] c"r\00"
@.str.5 = [16 x i8] c"File not found\0A\00"
@.str.6 = [13 x i8] c"%s\0A%d %d\0A%d\0A\00"
@.str.7 = [33 x i8] c"type: %s\0ASize: %d, %d\0ADepth: %d\0A\00"
@.str.8 = [7 x i8] c"%c%c%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca [32 x i8]
store i32 0, i32* %1
%20 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %20, i32** %3
%21 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %21, i32** %4
%22 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %22, i32** %2
%23 = load i32*, i32** %2
%24 = icmp eq i32* %23, null
br i1 %24, label %25, label %28
25: ; preds = %0
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
%27 = call i32 @exit(i32 0)
unreachable
28: ; preds = %0
%29 = load i32*, i32** %2
%30 = bitcast [32 x i8]* %19 to i8**
%31 = call i32 @fscanf(i32* %29, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i8** %30, i32* %7, i32* %8, i32* %9)
%32 = getelementptr inbounds [32 x i8], [32 x i8]* %19, i64 0, i64 0
%33 = load i32, i32* %7
%34 = load i32, i32* %8
%35 = load i32, i32* %9
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0), i8* %32, i32 %33, i32 %34, i32 %35)
%37 = load i32*, i32** %3
%38 = getelementptr inbounds [32 x i8], [32 x i8]* %19, i64 0, i64 0
%39 = load i32, i32* %7
%40 = load i32, i32* %8
%41 = load i32, i32* %9
%42 = call i32 (i32*, i8*, ...) @fprintf(i32* %37, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i8* %38, i32 %39, i32 %40, i32 %41)
%43 = load i32*, i32** %4
%44 = getelementptr inbounds [32 x i8], [32 x i8]* %19, i64 0, i64 0
%45 = load i32, i32* %7
%46 = load i32, i32* %8
%47 = load i32, i32* %9
%48 = call i32 (i32*, i8*, ...) @fprintf(i32* %43, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i8* %44, i32 %45, i32 %46, i32 %47)
store i32 0, i32* %5
br label %49
49: ; preds = %115, %28
%50 = load i32, i32* %5
%51 = load i32, i32* %7
%52 = icmp slt i32 %50, %51
br i1 %52, label %53, label %118
53: ; preds = %49
store i32 0, i32* %6
br label %54
54: ; preds = %111, %53
%55 = load i32, i32* %6
%56 = load i32, i32* %8
%57 = icmp slt i32 %55, %56
br i1 %57, label %58, label %114
58: ; preds = %54
%59 = load i32*, i32** %2
%60 = call i32 @fgetc(i32* %59)
store i32 %60, i32* %10
%61 = load i32*, i32** %2
%62 = call i32 @fgetc(i32* %61)
store i32 %62, i32* %11
%63 = load i32*, i32** %2
%64 = call i32 @fgetc(i32* %63)
store i32 %64, i32* %12
%65 = load i32, i32* %10
%66 = sub nsw i32 %65, 16
store i32 %66, i32* %16
%67 = load i32, i32* %11
%68 = sub nsw i32 %67, 128
store i32 %68, i32* %17
%69 = load i32, i32* %12
%70 = sub nsw i32 %69, 128
store i32 %70, i32* %18
%71 = load i32, i32* %16
%72 = mul nsw i32 298, %71
%73 = load i32, i32* %18
%74 = mul nsw i32 409, %73
%75 = add nsw i32 %72, %74
%76 = add nsw i32 %75, 128
%77 = ashr i32 %76, 8
store i32 %77, i32* %13
%78 = load i32, i32* %16
%79 = mul nsw i32 298, %78
%80 = load i32, i32* %17
%81 = mul nsw i32 100, %80
%82 = sub nsw i32 %79, %81
%83 = load i32, i32* %18
%84 = mul nsw i32 208, %83
%85 = sub nsw i32 %82, %84
%86 = add nsw i32 %85, 128
%87 = ashr i32 %86, 8
store i32 %87, i32* %14
%88 = load i32, i32* %16
%89 = mul nsw i32 298, %88
%90 = load i32, i32* %17
%91 = mul nsw i32 516, %90
%92 = add nsw i32 %89, %91
%93 = add nsw i32 %92, 128
%94 = ashr i32 %93, 8
store i32 %94, i32* %15
%95 = load i32, i32* %13
%96 = call i32 @clip(i32 %95)
store i32 %96, i32* %13
%97 = load i32, i32* %14
%98 = call i32 @clip(i32 %97)
store i32 %98, i32* %14
%99 = load i32, i32* %15
%100 = call i32 @clip(i32 %99)
store i32 %100, i32* %15
%101 = load i32*, i32** %3
%102 = load i32, i32* %13
%103 = load i32, i32* %14
%104 = load i32, i32* %15
%105 = call i32 (i32*, i8*, ...) @fprintf(i32* %101, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i32 %102, i32 %103, i32 %104)
%106 = load i32*, i32** %4
%107 = load i32, i32* %10
%108 = load i32, i32* %10
%109 = load i32, i32* %10
%110 = call i32 (i32*, i8*, ...) @fprintf(i32* %106, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i32 %107, i32 %108, i32 %109)
br label %111
111: ; preds = %58
%112 = load i32, i32* %6
%113 = add nsw i32 %112, 1
store i32 %113, i32* %6
br label %54
114: ; preds = %54
br label %115
115: ; preds = %114
%116 = load i32, i32* %5
%117 = add nsw i32 %116, 1
store i32 %117, i32* %5
br label %49
118: ; preds = %49
%119 = load i32*, i32** %4
%120 = call i32 @fclose(i32* %119)
%121 = load i32*, i32** %3
%122 = call i32 @fclose(i32* %121)
%123 = load i32*, i32** %2
%124 = call i32 @fclose(i32* %123)
%125 = load i32, i32* %1
ret i32 %125
}

LLVM IR (-O2):
@.str = [8 x i8] c"rgb.ppm\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [9 x i8] c"mono.ppm\00"
@.str.3 = [8 x i8] c"out.ppm\00"
@.str.4 = [2 x i8] c"r\00"
@.str.6 = [13 x i8] c"%s\0A%d %d\0A%d\0A\00"
@.str.7 = [33 x i8] c"type: %s\0ASize: %d, %d\0ADepth: %d\0A\00"
@.str.8 = [7 x i8] c"%c%c%c\00"
@str = [15 x i8] c"File not found\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [32 x i8]
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%9 = tail call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%11 = tail call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %16
13: ; preds = %0
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%15 = tail call i32 @exit(i32 0)
unreachable
16: ; preds = %0
%17 = bitcast [32 x i8]* %4 to i8**
%18 = call i32 @fscanf(i32* %11, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i8** %17, i32* %1, i32* %2, i32* %3)
%19 = load i32, i32* %1
%20 = load i32, i32* %2
%21 = load i32, i32* %3
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0), i8* %8, i32 %19, i32 %20, i32 %21)
%23 = load i32, i32* %1
%24 = load i32, i32* %2
%25 = load i32, i32* %3
%26 = call i32 (i32*, i8*, ...) @fprintf(i32* %9, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i8* %8, i32 %23, i32 %24, i32 %25)
%27 = load i32, i32* %1
%28 = load i32, i32* %2
%29 = load i32, i32* %3
%30 = call i32 (i32*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i8* %8, i32 %27, i32 %28, i32 %29)
%31 = load i32, i32* %1
%32 = icmp sgt i32 %31, 0
br i1 %32, label %33, label %75
33: ; preds = %16
%34 = load i32, i32* %2
br label %35
35: ; preds = %33, %70
%36 = phi i32 [ %71, %70 ], [ %31, %33 ]
%37 = phi i32 [ %72, %70 ], [ %34, %33 ]
%38 = phi i32 [ %73, %70 ], [ 0, %33 ]
%39 = icmp sgt i32 %37, 0
br i1 %39, label %40, label %70
40: ; preds = %35, %40
%41 = phi i32 [ %65, %40 ], [ 0, %35 ]
%42 = call i32 @fgetc(i32* %11)
%43 = call i32 @fgetc(i32* %11)
%44 = call i32 @fgetc(i32* %11)
%45 = add nsw i32 %43, -128
%46 = add nsw i32 %44, -128
%47 = mul i32 %42, 298
%48 = mul nsw i32 %46, 409
%49 = add i32 %47, -4640
%50 = add i32 %49, %48
%51 = ashr i32 %50, 8
%52 = mul i32 %45, -100
%53 = mul i32 %46, -208
%54 = add i32 %49, %52
%55 = add i32 %54, %53
%56 = ashr i32 %55, 8
%57 = mul nsw i32 %45, 516
%58 = add i32 %49, %57
%59 = ashr i32 %58, 8
%60 = call i32 @clip(i32 %51)
%61 = call i32 @clip(i32 %56)
%62 = call i32 @clip(i32 %59)
%63 = call i32 (i32*, i8*, ...) @fprintf(i32* %9, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i32 %60, i32 %61, i32 %62)
%64 = call i32 (i32*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i32 %42, i32 %42, i32 %42)
%65 = add nuw nsw i32 %41, 1
%66 = load i32, i32* %2
%67 = icmp slt i32 %65, %66
br i1 %67, label %40, label %68
68: ; preds = %40
%69 = load i32, i32* %1
br label %70
70: ; preds = %68, %35
%71 = phi i32 [ %69, %68 ], [ %36, %35 ]
%72 = phi i32 [ %66, %68 ], [ %37, %35 ]
%73 = add nuw nsw i32 %38, 1
%74 = icmp slt i32 %73, %71
br i1 %74, label %35, label %75
75: ; preds = %70, %16
%76 = call i32 @fclose(i32* %10)
%77 = call i32 @fclose(i32* %9)
%78 = call i32 @fclose(i32* %11)
ret i32 0
}