#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*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
char getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ putchar(char);
int main() {
  FILE *fp;
  char c;
  fp = fopen(
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/costaafm/C/refs/heads/master/print_source.c",
      "r");
  do {
    c = getc(fp);
    putchar(c);
  } while (c != EOF);
  fclose(fp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    0xf29(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <getc@plt>
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%edi
call   1030 <putchar@plt>
movsbl -0x11(%rbp),%eax
mov    0x2e62(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    1166 <main+0x26>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
lea    0xeb5(%rip),%rdi
lea    0xf34(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
mov    0x2e87(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1060 <getc@plt>
movsbl %al,%ebp
mov    %ebp,%edi
call   1030 <putchar@plt>
cmp    (%r14),%bpl
jne    1170 <main+0x30>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [134 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/costaafm/C/refs/heads/master/print_source.c\00"
@.str.1 = [2 x i8] c"r\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 ([134 x i8], [134 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
br label %5
5: ; preds = %10, %0
%6 = load i32*, i32** %2
%7 = call signext i8 @getc(i32* %6)
store i8 %7, i8* %3
%8 = load i8, i8* %3
%9 = call i32 @putchar(i8 signext %8)
br label %10
10: ; preds = %5
%11 = load i8, i8* %3
%12 = sext i8 %11 to i32
%13 = load i8, i8* @EOF
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %12, %14
br i1 %15, label %5, label %16
16: ; preds = %10
%17 = load i32*, i32** %2
%18 = call i32 @fclose(i32* %17)
ret i32 0
}

LLVM IR (-O2):
@.str = [134 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/costaafm/C/refs/heads/master/print_source.c\00"
@.str.1 = [2 x i8] c"r\00"
@EOF = global i8 0
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([134 x i8], [134 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %2
2: ; preds = %2, %0
%3 = tail call signext i8 @getc(i32* %1)
%4 = tail call i32 @putchar(i8 signext %3)
%5 = load i8, i8* @EOF
%6 = icmp eq i8 %3, %5
br i1 %6, label %7, label %2
7: ; preds = %2
%8 = tail call i32 @fclose(i32* %1)
ret i32 0
}