#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ *fopen(char *, char *);
int getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdout;
int main(void) {
  int ch;
  FILE *fp;
  if ((fp = fopen("clio.debug", "r")) != NULL) {
    while ((ch = getc(fp)) != EOF) {
      if (ch > 127) {
        if (ch == 255) {
          printf("[%d]", ch);
        } else {
          printf("[%d]", ch - 155);
        }
      } else {
        printf("%c", (char)ch);
      }
    }
    fflush(stdout);
    fclose(fp);
  } else {
    printf("Can't open clio.debug.\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
lea    0xe9e(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     121e <main+0xce>
jmp    1185 <main+0x35>
mov    -0x10(%rbp),%rdi
call   1070 <getc@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e50(%rip),%rcx
cmp    (%rcx),%eax
je     1202 <main+0xb2>
cmpl   $0x7f,-0x8(%rbp)
jle    11e9 <main+0x99>
cmpl   $0xff,-0x8(%rbp)
jne    11cd <main+0x7d>
mov    -0x8(%rbp),%esi
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11e4 <main+0x94>
mov    -0x8(%rbp),%esi
sub    $0x9b,%esi
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11fd <main+0xad>
mov    -0x8(%rbp),%eax
movsbl %al,%esi
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1185 <main+0x35>
mov    0x2dcf(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
jmp    122c <main+0xdc>
lea    0xdf0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
lea    0xe84(%rip),%rdi
lea    0xe88(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     11bc <main+0x4c>
mov    %rax,%rbx
mov    %rax,%rdi
call   1090 <getc@plt>
mov    0x2e49(%rip),%r15
cmp    (%r15),%eax
jne    11d0 <main+0x60>
mov    0x2e2d(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
jmp    11c8 <main+0x58>
lea    0xe4f(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xe36(%rip),%r14
jmp    11f5 <main+0x85>
nopl   0x0(%rax)
movsbl %al,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1090 <getc@plt>
cmp    (%r15),%eax
je     11a4 <main+0x34>
cmp    $0x80,%eax
jl     11e0 <main+0x70>
cmp    $0xff,%eax
jne    1210 <main+0xa0>
mov    %r14,%rdi
mov    $0xff,%esi
jmp    121a <main+0xaa>
nopl   (%rax)
add    $0xffffff65,%eax
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    11e8 <main+0x78>

LLVM IR (-O0):
@.str = [11 x i8] c"clio.debug\00"
@.str.1 = [2 x i8] c"r\00"
@EOF = global i32 0
@.str.2 = [5 x i8] c"[%d]\00"
@.str.3 = [3 x i8] c"%c\00"
@stdout = global i32 0
@.str.4 = [24 x i8] c"Can't open clio.debug.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
store i32 0, i32* %1
%4 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %4, i32** %3
%5 = icmp ne i32* %4, null
br i1 %5, label %6, label %37
6: ; preds = %0
br label %7
7: ; preds = %31, %6
%8 = load i32*, i32** %3
%9 = call i32 @getc(i32* %8)
store i32 %9, i32* %2
%10 = load i32, i32* @EOF
%11 = icmp ne i32 %9, %10
br i1 %11, label %12, label %32
12: ; preds = %7
%13 = load i32, i32* %2
%14 = icmp sgt i32 %13, 127
br i1 %14, label %15, label %26
15: ; preds = %12
%16 = load i32, i32* %2
%17 = icmp eq i32 %16, 255
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = load i32, i32* %2
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %19)
br label %25
21: ; preds = %15
%22 = load i32, i32* %2
%23 = sub nsw i32 %22, 155
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %21, %18
br label %31
26: ; preds = %12
%27 = load i32, i32* %2
%28 = trunc i32 %27 to i8
%29 = sext i8 %28 to i32
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %29)
br label %31
31: ; preds = %26, %25
br label %7
32: ; preds = %7
%33 = load i32, i32* @stdout
%34 = call i32 @fflush(i32 %33)
%35 = load i32*, i32** %3
%36 = call i32 @fclose(i32* %35)
br label %39
37: ; preds = %0
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
br label %39
39: ; preds = %37, %32
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"clio.debug\00"
@.str.1 = [2 x i8] c"r\00"
@EOF = global i32 0
@.str.2 = [5 x i8] c"[%d]\00"
@stdout = global i32 0
@str = [23 x i8] c"Can't open clio.debug.\00"
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i32* %1, null
br i1 %2, label %29, label %3
3: ; preds = %0
%4 = tail call i32 @getc(i32* %1)
%5 = load i32, i32* @EOF
%6 = icmp eq i32 %4, %5
br i1 %6, label %25, label %7
7: ; preds = %3, %21
%8 = phi i32 [ %22, %21 ], [ %4, %3 ]
%9 = icmp sgt i32 %8, 127
br i1 %9, label %10, label %17
10: ; preds = %7
%11 = icmp eq i32 %8, 255
br i1 %11, label %12, label %14
12: ; preds = %10
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 255)
br label %21
14: ; preds = %10
%15 = add nsw i32 %8, -155
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %15)
br label %21
17: ; preds = %7
%18 = shl i32 %8, 24
%19 = ashr exact i32 %18, 24
%20 = tail call i32 @putchar(i32 %19)
br label %21
21: ; preds = %12, %14, %17
%22 = tail call i32 @getc(i32* %1)
%23 = load i32, i32* @EOF
%24 = icmp eq i32 %22, %23
br i1 %24, label %25, label %7
25: ; preds = %21, %3
%26 = load i32, i32* @stdout
%27 = tail call i32 @fflush(i32 %26)
%28 = tail call i32 @fclose(i32* %1)
br label %31
29: ; preds = %0
%30 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
br label %31
31: ; preds = %29, %25
ret i32 0
}