#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 *, ...);
void fig06_04() {
  int n[10] = {32, 27, 64, 18, 95, 14, 90, 70, 60, 37};
  size_t i;
  printf("%s%13s\n", "Element", "Value");
  for (i = 0; i < 10; ++i) {
    printf("%7u%13u\n", i, n[i]);
  }
}


x86 assembly (clang, -O0):
<fig06_04>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x30(%rbp),%rdi
lea    0xecd(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
lea    0xee4(%rip),%rdi
lea    0xee5(%rip),%rsi
lea    0xee6(%rip),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
movq   $0x0,-0x38(%rbp)
cmpq   $0xa,-0x38(%rbp)
jae    1197 <fig06_04+0x77>
mov    -0x38(%rbp),%rsi
mov    -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edx
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1161 <fig06_04+0x41>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fig06_04>:
push   %rbx
lea    0xee8(%rip),%rdi
lea    0xee9(%rip),%rsi
lea    0xeea(%rip),%rdx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee2(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x20,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%esi
mov    %rbx,%rdi
mov    $0x1b,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x2,%esi
mov    %rbx,%rdi
mov    $0x40,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x3,%esi
mov    %rbx,%rdi
mov    $0x12,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x4,%esi
mov    %rbx,%rdi
mov    $0x5f,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x5,%esi
mov    %rbx,%rdi
mov    $0xe,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x6,%esi
mov    %rbx,%rdi
mov    $0x5a,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x7,%esi
mov    %rbx,%rdi
mov    $0x46,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x8,%esi
mov    %rbx,%rdi
mov    $0x3c,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x9,%esi
mov    %rbx,%rdi
mov    $0x25,%edx
xor    %eax,%eax
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@__const.fig06_04.n = [10 x i32] [i32 32, i32 27, i32 64, i32 18, i32 95, i32 14, i32 90, i32 70, i32 60, i32 37]
@.str = [8 x i8] c"%s%13s\0A\00"
@.str.1 = [8 x i8] c"Element\00"
@.str.2 = [6 x i8] c"Value\00"
@.str.3 = [9 x i8] c"%7u%13u\0A\00"
define void @fig06_04() {
%1 = alloca [10 x i32]
%2 = alloca i64
%3 = bitcast [10 x i32]* %1 to i8*
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 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))
store i64 0, i64* %2
br label %5
5: ; preds = %14, %0
%6 = load i64, i64* %2
%7 = icmp ult i64 %6, 10
br i1 %7, label %8, label %17
8: ; preds = %5
%9 = load i64, i64* %2
%10 = load i64, i64* %2
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %10
%12 = load i32, i32* %11
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i64 %9, i32 %12)
br label %14
14: ; preds = %8
%15 = load i64, i64* %2
%16 = add i64 %15, 1
store i64 %16, i64* %2
br label %5
17: ; preds = %5
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"%s%13s\0A\00"
@.str.1 = [8 x i8] c"Element\00"
@.str.2 = [6 x i8] c"Value\00"
@.str.3 = [9 x i8] c"%7u%13u\0A\00"
define void @fig06_04() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 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))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i64 0, i32 32)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i64 1, i32 27)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i64 2, i32 64)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i64 3, i32 18)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i64 4, i32 95)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i64 5, i32 14)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i64 6, i32 90)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i64 7, i32 70)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i64 8, i32 60)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i64 9, i32 37)
ret void
}