#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 pl_count(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int ret_val = 0;
  ret_val = pl_count("one three three seven", "three");
  if (ret_val != -1) {
    printf("The word 'three' was found %d times.\n", ret_val);
  }
  ret_val = pl_count("What do you get if you multiply six by nine?", "42");
  if (ret_val == 0) {
    printf("Apparantly not 42. I always knew something was wrong with the "
           "universe.\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xec3(%rip),%rdi
lea    0xed2(%rip),%rsi
call   1040 <pl_count@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
je     1167 <main+0x47>
mov    -0x8(%rbp),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
lea    0xefa(%rip),%rsi
call   1040 <pl_count@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1195 <main+0x75>
lea    0xee4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0xed7(%rip),%rsi
call   1050 <pl_count@plt>
cmp    $0xffffffff,%eax
je     1159 <main+0x29>
lea    0xecc(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee2(%rip),%rdi
lea    0xf08(%rip),%rsi
call   1050 <pl_count@plt>
test   %eax,%eax
jne    117c <main+0x4c>
lea    0xefb(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"one three three seven\00"
@.str.1 = [6 x i8] c"three\00"
@.str.2 = [38 x i8] c"The word 'three' was found %d times.\0A\00"
@.str.3 = [45 x i8] c"What do you get if you multiply six by nine?\00"
@.str.4 = [3 x i8] c"42\00"
@.str.5 = [73 x i8] c"Apparantly not 42. I always knew something was wrong with the universe.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = call i32 @pl_count(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = icmp ne i32 %4, -1
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = load i32, i32* %2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32 %7)
br label %9
9: ; preds = %6, %0
%10 = call i32 @pl_count(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.5, i64 0, i64 0))
br label %15
15: ; preds = %13, %9
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"one three three seven\00"
@.str.1 = [6 x i8] c"three\00"
@.str.2 = [38 x i8] c"The word 'three' was found %d times.\0A\00"
@.str.3 = [45 x i8] c"What do you get if you multiply six by nine?\00"
@.str.4 = [3 x i8] c"42\00"
@str = [72 x i8] c"Apparantly not 42. I always knew something was wrong with the universe.\00"
define i32 @main() {
%1 = tail call i32 @pl_count(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i32 %1, -1
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32 %1)
br label %5
5: ; preds = %3, %0
%6 = tail call i32 @pl_count(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([72 x i8], [72 x i8]* @str, i64 0, i64 0))
br label %10
10: ; preds = %8, %5
ret i32 0
}