#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*/ getchar();
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ *strstr(char *, char *);
main() {
  char input[20];
  int i;
  printf("Enter a sentence\n");
  gets(input);
  if (strstr(input, "is") != NULL) {
    printf("The string \"is\" was found");
  } else {
    printf("Not found");
  }
  for (i = 0; i < 20; i++) {
    if (input[i - 1] == ' ' && input[i] == 'i' && input[i + 1] == 'S' &&
        input[i + 2] == ' ') {
      printf("Found \"is\" in the sentence ");
    } else {
      printf("Did not find");
    }
  }
  getchar();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1050 <gets@plt>
lea    -0x20(%rbp),%rdi
lea    0xea3(%rip),%rsi
call   1060 <strstr@plt>
cmp    $0x0,%rax
je     118f <main+0x4f>
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
jmp    119b <main+0x5b>
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x24(%rbp)
cmpl   $0x14,-0x24(%rbp)
jge    1230 <main+0xf0>
mov    -0x24(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x20(%rbp,%rax,1),%eax
cmp    $0x20,%eax
jne    1211 <main+0xd1>
movslq -0x24(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%eax
cmp    $0x69,%eax
jne    1211 <main+0xd1>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
cltq
movsbl -0x20(%rbp,%rax,1),%eax
cmp    $0x53,%eax
jne    1211 <main+0xd1>
mov    -0x24(%rbp),%eax
add    $0x2,%eax
cltq
movsbl -0x20(%rbp,%rax,1),%eax
cmp    $0x20,%eax
jne    1211 <main+0xd1>
lea    0xe32(%rip),%rdi
call   1030 <printf@plt>
jmp    121d <main+0xdd>
lea    0xe3d(%rip),%rdi
call   1030 <printf@plt>
jmp    1222 <main+0xe2>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11a2 <main+0x62>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xeee(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%r15
mov    %r15,%rdi
call   1060 <gets@plt>
lea    0xe87(%rip),%rsi
mov    %r15,%rdi
call   1070 <strstr@plt>
test   %rax,%rax
lea    0xe92(%rip),%rax
lea    0xe71(%rip),%rdi
cmove  %rax,%rdi
call   1040 <printf@plt>
xor    %ebx,%ebx
lea    0xe83(%rip),%r14
lea    0xe98(%rip),%r12
nopl   0x0(%rax,%rax,1)
cmpb   $0x20,-0x1(%rbx,%r15,1)
jne    11f0 <main+0xa0>
cmpb   $0x69,(%rsp,%rbx,1)
jne    11f0 <main+0xa0>
cmpb   $0x53,0x1(%rsp,%rbx,1)
jne    11f0 <main+0xa0>
cmpb   $0x20,0x2(%rbx,%r15,1)
jne    11f0 <main+0xa0>
add    $0x1,%rbx
mov    %r14,%rdi
call   1040 <printf@plt>
cmp    $0x14,%rbx
jne    11b0 <main+0x60>
jmp    1202 <main+0xb2>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    $0x14,%rbx
jne    11b0 <main+0x60>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Enter a sentence\0A\00"
@.str.1 = [3 x i8] c"is\00"
@.str.2 = [26 x i8] c"The string \22is\22 was found\00"
@.str.3 = [10 x i8] c"Not found\00"
@.str.4 = [28 x i8] c"Found \22is\22 in the sentence \00"
@.str.5 = [13 x i8] c"Did not find\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i8]
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%6 = call i32 @gets(i8* %5)
%7 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%8 = call i32* @strstr(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp ne i32* %8, null
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %14
12: ; preds = %0
%13 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
br label %14
14: ; preds = %12, %10
store i32 0, i32* %3
br label %15
15: ; preds = %54, %14
%16 = load i32, i32* %3
%17 = icmp slt i32 %16, 20
br i1 %17, label %18, label %57
18: ; preds = %15
%19 = load i32, i32* %3
%20 = sub nsw i32 %19, 1
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 32
br i1 %25, label %26, label %51
26: ; preds = %18
%27 = load i32, i32* %3
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %28
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = icmp eq i32 %31, 105
br i1 %32, label %33, label %51
33: ; preds = %26
%34 = load i32, i32* %3
%35 = add nsw i32 %34, 1
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %36
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = icmp eq i32 %39, 83
br i1 %40, label %41, label %51
41: ; preds = %33
%42 = load i32, i32* %3
%43 = add nsw i32 %42, 2
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %44
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = icmp eq i32 %47, 32
br i1 %48, label %49, label %51
49: ; preds = %41
%50 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
br label %53
51: ; preds = %41, %33, %26, %18
%52 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
br label %53
53: ; preds = %51, %49
br label %54
54: ; preds = %53
%55 = load i32, i32* %3
%56 = add nsw i32 %55, 1
store i32 %56, i32* %3
br label %15
57: ; preds = %15
%58 = call i32 (...) @getchar()
%59 = load i32, i32* %1
ret i32 %59
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"is\00"
@.str.2 = [26 x i8] c"The string \22is\22 was found\00"
@.str.3 = [10 x i8] c"Not found\00"
@.str.4 = [28 x i8] c"Found \22is\22 in the sentence \00"
@.str.5 = [13 x i8] c"Did not find\00"
@str = [17 x i8] c"Enter a sentence\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%4 = call i32 @gets(i8* %2)
%5 = call i32* @strstr(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i32* %5, null
%7 = select i1 %6, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0)
%8 = call i32 @printf(i8* dereferenceable(1) %7)
br label %9
9: ; preds = %0, %34
%10 = phi i64 [ 0, %0 ], [ %35, %34 ]
%11 = add nsw i64 %10, -1
%12 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 %11
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 32
br i1 %14, label %15, label %31
15: ; preds = %9
%16 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 %10
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 105
br i1 %18, label %19, label %31
19: ; preds = %15
%20 = add nuw nsw i64 %10, 1
%21 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 %20
%22 = load i8, i8* %21
%23 = icmp eq i8 %22, 83
br i1 %23, label %24, label %31
24: ; preds = %19
%25 = add nuw nsw i64 %10, 2
%26 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = icmp eq i8 %27, 32
br i1 %28, label %29, label %31
29: ; preds = %24
%30 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
br label %34
31: ; preds = %24, %19, %15, %9
%32 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%33 = add nuw nsw i64 %10, 1
br label %34
34: ; preds = %29, %31
%35 = phi i64 [ %20, %29 ], [ %33, %31 ]
%36 = icmp eq i64 %35, 20
br i1 %36, label %37, label %9
37: ; preds = %34
%38 = call i32 (...) @getchar()
ret i32 0
}