void main() {
  int c[4] = {1, 2, 3, 4};
  int i;
  int *a[4];
  int(*b)[4];
  int m = c;
  b = &c;
  printf("Array c:\n");
  for (i = 0; i < 4; i++) {
    a[i] = &c[i];
    printf("%-3d ", *a[i]);
  }
  printf("\nB++ Move %d %d bytes\n", b + 1, b);
  printf("\nA++ Move %d %d bytes\n", a + 1, a);
  printf("\n*a[1] = %d\n(*b)[2]=%d", *a[1], (*b)[2]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0xee1(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xede(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    -0x10(%rbp),%rax
mov    %eax,-0x4c(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x48(%rbp)
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    119b <main+0x8b>
movslq -0x14(%rbp),%rax
lea    -0x10(%rbp),%rcx
shl    $0x2,%rax
add    %rax,%rcx
movslq -0x14(%rbp),%rax
mov    %rcx,-0x40(%rbp,%rax,8)
movslq -0x14(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rax
mov    (%rax),%esi
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1152 <main+0x42>
mov    -0x48(%rbp),%rsi
add    $0x10,%rsi
mov    -0x48(%rbp),%rdx
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x40(%rbp),%rsi
add    $0x8,%rsi
lea    -0x40(%rbp),%rdx
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%rax
mov    (%rax),%esi
mov    -0x48(%rbp),%rax
mov    0x8(%rax),%edx
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
movaps 0xed0(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xf20(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%r15
mov    %r15,0x10(%rsp)
lea    0xec1(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rax
lea    0x18(%rsp),%r14
mov    %rax,0x18(%rsp)
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rax
mov    %rax,0x20(%rsp)
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rsp),%rax
mov    %rax,0x28(%rsp)
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x10(%rsp),%rsi
lea    0xe5f(%rip),%rdi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe65(%rip),%rdi
lea    0x10(%rsp),%rdx
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%rsp),%rax
mov    (%rax),%esi
mov    0x8(%rsp),%edx
lea    0xe5b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.c = [4 x i32] [i32 1, i32 2, i32 3, i32 4]
@.str = [10 x i8] c"Array c:\0A\00"
@.str.1 = [6 x i8] c"%-3d \00"
@.str.2 = [23 x i8] c"\0AB++ Move %d %d bytes\0A\00"
@.str.3 = [23 x i8] c"\0AA++ Move %d %d bytes\0A\00"
@.str.4 = [23 x i8] c"\0A*a[1] = %d\0A(*b)[2]=%d\00"
define void @main() {
%1 = alloca [4 x i32]
%2 = alloca i32
%3 = alloca [4 x i32*]
%4 = alloca [4 x i32]*
%5 = alloca i32
%6 = bitcast [4 x i32]* %1 to i8*
%7 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%8 = ptrtoint i32* %7 to i32
store i32 %8, i32* %5
store [4 x i32]* %1, [4 x i32]** %4
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %10
10: ; preds = %26, %0
%11 = load i32, i32* %2
%12 = icmp slt i32 %11, 4
br i1 %12, label %13, label %29
13: ; preds = %10
%14 = load i32, i32* %2
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 %15
%17 = load i32, i32* %2
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [4 x i32*], [4 x i32*]* %3, i64 0, i64 %18
store i32* %16, i32** %19
%20 = load i32, i32* %2
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [4 x i32*], [4 x i32*]* %3, i64 0, i64 %21
%23 = load i32*, i32** %22
%24 = load i32, i32* %23
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %13
%27 = load i32, i32* %2
%28 = add nsw i32 %27, 1
store i32 %28, i32* %2
br label %10
29: ; preds = %10
%30 = load [4 x i32]*, [4 x i32]** %4
%31 = getelementptr inbounds [4 x i32], [4 x i32]* %30, i64 1
%32 = load [4 x i32]*, [4 x i32]** %4
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), [4 x i32]* %31, [4 x i32]* %32)
%34 = getelementptr inbounds [4 x i32*], [4 x i32*]* %3, i64 0, i64 0
%35 = getelementptr inbounds i32*, i32** %34, i64 1
%36 = getelementptr inbounds [4 x i32*], [4 x i32*]* %3, i64 0, i64 0
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32** %35, i32** %36)
%38 = getelementptr inbounds [4 x i32*], [4 x i32*]* %3, i64 0, i64 1
%39 = load i32*, i32** %38
%40 = load i32, i32* %39
%41 = load [4 x i32]*, [4 x i32]** %4
%42 = getelementptr inbounds [4 x i32], [4 x i32]* %41, i64 0, i64 2
%43 = load i32, i32* %42
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 %40, i32 %43)
ret void
}

LLVM IR (-O2):
@__const.main.c = [4 x i32] [i32 1, i32 2, i32 3, i32 4]
@.str.1 = [6 x i8] c"%-3d \00"
@.str.2 = [23 x i8] c"\0AB++ Move %d %d bytes\0A\00"
@.str.3 = [23 x i8] c"\0AA++ Move %d %d bytes\0A\00"
@.str.4 = [23 x i8] c"\0A*a[1] = %d\0A(*b)[2]=%d\00"
@str = [9 x i8] c"Array c:\00"
define void @main() {
%1 = alloca [4 x i32]
%2 = alloca [4 x i32*]
%3 = bitcast [4 x i32]* %1 to i8*
%4 = bitcast [4 x i32*]* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%6 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%7 = getelementptr inbounds [4 x i32*], [4 x i32*]* %2, i64 0, i64 0
store i32* %6, i32** %7
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 1)
%9 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 1
%10 = getelementptr inbounds [4 x i32*], [4 x i32*]* %2, i64 0, i64 1
store i32* %9, i32** %10
%11 = load i32, i32* %9
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 2
%14 = getelementptr inbounds [4 x i32*], [4 x i32*]* %2, i64 0, i64 2
store i32* %13, i32** %14
%15 = load i32, i32* %13
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 3
%18 = getelementptr inbounds [4 x i32*], [4 x i32*]* %2, i64 0, i64 3
store i32* %17, i32** %18
%19 = load i32, i32* %17
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %19)
%21 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 1
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), [4 x i32]* %21, [4 x i32]* %1)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32** %10, i32** %7)
%24 = load i32*, i32** %10
%25 = load i32, i32* %24
%26 = load i32, i32* %13
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 %25, i32 %26)
ret void
}