#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 i, j;
  int sample[10] = {10, 3, 6, 12, 4, 5, 7, 9, 11, 2};
  printf("%s\t%s\t%s\n", "Number", "Value", "Chart");
  for (i = 0; i <= 10 - 1; i++) {
    printf("%d\t%d\t", i, sample[i]);
    for (j = 1; j <= sample[i]; j++) {
      printf("*");
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xec6(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
lea    0xedd(%rip),%rdi
lea    0xee0(%rip),%rsi
lea    0xee0(%rip),%rdx
lea    0xedf(%rip),%rcx
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x9,-0x8(%rbp)
jg     11e1 <main+0xc1>
mov    -0x8(%rbp),%esi
movslq -0x8(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%edx
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
movslq -0x8(%rbp),%rcx
cmp    -0x40(%rbp,%rcx,4),%eax
jg     11c5 <main+0xa5>
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1198 <main+0x78>
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%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    0xefc(%rip),%rsi
lea    0xefc(%rip),%rdx
lea    0xefb(%rip),%rcx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeae(%rip),%r15
lea    0xeec(%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>
cmp    $0x2,%ebp
cmovl  %r12d,%ebp
nopl   0x0(%rax)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1190 <main+0x70>
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.sample = [10 x i32] [i32 10, i32 3, i32 6, i32 12, i32 4, i32 5, i32 7, i32 9, i32 11, i32 2]
@.str = [10 x i8] c"%s\09%s\09%s\0A\00"
@.str.1 = [7 x i8] c"Number\00"
@.str.2 = [6 x i8] c"Value\00"
@.str.3 = [6 x i8] c"Chart\00"
@.str.4 = [7 x i8] c"%d\09%d\09\00"
@.str.5 = [2 x i8] c"*\00"
@.str.6 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [10 x i32]
store i32 0, i32* %1
%5 = bitcast [10 x i32]* %4 to i8*
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 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 ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %2
br label %7
7: ; preds = %31, %0
%8 = load i32, i32* %2
%9 = icmp sle i32 %8, 9
br i1 %9, label %10, label %34
10: ; preds = %7
%11 = load i32, i32* %2
%12 = load i32, i32* %2
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %13
%15 = load i32, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %11, i32 %15)
store i32 1, i32* %3
br label %17
17: ; preds = %26, %10
%18 = load i32, i32* %3
%19 = load i32, i32* %2
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %20
%22 = load i32, i32* %21
%23 = icmp sle i32 %18, %22
br i1 %23, label %24, label %29
24: ; preds = %17
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %26
26: ; preds = %24
%27 = load i32, i32* %3
%28 = add nsw i32 %27, 1
store i32 %28, i32* %3
br label %17
29: ; preds = %17
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %31
31: ; preds = %29
%32 = load i32, i32* %2
%33 = add nsw i32 %32, 1
store i32 %33, i32* %2
br label %7
34: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@__const.main.sample = [10 x i32] [i32 10, i32 3, i32 6, i32 12, i32 4, i32 5, i32 7, i32 9, i32 11, i32 2]
@.str = [10 x i8] c"%s\09%s\09%s\0A\00"
@.str.1 = [7 x i8] c"Number\00"
@.str.2 = [6 x i8] c"Value\00"
@.str.3 = [6 x i8] c"Chart\00"
@.str.4 = [7 x i8] c"%d\09%d\09\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 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 ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %2
2: ; preds = %14, %0
%3 = phi i64 [ 0, %0 ], [ %16, %14 ]
%4 = getelementptr inbounds [10 x i32], [10 x i32]* @__const.main.sample, 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 ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %6, i32 %5)
%8 = call i32 @llvm.smax.i32(i32 %5, i32 1)
br label %9
9: ; preds = %2, %9
%10 = phi i32 [ %12, %9 ], [ 1, %2 ]
%11 = tail call i32 @putchar(i32 42)
%12 = add nuw i32 %10, 1
%13 = icmp eq i32 %10, %8
br i1 %13, label %14, label %9
14: ; preds = %9
%15 = tail call i32 @putchar(i32 10)
%16 = add nuw nsw i64 %3, 1
%17 = icmp eq i64 %16, 10
br i1 %17, label %18, label %2
18: ; preds = %14
ret i32 0
}