#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 main(void) {
  int c, i;
  int word_length = 0;
  int height = 0;
  int state = 0;
  int length[10 + 1] = {0};
  c = i = 0;
  while ((c = getchar()) != EOF) {
    if (c == ' ' || c == '\n' || c == '\t') {
      state = 0;
      if (word_length <= 10)
        length[word_length - 1]++;
      else
        length[10]++;
      word_length = 0;
    } else if (state == 0) {
      state = 1;
      word_length++;
    } else if (state == 1) {
      word_length++;
    }
  }
  printf("length =");
  for (i = 0; i <= 10; i++) {
    if (length[i] > height)
      height = length[i];
    printf(" %d", length[i]);
  }
  printf("\nmax = %d\n", height);
  printf("\nhorizontal histogram:\n");
  int j;
  for (i = 0; i <= 10; i++) {
    if (i < 10)
      printf("len=%d\t[%d]:\t", i + 1, length[i]);
    else
      printf("len>10\t[%d]:\t", length[i]);
    for (j = 1; j <= length[i]; j++)
      printf("+");
    printf("\n");
  }
  printf("\nvertical histogram:\n");
  for (i = 0; i <= height; i++) {
    for (j = 0; j <= 10; j++) {
      if (i == 0) {
        if (j == 10)
          printf(">10 [%d]\t", length[j]);
        else
          printf("%d [%d]\t", j + 1, length[j]);
      } else if (length[j] >= i)
        printf("+\t");
      else
        printf("\t");
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x2c,%edx
call   1040 <memset@plt>
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e65(%rip),%rcx
cmp    (%rcx),%eax
je     1228 <main+0xf8>
cmpl   $0x20,-0x8(%rbp)
je     11a9 <main+0x79>
cmpl   $0xa,-0x8(%rbp)
je     11a9 <main+0x79>
cmpl   $0x9,-0x8(%rbp)
jne    11e7 <main+0xb7>
movl   $0x0,-0x18(%rbp)
cmpl   $0xa,-0x10(%rbp)
jg     11d2 <main+0xa2>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x50(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x50(%rbp,%rax,4)
jmp    11db <main+0xab>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
movl   $0x0,-0x10(%rbp)
jmp    1223 <main+0xf3>
cmpl   $0x0,-0x18(%rbp)
jne    1206 <main+0xd6>
movl   $0x1,-0x18(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    121e <main+0xee>
cmpl   $0x1,-0x18(%rbp)
jne    1219 <main+0xe9>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    121e <main+0xee>
jmp    1223 <main+0xf3>
jmp    1172 <main+0x42>
lea    0xdd1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jg     1287 <main+0x157>
movslq -0xc(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%eax
cmp    -0x14(%rbp),%eax
jle    1263 <main+0x133>
movslq -0xc(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%eax
mov    %eax,-0x14(%rbp)
movslq -0xc(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%esi
lea    0xd97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    123d <main+0x10d>
mov    -0x14(%rbp),%esi
lea    0xd7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jg     1348 <main+0x218>
cmpl   $0xa,-0xc(%rbp)
jge    12e2 <main+0x1b2>
mov    -0xc(%rbp),%esi
add    $0x1,%esi
movslq -0xc(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%edx
lea    0xd5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12f8 <main+0x1c8>
movslq -0xc(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%esi
lea    0xd4d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x54(%rbp)
mov    -0x54(%rbp),%eax
movslq -0xc(%rbp),%rcx
cmp    -0x50(%rbp,%rcx,4),%eax
jg     132c <main+0x1fc>
lea    0xd35(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    12ff <main+0x1cf>
lea    0xd2f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    12ad <main+0x17d>
lea    0xcff(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     1430 <main+0x300>
movl   $0x0,-0x54(%rbp)
cmpl   $0xa,-0x54(%rbp)
jg     1414 <main+0x2e4>
cmpl   $0x0,-0xc(%rbp)
jne    13ca <main+0x29a>
cmpl   $0xa,-0x54(%rbp)
jne    13a9 <main+0x279>
movslq -0x54(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%esi
lea    0xcc7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    13c5 <main+0x295>
mov    -0x54(%rbp),%esi
add    $0x1,%esi
movslq -0x54(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%edx
lea    0xcb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1401 <main+0x2d1>
movslq -0x54(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%eax
cmp    -0xc(%rbp),%eax
jl     13ee <main+0x2be>
lea    0xc95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    13fc <main+0x2cc>
lea    0xc83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1401 <main+0x2d1>
jmp    1406 <main+0x2d6>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1370 <main+0x240>
lea    0xc47(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    135d <main+0x22d>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
xorps  %xmm0,%xmm0
movups %xmm0,0x3c(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
xor    %eax,%eax
call   1060 <getchar@plt>
mov    0x2e7a(%rip),%rbx
cmp    (%rbx),%eax
jne    11c4 <main+0x84>
lea    0xe87(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %esi,%esi
xor    %ebx,%ebx
xor    %r14d,%r14d
xor    %ebp,%ebp
movl   $0x0,0x8(%rsp)
movl   $0x0,0xc(%rsp)
movl   $0x0,0x10(%rsp)
movl   $0x0,0x14(%rsp)
movl   $0x0,0x18(%rsp)
movl   $0x0,0x1c(%rsp)
xor    %r12d,%r12d
xor    %r13d,%r13d
jmp    127b <main+0x13b>
movabs $0x100000600,%r14
xor    %ebp,%ebp
jmp    11ee <main+0xae>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebp
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    (%rbx),%eax
je     1219 <main+0xd9>
cmp    $0x20,%eax
ja     11e0 <main+0xa0>
mov    %eax,%eax
bt     %rax,%r14
jae    11e0 <main+0xa0>
cmp    $0xa,%ebp
jg     1210 <main+0xd0>
movslq %ebp,%rax
addl   $0x1,0x1c(%rsp,%rax,4)
xor    %ebp,%ebp
jmp    11e3 <main+0xa3>
nopl   0x0(%rax)
addl   $0x1,0x48(%rsp)
xor    %ebp,%ebp
jmp    11e3 <main+0xa3>
mov    0x20(%rsp),%r15d
mov    0x24(%rsp),%ebx
mov    0x28(%rsp),%r14d
mov    0x2c(%rsp),%ebp
mov    0x30(%rsp),%eax
mov    %eax,0x8(%rsp)
mov    0x34(%rsp),%eax
mov    %eax,0xc(%rsp)
mov    0x38(%rsp),%eax
mov    %eax,0x10(%rsp)
mov    0x3c(%rsp),%eax
mov    %eax,0x14(%rsp)
mov    0x40(%rsp),%eax
mov    %eax,0x18(%rsp)
mov    0x44(%rsp),%eax
mov    %eax,0x1c(%rsp)
mov    0x48(%rsp),%r12d
lea    0xd99(%rip),%rdi
xor    %r13d,%r13d
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15d,%esi
test   %r15d,%r15d
cmovns %r15d,%r13d
lea    0xd87(%rip),%r15
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    %r13d,%ebx
cmovg  %ebx,%r13d
mov    %r15,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    %r13d,%r14d
cmovg  %r14d,%r13d
mov    %r15,%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    %r13d,%ebp
cmovg  %ebp,%r13d
mov    %r15,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rsp),%esi
cmp    %r13d,%esi
cmovg  %esi,%r13d
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%esi
cmp    %r13d,%esi
cmovg  %esi,%r13d
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rsp),%esi
cmp    %r13d,%esi
cmovg  %esi,%r13d
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x14(%rsp),%esi
cmp    %r13d,%esi
cmovg  %esi,%r13d
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x18(%rsp),%esi
cmp    %r13d,%esi
cmovg  %esi,%r13d
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x1c(%rsp),%esi
cmp    %r13d,%esi
cmovg  %esi,%r13d
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    %r13d,%r12d
cmovg  %r12d,%r13d
mov    %r15,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xcae(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xcda(%rip),%rdi
call   1040 <puts@plt>
lea    0xcaa(%rip),%r14
lea    0xc95(%rip),%r15
xor    %ebp,%ebp
jmp    13a4 <main+0x264>
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
cmp    $0xb,%rbp
je     13f1 <main+0x2b1>
cmp    $0xa,%rbp
jne    13c0 <main+0x280>
mov    %r14,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12d,%ebx
test   %ebx,%ebx
jg     13e0 <main+0x2a0>
jmp    1390 <main+0x250>
mov    0x20(%rsp,%rbp,4),%ebx
lea    0x1(%rbp),%esi
mov    %r15,%rdi
mov    %ebx,%edx
xor    %eax,%eax
call   1050 <printf@plt>
test   %ebx,%ebx
jle    1390 <main+0x250>
nopw   0x0(%rax,%rax,1)
mov    $0x2b,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    13e0 <main+0x2a0>
jmp    1390 <main+0x250>
lea    0xc69(%rip),%rdi
call   1040 <puts@plt>
test   %r13d,%r13d
js     149b <main+0x35b>
lea    0xc31(%rip),%rbx
lea    0xc33(%rip),%r15
xor    %ebp,%ebp
jmp    1445 <main+0x305>
nopl   0x0(%rax,%rax,1)
lea    0xc0d(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%rbp),%eax
cmp    %r13d,%ebp
mov    %eax,%ebp
je     149b <main+0x35b>
xor    %r14d,%r14d
jmp    1464 <main+0x324>
nopw   0x0(%rax,%rax,1)
mov    $0x9,%edi
call   1030 <putchar@plt>
add    $0x1,%r14
cmp    $0xb,%r14
je     1431 <main+0x2f1>
test   %ebp,%ebp
je     1480 <main+0x340>
cmp    %ebp,0x20(%rsp,%r14,4)
jl     1450 <main+0x310>
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    145a <main+0x31a>
nopl   0x0(%rax,%rax,1)
cmp    $0xa,%r14
je     1420 <main+0x2e0>
mov    0x20(%rsp,%r14,4),%edx
lea    0x1(%r14),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    145a <main+0x31a>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i32 0
@.str = [9 x i8] c"length =\00"
@.str.1 = [4 x i8] c" %d\00"
@.str.2 = [11 x i8] c"\0Amax = %d\0A\00"
@.str.3 = [24 x i8] c"\0Ahorizontal histogram:\0A\00"
@.str.4 = [14 x i8] c"len=%d\09[%d]:\09\00"
@.str.5 = [14 x i8] c"len>10\09[%d]:\09\00"
@.str.6 = [2 x i8] c"+\00"
@.str.7 = [2 x i8] c"\0A\00"
@.str.8 = [22 x i8] c"\0Avertical histogram:\0A\00"
@.str.9 = [10 x i8] c">10 [%d]\09\00"
@.str.10 = [9 x i8] c"%d [%d]\09\00"
@.str.11 = [3 x i8] c"+\09\00"
@.str.12 = [2 x i8] c"\09\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [11 x i32]
%8 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
%9 = bitcast [11 x i32]* %7 to i8*
store i32 0, i32* %3
store i32 0, i32* %2
br label %10
10: ; preds = %52, %0
%11 = call i32 (...) @getchar()
store i32 %11, i32* %2
%12 = load i32, i32* @EOF
%13 = icmp ne i32 %11, %12
br i1 %13, label %14, label %53
14: ; preds = %10
%15 = load i32, i32* %2
%16 = icmp eq i32 %15, 32
br i1 %16, label %23, label %17
17: ; preds = %14
%18 = load i32, i32* %2
%19 = icmp eq i32 %18, 10
br i1 %19, label %23, label %20
20: ; preds = %17
%21 = load i32, i32* %2
%22 = icmp eq i32 %21, 9
br i1 %22, label %23, label %38
23: ; preds = %20, %17, %14
store i32 0, i32* %6
%24 = load i32, i32* %4
%25 = icmp sle i32 %24, 10
br i1 %25, label %26, label %33
26: ; preds = %23
%27 = load i32, i32* %4
%28 = sub nsw i32 %27, 1
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [11 x i32], [11 x i32]* %7, i64 0, i64 %29
%31 = load i32, i32* %30
%32 = add nsw i32 %31, 1
store i32 %32, i32* %30
br label %37
33: ; preds = %23
%34 = getelementptr inbounds [11 x i32], [11 x i32]* %7, i64 0, i64 10
%35 = load i32, i32* %34
%36 = add nsw i32 %35, 1
store i32 %36, i32* %34
br label %37
37: ; preds = %33, %26
store i32 0, i32* %4
br label %52
38: ; preds = %20
%39 = load i32, i32* %6
%40 = icmp eq i32 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %38
store i32 1, i32* %6
%42 = load i32, i32* %4
%43 = add nsw i32 %42, 1
store i32 %43, i32* %4
br label %51
44: ; preds = %38
%45 = load i32, i32* %6
%46 = icmp eq i32 %45, 1
br i1 %46, label %47, label %50
47: ; preds = %44
%48 = load i32, i32* %4
%49 = add nsw i32 %48, 1
store i32 %49, i32* %4
br label %50
50: ; preds = %47, %44
br label %51
51: ; preds = %50, %41
br label %52
52: ; preds = %51, %37
br label %10
53: ; preds = %10
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %55
55: ; preds = %76, %53
%56 = load i32, i32* %3
%57 = icmp sle i32 %56, 10
br i1 %57, label %58, label %79
58: ; preds = %55
%59 = load i32, i32* %3
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [11 x i32], [11 x i32]* %7, i64 0, i64 %60
%62 = load i32, i32* %61
%63 = load i32, i32* %5
%64 = icmp sgt i32 %62, %63
br i1 %64, label %65, label %70
65: ; preds = %58
%66 = load i32, i32* %3
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [11 x i32], [11 x i32]* %7, i64 0, i64 %67
%69 = load i32, i32* %68
store i32 %69, i32* %5
br label %70
70: ; preds = %65, %58
%71 = load i32, i32* %3
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [11 x i32], [11 x i32]* %7, i64 0, i64 %72
%74 = load i32, i32* %73
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %74)
br label %76
76: ; preds = %70
%77 = load i32, i32* %3
%78 = add nsw i32 %77, 1
store i32 %78, i32* %3
br label %55
79: ; preds = %55
%80 = load i32, i32* %5
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %80)
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %3
br label %83
83: ; preds = %118, %79
%84 = load i32, i32* %3
%85 = icmp sle i32 %84, 10
br i1 %85, label %86, label %121
86: ; preds = %83
%87 = load i32, i32* %3
%88 = icmp slt i32 %87, 10
br i1 %88, label %89, label %97
89: ; preds = %86
%90 = load i32, i32* %3
%91 = add nsw i32 %90, 1
%92 = load i32, i32* %3
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds [11 x i32], [11 x i32]* %7, i64 0, i64 %93
%95 = load i32, i32* %94
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 %91, i32 %95)
br label %103
97: ; preds = %86
%98 = load i32, i32* %3
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds [11 x i32], [11 x i32]* %7, i64 0, i64 %99
%101 = load i32, i32* %100
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 %101)
br label %103
103: ; preds = %97, %89
store i32 1, i32* %8
br label %104
104: ; preds = %113, %103
%105 = load i32, i32* %8
%106 = load i32, i32* %3
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds [11 x i32], [11 x i32]* %7, i64 0, i64 %107
%109 = load i32, i32* %108
%110 = icmp sle i32 %105, %109
br i1 %110, label %111, label %116
111: ; preds = %104
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %113
113: ; preds = %111
%114 = load i32, i32* %8
%115 = add nsw i32 %114, 1
store i32 %115, i32* %8
br label %104
116: ; preds = %104
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %118
118: ; preds = %116
%119 = load i32, i32* %3
%120 = add nsw i32 %119, 1
store i32 %120, i32* %3
br label %83
121: ; preds = %83
%122 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %3
br label %123
123: ; preds = %170, %121
%124 = load i32, i32* %3
%125 = load i32, i32* %5
%126 = icmp sle i32 %124, %125
br i1 %126, label %127, label %173
127: ; preds = %123
store i32 0, i32* %8
br label %128
128: ; preds = %165, %127
%129 = load i32, i32* %8
%130 = icmp sle i32 %129, 10
br i1 %130, label %131, label %168
131: ; preds = %128
%132 = load i32, i32* %3
%133 = icmp eq i32 %132, 0
br i1 %133, label %134, label %152
134: ; preds = %131
%135 = load i32, i32* %8
%136 = icmp eq i32 %135, 10
br i1 %136, label %137, label %143
137: ; preds = %134
%138 = load i32, i32* %8
%139 = sext i32 %138 to i64
%140 = getelementptr inbounds [11 x i32], [11 x i32]* %7, i64 0, i64 %139
%141 = load i32, i32* %140
%142 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i32 %141)
br label %151
143: ; preds = %134
%144 = load i32, i32* %8
%145 = add nsw i32 %144, 1
%146 = load i32, i32* %8
%147 = sext i32 %146 to i64
%148 = getelementptr inbounds [11 x i32], [11 x i32]* %7, i64 0, i64 %147
%149 = load i32, i32* %148
%150 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i32 %145, i32 %149)
br label %151
151: ; preds = %143, %137
br label %164
152: ; preds = %131
%153 = load i32, i32* %8
%154 = sext i32 %153 to i64
%155 = getelementptr inbounds [11 x i32], [11 x i32]* %7, i64 0, i64 %154
%156 = load i32, i32* %155
%157 = load i32, i32* %3
%158 = icmp sge i32 %156, %157
br i1 %158, label %159, label %161
159: ; preds = %152
%160 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
br label %163
161: ; preds = %152
%162 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
br label %163
163: ; preds = %161, %159
br label %164
164: ; preds = %163, %151
br label %165
165: ; preds = %164
%166 = load i32, i32* %8
%167 = add nsw i32 %166, 1
store i32 %167, i32* %8
br label %128
168: ; preds = %128
%169 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %170
170: ; preds = %168
%171 = load i32, i32* %3
%172 = add nsw i32 %171, 1
store i32 %172, i32* %3
br label %123
173: ; preds = %123
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [9 x i8] c"length =\00"
@.str.1 = [4 x i8] c" %d\00"
@.str.2 = [11 x i8] c"\0Amax = %d\0A\00"
@.str.4 = [14 x i8] c"len=%d\09[%d]:\09\00"
@.str.5 = [14 x i8] c"len>10\09[%d]:\09\00"
@.str.9 = [10 x i8] c">10 [%d]\09\00"
@.str.10 = [9 x i8] c"%d [%d]\09\00"
@.str.11 = [3 x i8] c"+\09\00"
@str = [23 x i8] c"\0Ahorizontal histogram:\00"
@str.13 = [21 x i8] c"\0Avertical histogram:\00"
define i32 @main() {
%1 = alloca [11 x i32]
%2 = bitcast [11 x i32]* %1 to i8*
%3 = tail call i32 (...) @getchar()
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %56
8: ; preds = %0
%9 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 10
br label %10
10: ; preds = %8, %26
%11 = phi i32 [ %3, %8 ], [ %28, %26 ]
%12 = phi i32 [ 0, %8 ], [ %27, %26 ]
switch i32 %11, label %24 [
i32 32, label %13
i32 10, label %13
i32 9, label %13
]
13: ; preds = %10, %10, %10
%14 = icmp slt i32 %12, 11
br i1 %14, label %15, label %21
15: ; preds = %13
%16 = add nsw i32 %12, -1
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 %17
%19 = load i32, i32* %18
%20 = add nsw i32 %19, 1
store i32 %20, i32* %18
br label %26
21: ; preds = %13
%22 = load i32, i32* %9
%23 = add nsw i32 %22, 1
store i32 %23, i32* %9
br label %26
24: ; preds = %10
%25 = add nsw i32 %12, 1
br label %26
26: ; preds = %24, %15, %21
%27 = phi i32 [ 0, %21 ], [ 0, %15 ], [ %25, %24 ]
%28 = tail call i32 (...) @getchar()
%29 = load i32, i32* @EOF
%30 = icmp eq i32 %28, %29
br i1 %30, label %31, label %10
31: ; preds = %26
%32 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 0
%33 = load i32, i32* %32
%34 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 1
%35 = load i32, i32* %34
%36 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 2
%37 = load i32, i32* %36
%38 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 3
%39 = load i32, i32* %38
%40 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 4
%41 = load i32, i32* %40
%42 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 5
%43 = load i32, i32* %42
%44 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 6
%45 = load i32, i32* %44
%46 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 7
%47 = load i32, i32* %46
%48 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 8
%49 = load i32, i32* %48
%50 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 9
%51 = load i32, i32* %50
%52 = load i32, i32* %9
%53 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%54 = icmp sgt i32 %33, 0
%55 = select i1 %54, i32 %33, i32 0
br label %56
56: ; preds = %31, %6
%57 = phi i32 [ 0, %6 ], [ %33, %31 ]
%58 = phi i32 [ 0, %6 ], [ %35, %31 ]
%59 = phi i32 [ 0, %6 ], [ %37, %31 ]
%60 = phi i32 [ 0, %6 ], [ %39, %31 ]
%61 = phi i32 [ 0, %6 ], [ %41, %31 ]
%62 = phi i32 [ 0, %6 ], [ %43, %31 ]
%63 = phi i32 [ 0, %6 ], [ %45, %31 ]
%64 = phi i32 [ 0, %6 ], [ %47, %31 ]
%65 = phi i32 [ 0, %6 ], [ %49, %31 ]
%66 = phi i32 [ 0, %6 ], [ %51, %31 ]
%67 = phi i32 [ 0, %6 ], [ %52, %31 ]
%68 = phi i32 [ 0, %6 ], [ %55, %31 ]
%69 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %57)
%70 = icmp sgt i32 %58, %68
%71 = select i1 %70, i32 %58, i32 %68
%72 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %58)
%73 = icmp sgt i32 %59, %71
%74 = select i1 %73, i32 %59, i32 %71
%75 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %59)
%76 = icmp sgt i32 %60, %74
%77 = select i1 %76, i32 %60, i32 %74
%78 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %60)
%79 = icmp sgt i32 %61, %77
%80 = select i1 %79, i32 %61, i32 %77
%81 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %61)
%82 = icmp sgt i32 %62, %80
%83 = select i1 %82, i32 %62, i32 %80
%84 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %62)
%85 = icmp sgt i32 %63, %83
%86 = select i1 %85, i32 %63, i32 %83
%87 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %63)
%88 = icmp sgt i32 %64, %86
%89 = select i1 %88, i32 %64, i32 %86
%90 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %64)
%91 = icmp sgt i32 %65, %89
%92 = select i1 %91, i32 %65, i32 %89
%93 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %65)
%94 = icmp sgt i32 %66, %92
%95 = select i1 %94, i32 %66, i32 %92
%96 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %66)
%97 = icmp sgt i32 %67, %95
%98 = select i1 %97, i32 %67, i32 %95
%99 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %67)
%100 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %98)
%101 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
br label %102
102: ; preds = %56, %121
%103 = phi i64 [ 0, %56 ], [ %123, %121 ]
%104 = icmp eq i64 %103, 10
br i1 %104, label %111, label %105
105: ; preds = %102
%106 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 %103
%107 = load i32, i32* %106
%108 = trunc i64 %103 to i32
%109 = add i32 %108, 1
%110 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 %109, i32 %107)
br label %113
111: ; preds = %102
%112 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 %67)
br label %113
113: ; preds = %111, %105
%114 = phi i32 [ %67, %111 ], [ %107, %105 ]
%115 = icmp slt i32 %114, 1
br i1 %115, label %121, label %116
116: ; preds = %113, %116
%117 = phi i32 [ %119, %116 ], [ 1, %113 ]
%118 = tail call i32 @putchar(i32 43)
%119 = add nuw i32 %117, 1
%120 = icmp eq i32 %117, %114
br i1 %120, label %121, label %116
121: ; preds = %116, %113
%122 = tail call i32 @putchar(i32 10)
%123 = add nuw nsw i64 %103, 1
%124 = icmp eq i64 %123, 11
br i1 %124, label %125, label %102
125: ; preds = %121
%126 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.13, i64 0, i64 0))
%127 = icmp slt i32 %98, 0
br i1 %127, label %158, label %128
128: ; preds = %125, %154
%129 = phi i32 [ %156, %154 ], [ 0, %125 ]
%130 = icmp eq i32 %129, 0
br label %131
131: ; preds = %128, %151
%132 = phi i64 [ 0, %128 ], [ %152, %151 ]
br i1 %130, label %133, label %143
133: ; preds = %131
%134 = icmp eq i64 %132, 10
br i1 %134, label %135, label %137
135: ; preds = %133
%136 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i32 %67)
br label %154
137: ; preds = %133
%138 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 %132
%139 = load i32, i32* %138
%140 = trunc i64 %132 to i32
%141 = add i32 %140, 1
%142 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i32 %141, i32 %139)
br label %151
143: ; preds = %131
%144 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 %132
%145 = load i32, i32* %144
%146 = icmp slt i32 %145, %129
br i1 %146, label %149, label %147
147: ; preds = %143
%148 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
br label %151
149: ; preds = %143
%150 = tail call i32 @putchar(i32 9)
br label %151
151: ; preds = %137, %149, %147
%152 = add nuw nsw i64 %132, 1
%153 = icmp eq i64 %152, 11
br i1 %153, label %154, label %131
154: ; preds = %151, %135
%155 = tail call i32 @putchar(i32 10)
%156 = add nuw i32 %129, 1
%157 = icmp eq i32 %129, %98
br i1 %157, label %158, label %128
158: ; preds = %154, %125
ret i32 0
}