#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 /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputc(unsigned char, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
int main(void) {
  FILE *f;
  FILE *o;
  unsigned int r, g, gh, gl, b, s;
  unsigned char c;
  char nombre[80];
  printf("File: ");
  fgets(nombre, 80, stdin);
  s = 0;
  while (nombre[s] != '\n' && nombre[s] != '\0') {
    s++;
  }
  nombre[s] = 0;
  printf("Opening %s...\n", nombre);
  f = fopen(nombre, "rb");
  if (f == NULL) {
    printf("*** no file ***\n");
    return -1;
  }
  o = fopen("output.sv", "wb");
  if (o == NULL) {
    printf("*** cannot write ***\n");
    return -1;
  }
  if ((fgetc(f) != 'P') || (fgetc(f) != '6')) {
    printf("*** wrong file type ***\n");
    return -1;
  }
  b = 0;
  while (b < 4)
    if (fgetc(f) == 10)
      b++;
  s = 255;
  do {
    r = fgetc(f);
    g = fgetc(f);
    b = fgetc(f);
    r = r / s;
    g = g * 3 / s;
    b = b / s;
    gh = g >> 1;
    gl = g & 1;
    c = b << 7 | gl << 6 | r << 5 | gh << 4;
    r = fgetc(f);
    g = fgetc(f);
    b = fgetc(f);
    r = r / s;
    g = g * 3 / s;
    b = b / s;
    gh = g >> 1;
    gl = g & 1;
    c |= b << 3 | gl << 2 | r << 1 | gh;
    fputc(c, o);
  } while (!feof(f));
  fclose(f);
  fclose(o);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x90(%rbp),%rdi
mov    0x2e4a(%rip),%rax
mov    (%rax),%edx
mov    $0x50,%esi
call   1070 <fgets@plt>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
movsbl -0x90(%rbp,%rax,1),%ecx
ff
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x91(%rbp)
je     11e4 <main+0x74>
mov    -0x30(%rbp),%eax
movsbl -0x90(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
setne  %al
mov    %al,-0x91(%rbp)
mov    -0x91(%rbp),%al
test   $0x1,%al
jne    11f7 <main+0x87>
jmp    1205 <main+0x95>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11b1 <main+0x41>
mov    -0x30(%rbp),%eax
movb   $0x0,-0x90(%rbp,%rax,1)
lea    -0x90(%rbp),%rsi
lea    0xde9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x90(%rbp),%rdi
lea    0xde3(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1261 <main+0xf1>
lea    0xdcb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1447 <main+0x2d7>
lea    0xdc2(%rip),%rdi
lea    0xdc5(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    129d <main+0x12d>
lea    0xdad(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1447 <main+0x2d7>
mov    -0x10(%rbp),%rdi
call   1050 <fgetc@plt>
cmp    $0x50,%eax
jne    12c1 <main+0x151>
mov    -0x10(%rbp),%rdi
call   1050 <fgetc@plt>
cmp    $0x36,%eax
je     12db <main+0x16b>
lea    0xd85(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1447 <main+0x2d7>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x4,-0x2c(%rbp)
jae    130c <main+0x19c>
mov    -0x10(%rbp),%rdi
call   1050 <fgetc@plt>
cmp    $0xa,%eax
jne    1307 <main+0x197>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    12e2 <main+0x172>
movl   $0xff,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x1c(%rbp),%eax
xor    %edx,%edx
divl   -0x30(%rbp)
mov    %eax,-0x1c(%rbp)
imul   $0x3,-0x20(%rbp),%eax
xor    %edx,%edx
divl   -0x30(%rbp)
mov    %eax,-0x20(%rbp)
mov    -0x2c(%rbp),%eax
xor    %edx,%edx
divl   -0x30(%rbp)
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%eax
and    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x2c(%rbp),%eax
shl    $0x7,%eax
mov    -0x28(%rbp),%ecx
shl    $0x6,%ecx
or     %ecx,%eax
mov    -0x1c(%rbp),%ecx
shl    $0x5,%ecx
or     %ecx,%eax
mov    -0x24(%rbp),%ecx
shl    $0x4,%ecx
or     %ecx,%eax
mov    %al,-0x31(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x1c(%rbp),%eax
xor    %edx,%edx
divl   -0x30(%rbp)
mov    %eax,-0x1c(%rbp)
imul   $0x3,-0x20(%rbp),%eax
xor    %edx,%edx
divl   -0x30(%rbp)
mov    %eax,-0x20(%rbp)
mov    -0x2c(%rbp),%eax
xor    %edx,%edx
divl   -0x30(%rbp)
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%eax
and    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x2c(%rbp),%ecx
shl    $0x3,%ecx
mov    -0x28(%rbp),%eax
shl    $0x2,%eax
or     %eax,%ecx
mov    -0x1c(%rbp),%eax
shl    $0x1,%eax
or     %eax,%ecx
or     -0x24(%rbp),%ecx
movzbl -0x31(%rbp),%eax
or     %ecx,%eax
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%al
mov    -0x18(%rbp),%rsi
movzbl %al,%edi
call   1060 <fputc@plt>
mov    -0x10(%rbp),%rdi
call   1080 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1313 <main+0x1a3>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa0,%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    0xe6b(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2e43(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rdi
mov    $0x50,%esi
call   1080 <fgets@plt>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ebx,%eax
movzbl (%rsp,%rax,1),%ecx
test   %cl,%cl
je     11d4 <main+0x54>
cmp    $0xa,%cl
je     11d4 <main+0x54>
add    $0x1,%ebx
jmp    11c0 <main+0x40>
movb   $0x0,(%rsp,%rax,1)
lea    0xe28(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe23(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <fopen@plt>
test   %rax,%rax
je     1358 <main+0x1d8>
mov    %rax,%r15
lea    0xe0b(%rip),%rdi
lea    0xe0e(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     136a <main+0x1ea>
mov    %rax,%r14
mov    %r15,%rdi
call   1060 <fgetc@plt>
cmp    $0x50,%eax
jne    1361 <main+0x1e1>
mov    %r15,%rdi
call   1060 <fgetc@plt>
cmp    $0x36,%eax
jne    1361 <main+0x1e1>
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1060 <fgetc@plt>
xor    %ecx,%ecx
cmp    $0xa,%eax
sete   %cl
add    %ecx,%ebx
cmp    $0x4,%ebx
jb     1250 <main+0xd0>
mov    $0x80808081,%r12d
nopl   (%rax)
mov    %r15,%rdi
call   1060 <fgetc@plt>
mov    %eax,%ebp
mov    %r15,%rdi
call   1060 <fgetc@plt>
mov    %eax,%ebx
mov    %r15,%rdi
call   1060 <fgetc@plt>
mov    %ebp,%ecx
imul   %r12,%rcx
shr    $0x22,%rcx
and    $0xe0,%ecx
lea    (%rbx,%rbx,2),%ebp
imul   %r12,%rbp
shr    $0x27,%rbp
mov    %eax,%eax
imul   %r12,%rax
shr    $0x20,%rax
and    $0x80,%eax
mov    %ebp,%edx
shl    $0x6,%edx
and    $0x40,%edx
or     %eax,%edx
shl    $0x3,%ebp
or     %ecx,%ebp
or     %edx,%ebp
mov    %r15,%rdi
call   1060 <fgetc@plt>
mov    %eax,%ebx
mov    %r15,%rdi
call   1060 <fgetc@plt>
mov    %eax,%r13d
mov    %r15,%rdi
call   1060 <fgetc@plt>
mov    %ebx,%ecx
imul   %r12,%rcx
shr    $0x26,%rcx
and    $0xfe,%ecx
lea    0x0(%r13,%r13,2),%edx
imul   %r12,%rdx
mov    %rdx,%rsi
shr    $0x27,%rsi
mov    %eax,%eax
imul   %r12,%rax
shr    $0x24,%rax
and    $0xf8,%eax
shr    $0x28,%rdx
and    $0x1,%esi
lea    (%rax,%rsi,4),%eax
and    $0xf0,%ebp
or     %ecx,%edx
or     %eax,%edx
or     %ebp,%edx
movzbl %dl,%edi
mov    %r14,%rsi
call   1070 <fputc@plt>
mov    %r15,%rdi
call   1090 <feof@plt>
test   %eax,%eax
je     1270 <main+0xf0>
mov    %r15,%rdi
call   1040 <fclose@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
jmp    137b <main+0x1fb>
lea    0xcf4(%rip),%rdi
jmp    1371 <main+0x1f1>
lea    0xcbe(%rip),%rdi
jmp    1371 <main+0x1f1>
lea    0xccd(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"File: \00"
@stdin = global i32 0
@.str.1 = [15 x i8] c"Opening %s...\0A\00"
@.str.2 = [3 x i8] c"rb\00"
@.str.3 = [17 x i8] c"*** no file ***\0A\00"
@.str.4 = [10 x i8] c"output.sv\00"
@.str.5 = [3 x i8] c"wb\00"
@.str.6 = [22 x i8] c"*** cannot write ***\0A\00"
@.str.7 = [25 x i8] c"*** wrong file type ***\0A\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 i8
%11 = alloca [80 x i8]
store i32 0, i32* %1
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%13 = getelementptr inbounds [80 x i8], [80 x i8]* %11, i64 0, i64 0
%14 = load i32, i32* @stdin
%15 = call i32 @fgets(i8* %13, i32 80, i32 %14)
store i32 0, i32* %9
br label %16
16: ; preds = %32, %0
%17 = load i32, i32* %9
%18 = zext i32 %17 to i64
%19 = getelementptr inbounds [80 x i8], [80 x i8]* %11, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp ne i32 %21, 10
br i1 %22, label %23, label %30
23: ; preds = %16
%24 = load i32, i32* %9
%25 = zext i32 %24 to i64
%26 = getelementptr inbounds [80 x i8], [80 x i8]* %11, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp ne i32 %28, 0
br label %30
30: ; preds = %23, %16
%31 = phi i1 [ false, %16 ], [ %29, %23 ]
br i1 %31, label %32, label %35
32: ; preds = %30
%33 = load i32, i32* %9
%34 = add i32 %33, 1
store i32 %34, i32* %9
br label %16
35: ; preds = %30
%36 = load i32, i32* %9
%37 = zext i32 %36 to i64
%38 = getelementptr inbounds [80 x i8], [80 x i8]* %11, i64 0, i64 %37
store i8 0, i8* %38
%39 = getelementptr inbounds [80 x i8], [80 x i8]* %11, i64 0, i64 0
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %39)
%41 = getelementptr inbounds [80 x i8], [80 x i8]* %11, i64 0, i64 0
%42 = call i32* @fopen(i8* %41, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %42, i32** %2
%43 = load i32*, i32** %2
%44 = icmp eq i32* %43, null
br i1 %44, label %45, label %47
45: ; preds = %35
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %1
br label %156
47: ; preds = %35
%48 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
store i32* %48, i32** %3
%49 = load i32*, i32** %3
%50 = icmp eq i32* %49, null
br i1 %50, label %51, label %53
51: ; preds = %47
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0))
store i32 -1, i32* %1
br label %156
53: ; preds = %47
%54 = load i32*, i32** %2
%55 = call i32 @fgetc(i32* %54)
%56 = icmp ne i32 %55, 80
br i1 %56, label %61, label %57
57: ; preds = %53
%58 = load i32*, i32** %2
%59 = call i32 @fgetc(i32* %58)
%60 = icmp ne i32 %59, 54
br i1 %60, label %61, label %63
61: ; preds = %57, %53
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0))
store i32 -1, i32* %1
br label %156
63: ; preds = %57
store i32 0, i32* %8
br label %64
64: ; preds = %74, %63
%65 = load i32, i32* %8
%66 = icmp ult i32 %65, 4
br i1 %66, label %67, label %75
67: ; preds = %64
%68 = load i32*, i32** %2
%69 = call i32 @fgetc(i32* %68)
%70 = icmp eq i32 %69, 10
br i1 %70, label %71, label %74
71: ; preds = %67
%72 = load i32, i32* %8
%73 = add i32 %72, 1
store i32 %73, i32* %8
br label %74
74: ; preds = %71, %67
br label %64
75: ; preds = %64
store i32 255, i32* %9
br label %76
76: ; preds = %146, %75
%77 = load i32*, i32** %2
%78 = call i32 @fgetc(i32* %77)
store i32 %78, i32* %4
%79 = load i32*, i32** %2
%80 = call i32 @fgetc(i32* %79)
store i32 %80, i32* %5
%81 = load i32*, i32** %2
%82 = call i32 @fgetc(i32* %81)
store i32 %82, i32* %8
%83 = load i32, i32* %4
%84 = load i32, i32* %9
%85 = udiv i32 %83, %84
store i32 %85, i32* %4
%86 = load i32, i32* %5
%87 = mul i32 %86, 3
%88 = load i32, i32* %9
%89 = udiv i32 %87, %88
store i32 %89, i32* %5
%90 = load i32, i32* %8
%91 = load i32, i32* %9
%92 = udiv i32 %90, %91
store i32 %92, i32* %8
%93 = load i32, i32* %5
%94 = lshr i32 %93, 1
store i32 %94, i32* %6
%95 = load i32, i32* %5
%96 = and i32 %95, 1
store i32 %96, i32* %7
%97 = load i32, i32* %8
%98 = shl i32 %97, 7
%99 = load i32, i32* %7
%100 = shl i32 %99, 6
%101 = or i32 %98, %100
%102 = load i32, i32* %4
%103 = shl i32 %102, 5
%104 = or i32 %101, %103
%105 = load i32, i32* %6
%106 = shl i32 %105, 4
%107 = or i32 %104, %106
%108 = trunc i32 %107 to i8
store i8 %108, i8* %10
%109 = load i32*, i32** %2
%110 = call i32 @fgetc(i32* %109)
store i32 %110, i32* %4
%111 = load i32*, i32** %2
%112 = call i32 @fgetc(i32* %111)
store i32 %112, i32* %5
%113 = load i32*, i32** %2
%114 = call i32 @fgetc(i32* %113)
store i32 %114, i32* %8
%115 = load i32, i32* %4
%116 = load i32, i32* %9
%117 = udiv i32 %115, %116
store i32 %117, i32* %4
%118 = load i32, i32* %5
%119 = mul i32 %118, 3
%120 = load i32, i32* %9
%121 = udiv i32 %119, %120
store i32 %121, i32* %5
%122 = load i32, i32* %8
%123 = load i32, i32* %9
%124 = udiv i32 %122, %123
store i32 %124, i32* %8
%125 = load i32, i32* %5
%126 = lshr i32 %125, 1
store i32 %126, i32* %6
%127 = load i32, i32* %5
%128 = and i32 %127, 1
store i32 %128, i32* %7
%129 = load i32, i32* %8
%130 = shl i32 %129, 3
%131 = load i32, i32* %7
%132 = shl i32 %131, 2
%133 = or i32 %130, %132
%134 = load i32, i32* %4
%135 = shl i32 %134, 1
%136 = or i32 %133, %135
%137 = load i32, i32* %6
%138 = or i32 %136, %137
%139 = load i8, i8* %10
%140 = zext i8 %139 to i32
%141 = or i32 %140, %138
%142 = trunc i32 %141 to i8
store i8 %142, i8* %10
%143 = load i8, i8* %10
%144 = load i32*, i32** %3
%145 = call i32 @fputc(i8 zeroext %143, i32* %144)
br label %146
146: ; preds = %76
%147 = load i32*, i32** %2
%148 = call i32 @feof(i32* %147)
%149 = icmp ne i32 %148, 0
%150 = xor i1 %149, true
br i1 %150, label %76, label %151
151: ; preds = %146
%152 = load i32*, i32** %2
%153 = call i32 @fclose(i32* %152)
%154 = load i32*, i32** %3
%155 = call i32 @fclose(i32* %154)
store i32 0, i32* %1
br label %156
156: ; preds = %151, %61, %51, %45
%157 = load i32, i32* %1
ret i32 %157
}

LLVM IR (-O2):
@.str = [7 x i8] c"File: \00"
@stdin = global i32 0
@.str.1 = [15 x i8] c"Opening %s...\0A\00"
@.str.2 = [3 x i8] c"rb\00"
@.str.4 = [10 x i8] c"output.sv\00"
@.str.5 = [3 x i8] c"wb\00"
@str = [24 x i8] c"*** wrong file type ***\00"
@str.8 = [21 x i8] c"*** cannot write ***\00"
@str.9 = [16 x i8] c"*** no file ***\00"
define i32 @main() {
%1 = alloca [80 x i8]
%2 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @stdin
%5 = call i32 @fgets(i8* %2, i32 80, i32 %4)
br label %6
6: ; preds = %11, %0
%7 = phi i32 [ 0, %0 ], [ %12, %11 ]
%8 = zext i32 %7 to i64
%9 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 %8
%10 = load i8, i8* %9
switch i8 %10, label %11 [
i8 10, label %13
i8 0, label %13
]
11: ; preds = %6
%12 = add i32 %7, 1
br label %6
13: ; preds = %6, %6
%14 = zext i32 %7 to i64
%15 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 %14
store i8 0, i8* %15
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%17 = call i32* @fopen(i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %21
19: ; preds = %13
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.9, i64 0, i64 0))
br label %81
21: ; preds = %13
%22 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%23 = icmp eq i32* %22, null
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.8, i64 0, i64 0))
br label %81
26: ; preds = %21
%27 = call i32 @fgetc(i32* %17)
%28 = icmp eq i32 %27, 80
br i1 %28, label %29, label %32
29: ; preds = %26
%30 = call i32 @fgetc(i32* %17)
%31 = icmp eq i32 %30, 54
br i1 %31, label %34, label %32
32: ; preds = %29, %26
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
br label %81
34: ; preds = %29, %34
%35 = phi i32 [ %39, %34 ], [ 0, %29 ]
%36 = call i32 @fgetc(i32* %17)
%37 = icmp eq i32 %36, 10
%38 = zext i1 %37 to i32
%39 = add nuw nsw i32 %35, %38
%40 = icmp ult i32 %39, 4
br i1 %40, label %34, label %41
41: ; preds = %34, %41
%42 = call i32 @fgetc(i32* %17)
%43 = call i32 @fgetc(i32* %17)
%44 = call i32 @fgetc(i32* %17)
%45 = udiv i32 %42, 255
%46 = mul i32 %43, 3
%47 = udiv i32 %46, 255
%48 = udiv i32 %44, 255
%49 = shl nuw i32 %48, 7
%50 = shl nuw nsw i32 %47, 6
%51 = and i32 %50, 64
%52 = or i32 %51, %49
%53 = shl nuw nsw i32 %45, 5
%54 = shl nuw nsw i32 %47, 3
%55 = or i32 %54, %53
%56 = or i32 %55, %52
%57 = call i32 @fgetc(i32* %17)
%58 = call i32 @fgetc(i32* %17)
%59 = call i32 @fgetc(i32* %17)
%60 = udiv i32 %57, 255
%61 = mul i32 %58, 3
%62 = udiv i32 %61, 255
%63 = udiv i32 %59, 255
%64 = lshr i32 %62, 1
%65 = shl nuw nsw i32 %63, 3
%66 = shl nuw nsw i32 %62, 2
%67 = and i32 %66, 4
%68 = or i32 %67, %65
%69 = shl nuw nsw i32 %60, 1
%70 = and i32 %56, 240
%71 = or i32 %64, %69
%72 = or i32 %71, %68
%73 = or i32 %72, %70
%74 = trunc i32 %73 to i8
%75 = call i32 @fputc(i8 zeroext %74, i32* %22)
%76 = call i32 @feof(i32* %17)
%77 = icmp eq i32 %76, 0
br i1 %77, label %41, label %78
78: ; preds = %41
%79 = call i32 @fclose(i32* %17)
%80 = call i32 @fclose(i32* %22)
br label %81
81: ; preds = %78, %32, %24, %19
%82 = phi i32 [ -1, %19 ], [ -1, %24 ], [ -1, %32 ], [ 0, %78 ]
ret i32 %82
}