#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, counter = 0;
  int vet[1000000], i, j, most_frequent = 0;
  char vet_layout[1000000];
  for (i = 0; i < 1000000; i++) {
    vet[i] = 0;
    vet_layout[i] = '0';
  }
  while ((c = getchar()) != EOF) {
    if (c == ' ' || c == '\n' || c == '\t') {
      if (counter > 0)
        ++vet[counter];
      counter = 0;
    } else
      ++counter;
  }
  printf("\nHorizontal histogram");
  for (i = 1; i < 1000000; ++i)
    for (j = 0; j < vet[i]; ++j) {
      if (j == 0)
        printf("\n%d: ", i);
      printf("|");
    }
  printf("\nVertical histogram");
  for (i = 1; i < 1000000; ++i) {
    if (most_frequent < vet[i])
      most_frequent = vet[i];
    if (vet[i] > 0)
      vet_layout[i] = '\t';
  }
  printf("\n");
  for (i = most_frequent; i > 0; --i) {
    for (j = 1; j < 1000000; ++j) {
      if (vet[j] == i) {
        printf("_");
        --vet[j];
      }
      if (vet_layout[j] != '0')
        printf("%c", vet_layout[j]);
    }
    printf("\n");
  }
  printf("\n");
  for (i = 1; i < 1000000; ++i)
    if (vet_layout[i] != '0')
      printf("%d%c", i, vet_layout[i]);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4c4b60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x3d091c(%rbp)
movl   $0x0,-0x3d0914(%rbp)
cmpl   $0xf4240,-0x3d0914(%rbp)
jge    1192 <main+0x72>
movslq -0x3d0914(%rbp),%rax
movl   $0x0,-0x3d0910(%rbp,%rax,4)
movslq -0x3d0914(%rbp),%rax
movb   $0x30,-0x4c4b60(%rbp,%rax,1)
30
mov    -0x3d0914(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3d0914(%rbp)
jmp    114d <main+0x2d>
jmp    1197 <main+0x77>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e40(%rip),%rcx
cmp    (%rcx),%eax
je     1207 <main+0xe7>
cmpl   $0x20,-0x8(%rbp)
je     11ce <main+0xae>
cmpl   $0xa,-0x8(%rbp)
je     11ce <main+0xae>
cmpl   $0x9,-0x8(%rbp)
jne    11f9 <main+0xd9>
cmpl   $0x0,-0xc(%rbp)
jle    11ed <main+0xcd>
movslq -0xc(%rbp),%rax
mov    -0x3d0910(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x3d0910(%rbp,%rax,4)
movl   $0x0,-0xc(%rbp)
jmp    1202 <main+0xe2>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1197 <main+0x77>
lea    0xdf2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x3d0914(%rbp)
cmpl   $0xf4240,-0x3d0914(%rbp)
jge    12af <main+0x18f>
movl   $0x0,-0x3d0918(%rbp)
mov    -0x3d0918(%rbp),%eax
movslq -0x3d0914(%rbp),%rcx
cmp    -0x3d0910(%rbp,%rcx,4),%eax
jge    1296 <main+0x176>
cmpl   $0x0,-0x3d0918(%rbp)
jne    1274 <main+0x154>
mov    -0x3d0914(%rbp),%esi
lea    0xda9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xda1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x3d0918(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3d0918(%rbp)
jmp    1239 <main+0x119>
jmp    129b <main+0x17b>
mov    -0x3d0914(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3d0914(%rbp)
jmp    121f <main+0xff>
lea    0xd68(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x3d0914(%rbp)
cmpl   $0xf4240,-0x3d0914(%rbp)
jge    1342 <main+0x222>
mov    -0x3d091c(%rbp),%eax
movslq -0x3d0914(%rbp),%rcx
cmp    -0x3d0910(%rbp,%rcx,4),%eax
jge    1305 <main+0x1e5>
movslq -0x3d0914(%rbp),%rax
mov    -0x3d0910(%rbp,%rax,4),%eax
mov    %eax,-0x3d091c(%rbp)
movslq -0x3d0914(%rbp),%rax
cmpl   $0x0,-0x3d0910(%rbp,%rax,4)
jle    1329 <main+0x209>
movslq -0x3d0914(%rbp),%rax
movb   $0x9,-0x4c4b60(%rbp,%rax,1)
09
jmp    132e <main+0x20e>
mov    -0x3d0914(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3d0914(%rbp)
jmp    12c7 <main+0x1a7>
lea    0xce9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x3d091c(%rbp),%eax
mov    %eax,-0x3d0914(%rbp)
cmpl   $0x0,-0x3d0914(%rbp)
jle    1433 <main+0x313>
movl   $0x1,-0x3d0918(%rbp)
cmpl   $0xf4240,-0x3d0918(%rbp)
jge    1411 <main+0x2f1>
movslq -0x3d0918(%rbp),%rax
mov    -0x3d0910(%rbp,%rax,4),%eax
cmp    -0x3d0914(%rbp),%eax
jne    13c3 <main+0x2a3>
lea    0xc90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x3d0918(%rbp),%rax
mov    -0x3d0910(%rbp,%rax,4),%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x3d0910(%rbp,%rax,4)
movslq -0x3d0918(%rbp),%rax
movsbl -0x4c4b60(%rbp,%rax,1),%eax
ff
cmp    $0x30,%eax
je     13f8 <main+0x2d8>
movslq -0x3d0918(%rbp),%rax
movsbl -0x4c4b60(%rbp,%rax,1),%esi
ff
lea    0xc47(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    13fd <main+0x2dd>
mov    -0x3d0918(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3d0918(%rbp)
jmp    1373 <main+0x253>
lea    0xc1a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x3d0914(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x3d0914(%rbp)
jmp    135c <main+0x23c>
lea    0xbf8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x3d0914(%rbp)
cmpl   $0xf4240,-0x3d0914(%rbp)
jge    14af <main+0x38f>
movslq -0x3d0914(%rbp),%rax
movsbl -0x4c4b60(%rbp,%rax,1),%eax
ff
cmp    $0x30,%eax
je     1496 <main+0x376>
mov    -0x3d0914(%rbp),%esi
movslq -0x3d0914(%rbp),%rax
movsbl -0x4c4b60(%rbp,%rax,1),%edx
ff
lea    0xba7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    149b <main+0x37b>
mov    -0x3d0914(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3d0914(%rbp)
jmp    144b <main+0x32b>
lea    0xb7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x4c4b60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x4c4b40,%rsp
lea    0xf4240(%rsp),%rdi
mov    $0x3d0900,%edx
xor    %esi,%esi
call   1050 <memset@plt>
mov    %rsp,%rdi
mov    $0xf4240,%edx
mov    $0x30,%esi
call   1050 <memset@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    0x2e69(%rip),%rbx
cmp    (%rbx),%eax
jne    14c0 <main+0x380>
lea    0xe72(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%ebx
lea    0xe75(%rip),%r14
jmp    11bd <main+0x7d>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%rbx
cmp    $0xf4240,%rbx
je     1201 <main+0xc1>
mov    0xf4240(%rsp,%rbx,4),%ebp
test   %ebp,%ebp
jle    11b0 <main+0x70>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x7c,%edi
call   1030 <putchar@plt>
cmp    $0x1,%ebp
je     11b0 <main+0x70>
add    $0xffffffff,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    $0x7c,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11f0 <main+0xb0>
jmp    11b0 <main+0x70>
lea    0xe14(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <printf@plt>
pxor   %xmm1,%xmm1
pxor   %xmm0,%xmm0
pxor   %xmm2,%xmm2
jmp    1259 <main+0x119>
nop
movdqa %xmm0,%xmm5
pcmpgtd %xmm3,%xmm0
pand   %xmm0,%xmm5
pandn  %xmm3,%xmm0
por    %xmm5,%xmm0
movdqa %xmm2,%xmm3
pcmpgtd %xmm4,%xmm2
pand   %xmm2,%xmm3
pandn  %xmm4,%xmm2
por    %xmm3,%xmm2
add    $0x8,%rbx
cmp    $0xf4238,%rbx
je     12f2 <main+0x1b2>
movdqu 0xf4244(%rsp,%rbx,4),%xmm3
movdqa %xmm3,%xmm4
pcmpgtd %xmm1,%xmm4
movd   %xmm4,%eax
test   $0x1,%al
je     1277 <main+0x137>
movb   $0x9,0x1(%rsp,%rbx,1)
pextrw $0x2,%xmm4,%eax
test   $0x1,%al
je     1285 <main+0x145>
movb   $0x9,0x2(%rsp,%rbx,1)
pextrw $0x4,%xmm4,%eax
test   $0x1,%al
je     1293 <main+0x153>
movb   $0x9,0x3(%rsp,%rbx,1)
pextrw $0x6,%xmm4,%eax
test   $0x1,%al
je     12a1 <main+0x161>
movb   $0x9,0x4(%rsp,%rbx,1)
movdqu 0xf4254(%rsp,%rbx,4),%xmm4
movdqa %xmm4,%xmm5
pcmpgtd %xmm1,%xmm5
movd   %xmm5,%eax
test   $0x1,%al
je     12bf <main+0x17f>
movb   $0x9,0x5(%rsp,%rbx,1)
pextrw $0x2,%xmm5,%eax
test   $0x1,%al
je     12cd <main+0x18d>
movb   $0x9,0x6(%rsp,%rbx,1)
pextrw $0x4,%xmm5,%eax
test   $0x1,%al
je     12db <main+0x19b>
movb   $0x9,0x7(%rsp,%rbx,1)
pextrw $0x6,%xmm5,%eax
test   $0x1,%al
je     1220 <main+0xe0>
movb   $0x9,0x8(%rsp,%rbx,1)
jmp    1220 <main+0xe0>
movdqa %xmm0,%xmm1
pcmpgtd %xmm2,%xmm1
pand   %xmm1,%xmm0
pandn  %xmm2,%xmm1
por    %xmm0,%xmm1
pshufd $0xee,%xmm1,%xmm0
movdqa %xmm1,%xmm2
pcmpgtd %xmm0,%xmm2
pand   %xmm2,%xmm1
pandn  %xmm0,%xmm2
por    %xmm1,%xmm2
pshufd $0x55,%xmm2,%xmm0
movdqa %xmm2,%xmm1
pcmpgtd %xmm0,%xmm1
pand   %xmm1,%xmm2
pandn  %xmm0,%xmm1
por    %xmm2,%xmm1
movd   %xmm1,%r14d
mov    0x4c4b24(%rsp),%eax
cmp    %eax,%r14d
cmovl  %eax,%r14d
test   %eax,%eax
jle    1357 <main+0x217>
movb   $0x9,0xf4239(%rsp)
09
mov    0x4c4b28(%rsp),%eax
cmp    %eax,%r14d
cmovl  %eax,%r14d
test   %eax,%eax
jle    1371 <main+0x231>
movb   $0x9,0xf423a(%rsp)
09
mov    0x4c4b2c(%rsp),%eax
cmp    %eax,%r14d
cmovl  %eax,%r14d
test   %eax,%eax
jle    138b <main+0x24b>
movb   $0x9,0xf423b(%rsp)
09
mov    0x4c4b30(%rsp),%eax
cmp    %eax,%r14d
cmovl  %eax,%r14d
test   %eax,%eax
jle    13a5 <main+0x265>
movb   $0x9,0xf423c(%rsp)
09
mov    0x4c4b34(%rsp),%eax
cmp    %eax,%r14d
cmovl  %eax,%r14d
test   %eax,%eax
jle    13bf <main+0x27f>
movb   $0x9,0xf423d(%rsp)
09
mov    0x4c4b38(%rsp),%eax
cmp    %eax,%r14d
cmovl  %eax,%r14d
test   %eax,%eax
jle    13d9 <main+0x299>
movb   $0x9,0xf423e(%rsp)
09
mov    0x4c4b3c(%rsp),%eax
cmp    %eax,%r14d
cmovl  %eax,%r14d
test   %eax,%eax
jle    13f3 <main+0x2b3>
movb   $0x9,0xf423f(%rsp)
09
mov    $0xa,%edi
call   1030 <putchar@plt>
test   %r14d,%r14d
jg     1463 <main+0x323>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1,%ebx
lea    0xc18(%rip),%r14
jmp    142d <main+0x2ed>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    $0xf4240,%rbx
je     14a8 <main+0x368>
movsbl (%rsp,%rbx,1),%edx
cmp    $0x30,%edx
je     1420 <main+0x2e0>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1420 <main+0x2e0>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0xa,%edi
call   1030 <putchar@plt>
cmp    $0x1,%r14d
mov    %ebp,%r14d
jle    1402 <main+0x2c2>
lea    -0x1(%r14),%ebp
mov    $0x1,%ebx
jmp    147d <main+0x33d>
xchg   %ax,%ax
add    $0x1,%rbx
cmp    $0xf4240,%rbx
je     1450 <main+0x310>
cmp    %r14d,0xf4240(%rsp,%rbx,4)
jne    1498 <main+0x358>
mov    $0x5f,%edi
call   1030 <putchar@plt>
mov    %ebp,0xf4240(%rsp,%rbx,4)
movsbl (%rsp,%rbx,1),%edi
cmp    $0x30,%edi
je     1470 <main+0x330>
call   1030 <putchar@plt>
jmp    1470 <main+0x330>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x4c4b40,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
movabs $0x100000600,%r14
xor    %ecx,%ecx
jmp    14e6 <main+0x3a6>
xchg   %ax,%ax
add    $0x1,%ecx
mov    %ecx,%ebp
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %ebp,%ecx
cmp    (%rbx),%eax
je     1187 <main+0x47>
cmp    $0x20,%eax
ja     14d0 <main+0x390>
mov    %eax,%eax
bt     %rax,%r14
jae    14d0 <main+0x390>
xor    %ebp,%ebp
test   %ecx,%ecx
jle    14d5 <main+0x395>
mov    %ecx,%eax
addl   $0x1,0xf4240(%rsp,%rax,4)
01
jmp    14d5 <main+0x395>

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

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