#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*/ SEEK_CUR;
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ *freopen(char *, char *, int /*<<< orphan*/ *);
scalar_t__ fseek(int /*<<< orphan*/ *, long, int /*<<< orphan*/);
int getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ putc(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ remove(char *);
int main(void) {
  FILE *fp;
  int i, j;
  puts("\nFile seek test");
  fp = fopen("/tmp/test.dat", "w");
  if (fp == NULL) {
    perror("/tmp/test.dat");
    return 1;
  }
  for (i = 0; i < 256; i++)
    putc(i, fp);
  if (freopen("/tmp/test.dat", "r", fp) != fp) {
    perror("Cannot open file for reading");
    return 1;
  }
  for (i = 1; i <= 255; i++) {
    printf("%3d\n", i);
    fseek(fp, (long)-i, SEEK_END);
    if ((j = getc(fp)) != 256 - i) {
      printf("SEEK_END failed %d\n", j);
      break;
    }
    if (fseek(fp, (long)i, SEEK_SET)) {
      puts("Cannot SEEK_SET");
      break;
    }
    if ((j = getc(fp)) != i) {
      printf("SEEK_SET failed %d\n", j);
      break;
    }
    if (fseek(fp, (long)i, SEEK_SET)) {
      puts("Cannot SEEK_SET");
      break;
    }
    if (fseek(fp, (long)(i >= 128 ? -128 : 128), SEEK_CUR)) {
      puts("Cannot SEEK_CUR");
      break;
    }
    if ((j = getc(fp)) != (i >= 128 ? i - 128 : i + 128)) {
      printf("SEEK_CUR failed %d\n", j);
      break;
    }
  }
  fclose(fp);
  remove("/tmp/test.dat");
  puts((i > 255) ? "Test succeeded." : "Test FAILED!");
  return (i > 255) ? 0 : 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe4a(%rip),%rdi
call   1040 <puts@plt>
lea    0xe4e(%rip),%rdi
lea    0xe55(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11f5 <main+0x55>
lea    0xe2c(%rip),%rdi
call   10b0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1451 <main+0x2b1>
movl   $0x0,-0x14(%rbp)
cmpl   $0x100,-0x14(%rbp)
jge    1223 <main+0x83>
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1080 <putc@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11fc <main+0x5c>
mov    -0x10(%rbp),%rdx
lea    0xde2(%rip),%rdi
lea    0xdeb(%rip),%rsi
call   1070 <freopen@plt>
cmp    -0x10(%rbp),%rax
je     125c <main+0xbc>
lea    0xdd7(%rip),%rdi
call   10b0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1451 <main+0x2b1>
movl   $0x1,-0x14(%rbp)
cmpl   $0xff,-0x14(%rbp)
jg     1406 <main+0x266>
mov    -0x14(%rbp),%esi
lea    0xdc5(%rip),%rdi
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
sub    -0x14(%rbp),%eax
movslq %eax,%rsi
mov    0x2d56(%rip),%rax
mov    (%rax),%edx
call   1090 <fseek@plt>
mov    -0x10(%rbp),%rdi
call   10c0 <getc@plt>
mov    %eax,-0x18(%rbp)
mov    $0x100,%ecx
sub    -0x14(%rbp),%ecx
cmp    %ecx,%eax
je     12c9 <main+0x129>
mov    -0x18(%rbp),%esi
lea    0xd85(%rip),%rdi
call   1060 <printf@plt>
jmp    1406 <main+0x266>
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rsi
mov    0x2cf8(%rip),%rax
mov    (%rax),%edx
call   1090 <fseek@plt>
cmp    $0x0,%rax
je     12fa <main+0x15a>
lea    0xd68(%rip),%rdi
call   1040 <puts@plt>
jmp    1406 <main+0x266>
mov    -0x10(%rbp),%rdi
call   10c0 <getc@plt>
mov    %eax,-0x18(%rbp)
cmp    -0x14(%rbp),%eax
je     1323 <main+0x183>
mov    -0x18(%rbp),%esi
lea    0xd4f(%rip),%rdi
call   1060 <printf@plt>
jmp    1406 <main+0x266>
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rsi
mov    0x2c9e(%rip),%rax
mov    (%rax),%edx
call   1090 <fseek@plt>
cmp    $0x0,%rax
je     1354 <main+0x1b4>
lea    0xd0e(%rip),%rdi
call   1040 <puts@plt>
jmp    1406 <main+0x266>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    $0x80,%eax
mov    $0xffffff80,%ecx
cmp    $0x80,%edx
cmovge %ecx,%eax
movslq %eax,%rsi
mov    0x2c68(%rip),%rax
mov    (%rax),%edx
call   1090 <fseek@plt>
cmp    $0x0,%rax
je     139a <main+0x1fa>
lea    0xcec(%rip),%rdi
call   1040 <puts@plt>
jmp    1406 <main+0x266>
mov    -0x10(%rbp),%rdi
call   10c0 <getc@plt>
mov    %eax,-0x1c(%rbp)
mov    %eax,-0x18(%rbp)
cmpl   $0x80,-0x14(%rbp)
jl     13c6 <main+0x226>
mov    -0x14(%rbp),%eax
sub    $0x80,%eax
mov    %eax,-0x20(%rbp)
jmp    13d1 <main+0x231>
mov    -0x14(%rbp),%eax
add    $0x80,%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x20(%rbp),%ecx
cmp    %ecx,%eax
je     13f3 <main+0x253>
mov    -0x18(%rbp),%esi
lea    0xca3(%rip),%rdi
call   1060 <printf@plt>
jmp    1406 <main+0x266>
jmp    13f8 <main+0x258>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1263 <main+0xc3>
mov    -0x10(%rbp),%rdi
call   1050 <fclose@plt>
lea    0xbfa(%rip),%rdi
call   1030 <remove@plt>
mov    -0x14(%rbp),%ecx
lea    0xc8b(%rip),%rdi
lea    0xc74(%rip),%rax
cmp    $0xff,%ecx
cmovg  %rax,%rdi
call   1040 <puts@plt>
mov    -0x14(%rbp),%edx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0xff,%edx
cmovg  %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xe4e(%rip),%rdi
call   1040 <puts@plt>
lea    0xe52(%rip),%rdi
lea    0xe59(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     138f <main+0x1ef>
mov    %rax,%rbx
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %rbx,%rsi
call   1080 <putc@plt>
add    $0x1,%ebp
cmp    $0x100,%ebp
jne    11e0 <main+0x40>
lea    0xe14(%rip),%rdi
lea    0xe1d(%rip),%rsi
mov    %rbx,%rdx
call   1070 <freopen@plt>
cmp    %rbx,%rax
jne    1398 <main+0x1f8>
mov    $0x1,%r14d
mov    $0xff,%ebp
lea    0xe19(%rip),%r15
mov    0x2da3(%rip),%r13
nopl   (%rax)
mov    %r15,%rdi
mov    %r14d,%esi
call   1060 <printf@plt>
lea    -0x100(%rbp),%rsi
mov    0x2d9f(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
call   1090 <fseek@plt>
mov    %rbx,%rdi
call   10c0 <getc@plt>
mov    %eax,%ecx
cmp    %rcx,%rbp
jne    1319 <main+0x179>
mov    0x0(%r13),%edx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1090 <fseek@plt>
test   %rax,%rax
jne    130b <main+0x16b>
mov    %rbx,%rdi
call   10c0 <getc@plt>
mov    %eax,%ecx
cmp    %rcx,%r14
jne    1322 <main+0x182>
mov    0x0(%r13),%edx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1090 <fseek@plt>
test   %rax,%rax
jne    130b <main+0x16b>
xor    %esi,%esi
cmp    $0x80,%r14
setb   %sil
shl    $0x8,%rsi
add    $0xffffffffffffff80,%rsi
mov    0x2d1f(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
call   1090 <fseek@plt>
test   %rax,%rax
jne    132b <main+0x18b>
xor    %r12d,%r12d
cmp    $0x80,%r14
setb   %r12b
mov    %rbx,%rdi
call   10c0 <getc@plt>
shl    $0x8,%r12d
lea    (%r12,%r14,1),%ecx
add    $0xffffff80,%ecx
cmp    %eax,%ecx
jne    1339 <main+0x199>
add    $0x1,%r14
add    $0xffffffffffffffff,%rbp
jne    1230 <main+0x90>
mov    $0x100,%r14d
jmp    1347 <main+0x1a7>
lea    0xd46(%rip),%rdi
call   1040 <puts@plt>
jmp    1347 <main+0x1a7>
lea    0xd24(%rip),%rdi
jmp    1340 <main+0x1a0>
lea    0xd3f(%rip),%rdi
jmp    1340 <main+0x1a0>
lea    0xd4a(%rip),%rdi
call   1040 <puts@plt>
jmp    1347 <main+0x1a7>
lea    0xd4c(%rip),%rdi
mov    %eax,%esi
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
lea    0xcba(%rip),%rdi
call   1030 <remove@plt>
xor    %ebx,%ebx
cmp    $0x100,%r14d
setb   %bl
lea    0xd32(%rip),%rax
lea    0xd3b(%rip),%rdi
cmovae %rax,%rdi
call   1040 <puts@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc7a(%rip),%rdi
jmp    139f <main+0x1ff>
lea    0xc83(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%ebx
jmp    137e <main+0x1de>

LLVM IR (-O0):
@.str = [16 x i8] c"\0AFile seek test\00"
@.str.1 = [14 x i8] c"/tmp/test.dat\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [29 x i8] c"Cannot open file for reading\00"
@.str.5 = [5 x i8] c"%3d\0A\00"
@SEEK_END = global i32 0
@.str.6 = [20 x i8] c"SEEK_END failed %d\0A\00"
@SEEK_SET = global i32 0
@.str.7 = [16 x i8] c"Cannot SEEK_SET\00"
@.str.8 = [20 x i8] c"SEEK_SET failed %d\0A\00"
@SEEK_CUR = global i32 0
@.str.9 = [16 x i8] c"Cannot SEEK_CUR\00"
@.str.10 = [20 x i8] c"SEEK_CUR failed %d\0A\00"
@.str.11 = [16 x i8] c"Test succeeded.\00"
@.str.12 = [13 x i8] c"Test FAILED!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%6 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %6, i32** %2
%7 = load i32*, i32** %2
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %1
br label %122
11: ; preds = %0
store i32 0, i32* %3
br label %12
12: ; preds = %19, %11
%13 = load i32, i32* %3
%14 = icmp slt i32 %13, 256
br i1 %14, label %15, label %22
15: ; preds = %12
%16 = load i32, i32* %3
%17 = load i32*, i32** %2
%18 = call i32 @putc(i32 %16, i32* %17)
br label %19
19: ; preds = %15
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %12
22: ; preds = %12
%23 = load i32*, i32** %2
%24 = call i32* @freopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32* %23)
%25 = load i32*, i32** %2
%26 = icmp ne i32* %24, %25
br i1 %26, label %27, label %29
27: ; preds = %22
%28 = call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %1
br label %122
29: ; preds = %22
store i32 1, i32* %3
br label %30
30: ; preds = %106, %29
%31 = load i32, i32* %3
%32 = icmp sle i32 %31, 255
br i1 %32, label %33, label %109
33: ; preds = %30
%34 = load i32, i32* %3
%35 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %34)
%36 = load i32*, i32** %2
%37 = load i32, i32* %3
%38 = sub nsw i32 0, %37
%39 = sext i32 %38 to i64
%40 = load i32, i32* @SEEK_END
%41 = call i64 @fseek(i32* %36, i64 %39, i32 %40)
%42 = load i32*, i32** %2
%43 = call i32 @getc(i32* %42)
store i32 %43, i32* %4
%44 = load i32, i32* %3
%45 = sub nsw i32 256, %44
%46 = icmp ne i32 %43, %45
br i1 %46, label %47, label %50
47: ; preds = %33
%48 = load i32, i32* %4
%49 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i32 %48)
br label %109
50: ; preds = %33
%51 = load i32*, i32** %2
%52 = load i32, i32* %3
%53 = sext i32 %52 to i64
%54 = load i32, i32* @SEEK_SET
%55 = call i64 @fseek(i32* %51, i64 %53, i32 %54)
%56 = icmp ne i64 %55, 0
br i1 %56, label %57, label %59
57: ; preds = %50
%58 = call i32 @puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
br label %109
59: ; preds = %50
%60 = load i32*, i32** %2
%61 = call i32 @getc(i32* %60)
store i32 %61, i32* %4
%62 = load i32, i32* %3
%63 = icmp ne i32 %61, %62
br i1 %63, label %64, label %67
64: ; preds = %59
%65 = load i32, i32* %4
%66 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i32 %65)
br label %109
67: ; preds = %59
%68 = load i32*, i32** %2
%69 = load i32, i32* %3
%70 = sext i32 %69 to i64
%71 = load i32, i32* @SEEK_SET
%72 = call i64 @fseek(i32* %68, i64 %70, i32 %71)
%73 = icmp ne i64 %72, 0
br i1 %73, label %74, label %76
74: ; preds = %67
%75 = call i32 @puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
br label %109
76: ; preds = %67
%77 = load i32*, i32** %2
%78 = load i32, i32* %3
%79 = icmp sge i32 %78, 128
%80 = zext i1 %79 to i64
%81 = select i1 %79, i32 -128, i32 128
%82 = sext i32 %81 to i64
%83 = load i32, i32* @SEEK_CUR
%84 = call i64 @fseek(i32* %77, i64 %82, i32 %83)
%85 = icmp ne i64 %84, 0
br i1 %85, label %86, label %88
86: ; preds = %76
%87 = call i32 @puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0))
br label %109
88: ; preds = %76
%89 = load i32*, i32** %2
%90 = call i32 @getc(i32* %89)
store i32 %90, i32* %4
%91 = load i32, i32* %3
%92 = icmp sge i32 %91, 128
br i1 %92, label %93, label %96
93: ; preds = %88
%94 = load i32, i32* %3
%95 = sub nsw i32 %94, 128
br label %99
96: ; preds = %88
%97 = load i32, i32* %3
%98 = add nsw i32 %97, 128
br label %99
99: ; preds = %96, %93
%100 = phi i32 [ %95, %93 ], [ %98, %96 ]
%101 = icmp ne i32 %90, %100
br i1 %101, label %102, label %105
102: ; preds = %99
%103 = load i32, i32* %4
%104 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0), i32 %103)
br label %109
105: ; preds = %99
br label %106
106: ; preds = %105
%107 = load i32, i32* %3
%108 = add nsw i32 %107, 1
store i32 %108, i32* %3
br label %30
109: ; preds = %102, %86, %74, %64, %57, %47, %30
%110 = load i32*, i32** %2
%111 = call i32 @fclose(i32* %110)
%112 = call i32 @remove(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%113 = load i32, i32* %3
%114 = icmp sgt i32 %113, 255
%115 = zext i1 %114 to i64
%116 = select i1 %114, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.12, i64 0, i64 0)
%117 = call i32 @puts(i8* %116)
%118 = load i32, i32* %3
%119 = icmp sgt i32 %118, 255
%120 = zext i1 %119 to i64
%121 = select i1 %119, i32 0, i32 1
store i32 %121, i32* %1
br label %122
122: ; preds = %109, %27, %9
%123 = load i32, i32* %1
ret i32 %123
}

LLVM IR (-O2):
@.str = [16 x i8] c"\0AFile seek test\00"
@.str.1 = [14 x i8] c"/tmp/test.dat\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [29 x i8] c"Cannot open file for reading\00"
@.str.5 = [5 x i8] c"%3d\0A\00"
@SEEK_END = global i32 0
@.str.6 = [20 x i8] c"SEEK_END failed %d\0A\00"
@SEEK_SET = global i32 0
@.str.7 = [16 x i8] c"Cannot SEEK_SET\00"
@.str.8 = [20 x i8] c"SEEK_SET failed %d\0A\00"
@SEEK_CUR = global i32 0
@.str.9 = [16 x i8] c"Cannot SEEK_CUR\00"
@.str.10 = [20 x i8] c"SEEK_CUR failed %d\0A\00"
@.str.11 = [16 x i8] c"Test succeeded.\00"
@.str.12 = [13 x i8] c"Test FAILED!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = tail call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %80
6: ; preds = %0, %6
%7 = phi i32 [ %9, %6 ], [ 0, %0 ]
%8 = tail call i32 @putc(i32 %7, i32* %2)
%9 = add nuw nsw i32 %7, 1
%10 = icmp eq i32 %9, 256
br i1 %10, label %11, label %6
11: ; preds = %6
%12 = tail call i32* @freopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%13 = icmp eq i32* %12, %2
br i1 %13, label %16, label %14
14: ; preds = %11
%15 = tail call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
br label %80
16: ; preds = %11, %68
%17 = phi i64 [ %69, %68 ], [ 1, %11 ]
%18 = trunc i64 %17 to i32
%19 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %18)
%20 = sub nsw i64 0, %17
%21 = load i32, i32* @SEEK_END
%22 = tail call i64 @fseek(i32* %2, i64 %20, i32 %21)
%23 = tail call i32 @getc(i32* %2)
%24 = sub nuw nsw i64 256, %17
%25 = zext i32 %23 to i64
%26 = icmp eq i64 %24, %25
br i1 %26, label %30, label %27
27: ; preds = %16
%28 = trunc i64 %17 to i32
%29 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i32 %23)
br label %71
30: ; preds = %16
%31 = load i32, i32* @SEEK_SET
%32 = tail call i64 @fseek(i32* %2, i64 %17, i32 %31)
%33 = icmp eq i64 %32, 0
br i1 %33, label %37, label %34
34: ; preds = %30
%35 = trunc i64 %17 to i32
%36 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
br label %71
37: ; preds = %30
%38 = tail call i32 @getc(i32* %2)
%39 = zext i32 %38 to i64
%40 = icmp eq i64 %17, %39
br i1 %40, label %44, label %41
41: ; preds = %37
%42 = trunc i64 %17 to i32
%43 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i32 %38)
br label %71
44: ; preds = %37
%45 = load i32, i32* @SEEK_SET
%46 = tail call i64 @fseek(i32* %2, i64 %17, i32 %45)
%47 = icmp eq i64 %46, 0
br i1 %47, label %51, label %48
48: ; preds = %44
%49 = trunc i64 %17 to i32
%50 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
br label %71
51: ; preds = %44
%52 = icmp ugt i64 %17, 127
%53 = select i1 %52, i64 -128, i64 128
%54 = load i32, i32* @SEEK_CUR
%55 = tail call i64 @fseek(i32* %2, i64 %53, i32 %54)
%56 = icmp eq i64 %55, 0
br i1 %56, label %60, label %57
57: ; preds = %51
%58 = trunc i64 %17 to i32
%59 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0))
br label %71
60: ; preds = %51
%61 = tail call i32 @getc(i32* %2)
%62 = select i1 %52, i32 -128, i32 128
%63 = add nsw i32 %62, %18
%64 = icmp eq i32 %61, %63
br i1 %64, label %68, label %65
65: ; preds = %60
%66 = trunc i64 %17 to i32
%67 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0), i32 %61)
br label %71
68: ; preds = %60
%69 = add nuw nsw i64 %17, 1
%70 = icmp eq i64 %69, 256
br i1 %70, label %71, label %16
71: ; preds = %68, %65, %57, %48, %41, %34, %27
%72 = phi i32 [ %66, %65 ], [ %58, %57 ], [ %49, %48 ], [ %42, %41 ], [ %35, %34 ], [ %28, %27 ], [ 256, %68 ]
%73 = tail call i32 @fclose(i32* %2)
%74 = tail call i32 @remove(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%75 = icmp ugt i32 %72, 255
%76 = select i1 %75, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.12, i64 0, i64 0)
%77 = tail call i32 @puts(i8* dereferenceable(1) %76)
%78 = xor i1 %75, true
%79 = zext i1 %78 to i32
br label %80
80: ; preds = %71, %14, %4
%81 = phi i32 [ 1, %4 ], [ 1, %14 ], [ %79, %71 ]
ret i32 %81
}