#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(int argc, char *argv[]) {
  long a[5] = {1, 2, 3, 4, 5};
  long *p, *b;
  b = &a[0];
  p = &a[1];
  printf("sizeof(long)=%lu\n", sizeof(long));
  printf("&a[1]=%p\n", p);
  printf("&a[0]=%p\n", b);
  printf("&a[1] - &a[0]=%ld\n", &a[1] - &a[0]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
movq   $0x1,-0x40(%rbp)
movq   $0x2,-0x38(%rbp)
movq   $0x3,-0x30(%rbp)
movq   $0x4,-0x28(%rbp)
movq   $0x5,-0x20(%rbp)
lea    -0x40(%rbp),%rax
mov    %rax,-0x50(%rbp)
lea    -0x40(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x48(%rbp)
lea    0xe77(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x48(%rbp),%rsi
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x50(%rbp),%rsi
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x40(%rbp),%rsi
add    $0x8,%rsi
lea    -0x40(%rbp),%rax
sub    %rax,%rsi
sar    $0x3,%rsi
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
lea    0x8(%rsp),%rbx
movaps 0xedf(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xee4(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movq   $0x5,0x20(%rsp)
lea    0xedf(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xede(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed7(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed0(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"sizeof(long)=%lu\0A\00"
@.str.1 = [10 x i8] c"&a[1]=%p\0A\00"
@.str.2 = [10 x i8] c"&a[0]=%p\0A\00"
@.str.3 = [19 x i8] c"&a[1] - &a[0]=%ld\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [5 x i64]
%7 = alloca i64*
%8 = alloca i64*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = bitcast [5 x i64]* %6 to i8*
%10 = bitcast i8* %9 to [5 x i64]*
%11 = getelementptr inbounds [5 x i64], [5 x i64]* %10, i32 0, i32 0
store i64 1, i64* %11
%12 = getelementptr inbounds [5 x i64], [5 x i64]* %10, i32 0, i32 1
store i64 2, i64* %12
%13 = getelementptr inbounds [5 x i64], [5 x i64]* %10, i32 0, i32 2
store i64 3, i64* %13
%14 = getelementptr inbounds [5 x i64], [5 x i64]* %10, i32 0, i32 3
store i64 4, i64* %14
%15 = getelementptr inbounds [5 x i64], [5 x i64]* %10, i32 0, i32 4
store i64 5, i64* %15
%16 = getelementptr inbounds [5 x i64], [5 x i64]* %6, i64 0, i64 0
store i64* %16, i64** %8
%17 = getelementptr inbounds [5 x i64], [5 x i64]* %6, i64 0, i64 1
store i64* %17, i64** %7
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 8)
%19 = load i64*, i64** %7
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i64* %19)
%21 = load i64*, i64** %8
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i64* %21)
%23 = getelementptr inbounds [5 x i64], [5 x i64]* %6, i64 0, i64 1
%24 = getelementptr inbounds [5 x i64], [5 x i64]* %6, i64 0, i64 0
%25 = ptrtoint i64* %23 to i64
%26 = ptrtoint i64* %24 to i64
%27 = sub i64 %25, %26
%28 = sdiv exact i64 %27, 8
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i64 %28)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"sizeof(long)=%lu\0A\00"
@.str.1 = [10 x i8] c"&a[1]=%p\0A\00"
@.str.2 = [10 x i8] c"&a[0]=%p\0A\00"
@.str.3 = [19 x i8] c"&a[1] - &a[0]=%ld\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [5 x i64]
%4 = bitcast [5 x i64]* %3 to i8*
%5 = getelementptr inbounds [5 x i64], [5 x i64]* %3, i64 0, i64 0
%6 = getelementptr inbounds [5 x i64], [5 x i64]* %3, i64 0, i64 1
%7 = bitcast [5 x i64]* %3 to <2 x i64>*
store <2 x i64> <i64 1, i64 2>, <2 x i64>* %7
%8 = getelementptr inbounds [5 x i64], [5 x i64]* %3, i64 0, i64 2
%9 = bitcast i64* %8 to <2 x i64>*
store <2 x i64> <i64 3, i64 4>, <2 x i64>* %9
%10 = getelementptr inbounds [5 x i64], [5 x i64]* %3, i64 0, i64 4
store i64 5, i64* %10
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 8)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i64* %6)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i64* %5)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i64 1)
ret i32 0
}