#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 */
char getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ puts(char *);
void count_5(void) {
  char c;
  int x, i, state, words, nr_maxim;
  x = state = words = nr_maxim = 0;
  int words_lenght[100] = {0};
  puts("\t\t THE GREAT WORD COUNTER PROGRAM\n\n");
  puts("Say what you wanna say & then press \" ~ \".");
  while ((c = getchar()) != '~') {
    if ((state == 0 && c >= '0' && c <= '9') ||
        (state == 0 && c >= 'a' && c <= 'z') ||
        (state == 0 && c >= 'A' && c <= 'Z')) {
      state = 1;
      words++;
      words_lenght[x]++;
    } else if ((state == 1 && c >= '0' && c <= '9') ||
               (state == 1 && c >= 'a' && c <= 'z') ||
               (state == 1 && c >= 'A' && c <= 'Z'))
      words_lenght[x]++;
    else if (c == ' ' || c == '\t' || c == '\n') {
      state = 0;
      x++;
    } else
      continue;
  }
  printf("\nIn total you said.. %i words\n\n", words);
  if (words == 0) {
    printf("So you've got nothing to say, huh?\n");
    printf("\n\tOk..\n\t\tBye then!");
    goto tambalau;
  }
  x = 0;
  nr_maxim = 0;
  while (x < words) {
    if (words == 1)
      nr_maxim = words_lenght[0];
    else if (nr_maxim <= words_lenght[x])
      nr_maxim = words_lenght[x];
    x++;
  }
  for (x = nr_maxim; x > 0; x--) {
    while (x <= nr_maxim) {
      printf("Letters x %2d |", x);
      break;
    }
    for (i = 0; i < words; i++) {
      if (words_lenght[i] >= x)
        printf(" * ");
      else
        printf(" - ");
    }
    putchar('\n');
    for (i = 0; i < (words * 3 + 15); i++)
      printf("-");
    putchar('\n');
  }
  x = 1;
  printf("   Word no.  |");
  for (x >= 1; x <= words; x++)
    printf(" %d ", x);
tambalau:;
}


x86 assembly (clang, -O0):
<count_5>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
lea    -0x1b0(%rbp),%rdi
xor    %esi,%esi
mov    $0x190,%edx
call   1060 <memset@plt>
lea    0xe6f(%rip),%rdi
call   1040 <puts@plt>
lea    0xe87(%rip),%rdi
call   1040 <puts@plt>
mov    $0x0,%al
call   1070 <getchar@plt>
mov    %al,-0x1(%rbp)
movsbl %al,%eax
cmp    $0x7e,%eax
je     1324 <count_5+0x1d4>
cmpl   $0x0,-0x10(%rbp)
jne    11dc <count_5+0x8c>
movsbl -0x1(%rbp),%eax
cmp    $0x30,%eax
jl     11dc <count_5+0x8c>
movsbl -0x1(%rbp),%eax
cmp    $0x39,%eax
jle    1224 <count_5+0xd4>
cmpl   $0x0,-0x10(%rbp)
jne    1200 <count_5+0xb0>
movsbl -0x1(%rbp),%eax
cmp    $0x61,%eax
jl     1200 <count_5+0xb0>
movsbl -0x1(%rbp),%eax
cmp    $0x7a,%eax
jle    1224 <count_5+0xd4>
cmpl   $0x0,-0x10(%rbp)
jne    124e <count_5+0xfe>
movsbl -0x1(%rbp),%eax
cmp    $0x41,%eax
jl     124e <count_5+0xfe>
movsbl -0x1(%rbp),%eax
cmp    $0x5a,%eax
jg     124e <count_5+0xfe>
movl   $0x1,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
movslq -0x8(%rbp),%rax
mov    -0x1b0(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x1b0(%rbp,%rax,4)
jmp    131f <count_5+0x1cf>
cmpl   $0x1,-0x10(%rbp)
jne    1272 <count_5+0x122>
movsbl -0x1(%rbp),%eax
cmp    $0x30,%eax
jl     1272 <count_5+0x122>
movsbl -0x1(%rbp),%eax
cmp    $0x39,%eax
jle    12ba <count_5+0x16a>
cmpl   $0x1,-0x10(%rbp)
jne    1296 <count_5+0x146>
movsbl -0x1(%rbp),%eax
cmp    $0x61,%eax
jl     1296 <count_5+0x146>
movsbl -0x1(%rbp),%eax
cmp    $0x7a,%eax
jle    12ba <count_5+0x16a>
cmpl   $0x1,-0x10(%rbp)
jne    12d4 <count_5+0x184>
movsbl -0x1(%rbp),%eax
cmp    $0x41,%eax
jl     12d4 <count_5+0x184>
movsbl -0x1(%rbp),%eax
cmp    $0x5a,%eax
jg     12d4 <count_5+0x184>
movslq -0x8(%rbp),%rax
mov    -0x1b0(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x1b0(%rbp,%rax,4)
jmp    131a <count_5+0x1ca>
movsbl -0x1(%rbp),%eax
cmp    $0x20,%eax
je     12fb <count_5+0x1ab>
movsbl -0x1(%rbp),%eax
cmp    $0x9,%eax
je     12fb <count_5+0x1ab>
movsbl -0x1(%rbp),%eax
cmp    $0xa,%eax
jne    1310 <count_5+0x1c0>
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1315 <count_5+0x1c5>
jmp    11a2 <count_5+0x52>
jmp    131a <count_5+0x1ca>
jmp    131f <count_5+0x1cf>
jmp    11a2 <count_5+0x52>
mov    -0x14(%rbp),%esi
lea    0xd21(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x0,-0x14(%rbp)
jne    1360 <count_5+0x210>
lea    0xd29(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd3f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    14f0 <count_5+0x3a0>
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    13c7 <count_5+0x277>
cmpl   $0x1,-0x14(%rbp)
jne    1392 <count_5+0x242>
mov    -0x1b0(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    13b9 <count_5+0x269>
mov    -0x18(%rbp),%eax
movslq -0x8(%rbp),%rcx
cmp    -0x1b0(%rbp,%rcx,4),%eax
jg     13b4 <count_5+0x264>
movslq -0x8(%rbp),%rax
mov    -0x1b0(%rbp,%rax,4),%eax
mov    %eax,-0x18(%rbp)
jmp    13b9 <count_5+0x269>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    136e <count_5+0x21e>
mov    -0x18(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    14ab <count_5+0x35b>
jmp    13dc <count_5+0x28c>
mov    -0x8(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     13f9 <count_5+0x2a9>
mov    -0x8(%rbp),%esi
lea    0xcb4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1454 <count_5+0x304>
movslq -0xc(%rbp),%rax
mov    -0x1b0(%rbp,%rax,4),%eax
cmp    -0x8(%rbp),%eax
jl     1433 <count_5+0x2e3>
lea    0xc8f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1441 <count_5+0x2f1>
lea    0xc80(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1446 <count_5+0x2f6>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1400 <count_5+0x2b0>
mov    $0xa,%edi
call   1030 <putchar@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
imul   $0x3,-0x14(%rbp),%ecx
add    $0xf,%ecx
cmp    %ecx,%eax
jge    1493 <count_5+0x343>
lea    0xc40(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1465 <count_5+0x315>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    13cd <count_5+0x27d>
movl   $0x1,-0x8(%rbp)
lea    0xc07(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     14eb <count_5+0x39b>
mov    -0x8(%rbp),%esi
lea    0xbf9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    14c0 <count_5+0x370>
jmp    14f0 <count_5+0x3a0>
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<count_5>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1b8,%rsp
lea    0x20(%rsp),%rdi
mov    $0x190,%edx
xor    %esi,%esi
call   1060 <memset@plt>
lea    0xe87(%rip),%rdi
call   1040 <puts@plt>
lea    0xe9f(%rip),%rdi
call   1040 <puts@plt>
movabs $0x100000600,%r13
xor    %eax,%eax
xor    %r12d,%r12d
jmp    11a4 <count_5+0x54>
nopl   0x0(%rax,%rax,1)
lea    0x1(%r15),%eax
mov    %eax,%r15d
lea    (%r12,%r12,2),%eax
add    $0xe,%eax
mov    %eax,0xc(%rsp)
mov    $0x1,%r14b
xor    %ebp,%ebp
mov    %r12d,%eax
mov    %r12b,0x10(%rsp)
nop
xor    %eax,%eax
call   1070 <getchar@plt>
cmp    $0x7e,%al
je     125b <count_5+0x10b>
lea    -0x30(%rax),%ecx
cmp    $0xa,%cl
setb   %dl
test   %dl,%r14b
jne    1234 <count_5+0xe4>
lea    -0x61(%rax),%edx
cmp    $0x1a,%dl
setb   %bl
test   %bl,%r14b
jne    1234 <count_5+0xe4>
lea    -0x41(%rax),%esi
cmp    $0x1a,%sil
setae  %dil
mov    %r14d,%ebx
not    %bl
or     %dil,%bl
test   $0x1,%bl
je     1234 <count_5+0xe4>
cmp    $0x1a,%sil
setb   %bl
cmp    $0x1a,%dl
setb   %dl
cmp    $0xa,%cl
setb   %cl
or     %dl,%cl
or     %bl,%cl
and    %bpl,%cl
cmp    $0x1,%cl
je     124a <count_5+0xfa>
cmp    $0x20,%al
ja     11c0 <count_5+0x70>
movzbl %al,%eax
bt     %rax,%r13
jae    11c0 <count_5+0x70>
jmp    11a0 <count_5+0x50>
add    $0x1,%r12d
addl   $0x1,0x20(%rsp,%r15,4)
addl   $0x3,0xc(%rsp)
addb   $0x1,0x10(%rsp)
jmp    1250 <count_5+0x100>
addl   $0x1,0x20(%rsp,%r15,4)
mov    $0x1,%bpl
xor    %r14d,%r14d
jmp    11c0 <count_5+0x70>
lea    0xded(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
test   %r12d,%r12d
je     12cd <count_5+0x17d>
jle    1415 <count_5+0x2c5>
mov    0x20(%rsp),%ebp
mov    %r12d,%r13d
lea    -0x1(%r13),%rcx
cmp    $0x3,%rcx
jae    1434 <count_5+0x2e4>
xor    %ecx,%ecx
xor    %eax,%eax
mov    %eax,%esi
test   $0x3,%r13b
je     12e5 <count_5+0x195>
lea    (%rsp,%rcx,4),%rcx
add    $0x20,%rcx
movzbl 0x10(%rsp),%edx
and    $0x3,%edx
xor    %edi,%edi
jmp    12bb <count_5+0x16b>
nopl   0x0(%rax)
add    $0x1,%rdi
mov    %esi,%eax
cmp    %rdi,%rdx
je     12e5 <count_5+0x195>
mov    %ebp,%esi
cmp    $0x1,%r12d
je     12b0 <count_5+0x160>
mov    (%rcx,%rdi,4),%esi
cmp    %esi,%eax
cmovg  %eax,%esi
jmp    12b0 <count_5+0x160>
lea    0xdda(%rip),%rdi
call   1040 <puts@plt>
lea    0xd8f(%rip),%rdi
jmp    141c <count_5+0x2cc>
mov    %r12,0x10(%rsp)
test   %esi,%esi
jle    13c4 <count_5+0x274>
mov    0x10(%rsp),%rax
lea    (%rax,%rax,2),%eax
mov    %eax,0x18(%rsp)
xor    %eax,%eax
mov    0xc(%rsp),%ecx
test   %ecx,%ecx
cmovle %eax,%ecx
add    $0x1,%ecx
mov    %ecx,0xc(%rsp)
lea    0xd7f(%rip),%r12
lea    0xd74(%rip),%r14
mov    %esi,%ebx
mov    %esi,0x1c(%rsp)
jmp    1348 <count_5+0x1f8>
cs nopw 0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    -0x1(%rbx),%eax
cmp    $0x1,%ebx
mov    %eax,%ebx
mov    0x1c(%rsp),%esi
jle    13c4 <count_5+0x274>
cmp    %esi,%ebx
jg     135c <count_5+0x20c>
lea    0xd2f(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
cmpl   $0x0,0x10(%rsp)
jle    1390 <count_5+0x240>
xor    %r15d,%r15d
jmp    1380 <count_5+0x230>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r15
cmp    %r15,%r13
je     1390 <count_5+0x240>
mov    %r12,%rdi
cmp    %ebx,0x20(%rsp,%r15,4)
jl     1370 <count_5+0x220>
mov    %r14,%rdi
jmp    1370 <count_5+0x220>
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
cmpl   $0xfffffff2,0x18(%rsp)
jl     1330 <count_5+0x1e0>
mov    0xc(%rsp),%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x2d,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    13b0 <count_5+0x260>
jmp    1330 <count_5+0x1e0>
lea    0xccf(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rsp),%rbx
test   %ebx,%ebx
jle    1403 <count_5+0x2b3>
lea    0xcc7(%rip),%r14
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%ebp
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    %ebp,%ebx
jne    13f0 <count_5+0x2a0>
add    $0x1b8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc7e(%rip),%rdi
xor    %eax,%eax
add    $0x1b8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <printf@plt>
mov    %r12d,%edx
and    $0xfffffffc,%edx
xor    %ecx,%ecx
xor    %eax,%eax
jmp    144f <count_5+0x2ff>
mov    %edi,%eax
add    $0x4,%rcx
cmp    %rcx,%rdx
je     1290 <count_5+0x140>
mov    %ebp,%edi
cmp    $0x1,%r12d
je     1460 <count_5+0x310>
mov    0x20(%rsp,%rcx,4),%edi
cmp    %edi,%eax
cmovg  %eax,%edi
mov    %ebp,%esi
cmp    $0x1,%r12d
je     1474 <count_5+0x324>
mov    0x24(%rsp,%rcx,4),%esi
cmp    %esi,%edi
jg     1472 <count_5+0x322>
mov    %esi,%edi
mov    %edi,%esi
mov    %ebp,%edi
cmp    $0x1,%r12d
je     1488 <count_5+0x338>
mov    0x28(%rsp,%rcx,4),%edi
cmp    %edi,%esi
jg     1486 <count_5+0x336>
mov    %edi,%esi
mov    %esi,%edi
mov    %ebp,%eax
cmp    $0x1,%r12d
je     1442 <count_5+0x2f2>
mov    0x2c(%rsp,%rcx,4),%esi
cmp    %esi,%edi
jg     1440 <count_5+0x2f0>
mov    %esi,%edi
jmp    1440 <count_5+0x2f0>

LLVM IR (-O0):
@.str = [36 x i8] c"\09\09 THE GREAT WORD COUNTER PROGRAM\0A\0A\00"
@.str.1 = [43 x i8] c"Say what you wanna say & then press \22 ~ \22.\00"
@.str.2 = [32 x i8] c"\0AIn total you said.. %i words\0A\0A\00"
@.str.3 = [36 x i8] c"So you've got nothing to say, huh?\0A\00"
@.str.4 = [19 x i8] c"\0A\09Ok..\0A\09\09Bye then!\00"
@.str.5 = [16 x i8] c"Letters x %2d |\00"
@.str.6 = [4 x i8] c" * \00"
@.str.7 = [4 x i8] c" - \00"
@.str.8 = [2 x i8] c"-\00"
@.str.9 = [15 x i8] c" Word no. |\00"
@.str.10 = [5 x i8] c" %d \00"
define void @count_5() {
%1 = alloca i8
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [100 x i32]
store i32 0, i32* %6
store i32 0, i32* %5
store i32 0, i32* %4
store i32 0, i32* %2
%8 = bitcast [100 x i32]* %7 to i8*
%9 = call i32 @puts(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @puts(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %113, %110, %0
%12 = call signext i8 (...) @getchar()
store i8 %12, i8* %1
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %13, 126
br i1 %14, label %15, label %114
15: ; preds = %11
%16 = load i32, i32* %4
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %26
18: ; preds = %15
%19 = load i8, i8* %1
%20 = sext i8 %19 to i32
%21 = icmp sge i32 %20, 48
br i1 %21, label %22, label %26
22: ; preds = %18
%23 = load i8, i8* %1
%24 = sext i8 %23 to i32
%25 = icmp sle i32 %24, 57
br i1 %25, label %48, label %26
26: ; preds = %22, %18, %15
%27 = load i32, i32* %4
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %37
29: ; preds = %26
%30 = load i8, i8* %1
%31 = sext i8 %30 to i32
%32 = icmp sge i32 %31, 97
br i1 %32, label %33, label %37
33: ; preds = %29
%34 = load i8, i8* %1
%35 = sext i8 %34 to i32
%36 = icmp sle i32 %35, 122
br i1 %36, label %48, label %37
37: ; preds = %33, %29, %26
%38 = load i32, i32* %4
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %56
40: ; preds = %37
%41 = load i8, i8* %1
%42 = sext i8 %41 to i32
%43 = icmp sge i32 %42, 65
br i1 %43, label %44, label %56
44: ; preds = %40
%45 = load i8, i8* %1
%46 = sext i8 %45 to i32
%47 = icmp sle i32 %46, 90
br i1 %47, label %48, label %56
48: ; preds = %44, %33, %22
store i32 1, i32* %4
%49 = load i32, i32* %5
%50 = add nsw i32 %49, 1
store i32 %50, i32* %5
%51 = load i32, i32* %2
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [100 x i32], [100 x i32]* %7, i64 0, i64 %52
%54 = load i32, i32* %53
%55 = add nsw i32 %54, 1
store i32 %55, i32* %53
br label %113
56: ; preds = %44, %40, %37
%57 = load i32, i32* %4
%58 = icmp eq i32 %57, 1
br i1 %58, label %59, label %67
59: ; preds = %56
%60 = load i8, i8* %1
%61 = sext i8 %60 to i32
%62 = icmp sge i32 %61, 48
br i1 %62, label %63, label %67
63: ; preds = %59
%64 = load i8, i8* %1
%65 = sext i8 %64 to i32
%66 = icmp sle i32 %65, 57
br i1 %66, label %89, label %67
67: ; preds = %63, %59, %56
%68 = load i32, i32* %4
%69 = icmp eq i32 %68, 1
br i1 %69, label %70, label %78
70: ; preds = %67
%71 = load i8, i8* %1
%72 = sext i8 %71 to i32
%73 = icmp sge i32 %72, 97
br i1 %73, label %74, label %78
74: ; preds = %70
%75 = load i8, i8* %1
%76 = sext i8 %75 to i32
%77 = icmp sle i32 %76, 122
br i1 %77, label %89, label %78
78: ; preds = %74, %70, %67
%79 = load i32, i32* %4
%80 = icmp eq i32 %79, 1
br i1 %80, label %81, label %95
81: ; preds = %78
%82 = load i8, i8* %1
%83 = sext i8 %82 to i32
%84 = icmp sge i32 %83, 65
br i1 %84, label %85, label %95
85: ; preds = %81
%86 = load i8, i8* %1
%87 = sext i8 %86 to i32
%88 = icmp sle i32 %87, 90
br i1 %88, label %89, label %95
89: ; preds = %85, %74, %63
%90 = load i32, i32* %2
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds [100 x i32], [100 x i32]* %7, i64 0, i64 %91
%93 = load i32, i32* %92
%94 = add nsw i32 %93, 1
store i32 %94, i32* %92
br label %112
95: ; preds = %85, %81, %78
%96 = load i8, i8* %1
%97 = sext i8 %96 to i32
%98 = icmp eq i32 %97, 32
br i1 %98, label %107, label %99
99: ; preds = %95
%100 = load i8, i8* %1
%101 = sext i8 %100 to i32
%102 = icmp eq i32 %101, 9
br i1 %102, label %107, label %103
103: ; preds = %99
%104 = load i8, i8* %1
%105 = sext i8 %104 to i32
%106 = icmp eq i32 %105, 10
br i1 %106, label %107, label %110
107: ; preds = %103, %99, %95
store i32 0, i32* %4
%108 = load i32, i32* %2
%109 = add nsw i32 %108, 1
store i32 %109, i32* %2
br label %111
110: ; preds = %103
br label %11
111: ; preds = %107
br label %112
112: ; preds = %111, %89
br label %113
113: ; preds = %112, %48
br label %11
114: ; preds = %11
%115 = load i32, i32* %5
%116 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %115)
%117 = load i32, i32* %5
%118 = icmp eq i32 %117, 0
br i1 %118, label %119, label %122
119: ; preds = %114
%120 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0))
%121 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
br label %216
122: ; preds = %114
store i32 0, i32* %2
store i32 0, i32* %6
br label %123
123: ; preds = %146, %122
%124 = load i32, i32* %2
%125 = load i32, i32* %5
%126 = icmp slt i32 %124, %125
br i1 %126, label %127, label %149
127: ; preds = %123
%128 = load i32, i32* %5
%129 = icmp eq i32 %128, 1
br i1 %129, label %130, label %133
130: ; preds = %127
%131 = getelementptr inbounds [100 x i32], [100 x i32]* %7, i64 0, i64 0
%132 = load i32, i32* %131
store i32 %132, i32* %6
br label %146
133: ; preds = %127
%134 = load i32, i32* %6
%135 = load i32, i32* %2
%136 = sext i32 %135 to i64
%137 = getelementptr inbounds [100 x i32], [100 x i32]* %7, i64 0, i64 %136
%138 = load i32, i32* %137
%139 = icmp sle i32 %134, %138
br i1 %139, label %140, label %145
140: ; preds = %133
%141 = load i32, i32* %2
%142 = sext i32 %141 to i64
%143 = getelementptr inbounds [100 x i32], [100 x i32]* %7, i64 0, i64 %142
%144 = load i32, i32* %143
store i32 %144, i32* %6
br label %145
145: ; preds = %140, %133
br label %146
146: ; preds = %145, %130
%147 = load i32, i32* %2
%148 = add nsw i32 %147, 1
store i32 %148, i32* %2
br label %123
149: ; preds = %123
%150 = load i32, i32* %6
store i32 %150, i32* %2
br label %151
151: ; preds = %197, %149
%152 = load i32, i32* %2
%153 = icmp sgt i32 %152, 0
br i1 %153, label %154, label %200
154: ; preds = %151
br label %155
155: ; preds = %154
%156 = load i32, i32* %2
%157 = load i32, i32* %6
%158 = icmp sle i32 %156, %157
br i1 %158, label %159, label %162
159: ; preds = %155
%160 = load i32, i32* %2
%161 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %160)
br label %162
162: ; preds = %159, %155
store i32 0, i32* %3
br label %163
163: ; preds = %179, %162
%164 = load i32, i32* %3
%165 = load i32, i32* %5
%166 = icmp slt i32 %164, %165
br i1 %166, label %167, label %182
167: ; preds = %163
%168 = load i32, i32* %3
%169 = sext i32 %168 to i64
%170 = getelementptr inbounds [100 x i32], [100 x i32]* %7, i64 0, i64 %169
%171 = load i32, i32* %170
%172 = load i32, i32* %2
%173 = icmp sge i32 %171, %172
br i1 %173, label %174, label %176
174: ; preds = %167
%175 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
br label %178
176: ; preds = %167
%177 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
br label %178
178: ; preds = %176, %174
br label %179
179: ; preds = %178
%180 = load i32, i32* %3
%181 = add nsw i32 %180, 1
store i32 %181, i32* %3
br label %163
182: ; preds = %163
%183 = call i32 @putchar(i8 signext 10)
store i32 0, i32* %3
br label %184
184: ; preds = %192, %182
%185 = load i32, i32* %3
%186 = load i32, i32* %5
%187 = mul nsw i32 %186, 3
%188 = add nsw i32 %187, 15
%189 = icmp slt i32 %185, %188
br i1 %189, label %190, label %195
190: ; preds = %184
%191 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
br label %192
192: ; preds = %190
%193 = load i32, i32* %3
%194 = add nsw i32 %193, 1
store i32 %194, i32* %3
br label %184
195: ; preds = %184
%196 = call i32 @putchar(i8 signext 10)
br label %197
197: ; preds = %195
%198 = load i32, i32* %2
%199 = add nsw i32 %198, -1
store i32 %199, i32* %2
br label %151
200: ; preds = %151
store i32 1, i32* %2
%201 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0))
%202 = load i32, i32* %2
%203 = icmp sge i32 %202, 1
%204 = zext i1 %203 to i32
br label %205
205: ; preds = %212, %200
%206 = load i32, i32* %2
%207 = load i32, i32* %5
%208 = icmp sle i32 %206, %207
br i1 %208, label %209, label %215
209: ; preds = %205
%210 = load i32, i32* %2
%211 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i32 %210)
br label %212
212: ; preds = %209
%213 = load i32, i32* %2
%214 = add nsw i32 %213, 1
store i32 %214, i32* %2
br label %205
215: ; preds = %205
br label %216
216: ; preds = %215, %119
ret void
}

LLVM IR (-O2):
@.str = [36 x i8] c"\09\09 THE GREAT WORD COUNTER PROGRAM\0A\0A\00"
@.str.1 = [43 x i8] c"Say what you wanna say & then press \22 ~ \22.\00"
@.str.2 = [32 x i8] c"\0AIn total you said.. %i words\0A\0A\00"
@.str.4 = [19 x i8] c"\0A\09Ok..\0A\09\09Bye then!\00"
@.str.5 = [16 x i8] c"Letters x %2d |\00"
@.str.6 = [4 x i8] c" * \00"
@.str.7 = [4 x i8] c" - \00"
@.str.9 = [15 x i8] c" Word no. |\00"
@.str.10 = [5 x i8] c" %d \00"
@str = [35 x i8] c"So you've got nothing to say, huh?\00"
define void @count_5() {
%1 = alloca [100 x i32]
%2 = bitcast [100 x i32]* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
br label %5
5: ; preds = %46, %0
%6 = phi i32 [ %47, %46 ], [ 0, %0 ]
%7 = phi i32 [ %15, %46 ], [ 0, %0 ]
%8 = zext i32 %6 to i64
%9 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %8
%10 = zext i32 %6 to i64
%11 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %10
br label %12
12: ; preds = %5, %34
%13 = phi i1 [ true, %5 ], [ false, %34 ]
%14 = phi i1 [ false, %5 ], [ true, %34 ]
%15 = phi i32 [ %7, %5 ], [ %35, %34 ]
br label %16
16: ; preds = %12, %42
%17 = phi i1 [ false, %42 ], [ %13, %12 ]
%18 = phi i1 [ true, %42 ], [ %14, %12 ]
br label %19
19: ; preds = %16, %45
%20 = tail call signext i8 (...) @getchar()
%21 = icmp eq i8 %20, 126
br i1 %21, label %48, label %22
22: ; preds = %19
%23 = add i8 %20, -48
%24 = icmp ult i8 %23, 10
%25 = and i1 %17, %24
br i1 %25, label %34, label %26
26: ; preds = %22
%27 = add i8 %20, -97
%28 = icmp ult i8 %27, 26
%29 = and i1 %17, %28
br i1 %29, label %34, label %30
30: ; preds = %26
%31 = add i8 %20, -65
%32 = icmp ult i8 %31, 26
%33 = and i1 %17, %32
br i1 %33, label %34, label %38
34: ; preds = %30, %26, %22
%35 = add nsw i32 %15, 1
%36 = load i32, i32* %11
%37 = add nsw i32 %36, 1
store i32 %37, i32* %11
br label %12
38: ; preds = %30
%39 = or i1 %24, %28
%40 = or i1 %32, %39
%41 = and i1 %18, %40
br i1 %41, label %42, label %45
42: ; preds = %38
%43 = load i32, i32* %9
%44 = add nsw i32 %43, 1
store i32 %44, i32* %9
br label %16
45: ; preds = %38
switch i8 %20, label %19 [
i8 32, label %46
i8 10, label %46
i8 9, label %46
]
46: ; preds = %45, %45, %45
%47 = add nuw nsw i32 %6, 1
br label %5
48: ; preds = %19
%49 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %15)
%50 = icmp eq i32 %15, 0
br i1 %50, label %63, label %51
51: ; preds = %48
%52 = icmp sgt i32 %15, 0
br i1 %52, label %53, label %165
53: ; preds = %51
%54 = icmp eq i32 %15, 1
%55 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 0
%56 = load i32, i32* %55
%57 = zext i32 %15 to i64
%58 = add nsw i64 %57, -1
%59 = and i64 %57, 3
%60 = icmp ult i64 %58, 3
br i1 %60, label %65, label %61
61: ; preds = %53
%62 = and i64 %57, 4294967292
br label %93
63: ; preds = %48
%64 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
br label %165
65: ; preds = %126, %53
%66 = phi i32 [ undef, %53 ], [ %127, %126 ]
%67 = phi i64 [ 0, %53 ], [ %128, %126 ]
%68 = phi i32 [ 0, %53 ], [ %127, %126 ]
%69 = icmp eq i64 %59, 0
br i1 %69, label %84, label %70
70: ; preds = %65, %79
%71 = phi i64 [ %81, %79 ], [ %67, %65 ]
%72 = phi i32 [ %80, %79 ], [ %68, %65 ]
%73 = phi i64 [ %82, %79 ], [ 0, %65 ]
br i1 %54, label %79, label %74
74: ; preds = %70
%75 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %71
%76 = load i32, i32* %75
%77 = icmp sgt i32 %72, %76
%78 = select i1 %77, i32 %72, i32 %76
br label %79
79: ; preds = %74, %70
%80 = phi i32 [ %78, %74 ], [ %56, %70 ]
%81 = add nuw nsw i64 %71, 1
%82 = add i64 %73, 1
%83 = icmp eq i64 %82, %59
br i1 %83, label %84, label %70
84: ; preds = %79, %65
%85 = phi i32 [ %66, %65 ], [ %80, %79 ]
%86 = icmp sgt i32 %85, 0
br i1 %86, label %87, label %157
87: ; preds = %84
%88 = mul i32 %15, 3
%89 = icmp sgt i32 %88, -15
%90 = add i32 %88, 14
%91 = call i32 @llvm.smax.i32(i32 %90, i32 0)
%92 = zext i32 %15 to i64
br label %131
93: ; preds = %126, %61
%94 = phi i64 [ 0, %61 ], [ %128, %126 ]
%95 = phi i32 [ 0, %61 ], [ %127, %126 ]
%96 = phi i64 [ 0, %61 ], [ %129, %126 ]
br i1 %54, label %102, label %97
97: ; preds = %93
%98 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %94
%99 = load i32, i32* %98
%100 = icmp sgt i32 %95, %99
%101 = select i1 %100, i32 %95, i32 %99
br label %102
102: ; preds = %93, %97
%103 = phi i32 [ %101, %97 ], [ %56, %93 ]
br i1 %54, label %110, label %104
104: ; preds = %102
%105 = or i64 %94, 1
%106 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %105
%107 = load i32, i32* %106
%108 = icmp sgt i32 %103, %107
%109 = select i1 %108, i32 %103, i32 %107
br label %110
110: ; preds = %104, %102
%111 = phi i32 [ %109, %104 ], [ %56, %102 ]
br i1 %54, label %118, label %112
112: ; preds = %110
%113 = or i64 %94, 2
%114 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %113
%115 = load i32, i32* %114
%116 = icmp sgt i32 %111, %115
%117 = select i1 %116, i32 %111, i32 %115
br label %118
118: ; preds = %112, %110
%119 = phi i32 [ %117, %112 ], [ %56, %110 ]
br i1 %54, label %126, label %120
120: ; preds = %118
%121 = or i64 %94, 3
%122 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %121
%123 = load i32, i32* %122
%124 = icmp sgt i32 %119, %123
%125 = select i1 %124, i32 %119, i32 %123
br label %126
126: ; preds = %120, %118
%127 = phi i32 [ %125, %120 ], [ %56, %118 ]
%128 = add nuw nsw i64 %94, 4
%129 = add i64 %96, 4
%130 = icmp eq i64 %129, %62
br i1 %130, label %65, label %93
131: ; preds = %87, %153
%132 = phi i32 [ %85, %87 ], [ %155, %153 ]
%133 = icmp sgt i32 %132, %85
br i1 %133, label %136, label %134
134: ; preds = %131
%135 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %132)
br label %136
136: ; preds = %134, %131
br i1 %52, label %137, label %146
137: ; preds = %136, %137
%138 = phi i64 [ %144, %137 ], [ 0, %136 ]
%139 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %138
%140 = load i32, i32* %139
%141 = icmp slt i32 %140, %132
%142 = select i1 %141, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0)
%143 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %142)
%144 = add nuw nsw i64 %138, 1
%145 = icmp eq i64 %144, %92
br i1 %145, label %146, label %137
146: ; preds = %137, %136
%147 = tail call i32 @putchar(i8 signext 10)
br i1 %89, label %148, label %153
148: ; preds = %146, %148
%149 = phi i32 [ %151, %148 ], [ 0, %146 ]
%150 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 45)
%151 = add nuw i32 %149, 1
%152 = icmp eq i32 %149, %91
br i1 %152, label %153, label %148
153: ; preds = %148, %146
%154 = tail call i32 @putchar(i8 signext 10)
%155 = add nsw i32 %132, -1
%156 = icmp sgt i32 %132, 1
br i1 %156, label %131, label %157
157: ; preds = %153, %84
%158 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0))
%159 = icmp slt i32 %15, 1
br i1 %159, label %168, label %160
160: ; preds = %157, %160
%161 = phi i32 [ %163, %160 ], [ 1, %157 ]
%162 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i32 %161)
%163 = add nuw i32 %161, 1
%164 = icmp eq i32 %161, %15
br i1 %164, label %168, label %160
165: ; preds = %51, %63
%166 = phi i8* [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), %63 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), %51 ]
%167 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %166)
br label %168
168: ; preds = %160, %165, %157
ret void
}