#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 */
char EOF;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ stderr;
int main(void) {
  FILE *file = fopen("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                     "outputs/2022-01-22/02-19-57/repos/CptDemocracy/"
                     "The-C-Blues/refs/heads/master/April-6th-2016/quine.c",
                     "r");
  if (!file) {
    fprintf(stderr, "Failed to open \"%s\"",
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/CptDemocracy/The-C-Blues/refs/heads/"
            "master/April-6th-2016/quine.c");
    getchar();
    return 1;
  }
  char c = '\0';
  do {
    c = fgetc(file);
    if (c == EOF) {
      break;
    }
    putchar(c);
  } while (1);
  fclose(file);
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
lea    0xf1f(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11c0 <main+0x60>
mov    0x2e40(%rip),%rax
mov    (%rax),%edi
lea    0xefd(%rip),%rsi
lea    0xe58(%rip),%rdx
call   1070 <fprintf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
movl   $0x1,-0x4(%rbp)
jmp    121a <main+0xba>
movb   $0x0,-0x11(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
mov    0x2e0d(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    11eb <main+0x8b>
jmp    1203 <main+0xa3>
movsbl -0x11(%rbp),%edi
call   1030 <putchar@plt>
mov    $0x1,%al
test   $0x1,%al
jne    11c4 <main+0x64>
jmp    1203 <main+0xa3>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xe95(%rip),%rdi
lea    0xf2a(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     11c1 <main+0x61>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <fgetc@plt>
mov    0x2e5a(%rip),%r14
cmp    (%r14),%al
je     11b5 <main+0x55>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl %al,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1050 <fgetc@plt>
cmp    (%r14),%al
jne    11a0 <main+0x40>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %ebx,%ebx
jmp    11e2 <main+0x82>
mov    0x2e10(%rip),%rax
mov    (%rax),%edi
lea    0xecd(%rip),%rsi
lea    0xe28(%rip),%rdx
call   1070 <fprintf@plt>
mov    $0x1,%ebx
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [156 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/CptDemocracy/The-C-Blues/refs/heads/master/April-6th-2016/quine.c\00"
@.str.1 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.2 = [20 x i8] c"Failed to open \22%s\22\00"
@EOF = global i8 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i8
store i32 0, i32* %1
%4 = call i32* @fopen(i8* getelementptr inbounds ([156 x i8], [156 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** %2
%5 = load i32*, i32** %2
%6 = icmp ne i32* %5, null
br i1 %6, label %11, label %7
7: ; preds = %0
%8 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([156 x i8], [156 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (...) @getchar()
store i32 1, i32* %1
br label %29
11: ; preds = %0
store i8 0, i8* %3
br label %12
12: ; preds = %24, %11
%13 = load i32*, i32** %2
%14 = call signext i8 @fgetc(i32* %13)
store i8 %14, i8* %3
%15 = load i8, i8* %3
%16 = sext i8 %15 to i32
%17 = load i8, i8* @EOF
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %16, %18
br i1 %19, label %20, label %21
20: ; preds = %12
br label %25
21: ; preds = %12
%22 = load i8, i8* %3
%23 = call i32 @putchar(i8 signext %22)
br label %24
24: ; preds = %21
br i1 true, label %12, label %25
25: ; preds = %24, %20
%26 = load i32*, i32** %2
%27 = call i32 @fclose(i32* %26)
%28 = call i32 (...) @getchar()
store i32 0, i32* %1
br label %29
29: ; preds = %25, %7
%30 = load i32, i32* %1
ret i32 %30
}

LLVM IR (-O2):
@.str = [156 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/CptDemocracy/The-C-Blues/refs/heads/master/April-6th-2016/quine.c\00"
@.str.1 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.2 = [20 x i8] c"Failed to open \22%s\22\00"
@EOF = global i8 0
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([156 x i8], [156 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 %7, label %3
3: ; preds = %0
%4 = tail call signext i8 @fgetc(i32* %1)
%5 = load i8, i8* @EOF
%6 = icmp eq i8 %4, %5
br i1 %6, label %16, label %10
7: ; preds = %0
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([156 x i8], [156 x i8]* @.str, i64 0, i64 0))
br label %18
10: ; preds = %3, %10
%11 = phi i8 [ %13, %10 ], [ %4, %3 ]
%12 = tail call i32 @putchar(i8 signext %11)
%13 = tail call signext i8 @fgetc(i32* %1)
%14 = load i8, i8* @EOF
%15 = icmp eq i8 %13, %14
br i1 %15, label %16, label %10
16: ; preds = %10, %3
%17 = tail call i32 @fclose(i32* %1)
br label %18
18: ; preds = %16, %7
%19 = phi i32 [ 0, %16 ], [ 1, %7 ]
%20 = tail call i32 (...) @getchar()
ret i32 %19
}