#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*/ boop();
int read(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ sleep(int);
char *strstr(char *, char *);
int main(int argc, char **argv) {
  char buf[16];
  int a = 1;
  int *b = NULL;
  int ret = read(0, buf, 16);
  buf[ret + 1] = 0x0;
  if (strstr(buf, "s") == buf) {
    if (strstr(buf, "sl") == buf) {
      sleep(5);
    }
  } else if (strstr(buf, "b") == buf) {
    if (strstr(buf, "bo") == buf) {
      boop();
    }
  } else if (strstr(buf, "c") == buf) {
    if (strstr(buf, "cr") == buf) {
      *b = a;
    }
  }
  return a;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x24(%rbp)
movq   $0x0,-0x30(%rbp)
lea    -0x20(%rbp),%rsi
xor    %edi,%edi
mov    $0x10,%edx
call   1030 <read@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
cltq
movb   $0x0,-0x20(%rbp,%rax,1)
lea    -0x20(%rbp),%rdi
lea    0xe70(%rip),%rsi
call   1060 <strstr@plt>
lea    -0x20(%rbp),%rcx
cmp    %rcx,%rax
jne    11ce <main+0x8e>
lea    -0x20(%rbp),%rdi
lea    0xe55(%rip),%rsi
call   1060 <strstr@plt>
lea    -0x20(%rbp),%rcx
cmp    %rcx,%rax
jne    11c9 <main+0x89>
mov    $0x5,%edi
call   1050 <sleep@plt>
jmp    1266 <main+0x126>
lea    -0x20(%rbp),%rdi
lea    0xe2c(%rip),%rsi
call   1060 <strstr@plt>
lea    -0x20(%rbp),%rcx
cmp    %rcx,%rax
jne    1214 <main+0xd4>
lea    -0x20(%rbp),%rdi
lea    0xe11(%rip),%rsi
call   1060 <strstr@plt>
lea    -0x20(%rbp),%rcx
cmp    %rcx,%rax
jne    120f <main+0xcf>
mov    $0x0,%al
call   1040 <boop@plt>
jmp    1261 <main+0x121>
lea    -0x20(%rbp),%rdi
lea    0xdeb(%rip),%rsi
call   1060 <strstr@plt>
lea    -0x20(%rbp),%rcx
cmp    %rcx,%rax
jne    125c <main+0x11c>
lea    -0x20(%rbp),%rdi
lea    0xdd0(%rip),%rsi
call   1060 <strstr@plt>
lea    -0x20(%rbp),%rcx
cmp    %rcx,%rax
jne    1257 <main+0x117>
mov    -0x24(%rbp),%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,(%rax)
jmp    125c <main+0x11c>
jmp    1261 <main+0x121>
jmp    1266 <main+0x126>
mov    -0x24(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    %rsp,%rbx
xor    %edi,%edi
mov    %rbx,%rsi
mov    $0x10,%edx
call   1030 <read@plt>
cltq
movb   $0x0,0x1(%rax,%rbx,1)
mov    (%rsp),%al
cmp    $0x62,%al
je     1170 <main+0x40>
cmp    $0x73,%al
jne    1182 <main+0x52>
movzwl (%rsp),%eax
cmp    $0x6c73,%eax
jne    1182 <main+0x52>
mov    $0x5,%edi
call   1050 <sleep@plt>
jmp    1182 <main+0x52>
movzwl (%rsp),%eax
cmp    $0x6f62,%eax
jne    1182 <main+0x52>
xor    %eax,%eax
call   1040 <boop@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"s\00"
@.str.1 = [3 x i8] c"sl\00"
@.str.2 = [2 x i8] c"b\00"
@.str.3 = [3 x i8] c"bo\00"
@.str.4 = [2 x i8] c"c\00"
@.str.5 = [3 x i8] c"cr\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [16 x i8]
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %7
store i32* null, i32** %8
%10 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%11 = call i32 @read(i32 0, i8* %10, i32 16)
store i32 %11, i32* %9
%12 = load i32, i32* %9
%13 = add nsw i32 %12, 1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 %14
store i8 0, i8* %15
%16 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%17 = call i8* @strstr(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%18 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%19 = icmp eq i8* %17, %18
br i1 %19, label %20, label %28
20: ; preds = %2
%21 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%22 = call i8* @strstr(i8* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%23 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%24 = icmp eq i8* %22, %23
br i1 %24, label %25, label %27
25: ; preds = %20
%26 = call i32 @sleep(i32 5)
br label %27
27: ; preds = %25, %20
br label %57
28: ; preds = %2
%29 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%30 = call i8* @strstr(i8* %29, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%31 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%32 = icmp eq i8* %30, %31
br i1 %32, label %33, label %41
33: ; preds = %28
%34 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%35 = call i8* @strstr(i8* %34, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%36 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%37 = icmp eq i8* %35, %36
br i1 %37, label %38, label %40
38: ; preds = %33
%39 = call i32 (...) @boop()
br label %40
40: ; preds = %38, %33
br label %56
41: ; preds = %28
%42 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%43 = call i8* @strstr(i8* %42, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%44 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%45 = icmp eq i8* %43, %44
br i1 %45, label %46, label %55
46: ; preds = %41
%47 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%48 = call i8* @strstr(i8* %47, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%49 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%50 = icmp eq i8* %48, %49
br i1 %50, label %51, label %54
51: ; preds = %46
%52 = load i32, i32* %7
%53 = load i32*, i32** %8
store i32 %52, i32* %53
br label %54
54: ; preds = %51, %46
br label %55
55: ; preds = %54, %41
br label %56
56: ; preds = %55, %40
br label %57
57: ; preds = %56, %27
%58 = load i32, i32* %7
ret i32 %58
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [16 x i8]
%4 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%5 = call i32 @read(i32 0, i8* %4, i32 16)
%6 = add nsw i32 %5, 1
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 %7
store i8 0, i8* %8
%9 = load i8, i8* %4
switch i8 %9, label %22 [
i8 115, label %10
i8 98, label %16
]
10: ; preds = %2
%11 = bitcast [16 x i8]* %3 to i16*
%12 = load i16, i16* %11
%13 = icmp eq i16 %12, 27763
br i1 %13, label %14, label %28
14: ; preds = %10
%15 = tail call i32 @sleep(i32 5)
br label %28
16: ; preds = %2
%17 = bitcast [16 x i8]* %3 to i16*
%18 = load i16, i16* %17
%19 = icmp eq i16 %18, 28514
br i1 %19, label %20, label %28
20: ; preds = %16
%21 = tail call i32 (...) @boop()
br label %28
22: ; preds = %2
%23 = icmp ne i8 %9, 99
%24 = bitcast [16 x i8]* %3 to i16*
%25 = load i16, i16* %24
%26 = icmp ne i16 %25, 29283
%27 = select i1 %23, i1 true, i1 %26
tail call void @llvm.assume(i1 %27)
br label %28
28: ; preds = %22, %20, %16, %10, %14
ret i32 1
}