#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*/ printf(char *);
int /*<<< orphan*/ putchar(char);
int printself() {
  FILE *fp;
  char c;
  fp = fopen("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/shaloo/Hello-world/refs/heads/master/"
             "hello-world.c",
             "r");
  if (NULL == fp) {
    printf("File Open error\n");
    return 1;
  }
  do {
    c = getc(fp);
    putchar(c);
  } while (c != EOF);
  fclose(fp);
  return 0;
}


x86 assembly (clang, -O0):
<printself>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xea1(%rip),%rdi
lea    0xf27(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
jne    1193 <printself+0x43>
lea    0xf0d(%rip),%rdi
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11d3 <printself+0x83>
jmp    1198 <printself+0x48>
mov    -0x10(%rbp),%rdi
call   1070 <getc@plt>
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%edi
call   1030 <putchar@plt>
movsbl -0x11(%rbp),%eax
mov    0x2e30(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    1198 <printself+0x48>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printself>:
push   %rbp
push   %r14
push   %rbx
lea    0xea5(%rip),%rdi
lea    0xf39(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     11a3 <printself+0x53>
mov    %rax,%rbx
mov    0x2e72(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1070 <getc@plt>
movsbl %al,%ebp
mov    %ebp,%edi
call   1030 <putchar@plt>
cmp    (%r14),%bpl
jne    1180 <printself+0x30>
mov    %rbx,%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
jmp    11b4 <printself+0x64>
lea    0xee3(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [141 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/shaloo/Hello-world/refs/heads/master/hello-world.c\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [17 x i8] c"File Open error\0A\00"
@EOF = global i8 0
define i32 @printself() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i8
%4 = call i32* @fopen(i8* getelementptr inbounds ([141 x i8], [141 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 eq i32* null, %5
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %1
br label %24
9: ; preds = %0
br label %10
10: ; preds = %15, %9
%11 = load i32*, i32** %2
%12 = call signext i8 @getc(i32* %11)
store i8 %12, i8* %3
%13 = load i8, i8* %3
%14 = call i32 @putchar(i8 signext %13)
br label %15
15: ; preds = %10
%16 = load i8, i8* %3
%17 = sext i8 %16 to i32
%18 = load i8, i8* @EOF
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %17, %19
br i1 %20, label %10, label %21
21: ; preds = %15
%22 = load i32*, i32** %2
%23 = call i32 @fclose(i32* %22)
store i32 0, i32* %1
br label %24
24: ; preds = %21, %7
%25 = load i32, i32* %1
ret i32 %25
}

LLVM IR (-O2):
@.str = [141 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/shaloo/Hello-world/refs/heads/master/hello-world.c\00"
@.str.1 = [2 x i8] c"r\00"
@EOF = global i8 0
@str = [16 x i8] c"File Open error\00"
define i32 @printself() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([141 x i8], [141 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 %3, label %5
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
br label %12
5: ; preds = %0, %5
%6 = tail call signext i8 @getc(i32* %1)
%7 = tail call i32 @putchar(i8 signext %6)
%8 = load i8, i8* @EOF
%9 = icmp eq i8 %6, %8
br i1 %9, label %10, label %5
10: ; preds = %5
%11 = tail call i32 @fclose(i32* %1)
br label %12
12: ; preds = %10, %3
%13 = phi i32 [ 1, %3 ], [ 0, %10 ]
ret i32 %13
}