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

/* Variables and functions */
int EOF;
int /*<<< orphan*/ printf(char *);
void _eval(int (*getc)()) {
  int c;
  c = getc();
  while (c != EOF) {
    if (c == 'h') {
      c = getc();
      if (c == 'e') {
        c = getc();
        if (c == 'l') {
          c = getc();
          if (c == 'l') {
            c = getc();
            if (c == 'o') {
              printf("Hello, world!\n");
            }
          }
        }
      }
    } else {
      c = getc();
    }
  }
}


x86 assembly (clang, -O0):
<_eval>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   *-0x8(%rbp)
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2eba(%rip),%rcx
cmp    (%rcx),%eax
je     11b5 <_eval+0xa5>
cmpl   $0x68,-0xc(%rbp)
jne    11a8 <_eval+0x98>
mov    $0x0,%al
call   *-0x8(%rbp)
mov    %eax,-0xc(%rbp)
cmpl   $0x65,-0xc(%rbp)
jne    11a3 <_eval+0x93>
mov    $0x0,%al
call   *-0x8(%rbp)
mov    %eax,-0xc(%rbp)
cmpl   $0x6c,-0xc(%rbp)
jne    119e <_eval+0x8e>
mov    $0x0,%al
call   *-0x8(%rbp)
mov    %eax,-0xc(%rbp)
cmpl   $0x6c,-0xc(%rbp)
jne    1199 <_eval+0x89>
mov    $0x0,%al
call   *-0x8(%rbp)
mov    %eax,-0xc(%rbp)
cmpl   $0x6f,-0xc(%rbp)
jne    1194 <_eval+0x84>
lea    0xe71(%rip),%rdi
call   1030 <printf@plt>
jmp    1199 <_eval+0x89>
jmp    119e <_eval+0x8e>
jmp    11a3 <_eval+0x93>
jmp    11b0 <_eval+0xa0>
mov    $0x0,%al
call   *-0x8(%rbp)
mov    %eax,-0xc(%rbp)
jmp    1124 <_eval+0x14>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_eval>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %eax,%eax
call   *%rdi
mov    0x2ec3(%rip),%r15
cmp    (%r15),%eax
jne    1135 <_eval+0x25>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xec4(%rip),%r14
jmp    1145 <_eval+0x35>
xchg   %ax,%ax
cmp    (%r15),%eax
je     112a <_eval+0x1a>
mov    %eax,%ebp
xor    %eax,%eax
call   *%rbx
cmp    $0x68,%ebp
jne    1140 <_eval+0x30>
cmp    $0x65,%eax
jne    1140 <_eval+0x30>
xor    %eax,%eax
call   *%rbx
cmp    $0x6c,%eax
jne    1140 <_eval+0x30>
xor    %eax,%eax
call   *%rbx
cmp    $0x6c,%eax
jne    1140 <_eval+0x30>
xor    %eax,%eax
call   *%rbx
cmp    $0x6f,%eax
jne    1140 <_eval+0x30>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    $0x6f,%eax
jmp    1140 <_eval+0x30>

LLVM IR (-O0):
@EOF = global i32 0
@.str = [15 x i8] c"Hello, world!\0A\00"
define void @_eval(i32 (...)* %0) {
%2 = alloca i32 (...)*
%3 = alloca i32
store i32 (...)* %0, i32 (...)** %2
%4 = load i32 (...)*, i32 (...)** %2
%5 = call i32 (...) %4()
store i32 %5, i32* %3
br label %6
6: ; preds = %42, %1
%7 = load i32, i32* %3
%8 = load i32, i32* @EOF
%9 = icmp ne i32 %7, %8
br i1 %9, label %10, label %43
10: ; preds = %6
%11 = load i32, i32* %3
%12 = icmp eq i32 %11, 104
br i1 %12, label %13, label %39
13: ; preds = %10
%14 = load i32 (...)*, i32 (...)** %2
%15 = call i32 (...) %14()
store i32 %15, i32* %3
%16 = load i32, i32* %3
%17 = icmp eq i32 %16, 101
br i1 %17, label %18, label %38
18: ; preds = %13
%19 = load i32 (...)*, i32 (...)** %2
%20 = call i32 (...) %19()
store i32 %20, i32* %3
%21 = load i32, i32* %3
%22 = icmp eq i32 %21, 108
br i1 %22, label %23, label %37
23: ; preds = %18
%24 = load i32 (...)*, i32 (...)** %2
%25 = call i32 (...) %24()
store i32 %25, i32* %3
%26 = load i32, i32* %3
%27 = icmp eq i32 %26, 108
br i1 %27, label %28, label %36
28: ; preds = %23
%29 = load i32 (...)*, i32 (...)** %2
%30 = call i32 (...) %29()
store i32 %30, i32* %3
%31 = load i32, i32* %3
%32 = icmp eq i32 %31, 111
br i1 %32, label %33, label %35
33: ; preds = %28
%34 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %35
35: ; preds = %33, %28
br label %36
36: ; preds = %35, %23
br label %37
37: ; preds = %36, %18
br label %38
38: ; preds = %37, %13
br label %42
39: ; preds = %10
%40 = load i32 (...)*, i32 (...)** %2
%41 = call i32 (...) %40()
store i32 %41, i32* %3
br label %42
42: ; preds = %39, %38
br label %6
43: ; preds = %6
ret void
}

LLVM IR (-O2):
@EOF = global i32 0
@str = [14 x i8] c"Hello, world!\00"
define void @_eval(i32 (...)* nocapture %0) {
%2 = tail call i32 (...) %0()
%3 = load i32, i32* @EOF
%4 = icmp eq i32 %2, %3
br i1 %4, label %26, label %5
5: ; preds = %1, %22
%6 = phi i32 [ %23, %22 ], [ %2, %1 ]
%7 = icmp eq i32 %6, 104
%8 = tail call i32 (...) %0()
%9 = icmp eq i32 %8, 101
%10 = select i1 %7, i1 %9, i1 false
br i1 %10, label %11, label %22
11: ; preds = %5
%12 = tail call i32 (...) %0()
%13 = icmp eq i32 %12, 108
br i1 %13, label %14, label %22
14: ; preds = %11
%15 = tail call i32 (...) %0()
%16 = icmp eq i32 %15, 108
br i1 %16, label %17, label %22
17: ; preds = %14
%18 = tail call i32 (...) %0()
%19 = icmp eq i32 %18, 111
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
br label %22
22: ; preds = %5, %14, %20, %17, %11
%23 = phi i32 [ 111, %20 ], [ %18, %17 ], [ %15, %14 ], [ %12, %11 ], [ %8, %5 ]
%24 = load i32, i32* @EOF
%25 = icmp eq i32 %23, %24
br i1 %25, label %26, label %5
26: ; preds = %22, %1
ret void
}