#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 EOF;
char getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
main() {
  int wordcount[10 + 1];
  int i, j;
  for (i = 0; i < 10 + 1; i++) {
    wordcount[i] = 0;
  }
  int length, max;
  max = 0;
  length = 0;
  char c;
  while ((c = getchar()) != EOF) {
    if (c == ' ' || c == '\t' || c == '\n') {
      if (length > 10) {
        wordcount[0] = wordcount[0] + 1;
      } else {
        wordcount[length] = wordcount[length] + 1;
      }
      length = 0;
    } else {
      ++length;
    }
  }
  for (i = 0; i < 10 + 1; i++) {
    if (max < wordcount[i]) {
      max = wordcount[i];
    }
  }
  putchar('\n');
  printf("histogram with the bars horizontal:\n");
  for (i = 1; i < 10 + 1; i++) {
    printf("%3d | ", i);
    for (j = 0; j < wordcount[i]; j++) {
      putchar('*');
    }
    putchar('\n');
  }
  printf(">10 | ");
  for (j = 0; j < wordcount[0]; j++) {
    putchar('*');
  }
  putchar('\n');
  printf("histogram with the bars vertical:\n");
  for (i = max; i > 0; i--) {
    for (j = 1; j < 10 + 1; j++) {
      putchar(' ');
      if (i <= wordcount[j]) {
        putchar('*');
      } else {
        putchar(' ');
      }
      putchar(' ');
    }
    putchar(' ');
    if (i <= wordcount[0]) {
      putchar('*');
    } else {
      putchar(' ');
    }
    putchar(' ');
    putchar('\n');
  }
  for (i = 1; i < 10 + 1; i++) {
    printf("%2d ", i);
  }
  printf(">10");
  putchar('\n');
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0xb,-0x34(%rbp)
jge    116a <main+0x3a>
movslq -0x34(%rbp),%rax
movl   $0x0,-0x30(%rbp,%rax,4)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1146 <main+0x16>
movl   $0x0,-0x40(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x41(%rbp)
movsbl %al,%eax
mov    0x2e5c(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1203 <main+0xd3>
movsbl -0x41(%rbp),%eax
cmp    $0x20,%eax
je     11be <main+0x8e>
movsbl -0x41(%rbp),%eax
cmp    $0x9,%eax
je     11be <main+0x8e>
movsbl -0x41(%rbp),%eax
cmp    $0xa,%eax
jne    11f5 <main+0xc5>
cmpl   $0xa,-0x3c(%rbp)
jle    11d6 <main+0xa6>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11e9 <main+0xb9>
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%ecx
add    $0x1,%ecx
movslq -0x3c(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
movl   $0x0,-0x3c(%rbp)
jmp    11fe <main+0xce>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1178 <main+0x48>
movl   $0x0,-0x34(%rbp)
cmpl   $0xb,-0x34(%rbp)
jge    1243 <main+0x113>
mov    -0x40(%rbp),%eax
movslq -0x34(%rbp),%rcx
cmp    -0x30(%rbp,%rcx,4),%eax
jge    1230 <main+0x100>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x40(%rbp)
jmp    1235 <main+0x105>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    120a <main+0xda>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xdac(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x34(%rbp)
cmpl   $0xb,-0x34(%rbp)
jge    12c5 <main+0x195>
mov    -0x34(%rbp),%esi
lea    0xdaf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
movslq -0x34(%rbp),%rcx
cmp    -0x30(%rbp,%rcx,4),%eax
jge    12ad <main+0x17d>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1284 <main+0x154>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1262 <main+0x132>
lea    0xd60(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    12fe <main+0x1ce>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    12da <main+0x1aa>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xd24(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x40(%rbp),%eax
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jle    13d4 <main+0x2a4>
movl   $0x1,-0x38(%rbp)
cmpl   $0xb,-0x38(%rbp)
jge    1383 <main+0x253>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x34(%rbp),%eax
movslq -0x38(%rbp),%rcx
cmp    -0x30(%rbp,%rcx,4),%eax
jg     1361 <main+0x231>
mov    $0x2a,%edi
call   1030 <putchar@plt>
jmp    136b <main+0x23b>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    132d <main+0x1fd>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x34(%rbp),%eax
cmp    -0x30(%rbp),%eax
jg     13a8 <main+0x278>
mov    $0x2a,%edi
call   1030 <putchar@plt>
jmp    13b2 <main+0x282>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x34(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x34(%rbp)
jmp    131c <main+0x1ec>
movl   $0x1,-0x34(%rbp)
cmpl   $0xb,-0x34(%rbp)
jge    1404 <main+0x2d4>
mov    -0x34(%rbp),%esi
lea    0xc67(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    13db <main+0x2ab>
lea    0xc50(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
xorps  %xmm0,%xmm0
movups %xmm0,0x4c(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
xor    %eax,%eax
call   1060 <getchar@plt>
mov    0x2e7a(%rip),%r14
mov    $0x0,%ebp
mov    $0x0,%r8d
mov    $0x0,%r9d
mov    $0x0,%r10d
mov    $0x0,%r11d
mov    $0x0,%r12d
mov    $0x0,%ecx
mov    $0x0,%edx
mov    $0x0,%esi
mov    $0x0,%edi
mov    $0x0,%ebx
cmp    (%r14),%al
je     122a <main+0xea>
movabs $0x100000600,%rbp
xor    %ebx,%ebx
jmp    11cf <main+0x8f>
nopl   (%rax)
add    $0x1,%ebx
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    (%r14),%al
je     11f9 <main+0xb9>
cmp    $0x20,%al
ja     11c0 <main+0x80>
movzbl %al,%eax
bt     %rax,%rbp
jae    11c0 <main+0x80>
cmp    $0xb,%ebx
jge    11f0 <main+0xb0>
movslq %ebx,%rax
addl   $0x1,0x30(%rsp,%rax,4)
xor    %ebx,%ebx
jmp    11c3 <main+0x83>
nopl   (%rax)
addl   $0x1,0x30(%rsp)
xor    %ebx,%ebx
jmp    11c3 <main+0x83>
mov    0x30(%rsp),%ebx
mov    0x34(%rsp),%edi
mov    0x38(%rsp),%esi
mov    0x3c(%rsp),%edx
mov    0x40(%rsp),%ecx
mov    0x44(%rsp),%r12d
mov    0x48(%rsp),%r11d
mov    0x4c(%rsp),%r10d
mov    0x50(%rsp),%r9d
mov    0x54(%rsp),%r8d
mov    0x58(%rsp),%ebp
test   %ebx,%ebx
mov    $0x0,%r15d
mov    %ebx,%r13d
cmovns %ebx,%r15d
cmp    %edi,%r15d
mov    %edi,0x8(%rsp)
cmovl  %edi,%r15d
cmp    %esi,%r15d
mov    %esi,0xc(%rsp)
cmovl  %esi,%r15d
cmp    %edx,%r15d
mov    %edx,0x10(%rsp)
cmovl  %edx,%r15d
cmp    %ecx,%r15d
mov    %ecx,0x1c(%rsp)
cmovl  %ecx,%r15d
cmp    %r12d,%r15d
mov    %r12d,0x20(%rsp)
cmovl  %r12d,%r15d
cmp    %r11d,%r15d
mov    %r11d,0x24(%rsp)
cmovl  %r11d,%r15d
cmp    %r10d,%r15d
mov    %r10d,0x18(%rsp)
cmovl  %r10d,%r15d
cmp    %r9d,%r15d
mov    %r9d,0x28(%rsp)
cmovl  %r9d,%r15d
cmp    %r8d,%r15d
mov    %r8d,0x2c(%rsp)
cmovl  %r8d,%r15d
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xd65(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%ebx
lea    0xd3d(%rip),%r14
jmp    12e4 <main+0x1a4>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    $0xb,%rbx
je     1312 <main+0x1d2>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x30(%rsp,%rbx,4),%r12d
test   %r12d,%r12d
jle    12d0 <main+0x190>
nopw   0x0(%rax,%rax,1)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%r12d
jne    1300 <main+0x1c0>
jmp    12d0 <main+0x190>
cmp    %ebp,%r15d
mov    %ebp,%r12d
cmovl  %ebp,%r15d
lea    0xce4(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
test   %r13d,%r13d
jle    134f <main+0x20f>
mov    %r13d,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1340 <main+0x200>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xcdb(%rip),%rdi
call   1040 <puts@plt>
test   %r15d,%r15d
mov    %r13d,0x14(%rsp)
mov    0x10(%rsp),%r14d
mov    0xc(%rsp),%r13d
mov    0x8(%rsp),%ebp
jle    1545 <main+0x405>
mov    $0x20,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
cmp    %ebp,%r15d
mov    $0x2a,%edi
cmovg  %ebx,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
cmp    %r13d,%r15d
mov    $0x2a,%edi
cmovg  %ebx,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
cmp    %r14d,%r15d
mov    $0x2a,%edi
cmovg  %ebx,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
cmp    0x1c(%rsp),%r15d
mov    $0x2a,%edi
cmovg  %ebx,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
cmp    0x20(%rsp),%r15d
mov    $0x2a,%edi
cmovg  %ebx,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
cmp    0x24(%rsp),%r15d
mov    $0x2a,%edi
cmovg  %ebx,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
cmp    0x18(%rsp),%r15d
mov    $0x2a,%edi
cmovg  %ebx,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
cmp    0x28(%rsp),%r15d
mov    $0x2a,%edi
cmovg  %ebx,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
cmp    0x2c(%rsp),%r15d
mov    $0x2a,%edi
cmovg  %ebx,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
cmp    %r12d,%r15d
mov    $0x2a,%edi
cmovg  %ebx,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
cmp    0x14(%rsp),%r15d
mov    $0x2a,%edi
cmovg  %ebx,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    -0x1(%r15),%eax
cmp    $0x1,%r15d
mov    %eax,%r15d
jg     1390 <main+0x250>
lea    0xac2(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xa2a(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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