int main() {
  {
    char a[10];
    char *pa1, *pa2;
    pa1 = &a[0];
    pa2 = &a[10];
    printf("length = %d, %X, %X\n", pa2 - pa1, pa2, pa1);
  }
  {
    int a[10];
    int *pa1, *pa2;
    pa1 = &a[0];
    pa2 = &a[10];
    printf("length = %d, %X, %X\n", pa2 - pa1, pa2, pa1);
  }
  {
    double a[10];
    double *pa1, *pa2;
    pa1 = &a[0];
    pa2 = &a[10];
    printf("length = %d, %X, %X\n", pa2 - pa1, pa2, pa1);
  }
  printf("\nPress any key to end...");
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xe(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0xe(%rbp),%rax
add    $0xa,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rax
sub    %rax,%rsi
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x50(%rbp),%rax
mov    %rax,-0x58(%rbp)
lea    -0x50(%rbp),%rax
add    $0x28,%rax
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rsi
mov    -0x58(%rbp),%rax
sub    %rax,%rsi
sar    $0x2,%rsi
mov    -0x60(%rbp),%rdx
mov    -0x58(%rbp),%rcx
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xb0(%rbp),%rax
mov    %rax,-0xb8(%rbp)
lea    -0xb0(%rbp),%rax
add    $0x50,%rax
mov    %rax,-0xc0(%rbp)
mov    -0xc0(%rbp),%rsi
mov    -0xb8(%rbp),%rax
sub    %rax,%rsi
sar    $0x3,%rsi
mov    -0xc0(%rbp),%rdx
mov    -0xb8(%rbp),%rcx
lea    0xe16(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe1d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
lea    0xa(%rsp),%rdx
lea    0xecf(%rip),%rbx
mov    %rsp,%rcx
mov    $0xa,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x28(%rsp),%rdx
mov    %rsp,%rcx
mov    $0xa,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x50(%rsp),%rdx
mov    %rsp,%rcx
mov    $0xa,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe9d(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"length = %d, %X, %X\0A\00"
@.str.1 = [25 x i8] c"\0APress any key to end...\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [10 x i32]
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca [10 x double]
%9 = alloca double*
%10 = alloca double*
store i32 0, i32* %1
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
store i8* %11, i8** %3
%12 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 10
store i8* %12, i8** %4
%13 = load i8*, i8** %4
%14 = load i8*, i8** %3
%15 = ptrtoint i8* %13 to i64
%16 = ptrtoint i8* %14 to i64
%17 = sub i64 %15, %16
%18 = load i8*, i8** %4
%19 = load i8*, i8** %3
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i64 %17, i8* %18, i8* %19)
%21 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 0
store i32* %21, i32** %6
%22 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 10
store i32* %22, i32** %7
%23 = load i32*, i32** %7
%24 = load i32*, i32** %6
%25 = ptrtoint i32* %23 to i64
%26 = ptrtoint i32* %24 to i64
%27 = sub i64 %25, %26
%28 = sdiv exact i64 %27, 4
%29 = load i32*, i32** %7
%30 = load i32*, i32** %6
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i64 %28, i32* %29, i32* %30)
%32 = getelementptr inbounds [10 x double], [10 x double]* %8, i64 0, i64 0
store double* %32, double** %9
%33 = getelementptr inbounds [10 x double], [10 x double]* %8, i64 0, i64 10
store double* %33, double** %10
%34 = load double*, double** %10
%35 = load double*, double** %9
%36 = ptrtoint double* %34 to i64
%37 = ptrtoint double* %35 to i64
%38 = sub i64 %36, %37
%39 = sdiv exact i64 %38, 8
%40 = load double*, double** %10
%41 = load double*, double** %9
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i64 %39, double* %40, double* %41)
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%44 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"length = %d, %X, %X\0A\00"
@.str.1 = [25 x i8] c"\0APress any key to end...\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = alloca [10 x i32]
%3 = alloca [10 x double]
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 10
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i64 10, i8* %5, i8* %4)
%7 = bitcast [10 x i32]* %2 to i8*
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 10
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i64 10, i32* %9, i32* %8)
%11 = bitcast [10 x double]* %3 to i8*
%12 = getelementptr inbounds [10 x double], [10 x double]* %3, i64 0, i64 0
%13 = getelementptr inbounds [10 x double], [10 x double]* %3, i64 0, i64 10
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i64 10, double* %13, double* %12)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%16 = call i32 (...) @getchar()
ret i32 0
}