#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 EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, int);
int word_count(char *, char);
int main() {
  printf("%d\n", word_count("Hard Rock, Hallelujah!", ' '));
  printf("%d\n", word_count("Hard Rock, Hallelujah!", ','));
  printf("%d\n", word_count("Uncle Sam wants you Man", ' '));
  printf("%d\n", word_count("Beat the beat!", '!'));
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xece(%rip),%rdi
mov    $0x20,%esi
call   1030 <word_count@plt>
mov    %eax,%esi
lea    0xeb7(%rip),%rdi
call   1040 <printf@plt>
lea    0xeaf(%rip),%rdi
mov    $0x2c,%esi
call   1030 <word_count@plt>
mov    %eax,%esi
lea    0xe98(%rip),%rdi
call   1040 <printf@plt>
lea    0xea7(%rip),%rdi
mov    $0x20,%esi
call   1030 <word_count@plt>
mov    %eax,%esi
lea    0xe79(%rip),%rdi
call   1040 <printf@plt>
lea    0xea0(%rip),%rdi
mov    $0x21,%esi
call   1030 <word_count@plt>
mov    %eax,%esi
lea    0xe5a(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e2e(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xed9(%rip),%r14
mov    %r14,%rdi
mov    $0x20,%esi
call   1030 <word_count@plt>
lea    0xec1(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0x2c,%esi
call   1030 <word_count@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
lea    0xeb4(%rip),%rdi
mov    $0x20,%esi
call   1030 <word_count@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
lea    0xeb1(%rip),%rdi
mov    $0x21,%esi
call   1030 <word_count@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    0x2e43(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [23 x i8] c"Hard Rock, Hallelujah!\00"
@.str.2 = [24 x i8] c"Uncle Sam wants you Man\00"
@.str.3 = [15 x i8] c"Beat the beat!\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @word_count(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8 signext 32)
%3 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = call i32 @word_count(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8 signext 44)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i32 @word_count(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8 signext 32)
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = call i32 @word_count(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8 signext 33)
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = load i32, i32* @EXIT_SUCCESS
ret i32 %10
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [23 x i8] c"Hard Rock, Hallelujah!\00"
@.str.2 = [24 x i8] c"Uncle Sam wants you Man\00"
@.str.3 = [15 x i8] c"Beat the beat!\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 @word_count(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8 signext 32)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @word_count(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8 signext 44)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @word_count(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8 signext 32)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = tail call i32 @word_count(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8 signext 33)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i32, i32* @EXIT_SUCCESS
ret i32 %9
}