#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*/ fflush(int /*<<< orphan*/);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(int);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ usleep(int);
int main() {
  int c;
  FILE *datei;
  usleep(5000000);
  datei = fopen("Disc0", "r");
  if (datei != NULL) {
    while ((c = fgetc(datei)) != EOF) {
      putchar(c);
      fflush(stdout);
      usleep(50000);
    }
  } else
    printf("Konnte Datei nicht finden bzw. öffnen!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4c4b40,%edi
call   1080 <usleep@plt>
lea    0xe80(%rip),%rdi
lea    0xe7f(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11e5 <main+0x85>
jmp    11a0 <main+0x40>
mov    -0x10(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e35(%rip),%rcx
cmp    (%rcx),%eax
je     11e0 <main+0x80>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
mov    0x2e0e(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
mov    $0xc350,%edi
call   1080 <usleep@plt>
jmp    11a0 <main+0x40>
jmp    11f1 <main+0x91>
lea    0xe1c(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0x4c4b40,%edi
call   1080 <usleep@plt>
lea    0xe8a(%rip),%rdi
lea    0xe89(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     11d8 <main+0x78>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <fgetc@plt>
mov    0x2e4f(%rip),%r14
cmp    (%r14),%eax
je     11e4 <main+0x84>
mov    0x2e33(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
mov    %eax,%edi
call   1030 <putchar@plt>
mov    (%r15),%edi
call   1060 <fflush@plt>
mov    $0xc350,%edi
call   1080 <usleep@plt>
mov    %rbx,%rdi
call   1050 <fgetc@plt>
cmp    (%r14),%eax
jne    11b0 <main+0x50>
jmp    11e4 <main+0x84>
lea    0xe29(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"Disc0\00"
@.str.1 = [2 x i8] c"r\00"
@EOF = global i32 0
@stdout = global i32 0
@.str.2 = [41 x i8] c"Konnte Datei nicht finden bzw. \C3\B6ffnen!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
store i32 0, i32* %1
%4 = call i32 @usleep(i32 5000000)
%5 = call i32* @fopen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = icmp ne i32* %6, null
br i1 %7, label %8, label %21
8: ; preds = %0
br label %9
9: ; preds = %14, %8
%10 = load i32*, i32** %3
%11 = call i32 @fgetc(i32* %10)
store i32 %11, i32* %2
%12 = load i32, i32* @EOF
%13 = icmp ne i32 %11, %12
br i1 %13, label %14, label %20
14: ; preds = %9
%15 = load i32, i32* %2
%16 = call i32 @putchar(i32 %15)
%17 = load i32, i32* @stdout
%18 = call i32 @fflush(i32 %17)
%19 = call i32 @usleep(i32 50000)
br label %9
20: ; preds = %9
br label %23
21: ; preds = %0
%22 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
br label %23
23: ; preds = %21, %20
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"Disc0\00"
@.str.1 = [2 x i8] c"r\00"
@EOF = global i32 0
@stdout = global i32 0
@str = [40 x i8] c"Konnte Datei nicht finden bzw. \C3\B6ffnen!\00"
define i32 @main() {
%1 = tail call i32 @usleep(i32 5000000)
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %17, label %4
4: ; preds = %0
%5 = tail call i32 @fgetc(i32* %2)
%6 = load i32, i32* @EOF
%7 = icmp eq i32 %5, %6
br i1 %7, label %19, label %8
8: ; preds = %4, %8
%9 = phi i32 [ %14, %8 ], [ %5, %4 ]
%10 = tail call i32 @putchar(i32 %9)
%11 = load i32, i32* @stdout
%12 = tail call i32 @fflush(i32 %11)
%13 = tail call i32 @usleep(i32 50000)
%14 = tail call i32 @fgetc(i32* %2)
%15 = load i32, i32* @EOF
%16 = icmp eq i32 %14, %15
br i1 %16, label %19, label %8
17: ; preds = %0
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
br label %19
19: ; preds = %8, %4, %17
ret i32 0
}