#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 EOF;
int getchar();
int /*<<< orphan*/ printf(char *, int, int, int);
int main() {
  int count[256];
  int c;
  while ((c = getchar()) != EOF) {
    count[c]++;
  }
  printf("%d %d %d\n", count[' '], count['\t'], count['\n']);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x414(%rbp)
mov    0x2ea2(%rip),%rcx
cmp    (%rcx),%eax
je     116b <main+0x4b>
movslq -0x414(%rbp),%rax
mov    -0x410(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x410(%rbp,%rax,4)
jmp    1132 <main+0x12>
mov    -0x390(%rbp),%esi
mov    -0x3ec(%rbp),%edx
mov    -0x3e8(%rbp),%ecx
lea    0xe7c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x400,%rsp
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb2(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
cltq
addl   $0x1,(%rsp,%rax,4)
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%rbx),%eax
jne    1140 <main+0x20>
mov    0x80(%rsp),%esi
mov    0x24(%rsp),%edx
mov    0x28(%rsp),%ecx
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@EOF = global i32 0
@.str = [10 x i8] c"%d %d %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [256 x i32]
%3 = alloca i32
store i32 0, i32* %1
br label %4
4: ; preds = %8, %0
%5 = call i32 (...) @getchar()
store i32 %5, i32* %3
%6 = load i32, i32* @EOF
%7 = icmp ne i32 %5, %6
br i1 %7, label %8, label %14
8: ; preds = %4
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [256 x i32], [256 x i32]* %2, i64 0, i64 %10
%12 = load i32, i32* %11
%13 = add nsw i32 %12, 1
store i32 %13, i32* %11
br label %4
14: ; preds = %4
%15 = getelementptr inbounds [256 x i32], [256 x i32]* %2, i64 0, i64 32
%16 = load i32, i32* %15
%17 = getelementptr inbounds [256 x i32], [256 x i32]* %2, i64 0, i64 9
%18 = load i32, i32* %17
%19 = getelementptr inbounds [256 x i32], [256 x i32]* %2, i64 0, i64 10
%20 = load i32, i32* %19
%21 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %16, i32 %18, i32 %20)
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [10 x i8] c"%d %d %d\0A\00"
define i32 @main() {
%1 = alloca [256 x i32]
%2 = bitcast [256 x i32]* %1 to i8*
%3 = tail call i32 (...) @getchar()
%4 = load i32, i32* @EOF
%5 = icmp ne i32 %3, %4
br label %6
6: ; preds = %0, %6
%7 = phi i32 [ %12, %6 ], [ %3, %0 ]
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [256 x i32], [256 x i32]* %1, i64 0, i64 %8
%10 = load i32, i32* %9
%11 = add nsw i32 %10, 1
store i32 %11, i32* %9
%12 = tail call i32 (...) @getchar()
%13 = load i32, i32* @EOF
%14 = icmp eq i32 %12, %13
br i1 %14, label %15, label %6
15: ; preds = %6
%16 = getelementptr inbounds [256 x i32], [256 x i32]* %1, i64 0, i64 32
%17 = load i32, i32* %16
%18 = getelementptr inbounds [256 x i32], [256 x i32]* %1, i64 0, i64 9
%19 = load i32, i32* %18
%20 = getelementptr inbounds [256 x i32], [256 x i32]* %1, i64 0, i64 10
%21 = load i32, i32* %20
%22 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %17, i32 %19, i32 %21)
ret i32 0
}