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

/* Variables and functions */
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
int strlen(char *);
int main(void) {
  char name[80];
  int lookup(char const *const name);
  while (1) {
    printf("Enter name: ");
    fgets(name, sizeof(name), stdin);
    if ((strlen(name) - 1) <= 1)
      break;
    name[strlen(name) - 1] = '\0';
    if (lookup(name))
      printf("%s is in the list\n", name);
    else
      printf("%s is not in the list\n", name);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    0x2e80(%rip),%rax
mov    (%rax),%edx
mov    $0x50,%esi
call   1050 <fgets@plt>
lea    -0x60(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
cmp    $0x1,%eax
jg     118e <main+0x4e>
jmp    11e1 <main+0xa1>
lea    -0x60(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
cltq
movb   $0x0,-0x60(%rbp,%rax,1)
lea    -0x60(%rbp),%rdi
call   1060 <lookup@plt>
cmp    $0x0,%eax
je     11ca <main+0x8a>
lea    -0x60(%rbp),%rsi
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11dc <main+0x9c>
lea    -0x60(%rbp),%rsi
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    114f <main+0xf>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x50,%rsp
lea    0xeac(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e86(%rip),%r15
mov    (%r15),%edx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x50,%esi
call   1050 <fgets@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmp    $0x3,%eax
jl     11f1 <main+0xb1>
lea    0xe97(%rip),%r12
lea    0xe7d(%rip),%r13
lea    0xe69(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
mov    %rbx,%rdi
call   1060 <lookup@plt>
test   %eax,%eax
mov    %r13,%rdi
cmove  %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%r15),%edx
mov    %rbx,%rdi
mov    $0x50,%esi
call   1050 <fgets@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmp    $0x2,%eax
jg     11a0 <main+0x60>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Enter name: \00"
@stdin = global i32 0
@.str.1 = [19 x i8] c"%s is in the list\0A\00"
@.str.2 = [23 x i8] c"%s is not in the list\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [80 x i8]
store i32 0, i32* %1
br label %3
3: ; preds = %0, %28
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%6 = load i32, i32* @stdin
%7 = call i32 @fgets(i8* %5, i32 80, i32 %6)
%8 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%9 = call i32 @strlen(i8* %8)
%10 = sub nsw i32 %9, 1
%11 = icmp sle i32 %10, 1
br i1 %11, label %12, label %13
12: ; preds = %3
br label %29
13: ; preds = %3
%14 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%15 = call i32 @strlen(i8* %14)
%16 = sub nsw i32 %15, 1
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %17
store i8 0, i8* %18
%19 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%20 = call i32 @lookup(i8* %19)
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %13
%23 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %23)
br label %28
25: ; preds = %13
%26 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %26)
br label %28
28: ; preds = %25, %22
br label %3
29: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"Enter name: \00"
@stdin = global i32 0
@.str.1 = [19 x i8] c"%s is in the list\0A\00"
@.str.2 = [23 x i8] c"%s is not in the list\0A\00"
define i32 @main() {
%1 = alloca [80 x i8]
%2 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @stdin
%5 = call i32 @fgets(i8* %2, i32 80, i32 %4)
%6 = call i32 @strlen(i8* %2)
%7 = icmp slt i32 %6, 3
br i1 %7, label %22, label %8
8: ; preds = %0, %8
%9 = call i32 @strlen(i8* %2)
%10 = add nsw i32 %9, -1
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 %11
store i8 0, i8* %12
%13 = call i32 @lookup(i8* %2)
%14 = icmp eq i32 %13, 0
%15 = select i1 %14, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %15, i8* %2)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%18 = load i32, i32* @stdin
%19 = call i32 @fgets(i8* %2, i32 80, i32 %18)
%20 = call i32 @strlen(i8* %2)
%21 = icmp slt i32 %20, 3
br i1 %21, label %22, label %8
22: ; preds = %8, %0
ret i32 0
}