#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 const *, int);
int main(void) {
  const char text1[] = "Well, here goes.";
  const char text2[] = "And here we go... again.";
  int countWords(const char string[]);
  printf("%s - words - %i\n", text1, countWords(text1));
  printf("%s - words - %i\n", text2, countWords(text2));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec5(%rip),%al
mov    %al,-0x10(%rbp)
mov    0xecb(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xec8(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xec5(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec3(%rip),%al
mov    %al,-0x28(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0x50(%rbp)
lea    -0x20(%rbp),%rdi
call   1040 <countWords@plt>
mov    -0x50(%rbp),%rsi
mov    %eax,%edx
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
lea    -0x40(%rbp),%rax
mov    %rax,-0x48(%rbp)
lea    -0x40(%rbp),%rdi
call   1040 <countWords@plt>
mov    -0x48(%rbp),%rsi
mov    %eax,%edx
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x48,%rsp
movaps 0xed2(%rip),%xmm0
movaps %xmm0,(%rsp)
movb   $0x0,0x10(%rsp)
movups 0xeeb(%rip),%xmm0
movups %xmm0,0x29(%rsp)
movaps 0xed6(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <countWords@plt>
lea    0xed8(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <printf@plt>
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <countWords@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.text1 = [17 x i8] c"Well, here goes.\00"
@__const.main.text2 = [25 x i8] c"And here we go... again.\00"
@.str = [17 x i8] c"%s - words - %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [17 x i8]
%3 = alloca [25 x i8]
store i32 0, i32* %1
%4 = bitcast [17 x i8]* %2 to i8*
%5 = bitcast [25 x i8]* %3 to i8*
%6 = getelementptr inbounds [17 x i8], [17 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [17 x i8], [17 x i8]* %2, i64 0, i64 0
%8 = call i32 @countWords(i8* %7)
%9 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %6, i32 %8)
%10 = getelementptr inbounds [25 x i8], [25 x i8]* %3, i64 0, i64 0
%11 = getelementptr inbounds [25 x i8], [25 x i8]* %3, i64 0, i64 0
%12 = call i32 @countWords(i8* %11)
%13 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %10, i32 %12)
ret i32 0
}

LLVM IR (-O2):
@__const.main.text1 = [17 x i8] c"Well, here goes.\00"
@__const.main.text2 = [25 x i8] c"And here we go... again.\00"
@.str = [17 x i8] c"%s - words - %i\0A\00"
define i32 @main() {
%1 = alloca [17 x i8]
%2 = alloca [25 x i8]
%3 = getelementptr inbounds [17 x i8], [17 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [25 x i8], [25 x i8]* %2, i64 0, i64 0
%5 = call i32 @countWords(i8* %3)
%6 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %3, i32 %5)
%7 = call i32 @countWords(i8* %4)
%8 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %4, i32 %7)
ret i32 0
}