#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 is_exit(char const *);
int main(void) {
  const char *exit_words[] = {
      "",
      "exit",
      "quit",
      "bye",
  };
  int i;
  for (i = 0; i < 4; ++i) {
    if (is_exit(exit_words[i]) != 1) {
      return (-1);
    }
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2cda(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2cd7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0x2cd4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2cd1(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x4,-0x34(%rbp)
jge    1192 <main+0x82>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rdi
call   1030 <is_exit@plt>
cmp    $0x1,%eax
je     117f <main+0x6f>
movl   $0xffffffff,-0x4(%rbp)
jmp    1199 <main+0x89>
jmp    1184 <main+0x74>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1152 <main+0x42>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xef5(%rip),%rdi
call   1030 <is_exit@plt>
mov    $0xffffffff,%ebx
cmp    $0x1,%eax
jne    115f <main+0x4f>
lea    0xed2(%rip),%rdi
call   1030 <is_exit@plt>
cmp    $0x1,%eax
jne    115f <main+0x4f>
lea    0xec6(%rip),%rdi
call   1030 <is_exit@plt>
cmp    $0x1,%eax
jne    115f <main+0x4f>
lea    0xeba(%rip),%rdi
call   1030 <is_exit@plt>
xor    %ebx,%ebx
cmp    $0x1,%eax
setne  %bl
neg    %ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [5 x i8] c"exit\00"
@.str.2 = [5 x i8] c"quit\00"
@.str.3 = [4 x i8] c"bye\00"
@__const.main.exit_words = [4 x i8*] [i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0)]
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i8*]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [4 x i8*]* %2 to i8*
store i32 0, i32* %3
br label %5
5: ; preds = %17, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 4
br i1 %7, label %8, label %20
8: ; preds = %5
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 %10
%12 = load i8*, i8** %11
%13 = call i32 @is_exit(i8* %12)
%14 = icmp ne i32 %13, 1
br i1 %14, label %15, label %16
15: ; preds = %8
store i32 -1, i32* %1
br label %21
16: ; preds = %8
br label %17
17: ; preds = %16
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
br label %5
20: ; preds = %5
store i32 0, i32* %1
br label %21
21: ; preds = %20, %15
%22 = load i32, i32* %1
ret i32 %22
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [5 x i8] c"exit\00"
@.str.2 = [5 x i8] c"quit\00"
@.str.3 = [4 x i8] c"bye\00"
define i32 @main() {
%1 = tail call i32 @is_exit(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32 %1, 1
br i1 %2, label %3, label %13
3: ; preds = %0
%4 = tail call i32 @is_exit(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %13
6: ; preds = %3
%7 = tail call i32 @is_exit(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %13
9: ; preds = %6
%10 = tail call i32 @is_exit(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%11 = icmp ne i32 %10, 1
%12 = sext i1 %11 to i32
br label %13
13: ; preds = %9, %6, %3, %0
%14 = phi i32 [ -1, %0 ], [ -1, %3 ], [ -1, %6 ], [ %12, %9 ]
ret i32 %14
}