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

/* Variables and functions */
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ print_generic_response();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ respond(char *);
int /*<<< orphan*/ stdin;
char *strnstr(char *, char *, int);
int main(int argc, char **argv) {
  char input_buffer[80];
  print_generic_response();
  for (;;) {
    printf(": ");
    fgets(input_buffer, sizeof(input_buffer), stdin);
    if (strnstr(input_buffer, "bye", 80) == input_buffer) {
      puts("Your bill will be mailed to you.");
      break;
    }
    respond(input_buffer);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1080 <print_generic_response@plt>
lea    0xe7c(%rip),%rdi
call   1050 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    0x2e54(%rip),%rax
mov    (%rax),%edx
mov    $0x50,%esi
call   1070 <fgets@plt>
lea    -0x60(%rbp),%rdi
lea    0xe58(%rip),%rsi
mov    $0x50,%edx
call   1060 <strnstr@plt>
lea    -0x60(%rbp),%rcx
cmp    %rcx,%rax
jne    11d3 <main+0x73>
lea    0xe3e(%rip),%rdi
call   1040 <puts@plt>
jmp    11e1 <main+0x81>
lea    -0x60(%rbp),%rdi
call   1030 <respond@plt>
jmp    117d <main+0x1d>
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x58,%rsp
xor    %eax,%eax
call   1080 <print_generic_response@plt>
lea    0xe87(%rip),%rdi
call   1050 <printf@plt>
mov    0x2e63(%rip),%r12
mov    (%r12),%edx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x50,%esi
call   1070 <fgets@plt>
lea    0xe63(%rip),%rsi
mov    %rbx,%rdi
mov    $0x50,%edx
call   1060 <strnstr@plt>
cmp    %rbx,%rax
je     11f6 <main+0x96>
lea    0xe47(%rip),%r14
lea    0xe43(%rip),%r15
mov    %rbx,%rdi
call   1030 <respond@plt>
mov    %r14,%rdi
call   1050 <printf@plt>
mov    (%r12),%edx
mov    %rbx,%rdi
mov    $0x50,%esi
call   1070 <fgets@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x50,%edx
call   1060 <strnstr@plt>
cmp    %rbx,%rax
jne    11c0 <main+0x60>
lea    0xe0a(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c": \00"
@stdin = global i32 0
@.str.1 = [4 x i8] c"bye\00"
@.str.2 = [33 x i8] c"Your bill will be mailed to you.\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [80 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (...) @print_generic_response()
br label %8
8: ; preds = %19, %2
%9 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%10 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%11 = load i32, i32* @stdin
%12 = call i32 @fgets(i8* %10, i32 80, i32 %11)
%13 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%14 = call i8* @strnstr(i8* %13, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 80)
%15 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%16 = icmp eq i8* %14, %15
br i1 %16, label %17, label %19
17: ; preds = %8
%18 = call i32 @puts(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
br label %22
19: ; preds = %8
%20 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%21 = call i32 @respond(i8* %20)
br label %8
22: ; preds = %17
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
@.str = [3 x i8] c": \00"
@stdin = global i32 0
@.str.1 = [4 x i8] c"bye\00"
@.str.2 = [33 x i8] c"Your bill will be mailed to you.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [80 x i8]
%4 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%5 = tail call i32 (...) @print_generic_response()
%6 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @stdin
%8 = call i32 @fgets(i8* %4, i32 80, i32 %7)
%9 = call i8* @strnstr(i8* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 80)
%10 = icmp eq i8* %9, %4
br i1 %10, label %11, label %13
11: ; preds = %13, %2
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
13: ; preds = %2, %13
%14 = call i32 @respond(i8* %4)
%15 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%16 = load i32, i32* @stdin
%17 = call i32 @fgets(i8* %4, i32 80, i32 %16)
%18 = call i8* @strnstr(i8* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 80)
%19 = icmp eq i8* %18, %4
br i1 %19, label %11, label %13
}