#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() {
  double balance[5] = {1000.0, 2.0, 3.4, 17.0, 50.0};
  double *p;
  int i;
  p = balance;
  printf("使用指针的数组值\n");
  for (i = 0; i < 5; i++) {
    printf("*(p + %d) : %f\n", i, *(p + i));
  }
  printf("使用 balance 作为地址的数组值\n");
  for (i = 0; i < 5; i++) {
    printf("*(balance + %d) : %f\n", i, *(balance + i));
  }
  printf("使用 balance value 作为地址的数组值\n");
  for (i = 0; i < 5; i++) {
    printf("(balance + %d) : %f\n", i, (balance[i]));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
movsd  0xed9(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xec4(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xeaf(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe9a(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe85(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x3c(%rbp)
cmpl   $0x5,-0x3c(%rbp)
jge    11d3 <main+0xb3>
mov    -0x3c(%rbp),%esi
mov    -0x38(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe84(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    119d <main+0x7d>
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x3c(%rbp)
cmpl   $0x5,-0x3c(%rbp)
jge    121b <main+0xfb>
mov    -0x3c(%rbp),%esi
movslq -0x3c(%rbp),%rax
movsd  -0x30(%rbp,%rax,8),%xmm0
lea    0xe75(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11e8 <main+0xc8>
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x3c(%rbp)
cmpl   $0x5,-0x3c(%rbp)
jge    1263 <main+0x143>
mov    -0x3c(%rbp),%esi
movslq -0x3c(%rbp),%rax
movsd  -0x30(%rbp,%rax,8),%xmm0
lea    0xe2e(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1230 <main+0x110>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xf26(%rip),%rdi
call   1030 <puts@plt>
lea    0xef4(%rip),%rbx
movsd  0xec4(%rip),%xmm0
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0xeb8(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0xea9(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0xe9a(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0xe8b(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xebc(%rip),%rdi
call   1030 <puts@plt>
lea    0xe81(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
movsd  0xe3c(%rip),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
movsd  0xe2d(%rip),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
movsd  0xe1e(%rip),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
movsd  0xe0f(%rip),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
movsd  0xe00(%rip),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe61(%rip),%rdi
call   1030 <puts@plt>
lea    0xdff(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
movsd  0xdb9(%rip),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
movsd  0xdaa(%rip),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
movsd  0xd9b(%rip),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
movsd  0xd8c(%rip),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
movsd  0xd7d(%rip),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"\E4\BD\BF\E7\94\A8\E6\8C\87\E9\92\88\E7\9A\84\E6\95\B0\E7\BB\84\E5\80\BC\0A\00"
@.str.1 = [16 x i8] c"*(p + %d) : %f\0A\00"
@.str.2 = [41 x i8] c"\E4\BD\BF\E7\94\A8 balance \E4\BD\9C\E4\B8\BA\E5\9C\B0\E5\9D\80\E7\9A\84\E6\95\B0\E7\BB\84\E5\80\BC\0A\00"
@.str.3 = [22 x i8] c"*(balance + %d) : %f\0A\00"
@.str.4 = [47 x i8] c"\E4\BD\BF\E7\94\A8 balance value \E4\BD\9C\E4\B8\BA\E5\9C\B0\E5\9D\80\E7\9A\84\E6\95\B0\E7\BB\84\E5\80\BC\0A\00"
@.str.5 = [21 x i8] c"(balance + %d) : %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x double]
%3 = alloca double*
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [5 x double]* %2 to i8*
%6 = bitcast i8* %5 to [5 x double]*
%7 = getelementptr inbounds [5 x double], [5 x double]* %6, i32 0, i32 0
store double 1.000000e+03, double* %7
%8 = getelementptr inbounds [5 x double], [5 x double]* %6, i32 0, i32 1
store double 2.000000e+00, double* %8
%9 = getelementptr inbounds [5 x double], [5 x double]* %6, i32 0, i32 2
store double 3.400000e+00, double* %9
%10 = getelementptr inbounds [5 x double], [5 x double]* %6, i32 0, i32 3
store double 1.700000e+01, double* %10
%11 = getelementptr inbounds [5 x double], [5 x double]* %6, i32 0, i32 4
store double 5.000000e+01, double* %11
%12 = getelementptr inbounds [5 x double], [5 x double]* %2, i64 0, i64 0
store double* %12, double** %3
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %14
14: ; preds = %25, %0
%15 = load i32, i32* %4
%16 = icmp slt i32 %15, 5
br i1 %16, label %17, label %28
17: ; preds = %14
%18 = load i32, i32* %4
%19 = load double*, double** %3
%20 = load i32, i32* %4
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds double, double* %19, i64 %21
%23 = load double, double* %22
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %18, double %23)
br label %25
25: ; preds = %17
%26 = load i32, i32* %4
%27 = add nsw i32 %26, 1
store i32 %27, i32* %4
br label %14
28: ; preds = %14
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %4
br label %30
30: ; preds = %41, %28
%31 = load i32, i32* %4
%32 = icmp slt i32 %31, 5
br i1 %32, label %33, label %44
33: ; preds = %30
%34 = load i32, i32* %4
%35 = getelementptr inbounds [5 x double], [5 x double]* %2, i64 0, i64 0
%36 = load i32, i32* %4
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds double, double* %35, i64 %37
%39 = load double, double* %38
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %34, double %39)
br label %41
41: ; preds = %33
%42 = load i32, i32* %4
%43 = add nsw i32 %42, 1
store i32 %43, i32* %4
br label %30
44: ; preds = %30
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %4
br label %46
46: ; preds = %56, %44
%47 = load i32, i32* %4
%48 = icmp slt i32 %47, 5
br i1 %48, label %49, label %59
49: ; preds = %46
%50 = load i32, i32* %4
%51 = load i32, i32* %4
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [5 x double], [5 x double]* %2, i64 0, i64 %52
%54 = load double, double* %53
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i32 %50, double %54)
br label %56
56: ; preds = %49
%57 = load i32, i32* %4
%58 = add nsw i32 %57, 1
store i32 %58, i32* %4
br label %46
59: ; preds = %46
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [16 x i8] c"*(p + %d) : %f\0A\00"
@.str.3 = [22 x i8] c"*(balance + %d) : %f\0A\00"
@.str.5 = [21 x i8] c"(balance + %d) : %f\0A\00"
@str = [25 x i8] c"\E4\BD\BF\E7\94\A8\E6\8C\87\E9\92\88\E7\9A\84\E6\95\B0\E7\BB\84\E5\80\BC\00"
@str.6 = [40 x i8] c"\E4\BD\BF\E7\94\A8 balance \E4\BD\9C\E4\B8\BA\E5\9C\B0\E5\9D\80\E7\9A\84\E6\95\B0\E7\BB\84\E5\80\BC\00"
@str.7 = [46 x i8] c"\E4\BD\BF\E7\94\A8 balance value \E4\BD\9C\E4\B8\BA\E5\9C\B0\E5\9D\80\E7\9A\84\E6\95\B0\E7\BB\84\E5\80\BC\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 0, double 1.000000e+03)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 1, double 2.000000e+00)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 2, double 3.400000e+00)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 3, double 1.700000e+01)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 4, double 5.000000e+01)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.6, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 0, double 1.000000e+03)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 1, double 2.000000e+00)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 2, double 3.400000e+00)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 3, double 1.700000e+01)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 4, double 5.000000e+01)
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.7, i64 0, i64 0))
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i32 0, double 1.000000e+03)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i32 1, double 2.000000e+00)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i32 2, double 3.400000e+00)
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i32 3, double 1.700000e+01)
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i32 4, double 5.000000e+01)
ret i32 0
}