#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 __BNF_trans_string(char *);
int item();
int location();
int organism();
int ynanswer();
int thing_to_say(void) {
  int state;
  do {
    state = item();
    if (!state)
      break;
    state = organism();
    if (!state)
      break;
    state = location();
    if (!state)
      break;
    state = __BNF_trans_string("hello");
    if (!state)
      break;
    state = __BNF_trans_string("hi");
    if (!state)
      break;
    state = ynanswer();
  } while (0);
  return state;
}


x86 assembly (clang, -O0):
<thing_to_say>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <item@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1171 <thing_to_say+0x21>
jmp    11e9 <thing_to_say+0x99>
mov    $0x0,%al
call   1040 <organism@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    118a <thing_to_say+0x3a>
jmp    11e9 <thing_to_say+0x99>
mov    $0x0,%al
call   1050 <location@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    11a3 <thing_to_say+0x53>
jmp    11e9 <thing_to_say+0x99>
lea    0xe56(%rip),%rdi
call   1060 <__BNF_trans_string@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    11c1 <thing_to_say+0x71>
jmp    11e9 <thing_to_say+0x99>
lea    0xe3e(%rip),%rdi
call   1060 <__BNF_trans_string@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    11df <thing_to_say+0x8f>
jmp    11e9 <thing_to_say+0x99>
mov    $0x0,%al
call   1070 <ynanswer@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thing_to_say>:
push   %rax
xor    %eax,%eax
call   1030 <item@plt>
test   %eax,%eax
je     119a <thing_to_say+0x4a>
xor    %eax,%eax
call   1040 <organism@plt>
test   %eax,%eax
je     119a <thing_to_say+0x4a>
xor    %eax,%eax
call   1050 <location@plt>
test   %eax,%eax
je     119a <thing_to_say+0x4a>
lea    0xe87(%rip),%rdi
call   1060 <__BNF_trans_string@plt>
test   %eax,%eax
je     119a <thing_to_say+0x4a>
lea    0xe7d(%rip),%rdi
call   1060 <__BNF_trans_string@plt>
test   %eax,%eax
je     119a <thing_to_say+0x4a>
xor    %eax,%eax
pop    %rcx
jmp    1070 <ynanswer@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"hello\00"
@.str.1 = [3 x i8] c"hi\00"
define i32 @thing_to_say() {
%1 = alloca i32
br label %2
2: ; preds = %0
%3 = call i32 (...) @item()
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = icmp ne i32 %4, 0
br i1 %5, label %7, label %6
6: ; preds = %2
br label %29
7: ; preds = %2
%8 = call i32 (...) @organism()
store i32 %8, i32* %1
%9 = load i32, i32* %1
%10 = icmp ne i32 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %7
br label %29
12: ; preds = %7
%13 = call i32 (...) @location()
store i32 %13, i32* %1
%14 = load i32, i32* %1
%15 = icmp ne i32 %14, 0
br i1 %15, label %17, label %16
16: ; preds = %12
br label %29
17: ; preds = %12
%18 = call i32 @__BNF_trans_string(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32 %18, i32* %1
%19 = load i32, i32* %1
%20 = icmp ne i32 %19, 0
br i1 %20, label %22, label %21
21: ; preds = %17
br label %29
22: ; preds = %17
%23 = call i32 @__BNF_trans_string(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32 %23, i32* %1
%24 = load i32, i32* %1
%25 = icmp ne i32 %24, 0
br i1 %25, label %27, label %26
26: ; preds = %22
br label %29
27: ; preds = %22
%28 = call i32 (...) @ynanswer()
store i32 %28, i32* %1
br label %29
29: ; preds = %27, %26, %21, %16, %11, %6
%30 = load i32, i32* %1
ret i32 %30
}

LLVM IR (-O2):
@.str = [6 x i8] c"hello\00"
@.str.1 = [3 x i8] c"hi\00"
define i32 @thing_to_say() {
%1 = tail call i32 (...) @item()
%2 = icmp eq i32 %1, 0
br i1 %2, label %17, label %3
3: ; preds = %0
%4 = tail call i32 (...) @organism()
%5 = icmp eq i32 %4, 0
br i1 %5, label %17, label %6
6: ; preds = %3
%7 = tail call i32 (...) @location()
%8 = icmp eq i32 %7, 0
br i1 %8, label %17, label %9
9: ; preds = %6
%10 = tail call i32 @__BNF_trans_string(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i32 %10, 0
br i1 %11, label %17, label %12
12: ; preds = %9
%13 = tail call i32 @__BNF_trans_string(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i32 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %12
%16 = tail call i32 (...) @ynanswer()
br label %17
17: ; preds = %12, %9, %6, %3, %0, %15
%18 = phi i32 [ %16, %15 ], [ 0, %12 ], [ 0, %9 ], [ 0, %6 ], [ 0, %3 ], [ 0, %0 ]
ret i32 %18
}