#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*/ line;

/* Variables and functions */
int /*<<< orphan*/ Chomp(char *);
int /*<<< orphan*/ IncludeExampleFile(char const *, char *);
int /*<<< orphan*/ exit(int);
scalar_t__ ferror(int /*<<< orphan*/);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int strlen(char *);
char *strstr(char *, char *);
void Manual(const char *examples_dir) {
  for (;;) {
    char line[2048];
    if (fgets(line, sizeof(line), stdin) == NULL) {
      if (ferror(stdin)) {
        fprintf(stderr, "Error during reading stdin. Bailing out.\n");
        exit(1);
      } else {
        return;
      }
    }
    if (strstr(line, "#CFEexample:")) {
      char *filename = strstr(line, "#CFEexample:") + strlen("#CFEexample:");
      Chomp(filename);
      IncludeExampleFile(examples_dir, filename);
    } else {
      fputs(line, stdout);
    }
  }
}


x86 assembly (clang, -O0):
<Manual>:
push   %rbp
mov    %rsp,%rbp
sub    $0x820,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x810(%rbp),%rdi
mov    0x2e3b(%rip),%rax
mov    (%rax),%edx
mov    $0x800,%esi
call   1070 <fgets@plt>
cmp    $0x0,%rax
jne    1203 <Manual+0x73>
mov    0x2e1e(%rip),%rax
mov    (%rax),%edi
call   1030 <ferror@plt>
cmp    $0x0,%rax
je     11fa <Manual+0x6a>
mov    0x2df6(%rip),%rax
mov    (%rax),%edi
lea    0xe15(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
add    $0x820,%rsp
pop    %rbp
ret
lea    -0x810(%rbp),%rdi
lea    0xe19(%rip),%rsi
call   10b0 <strstr@plt>
cmp    $0x0,%rax
je     127d <Manual+0xed>
lea    -0x810(%rbp),%rdi
lea    0xdfc(%rip),%rsi
call   10b0 <strstr@plt>
mov    %rax,-0x820(%rbp)
lea    0xde9(%rip),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x820(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x818(%rbp)
mov    -0x818(%rbp),%rdi
call   1090 <Chomp@plt>
mov    -0x8(%rbp),%rdi
mov    -0x818(%rbp),%rsi
call   1060 <IncludeExampleFile@plt>
jmp    1292 <Manual+0x102>
lea    -0x810(%rbp),%rdi
mov    0x2d45(%rip),%rax
mov    (%rax),%esi
call   1050 <fputs@plt>
jmp    119f <Manual+0xf>

x86 assembly (clang, -O2):
<Manual>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x808,%rsp
mov    %rdi,%r14
mov    0x2e3d(%rip),%r13
mov    0x0(%r13),%edx
mov    %rsp,%rdi
mov    $0x800,%esi
call   1070 <fgets@plt>
test   %rax,%rax
je     1236 <Manual+0xa6>
lea    0xe62(%rip),%r15
mov    %rsp,%r12
mov    0x2dfe(%rip),%rbp
jmp    1201 <Manual+0x71>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x0(%rbp),%esi
mov    %r12,%rdi
call   1050 <fputs@plt>
mov    0x0(%r13),%edx
mov    %r12,%rdi
mov    $0x800,%esi
call   1070 <fgets@plt>
test   %rax,%rax
je     1236 <Manual+0xa6>
mov    %r12,%rdi
mov    %r15,%rsi
call   10b0 <strstr@plt>
test   %rax,%rax
je     11e0 <Manual+0x50>
mov    %rax,%rbx
mov    %r15,%rdi
call   1040 <strlen@plt>
cltq
add    %rax,%rbx
mov    %rbx,%rdi
call   1090 <Chomp@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <IncludeExampleFile@plt>
jmp    11eb <Manual+0x5b>
mov    0x0(%r13),%edi
call   1030 <ferror@plt>
test   %rax,%rax
jne    1256 <Manual+0xc6>
add    $0x808,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2d7b(%rip),%rax
mov    (%rax),%edi
lea    0xd9a(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@stdin = global i32 0
@stderr = global i32 0
@.str = [42 x i8] c"Error during reading stdin. Bailing out.\0A\00"
@.str.1 = [13 x i8] c"#CFEexample:\00"
@stdout = global i32 0
define void @Manual(i8* %0) {
%2 = alloca i8*
%3 = alloca [2048 x i8]
%4 = alloca i8*
store i8* %0, i8** %2
br label %5
5: ; preds = %38, %1
%6 = getelementptr inbounds [2048 x i8], [2048 x i8]* %3, i64 0, i64 0
%7 = load i32, i32* @stdin
%8 = call i32* @fgets(i8* %6, i32 2048, i32 %7)
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %19
10: ; preds = %5
%11 = load i32, i32* @stdin
%12 = call i64 @ferror(i32 %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i32, i32* @stderr
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%17 = call i32 @exit(i32 1)
unreachable
18: ; preds = %10
ret void
19: ; preds = %5
%20 = getelementptr inbounds [2048 x i8], [2048 x i8]* %3, i64 0, i64 0
%21 = call i8* @strstr(i8* %20, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%22 = icmp ne i8* %21, null
br i1 %22, label %23, label %34
23: ; preds = %19
%24 = getelementptr inbounds [2048 x i8], [2048 x i8]* %3, i64 0, i64 0
%25 = call i8* @strstr(i8* %24, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%26 = call i32 @strlen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %25, i64 %27
store i8* %28, i8** %4
%29 = load i8*, i8** %4
%30 = call i32 @Chomp(i8* %29)
%31 = load i8*, i8** %2
%32 = load i8*, i8** %4
%33 = call i32 @IncludeExampleFile(i8* %31, i8* %32)
br label %38
34: ; preds = %19
%35 = getelementptr inbounds [2048 x i8], [2048 x i8]* %3, i64 0, i64 0
%36 = load i32, i32* @stdout
%37 = call i32 @fputs(i8* %35, i32 %36)
br label %38
38: ; preds = %34, %23
br label %5
}

LLVM IR (-O2):
@stdin = global i32 0
@stderr = global i32 0
@.str = [42 x i8] c"Error during reading stdin. Bailing out.\0A\00"
@.str.1 = [13 x i8] c"#CFEexample:\00"
@stdout = global i32 0
define void @Manual(i8* %0) {
%2 = alloca [2048 x i8]
%3 = getelementptr inbounds [2048 x i8], [2048 x i8]* %2, i64 0, i64 0
%4 = load i32, i32* @stdin
%5 = call i32* @fgets(i8* %3, i32 2048, i32 %4)
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %15
7: ; preds = %27, %1
%8 = load i32, i32* @stdin
%9 = call i64 @ferror(i32 %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %31, label %11
11: ; preds = %7
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %1, %27
%16 = call i8* @strstr(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp eq i8* %16, null
br i1 %17, label %24, label %18
18: ; preds = %15
%19 = call i32 @strlen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %16, i64 %20
%22 = call i32 @Chomp(i8* %21)
%23 = call i32 @IncludeExampleFile(i8* %0, i8* %21)
br label %27
24: ; preds = %15
%25 = load i32, i32* @stdout
%26 = call i32 @fputs(i8* %3, i32 %25)
br label %27
27: ; preds = %18, %24
%28 = load i32, i32* @stdin
%29 = call i32* @fgets(i8* %3, i32 2048, i32 %28)
%30 = icmp eq i32* %29, null
br i1 %30, label %7, label %15
31: ; preds = %7
ret void
}