#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);
int main() {
  int list[3] = {1, 2, 3};
  printf("list==&list[0]？%d\n", list == &list[0]);
  printf("把list当做指针使用,获取第一个元素的值:%d\n", *list);
  printf("把list当做指针使用,获取第二个元素的值:%d\n", *(list + 1));
  printf("把list当做指针使用,获取第三个元素的值:%d\n", *(list + 2));
  int *p = list;
  for (int i = 0; i < 3; i++) {
    printf("%d\n", *p++);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xed8(%rip),%eax
mov    %eax,-0x8(%rbp)
lea    -0x10(%rbp),%rax
lea    -0x10(%rbp),%rcx
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%esi
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xef0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xf1b(%rip),%rdi
call   1030 <printf@plt>
lea    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    11c3 <main+0xb3>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x18(%rbp)
mov    (%rax),%esi
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    118e <main+0x7e>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
lea    0xeec(%rip),%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
lea    0xf15(%rip),%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
lea    0xf3e(%rip),%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
lea    0xeef(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.list = [3 x i32] [i32 1, i32 2, i32 3]
@.str = [21 x i8] c"list==&list[0]\EF\BC\9F%d\0A\00"
@.str.1 = [58 x i8] c"\E6\8A\8Alist\E5\BD\93\E5\81\9A\E6\8C\87\E9\92\88\E4\BD\BF\E7\94\A8,\E8\8E\B7\E5\8F\96\E7\AC\AC\E4\B8\80\E4\B8\AA\E5\85\83\E7\B4\A0\E7\9A\84\E5\80\BC:%d\0A\00"
@.str.2 = [58 x i8] c"\E6\8A\8Alist\E5\BD\93\E5\81\9A\E6\8C\87\E9\92\88\E4\BD\BF\E7\94\A8,\E8\8E\B7\E5\8F\96\E7\AC\AC\E4\BA\8C\E4\B8\AA\E5\85\83\E7\B4\A0\E7\9A\84\E5\80\BC:%d\0A\00"
@.str.3 = [58 x i8] c"\E6\8A\8Alist\E5\BD\93\E5\81\9A\E6\8C\87\E9\92\88\E4\BD\BF\E7\94\A8,\E8\8E\B7\E5\8F\96\E7\AC\AC\E4\B8\89\E4\B8\AA\E5\85\83\E7\B4\A0\E7\9A\84\E5\80\BC:%d\0A\00"
@.str.4 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i32]
%3 = alloca i32*
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [3 x i32]* %2 to i8*
%6 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%7 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%8 = icmp eq i32* %6, %7
%9 = zext i1 %8 to i32
%10 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%12 = load i32, i32* %11
%13 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%15 = getelementptr inbounds i32, i32* %14, i64 1
%16 = load i32, i32* %15
%17 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%18 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%19 = getelementptr inbounds i32, i32* %18, i64 2
%20 = load i32, i32* %19
%21 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.3, i64 0, i64 0), i32 %20)
%22 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
store i32* %22, i32** %3
store i32 0, i32* %4
br label %23
23: ; preds = %31, %0
%24 = load i32, i32* %4
%25 = icmp slt i32 %24, 3
br i1 %25, label %26, label %34
26: ; preds = %23
%27 = load i32*, i32** %3
%28 = getelementptr inbounds i32, i32* %27, i32 1
store i32* %28, i32** %3
%29 = load i32, i32* %27
%30 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %29)
br label %31
31: ; preds = %26
%32 = load i32, i32* %4
%33 = add nsw i32 %32, 1
store i32 %33, i32* %4
br label %23
34: ; preds = %23
%35 = load i32, i32* %1
ret i32 %35
}

LLVM IR (-O2):
@.str = [21 x i8] c"list==&list[0]\EF\BC\9F%d\0A\00"
@.str.1 = [58 x i8] c"\E6\8A\8Alist\E5\BD\93\E5\81\9A\E6\8C\87\E9\92\88\E4\BD\BF\E7\94\A8,\E8\8E\B7\E5\8F\96\E7\AC\AC\E4\B8\80\E4\B8\AA\E5\85\83\E7\B4\A0\E7\9A\84\E5\80\BC:%d\0A\00"
@.str.2 = [58 x i8] c"\E6\8A\8Alist\E5\BD\93\E5\81\9A\E6\8C\87\E9\92\88\E4\BD\BF\E7\94\A8,\E8\8E\B7\E5\8F\96\E7\AC\AC\E4\BA\8C\E4\B8\AA\E5\85\83\E7\B4\A0\E7\9A\84\E5\80\BC:%d\0A\00"
@.str.3 = [58 x i8] c"\E6\8A\8Alist\E5\BD\93\E5\81\9A\E6\8C\87\E9\92\88\E4\BD\BF\E7\94\A8,\E8\8E\B7\E5\8F\96\E7\AC\AC\E4\B8\89\E4\B8\AA\E5\85\83\E7\B4\A0\E7\9A\84\E5\80\BC:%d\0A\00"
@.str.4 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 1)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0), i32 1)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0), i32 2)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.3, i64 0, i64 0), i32 3)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 1)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 2)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 3)
ret i32 0
}