#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 */
scalar_t__ countTokens(char *);
int /*<<< orphan*/ getLine(char *, int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int count = 0;
  char line1[80], line2[80];
  printf("Enter line 1: ");
  getLine(line1, 80);
  printf("Enter line 2: ");
  getLine(line2, 80);
  count += countTokens(line1);
  count += countTokens(line2);
  printf("Wordcount = %d\n", count);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    $0x50,%esi
call   1050 <getLine@plt>
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xb0(%rbp),%rdi
mov    $0x50,%esi
call   1050 <getLine@plt>
lea    -0x60(%rbp),%rdi
call   1030 <countTokens@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
lea    -0xb0(%rbp),%rdi
call   1030 <countTokens@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xa0,%rsp
lea    0xebd(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x50(%rsp),%r14
mov    %r14,%rdi
mov    $0x50,%esi
call   1050 <getLine@plt>
lea    0xeac(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0x50,%esi
call   1050 <getLine@plt>
mov    %r14,%rdi
call   1030 <countTokens@plt>
mov    %rax,%rbx
mov    %r15,%rdi
call   1030 <countTokens@plt>
add    %eax,%ebx
lea    0xe88(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Enter line 1: \00"
@.str.1 = [15 x i8] c"Enter line 2: \00"
@.str.2 = [16 x i8] c"Wordcount = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [80 x i8]
%4 = alloca [80 x i8]
store i32 0, i32* %1
store i32 0, i32* %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%7 = call i32 @getLine(i8* %6, i32 80)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%9 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%10 = call i32 @getLine(i8* %9, i32 80)
%11 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%12 = call i64 @countTokens(i8* %11)
%13 = load i32, i32* %2
%14 = sext i32 %13 to i64
%15 = add nsw i64 %14, %12
%16 = trunc i64 %15 to i32
store i32 %16, i32* %2
%17 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%18 = call i64 @countTokens(i8* %17)
%19 = load i32, i32* %2
%20 = sext i32 %19 to i64
%21 = add nsw i64 %20, %18
%22 = trunc i64 %21 to i32
store i32 %22, i32* %2
%23 = load i32, i32* %2
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %23)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"Enter line 1: \00"
@.str.1 = [15 x i8] c"Enter line 2: \00"
@.str.2 = [16 x i8] c"Wordcount = %d\0A\00"
define i32 @main() {
%1 = alloca [80 x i8]
%2 = alloca [80 x i8]
%3 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @getLine(i8* %3, i32 80)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @getLine(i8* %4, i32 80)
%9 = call i64 @countTokens(i8* %3)
%10 = call i64 @countTokens(i8* %4)
%11 = add i64 %10, %9
%12 = trunc i64 %11 to i32
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %12)
ret i32 0
}