#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 /*<<< orphan*/ my_exit(int);
int /*<<< orphan*/ my_printf(char *);
int /*<<< orphan*/ strcasecmp(char *, char *);
void check_quit(char *s) {
  if (!strcasecmp(s, "exit") || !strcasecmp(s, "quit") ||
      !strcasecmp(s, "logout")) {
    my_printf("\n\nQuitting...\n");
    my_exit(3);
  }
}


x86 assembly (clang, -O0):
<check_quit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
je     1187 <check_quit+0x57>
mov    -0x8(%rbp),%rdi
lea    0xea5(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
je     1187 <check_quit+0x57>
mov    -0x8(%rbp),%rdi
lea    0xe91(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    119d <check_quit+0x6d>
lea    0xe83(%rip),%rdi
call   1040 <my_printf@plt>
mov    $0x3,%edi
call   1050 <my_exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_quit>:
push   %rbx
mov    %rdi,%rbx
lea    0xec5(%rip),%rsi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     116c <check_quit+0x3c>
lea    0xeba(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     116c <check_quit+0x3c>
lea    0xeac(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     116c <check_quit+0x3c>
pop    %rbx
ret
lea    0xe9e(%rip),%rdi
call   1040 <my_printf@plt>
mov    $0x3,%edi
pop    %rbx
jmp    1050 <my_exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"exit\00"
@.str.1 = [5 x i8] c"quit\00"
@.str.2 = [7 x i8] c"logout\00"
@.str.3 = [15 x i8] c"\0A\0AQuitting...\0A\00"
define void @check_quit(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @strcasecmp(i8* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %14
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i32 @strcasecmp(i8* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %6
%11 = load i8*, i8** %2
%12 = call i32 @strcasecmp(i8* %11, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%13 = icmp ne i32 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %10, %6, %1
%15 = call i32 @my_printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%16 = call i32 @my_exit(i32 3)
br label %17
17: ; preds = %14, %10
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"exit\00"
@.str.1 = [5 x i8] c"quit\00"
@.str.2 = [7 x i8] c"logout\00"
@.str.3 = [15 x i8] c"\0A\0AQuitting...\0A\00"
define void @check_quit(i8* nocapture %0) {
%2 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %2, 0
br i1 %3, label %10, label %4
4: ; preds = %1
%5 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %4
%8 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %7, %4, %1
%11 = tail call i32 @my_printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%12 = tail call i32 @my_exit(i32 3)
br label %13
13: ; preds = %10, %7
ret void
}