#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*/ printf(char *, char *, char *);
int /*<<< orphan*/ puts(char *);
int strutil_contains(char *, char *);
int main(void) {
  char *str1 = "Hello, world!";
  char *str2 = "world";
  char *str3 = "WORLD";
  printf("\"%s\" contains \"%s\": ", str1, str2);
  switch (strutil_contains(str1, str2)) {
  case 1:
    puts("true");
    break;
  case 0:
    puts("false");
    break;
  }
  printf("\"%s\" contains \"%s\": ", str1, str3);
  switch (strutil_contains(str1, str3)) {
  case 1:
    puts("true");
    break;
  case 0:
    puts("false");
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xebd(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xeb8(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xeab(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <strutil_contains@plt>
mov    %eax,%ecx
mov    %ecx,-0x24(%rbp)
test   %eax,%eax
je     11b5 <main+0x85>
jmp    1193 <main+0x63>
mov    -0x24(%rbp),%eax
sub    $0x1,%eax
jne    11c1 <main+0x91>
jmp    11a4 <main+0x74>
lea    0xe84(%rip),%rdi
call   1030 <puts@plt>
jmp    11c1 <main+0x91>
lea    0xe78(%rip),%rdi
call   1030 <puts@plt>
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xe4a(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <strutil_contains@plt>
mov    %eax,%ecx
mov    %ecx,-0x28(%rbp)
test   %eax,%eax
je     1216 <main+0xe6>
jmp    11f4 <main+0xc4>
mov    -0x28(%rbp),%eax
sub    $0x1,%eax
jne    1222 <main+0xf2>
jmp    1205 <main+0xd5>
lea    0xe23(%rip),%rdi
call   1030 <puts@plt>
jmp    1222 <main+0xf2>
lea    0xe17(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xedf(%rip),%rdi
lea    0xebe(%rip),%rbx
lea    0xec5(%rip),%r14
mov    %rbx,%rsi
mov    %r14,%rdx
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strutil_contains@plt>
cmp    $0x1,%eax
je     1171 <main+0x41>
test   %eax,%eax
jne    117d <main+0x4d>
lea    0xec5(%rip),%rdi
jmp    1178 <main+0x48>
lea    0xeb7(%rip),%rdi
call   1030 <puts@plt>
lea    0xe96(%rip),%rdi
lea    0xe75(%rip),%rbx
lea    0xe82(%rip),%r14
mov    %rbx,%rsi
mov    %r14,%rdx
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strutil_contains@plt>
cmp    $0x1,%eax
je     11ba <main+0x8a>
test   %eax,%eax
jne    11c6 <main+0x96>
lea    0xe7c(%rip),%rdi
jmp    11c1 <main+0x91>
lea    0xe6e(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Hello, world!\00"
@.str.1 = [6 x i8] c"world\00"
@.str.2 = [6 x i8] c"WORLD\00"
@.str.3 = [21 x i8] c"\22%s\22 contains \22%s\22: \00"
@.str.4 = [5 x i8] c"true\00"
@.str.5 = [6 x i8] c"false\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %3
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8** %4
%5 = load i8*, i8** %2
%6 = load i8*, i8** %3
%7 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* %5, i8* %6)
%8 = load i8*, i8** %2
%9 = load i8*, i8** %3
%10 = call i32 @strutil_contains(i8* %8, i8* %9)
switch i32 %10, label %15 [
i32 1, label %11
i32 0, label %13
]
11: ; preds = %0
%12 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %15
13: ; preds = %0
%14 = call i32 @puts(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %15
15: ; preds = %0, %13, %11
%16 = load i8*, i8** %2
%17 = load i8*, i8** %4
%18 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* %16, i8* %17)
%19 = load i8*, i8** %2
%20 = load i8*, i8** %4
%21 = call i32 @strutil_contains(i8* %19, i8* %20)
switch i32 %21, label %26 [
i32 1, label %22
i32 0, label %24
]
22: ; preds = %15
%23 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %26
24: ; preds = %15
%25 = call i32 @puts(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %26
26: ; preds = %15, %24, %22
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"Hello, world!\00"
@.str.1 = [6 x i8] c"world\00"
@.str.2 = [6 x i8] c"WORLD\00"
@.str.3 = [21 x i8] c"\22%s\22 contains \22%s\22: \00"
@.str.4 = [5 x i8] c"true\00"
@.str.5 = [6 x i8] c"false\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @strutil_contains(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
switch i32 %2, label %7 [
i32 1, label %4
i32 0, label %3
]
3: ; preds = %0
br label %4
4: ; preds = %0, %3
%5 = phi i8* [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), %3 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), %0 ]
%6 = tail call i32 @puts(i8* dereferenceable(1) %5)
br label %7
7: ; preds = %4, %0
%8 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%9 = tail call i32 @strutil_contains(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
switch i32 %9, label %14 [
i32 1, label %11
i32 0, label %10
]
10: ; preds = %7
br label %11
11: ; preds = %7, %10
%12 = phi i8* [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), %10 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), %7 ]
%13 = tail call i32 @puts(i8* dereferenceable(1) %12)
br label %14
14: ; preds = %11, %7
ret i32 0
}