void main() {
  char a[5] = {'A', 'B', 'C', 'D'};
  char(*p3)[5] = &a;
  char(*p5)[10] = &a;
  char(*p4)[5] = a;
  printf("&a *p3[0] = %c,p3[0] = %c,p3[1] = %c,*p3[1] = %c\n", *p3[0], p3[0],
         p3[1], *p3[1]);
  printf("&a p4[0] = %c,p4[1] = %c\n", p4[0], p4[1]);
  printf("&a p5[0] = %c,p5[0] = %c,p5[1] = %c\n", *p5[0], p5[0], p5[1]);
  printf("\naddress a[0] = %p,a[1] = %p", &a[0], &a[1]);
  printf("\naddress a = %p,a+1 = %p", &a, &a + 1);
  printf("\naddress p3 = %p,p3+1 = %p", p3, p3 + 1);
  printf("\naddress p4 = %p,p4+1 = %p", p4, p4 + 1);
  printf("\naddress p5 = %p,p5+1 = %p", p5, p5 + 1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xee2(%rip),%eax
mov    %eax,-0x5(%rbp)
mov    0xedd(%rip),%al
mov    %al,-0x1(%rbp)
lea    -0x5(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    -0x5(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0x5(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%esi
mov    -0x10(%rbp),%rdx
mov    -0x10(%rbp),%rcx
add    $0x5,%rcx
mov    -0x10(%rbp),%rax
movsbl 0x5(%rax),%r8d
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rsi
mov    -0x20(%rbp),%rdx
add    $0x5,%rdx
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
movsbl (%rax),%esi
mov    -0x18(%rbp),%rdx
mov    -0x18(%rbp),%rcx
add    $0xa,%rcx
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x5(%rbp),%rsi
lea    -0x5(%rbp),%rdx
add    $0x1,%rdx
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x5(%rbp),%rdx
add    $0x5,%rdx
lea    0xec3(%rip),%rdi
lea    -0x5(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
mov    -0x10(%rbp),%rdx
add    $0x5,%rdx
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rsi
mov    -0x20(%rbp),%rdx
add    $0x5,%rdx
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
mov    -0x18(%rbp),%rdx
add    $0xa,%rdx
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movb   $0x0,0xc(%rsp)
movl   $0x44434241,0x8(%rsp)
44
lea    0xd(%rsp),%r14
lea    0xed3(%rip),%rdi
lea    0x8(%rsp),%rbx
mov    $0x41,%esi
mov    %rbx,%rdx
mov    %r14,%rcx
xor    %r8d,%r8d
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee4(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
movsbl 0x8(%rsp),%esi
lea    0x12(%rsp),%r15
lea    0xee0(%rip),%rdi
mov    %rbx,%rdx
mov    %r15,%rcx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x9(%rsp),%rdx
lea    0xeec(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef8(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xefd(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf04(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf0b(%rip),%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.a = [5 x i8] c"ABCD\00"
@.str = [50 x i8] c"&a *p3[0] = %c,p3[0] = %c,p3[1] = %c,*p3[1] = %c\0A\00"
@.str.1 = [26 x i8] c"&a p4[0] = %c,p4[1] = %c\0A\00"
@.str.2 = [37 x i8] c"&a p5[0] = %c,p5[0] = %c,p5[1] = %c\0A\00"
@.str.3 = [29 x i8] c"\0Aaddress a[0] = %p,a[1] = %p\00"
@.str.4 = [25 x i8] c"\0Aaddress a = %p,a+1 = %p\00"
@.str.5 = [27 x i8] c"\0Aaddress p3 = %p,p3+1 = %p\00"
@.str.6 = [27 x i8] c"\0Aaddress p4 = %p,p4+1 = %p\00"
@.str.7 = [27 x i8] c"\0Aaddress p5 = %p,p5+1 = %p\00"
define void @main() {
%1 = alloca [5 x i8]
%2 = alloca [5 x i8]*
%3 = alloca [10 x i8]*
%4 = alloca [5 x i8]*
%5 = bitcast [5 x i8]* %1 to i8*
store [5 x i8]* %1, [5 x i8]** %2
%6 = bitcast [5 x i8]* %1 to [10 x i8]*
store [10 x i8]* %6, [10 x i8]** %3
%7 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%8 = bitcast i8* %7 to [5 x i8]*
store [5 x i8]* %8, [5 x i8]** %4
%9 = load [5 x i8]*, [5 x i8]** %2
%10 = getelementptr inbounds [5 x i8], [5 x i8]* %9, i64 0
%11 = getelementptr inbounds [5 x i8], [5 x i8]* %10, i64 0, i64 0
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = load [5 x i8]*, [5 x i8]** %2
%15 = getelementptr inbounds [5 x i8], [5 x i8]* %14, i64 0
%16 = getelementptr inbounds [5 x i8], [5 x i8]* %15, i64 0, i64 0
%17 = load [5 x i8]*, [5 x i8]** %2
%18 = getelementptr inbounds [5 x i8], [5 x i8]* %17, i64 1
%19 = getelementptr inbounds [5 x i8], [5 x i8]* %18, i64 0, i64 0
%20 = load [5 x i8]*, [5 x i8]** %2
%21 = getelementptr inbounds [5 x i8], [5 x i8]* %20, i64 1
%22 = getelementptr inbounds [5 x i8], [5 x i8]* %21, i64 0, i64 0
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 %13, i8* %16, i8* %19, i32 %24)
%26 = load [5 x i8]*, [5 x i8]** %4
%27 = getelementptr inbounds [5 x i8], [5 x i8]* %26, i64 0
%28 = getelementptr inbounds [5 x i8], [5 x i8]* %27, i64 0, i64 0
%29 = load [5 x i8]*, [5 x i8]** %4
%30 = getelementptr inbounds [5 x i8], [5 x i8]* %29, i64 1
%31 = getelementptr inbounds [5 x i8], [5 x i8]* %30, i64 0, i64 0
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %28, i8* %31)
%33 = load [10 x i8]*, [10 x i8]** %3
%34 = getelementptr inbounds [10 x i8], [10 x i8]* %33, i64 0
%35 = getelementptr inbounds [10 x i8], [10 x i8]* %34, i64 0, i64 0
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = load [10 x i8]*, [10 x i8]** %3
%39 = getelementptr inbounds [10 x i8], [10 x i8]* %38, i64 0
%40 = getelementptr inbounds [10 x i8], [10 x i8]* %39, i64 0, i64 0
%41 = load [10 x i8]*, [10 x i8]** %3
%42 = getelementptr inbounds [10 x i8], [10 x i8]* %41, i64 1
%43 = getelementptr inbounds [10 x i8], [10 x i8]* %42, i64 0, i64 0
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %37, i8* %40, i8* %43)
%45 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%46 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 1
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i8* %45, i8* %46)
%48 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 1
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), [5 x i8]* %1, [5 x i8]* %48)
%50 = load [5 x i8]*, [5 x i8]** %2
%51 = load [5 x i8]*, [5 x i8]** %2
%52 = getelementptr inbounds [5 x i8], [5 x i8]* %51, i64 1
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), [5 x i8]* %50, [5 x i8]* %52)
%54 = load [5 x i8]*, [5 x i8]** %4
%55 = load [5 x i8]*, [5 x i8]** %4
%56 = getelementptr inbounds [5 x i8], [5 x i8]* %55, i64 1
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), [5 x i8]* %54, [5 x i8]* %56)
%58 = load [10 x i8]*, [10 x i8]** %3
%59 = load [10 x i8]*, [10 x i8]** %3
%60 = getelementptr inbounds [10 x i8], [10 x i8]* %59, i64 1
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), [10 x i8]* %58, [10 x i8]* %60)
ret void
}

LLVM IR (-O2):
@__const.main.a = [5 x i8] c"ABCD\00"
@.str = [50 x i8] c"&a *p3[0] = %c,p3[0] = %c,p3[1] = %c,*p3[1] = %c\0A\00"
@.str.1 = [26 x i8] c"&a p4[0] = %c,p4[1] = %c\0A\00"
@.str.2 = [37 x i8] c"&a p5[0] = %c,p5[0] = %c,p5[1] = %c\0A\00"
@.str.3 = [29 x i8] c"\0Aaddress a[0] = %p,a[1] = %p\00"
@.str.4 = [25 x i8] c"\0Aaddress a = %p,a+1 = %p\00"
@.str.5 = [27 x i8] c"\0Aaddress p3 = %p,p3+1 = %p\00"
@.str.6 = [27 x i8] c"\0Aaddress p4 = %p,p4+1 = %p\00"
@.str.7 = [27 x i8] c"\0Aaddress p5 = %p,p5+1 = %p\00"
define void @main() {
%1 = alloca [5 x i8]
%2 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%3 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 1
%4 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 65, i8* %2, i8* %4, i32 0)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %2, i8* %4)
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 2
%10 = getelementptr inbounds [5 x i8], [5 x i8]* %9, i64 0, i64 0
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %8, i8* %2, i8* %10)
%12 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 1
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i8* %2, i8* %12)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), [5 x i8]* %1, [5 x i8]* %3)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), [5 x i8]* %1, [5 x i8]* %3)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), [5 x i8]* %1, [5 x i8]* %3)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), [5 x i8]* %1, [5 x i8]* %9)
ret void
}