#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(void) {
  int n[10] = {19, 3, 15, 7, 11, 9, 13, 5, 17, 1};
  int i, j;
  printf("%s%13s%17s\n", "Element", "Value", "Histogram");
  for (i = 0; i < 10; i++) {
    printf("%7d%13d            ", i, n[i]);
    printf("|");
    for (j = 1; j <= n[i]; j++) {
      printf("%c", '*');
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xec6(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
lea    0xedd(%rip),%rdi
lea    0xee2(%rip),%rsi
lea    0xee3(%rip),%rdx
lea    0xee2(%rip),%rcx
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    11f4 <main+0xd4>
mov    -0x34(%rbp),%esi
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edx
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x38(%rbp)
mov    -0x38(%rbp),%eax
movslq -0x34(%rbp),%rcx
cmp    -0x30(%rbp,%rcx,4),%eax
jg     11d8 <main+0xb8>
lea    0xea4(%rip),%rdi
mov    $0x2a,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11a6 <main+0x86>
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    116e <main+0x4e>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
lea    0xef9(%rip),%rdi
lea    0xefe(%rip),%rsi
lea    0xeff(%rip),%rdx
lea    0xefe(%rip),%rcx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeae(%rip),%r15
lea    0xef3(%rip),%r14
mov    $0x1,%r12d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%ebp
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x7c,%edi
call   1030 <putchar@plt>
cmp    $0x2,%ebp
cmovl  %r12d,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11a0 <main+0x80>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    $0xa,%rbx
jne    1170 <main+0x50>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.n = [10 x i32] [i32 19, i32 3, i32 15, i32 7, i32 11, i32 9, i32 13, i32 5, i32 17, i32 1]
@.str = [12 x i8] c"%s%13s%17s\0A\00"
@.str.1 = [8 x i8] c"Element\00"
@.str.2 = [6 x i8] c"Value\00"
@.str.3 = [10 x i8] c"Histogram\00"
@.str.4 = [20 x i8] c"%7d%13d \00"
@.str.5 = [2 x i8] c"|\00"
@.str.6 = [3 x i8] c"%c\00"
@.str.7 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [10 x i32]* %2 to i8*
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %3
br label %7
7: ; preds = %32, %0
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 10
br i1 %9, label %10, label %35
10: ; preds = %7
%11 = load i32, i32* %3
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %13
%15 = load i32, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i32 %11, i32 %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %4
br label %18
18: ; preds = %27, %10
%19 = load i32, i32* %4
%20 = load i32, i32* %3
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %21
%23 = load i32, i32* %22
%24 = icmp sle i32 %19, %23
br i1 %24, label %25, label %30
25: ; preds = %18
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 42)
br label %27
27: ; preds = %25
%28 = load i32, i32* %4
%29 = add nsw i32 %28, 1
store i32 %29, i32* %4
br label %18
30: ; preds = %18
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %32
32: ; preds = %30
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
store i32 %34, i32* %3
br label %7
35: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@__const.main.n = [10 x i32] [i32 19, i32 3, i32 15, i32 7, i32 11, i32 9, i32 13, i32 5, i32 17, i32 1]
@.str = [12 x i8] c"%s%13s%17s\0A\00"
@.str.1 = [8 x i8] c"Element\00"
@.str.2 = [6 x i8] c"Value\00"
@.str.3 = [10 x i8] c"Histogram\00"
@.str.4 = [20 x i8] c"%7d%13d \00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
br label %2
2: ; preds = %15, %0
%3 = phi i64 [ 0, %0 ], [ %17, %15 ]
%4 = getelementptr inbounds [10 x i32], [10 x i32]* @__const.main.n, i64 0, i64 %3
%5 = load i32, i32* %4
%6 = trunc i64 %3 to i32
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i32 %6, i32 %5)
%8 = tail call i32 @putchar(i32 124)
%9 = call i32 @llvm.smax.i32(i32 %5, i32 1)
br label %10
10: ; preds = %2, %10
%11 = phi i32 [ %13, %10 ], [ 1, %2 ]
%12 = tail call i32 @putchar(i32 42)
%13 = add nuw i32 %11, 1
%14 = icmp eq i32 %11, %9
br i1 %14, label %15, label %10
15: ; preds = %10
%16 = tail call i32 @putchar(i32 10)
%17 = add nuw nsw i64 %3, 1
%18 = icmp eq i64 %17, 10
br i1 %18, label %19, label %2
19: ; preds = %15
ret i32 0
}