#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 /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv, char **envp) {
  char y[4096][4096] = {0};
  int histogram_value[256] = {0};
  int val;
  for (int h = 0; h < 4096; ++h) {
    for (int w = 0; w < 4096; ++w) {
      val = y[w][h];
      histogram_value[val] = histogram_value[val]++;
    }
  }
  for (int j = 0; j < 256; ++j)
    printf("%d", histogram_value[j]);
  printf("\r\r");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1000430,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x1000020(%rbp),%rdi
xor    %esi,%esi
mov    $0x1000000,%edx
call   1040 <memset@plt>
lea    -0x1000420(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1040 <memset@plt>
movl   $0x0,-0x1000428(%rbp)
cmpl   $0x1000,-0x1000428(%rbp)
jge    1212 <main+0xf2>
movl   $0x0,-0x100042c(%rbp)
cmpl   $0x1000,-0x100042c(%rbp)
jge    11f9 <main+0xd9>
movslq -0x100042c(%rbp),%rcx
lea    -0x1000020(%rbp),%rax
shl    $0xc,%rcx
add    %rcx,%rax
movslq -0x1000428(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x1000424(%rbp)
movslq -0x1000424(%rbp),%rax
mov    -0x1000420(%rbp,%rax,4),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x1000420(%rbp,%rax,4)
movslq -0x1000424(%rbp),%rax
mov    %ecx,-0x1000420(%rbp,%rax,4)
mov    -0x100042c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x100042c(%rbp)
jmp    1187 <main+0x67>
jmp    11fe <main+0xde>
mov    -0x1000428(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1000428(%rbp)
jmp    116d <main+0x4d>
movl   $0x0,-0x1000430(%rbp)
cmpl   $0x100,-0x1000430(%rbp)
jge    125c <main+0x13c>
movslq -0x1000430(%rbp),%rax
mov    -0x1000420(%rbp,%rax,4),%esi
lea    0xdbf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1000430(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1000430(%rbp)
jmp    121c <main+0xfc>
lea    0xda0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1000430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x408,%rsp
mov    %rsp,%rdi
mov    $0x400,%edx
xor    %esi,%esi
call   1040 <memset@plt>
lea    0xec0(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%rsp,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    $0x100,%rbx
jne    1150 <main+0x30>
lea    0xe92(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"\0D\0D\00"
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca [4096 x [4096 x i8]]
%9 = alloca [256 x i32]
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
%14 = bitcast [4096 x [4096 x i8]]* %8 to i8*
%15 = bitcast [256 x i32]* %9 to i8*
store i32 0, i32* %11
br label %16
16: ; preds = %44, %3
%17 = load i32, i32* %11
%18 = icmp slt i32 %17, 4096
br i1 %18, label %19, label %47
19: ; preds = %16
store i32 0, i32* %12
br label %20
20: ; preds = %40, %19
%21 = load i32, i32* %12
%22 = icmp slt i32 %21, 4096
br i1 %22, label %23, label %43
23: ; preds = %20
%24 = load i32, i32* %12
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [4096 x [4096 x i8]], [4096 x [4096 x i8]]* %8, i64 0, i64 %25
%27 = load i32, i32* %11
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [4096 x i8], [4096 x i8]* %26, i64 0, i64 %28
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
store i32 %31, i32* %10
%32 = load i32, i32* %10
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [256 x i32], [256 x i32]* %9, i64 0, i64 %33
%35 = load i32, i32* %34
%36 = add nsw i32 %35, 1
store i32 %36, i32* %34
%37 = load i32, i32* %10
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [256 x i32], [256 x i32]* %9, i64 0, i64 %38
store i32 %35, i32* %39
br label %40
40: ; preds = %23
%41 = load i32, i32* %12
%42 = add nsw i32 %41, 1
store i32 %42, i32* %12
br label %20
43: ; preds = %20
br label %44
44: ; preds = %43
%45 = load i32, i32* %11
%46 = add nsw i32 %45, 1
store i32 %46, i32* %11
br label %16
47: ; preds = %16
store i32 0, i32* %13
br label %48
48: ; preds = %57, %47
%49 = load i32, i32* %13
%50 = icmp slt i32 %49, 256
br i1 %50, label %51, label %60
51: ; preds = %48
%52 = load i32, i32* %13
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [256 x i32], [256 x i32]* %9, i64 0, i64 %53
%55 = load i32, i32* %54
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %55)
br label %57
57: ; preds = %51
%58 = load i32, i32* %13
%59 = add nsw i32 %58, 1
store i32 %59, i32* %13
br label %48
60: ; preds = %48
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"\0D\0D\00"
define i32 @main(i32 %0, i8** nocapture readnone %1, i8** nocapture readnone %2) {
%4 = alloca [256 x i32]
%5 = bitcast [256 x i32]* %4 to i8*
br label %8
6: ; preds = %8
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
8: ; preds = %3, %8
%9 = phi i64 [ 0, %3 ], [ %13, %8 ]
%10 = getelementptr inbounds [256 x i32], [256 x i32]* %4, i64 0, i64 %9
%11 = load i32, i32* %10
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = add nuw nsw i64 %9, 1
%14 = icmp eq i64 %13, 256
br i1 %14, label %6, label %8
}