#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_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *);
void readCardsPrinted() {
  FILE *fp;
  int t, c, i;
  char n;
  char buffer[200];
  fp = fopen("cardsfromwindow.txt", "r");
  t = ftell(fp);
  fseek(fp, t, SEEK_SET);
  fseek(fp, t, SEEK_END);
  while (fgets(buffer, 200, fp) != NULL) {
    printf("%s", buffer);
  }
  fclose(fp);
}


x86 assembly (clang, -O0):
<readCardsPrinted>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
lea    0xe8e(%rip),%rdi
lea    0xe9b(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <ftell@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    0x2e3c(%rip),%rax
mov    (%rax),%edx
call   1070 <fseek@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    0x2e37(%rip),%rax
mov    (%rax),%edx
call   1070 <fseek@plt>
lea    -0xe0(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0xc8,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     11ef <readCardsPrinted+0x8f>
lea    -0xe0(%rbp),%rsi
lea    0xe31(%rip),%rdi
call   1040 <printf@plt>
jmp    11b8 <readCardsPrinted+0x58>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readCardsPrinted>:
push   %r15
push   %r14
push   %rbx
sub    $0xd0,%rsp
lea    0xe8d(%rip),%rdi
lea    0xe9a(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%r15
mov    %rax,%rdi
call   1060 <ftell@plt>
mov    %eax,%ebx
mov    0x2e45(%rip),%rax
mov    (%rax),%edx
mov    %r15,%rdi
mov    %ebx,%esi
call   1070 <fseek@plt>
mov    0x2e42(%rip),%rax
mov    (%rax),%edx
mov    %r15,%rdi
mov    %ebx,%esi
call   1070 <fseek@plt>
mov    %rsp,%rdi
mov    $0xc8,%esi
mov    %r15,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     1200 <readCardsPrinted+0xa0>
lea    0xe48(%rip),%r14
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0xc8,%esi
mov    %r15,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
jne    11e0 <readCardsPrinted+0x80>
mov    %r15,%rdi
call   1030 <fclose@plt>
add    $0xd0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [20 x i8] c"cardsfromwindow.txt\00"
@.str.1 = [2 x i8] c"r\00"
@SEEK_SET = global i32 0
@SEEK_END = global i32 0
@.str.2 = [3 x i8] c"%s\00"
define void @readCardsPrinted() {
%1 = alloca i32*
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
%6 = alloca [200 x i8]
%7 = call i32* @fopen(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %7, i32** %1
%8 = load i32*, i32** %1
%9 = call i32 @ftell(i32* %8)
store i32 %9, i32* %2
%10 = load i32*, i32** %1
%11 = load i32, i32* %2
%12 = load i32, i32* @SEEK_SET
%13 = call i32 @fseek(i32* %10, i32 %11, i32 %12)
%14 = load i32*, i32** %1
%15 = load i32, i32* %2
%16 = load i32, i32* @SEEK_END
%17 = call i32 @fseek(i32* %14, i32 %15, i32 %16)
br label %18
18: ; preds = %23, %0
%19 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i64 0, i64 0
%20 = load i32*, i32** %1
%21 = call i32* @fgets(i8* %19, i32 200, i32* %20)
%22 = icmp ne i32* %21, null
br i1 %22, label %23, label %26
23: ; preds = %18
%24 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i64 0, i64 0
%25 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %24)
br label %18
26: ; preds = %18
%27 = load i32*, i32** %1
%28 = call i32 @fclose(i32* %27)
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"cardsfromwindow.txt\00"
@.str.1 = [2 x i8] c"r\00"
@SEEK_SET = global i32 0
@SEEK_END = global i32 0
@.str.2 = [3 x i8] c"%s\00"
define void @readCardsPrinted() {
%1 = alloca [200 x i8]
%2 = getelementptr inbounds [200 x i8], [200 x i8]* %1, i64 0, i64 0
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @ftell(i32* %3)
%5 = load i32, i32* @SEEK_SET
%6 = tail call i32 @fseek(i32* %3, i32 %4, i32 %5)
%7 = load i32, i32* @SEEK_END
%8 = tail call i32 @fseek(i32* %3, i32 %4, i32 %7)
%9 = call i32* @fgets(i8* %2, i32 200, i32* %3)
%10 = icmp eq i32* %9, null
br i1 %10, label %15, label %11
11: ; preds = %0, %11
%12 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%13 = call i32* @fgets(i8* %2, i32 200, i32* %3)
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %11
15: ; preds = %11, %0
%16 = call i32 @fclose(i32* %3)
ret void
}