#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 /*<<< orphan*/ putchar(int);
void get_word_lens() {
  int c, p, i;
  while ((c = getchar()) != EOF) {
    if (c == ' ' || c == '\n' || c == '\t') {
      if (!(p == ' ' || p == '\n' || p == '\t'))
        printf(" %d\n", i);
      i = 0;
    } else {
      ++i;
      putchar(c);
    }
    p = c;
  }
}


x86 assembly (clang, -O0):
<get_word_lens>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x4(%rbp)
mov    0x2e9f(%rip),%rcx
cmp    (%rcx),%eax
je     11c4 <get_word_lens+0x94>
cmpl   $0x20,-0x4(%rbp)
je     116f <get_word_lens+0x3f>
cmpl   $0xa,-0x4(%rbp)
je     116f <get_word_lens+0x3f>
cmpl   $0x9,-0x4(%rbp)
jne    11a8 <get_word_lens+0x78>
cmpl   $0x20,-0x8(%rbp)
je     119c <get_word_lens+0x6c>
cmpl   $0xa,-0x8(%rbp)
je     119c <get_word_lens+0x6c>
cmpl   $0x9,-0x8(%rbp)
je     119c <get_word_lens+0x6c>
mov    -0xc(%rbp),%esi
lea    0xe69(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0xc(%rbp)
jmp    11b9 <get_word_lens+0x89>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <putchar@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1138 <get_word_lens+0x8>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_word_lens>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e9f(%rip),%r15
cmp    (%r15),%eax
jne    115d <get_word_lens+0x2d>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
movabs $0x100000600,%r12
lea    0xe92(%rip),%r14
jmp    118c <get_word_lens+0x5c>
add    $0x1,%ebx
mov    %ebp,%edi
call   1030 <putchar@plt>
mov    %ebx,%r13d
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %r13d,%ebx
cmp    (%r15),%eax
je     114e <get_word_lens+0x1e>
mov    %ebp,%ecx
mov    %eax,%ebp
cmp    $0x20,%eax
ja     1170 <get_word_lens+0x40>
mov    %ebp,%eax
bt     %rax,%r12
jae    1170 <get_word_lens+0x40>
xor    %r13d,%r13d
cmp    $0x20,%ecx
ja     11ad <get_word_lens+0x7d>
mov    %ecx,%eax
bt     %rax,%r12
jb     117d <get_word_lens+0x4d>
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
jmp    117d <get_word_lens+0x4d>

LLVM IR (-O0):
@EOF = global i32 0
@.str = [5 x i8] c" %d\0A\00"
define void @get_word_lens() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
br label %4
4: ; preds = %35, %0
%5 = call i32 (...) @getchar()
store i32 %5, i32* %1
%6 = load i32, i32* @EOF
%7 = icmp ne i32 %5, %6
br i1 %7, label %8, label %37
8: ; preds = %4
%9 = load i32, i32* %1
%10 = icmp eq i32 %9, 32
br i1 %10, label %17, label %11
11: ; preds = %8
%12 = load i32, i32* %1
%13 = icmp eq i32 %12, 10
br i1 %13, label %17, label %14
14: ; preds = %11
%15 = load i32, i32* %1
%16 = icmp eq i32 %15, 9
br i1 %16, label %17, label %30
17: ; preds = %14, %11, %8
%18 = load i32, i32* %2
%19 = icmp eq i32 %18, 32
br i1 %19, label %29, label %20
20: ; preds = %17
%21 = load i32, i32* %2
%22 = icmp eq i32 %21, 10
br i1 %22, label %29, label %23
23: ; preds = %20
%24 = load i32, i32* %2
%25 = icmp eq i32 %24, 9
br i1 %25, label %29, label %26
26: ; preds = %23
%27 = load i32, i32* %3
%28 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %27)
br label %29
29: ; preds = %26, %23, %20, %17
store i32 0, i32* %3
br label %35
30: ; preds = %14
%31 = load i32, i32* %3
%32 = add nsw i32 %31, 1
store i32 %32, i32* %3
%33 = load i32, i32* %1
%34 = call i32 @putchar(i32 %33)
br label %35
35: ; preds = %30, %29
%36 = load i32, i32* %1
store i32 %36, i32* %2
br label %4
37: ; preds = %4
ret void
}

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