#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 *, ...);
int main(void) {
  int countWords(const char string[]);
  const char text1[] = "-$20,000.";
  const char text2[] = "And here we go... again.";
  char i = '$';
  printf("%s - words = %i\n", text1, countWords(text1));
  printf("%s - words = %i\n", text2, countWords(text2));
  printf("%i - $", i);
  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,-0xe(%rbp)
mov    0xec7(%rip),%ax
mov    %ax,-0x6(%rbp)
mov    0xee4(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xee1(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xede(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xedc(%rip),%al
mov    %al,-0x18(%rbp)
movb   $0x24,-0x31(%rbp)
lea    -0xe(%rbp),%rax
mov    %rax,-0x48(%rbp)
lea    -0xe(%rbp),%rdi
call   1040 <countWords@plt>
mov    -0x48(%rbp),%rsi
mov    %eax,%edx
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rax
mov    %rax,-0x40(%rbp)
lea    -0x30(%rbp),%rdi
call   1040 <countWords@plt>
mov    -0x40(%rbp),%rsi
mov    %eax,%edx
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0x31(%rbp),%esi
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
movabs $0x3030302c3032242d,%rax
30 30 30
mov    %rax,(%rsp)
movw   $0x2e,0x8(%rsp)
movups 0xef6(%rip),%xmm0
movups %xmm0,0x19(%rsp)
movaps 0xee1(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <countWords@plt>
lea    0xea4(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <countWords@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe83(%rip),%rdi
mov    $0x24,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@__const.main.text1 = [10 x i8] c"-$20,000.\00"
@__const.main.text2 = [25 x i8] c"And here we go... again.\00"
@.str = [17 x i8] c"%s - words = %i\0A\00"
@.str.1 = [7 x i8] c"%i - $\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = alloca [25 x i8]
%3 = getelementptr inbounds [10 x i8], [10 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 (i8*, ...) @printf(i8* dereferenceable(1) 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 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %4, i32 %7)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 36)
ret i32 0
}