#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 */
typedef int /*<<< orphan*/ data;

/* Variables and functions */
int /*<<< orphan*/ print_hist(int *, int);
int random();
int /*<<< orphan*/ srandom(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  int data[120 - 2];
  int i;
  srandom(time(NULL));
  for (i = 0; i < sizeof(data) / sizeof(int); i++)
    data[i] = random() % 100;
  print_hist(data, sizeof(data) / sizeof(int));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1f0,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srandom@plt>
movl   $0x0,-0x1e4(%rbp)
movslq -0x1e4(%rbp),%rax
cmp    $0x76,%rax
jae    11ae <main+0x6e>
mov    $0x0,%al
call   1050 <random@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
movslq -0x1e4(%rbp),%rax
mov    %edx,-0x1e0(%rbp,%rax,4)
mov    -0x1e4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1e4(%rbp)
jmp    116c <main+0x2c>
lea    -0x1e0(%rbp),%rdi
mov    $0x76,%esi
call   1060 <print_hist@plt>
xor    %eax,%eax
add    $0x1f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x1e0,%rsp
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srandom@plt>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <random@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,(%rsp,%rbx,4)
add    $0x1,%rbx
cmp    $0x76,%rbx
jne    1160 <main+0x20>
mov    %rsp,%rdi
mov    $0x76,%esi
call   1060 <print_hist@plt>
xor    %eax,%eax
add    $0x1e0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [118 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @time(i32* null)
%5 = call i32 @srandom(i32 %4)
store i32 0, i32* %3
br label %6
6: ; preds = %16, %0
%7 = load i32, i32* %3
%8 = sext i32 %7 to i64
%9 = icmp ult i64 %8, 118
br i1 %9, label %10, label %19
10: ; preds = %6
%11 = call i32 (...) @random()
%12 = srem i32 %11, 100
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [118 x i32], [118 x i32]* %2, i64 0, i64 %14
store i32 %12, i32* %15
br label %16
16: ; preds = %10
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
store i32 %18, i32* %3
br label %6
19: ; preds = %6
%20 = getelementptr inbounds [118 x i32], [118 x i32]* %2, i64 0, i64 0
%21 = call i32 @print_hist(i32* %20, i32 118)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [118 x i32]
%2 = bitcast [118 x i32]* %1 to i8*
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srandom(i32 %3)
br label %5
5: ; preds = %0, %5
%6 = phi i64 [ 0, %0 ], [ %10, %5 ]
%7 = tail call i32 (...) @random()
%8 = srem i32 %7, 100
%9 = getelementptr inbounds [118 x i32], [118 x i32]* %1, i64 0, i64 %6
store i32 %8, i32* %9
%10 = add nuw nsw i64 %6, 1
%11 = icmp eq i64 %10, 118
br i1 %11, label %12, label %5
12: ; preds = %5
%13 = getelementptr inbounds [118 x i32], [118 x i32]* %1, i64 0, i64 0
%14 = call i32 @print_hist(i32* %13, i32 118)
ret i32 0
}