#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*/ fclose(int /*<<< orphan*/ *);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
void printIntro(void) {
  FILE *fp;
  printf("crc_incremental [DATAFILE]\n\n");
  fp = fopen("README.txt", "r");
  if (fp) {
    int ch;
    while ((ch = fgetc(fp)) >= 0) {
      printf("%c", ch);
    }
    fclose(fp);
  } else {
    printf("Missing README.txt; skipping introduction.\n");
  }
}


x86 assembly (clang, -O0):
<printIntro>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec0(%rip),%rdi
lea    0xec4(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     11b6 <printIntro+0x76>
jmp    117d <printIntro+0x3d>
mov    -0x8(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
jl     11a8 <printIntro+0x68>
mov    -0xc(%rbp),%esi
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    117d <printIntro+0x3d>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
jmp    11c4 <printIntro+0x84>
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printIntro>:
push   %rbx
lea    0xeb5(%rip),%rdi
call   1040 <puts@plt>
lea    0xe9c(%rip),%rdi
lea    0xea0(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     119e <printIntro+0x4e>
mov    %rax,%rbx
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1060 <fgetc@plt>
test   %eax,%eax
js     1195 <printIntro+0x45>
mov    %eax,%edi
call   1030 <putchar@plt>
jmp    1180 <printIntro+0x30>
mov    %rbx,%rdi
pop    %rbx
jmp    1050 <fclose@plt>
lea    0xe84(%rip),%rdi
pop    %rbx
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"crc_incremental [DATAFILE]\0A\0A\00"
@.str.1 = [11 x i8] c"README.txt\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [3 x i8] c"%c\00"
@.str.4 = [44 x i8] c"Missing README.txt; skipping introduction.\0A\00"
define void @printIntro() {
%1 = alloca i32*
%2 = alloca i32
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%4 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %4, i32** %1
%5 = load i32*, i32** %1
%6 = icmp ne i32* %5, null
br i1 %6, label %7, label %18
7: ; preds = %0
br label %8
8: ; preds = %12, %7
%9 = load i32*, i32** %1
%10 = call i32 @fgetc(i32* %9)
store i32 %10, i32* %2
%11 = icmp sge i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %8
%13 = load i32, i32* %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %13)
br label %8
15: ; preds = %8
%16 = load i32*, i32** %1
%17 = call i32 @fclose(i32* %16)
br label %20
18: ; preds = %0
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0))
br label %20
20: ; preds = %18, %15
ret void
}

LLVM IR (-O2):
@.str.1 = [11 x i8] c"README.txt\00"
@.str.2 = [2 x i8] c"r\00"
@str = [28 x i8] c"crc_incremental [DATAFILE]\0A\00"
@str.5 = [43 x i8] c"Missing README.txt; skipping introduction.\00"
define void @printIntro() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %14, label %4
4: ; preds = %0
%5 = tail call i32 @fgetc(i32* %2)
%6 = icmp sgt i32 %5, -1
br i1 %6, label %7, label %12
7: ; preds = %4, %7
%8 = phi i32 [ %10, %7 ], [ %5, %4 ]
%9 = tail call i32 @putchar(i32 %8)
%10 = tail call i32 @fgetc(i32* %2)
%11 = icmp sgt i32 %10, -1
br i1 %11, label %7, label %12
12: ; preds = %7, %4
%13 = tail call i32 @fclose(i32* %2)
br label %16
14: ; preds = %0
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.5, i64 0, i64 0))
br label %16
16: ; preds = %14, %12
ret void
}