#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() {
  double dArr[5] = {0.0, 1.1, 2.2, 3.3, 4.4};
  double *dPtr = dArr;
  int i = 0;
  dPtr += 1;
  dPtr = 2 + dPtr;
  printf("%.1f\n", *dPtr);
  printf("%.1f\n", *(dPtr - 1));
  i = dPtr - dArr;
  printf("Pointer: %p\n", dPtr);
  printf("Position: %d\n", i);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
movsd  0xed8(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xec3(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xeae(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe99(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x38(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm0
lea    0xe7e(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%rax
movsd  -0x8(%rax),%xmm0
lea    0xe67(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%rax
lea    -0x30(%rbp),%rcx
sub    %rcx,%rax
sar    $0x3,%rax
mov    %eax,-0x3c(%rbp)
mov    -0x38(%rbp),%rsi
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x3c(%rbp),%esi
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movaps 0xedb(%rip),%xmm0
movups %xmm0,0x8(%rsp)
lea    0x18(%rsp),%r14
movaps 0xeda(%rip),%xmm0
movups %xmm0,0x18(%rsp)
lea    0xeee(%rip),%rbx
movsd  0xed6(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xecc(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xec9(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec5(%rip),%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%.1f\0A\00"
@.str.1 = [13 x i8] c"Pointer: %p\0A\00"
@.str.2 = [14 x i8] c"Position: %d\0A\00"
define i32 @main() {
%1 = alloca [5 x double]
%2 = alloca double*
%3 = alloca i32
%4 = bitcast [5 x double]* %1 to i8*
%5 = bitcast i8* %4 to [5 x double]*
%6 = getelementptr inbounds [5 x double], [5 x double]* %5, i32 0, i32 1
store double 1.100000e+00, double* %6
%7 = getelementptr inbounds [5 x double], [5 x double]* %5, i32 0, i32 2
store double 2.200000e+00, double* %7
%8 = getelementptr inbounds [5 x double], [5 x double]* %5, i32 0, i32 3
store double 3.300000e+00, double* %8
%9 = getelementptr inbounds [5 x double], [5 x double]* %5, i32 0, i32 4
store double 4.400000e+00, double* %9
%10 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 0
store double* %10, double** %2
store i32 0, i32* %3
%11 = load double*, double** %2
%12 = getelementptr inbounds double, double* %11, i64 1
store double* %12, double** %2
%13 = load double*, double** %2
%14 = getelementptr inbounds double, double* %13, i64 2
store double* %14, double** %2
%15 = load double*, double** %2
%16 = load double, double* %15
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %16)
%18 = load double*, double** %2
%19 = getelementptr inbounds double, double* %18, i64 -1
%20 = load double, double* %19
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %20)
%22 = load double*, double** %2
%23 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 0
%24 = ptrtoint double* %22 to i64
%25 = ptrtoint double* %23 to i64
%26 = sub i64 %24, %25
%27 = sdiv exact i64 %26, 8
%28 = trunc i64 %27 to i32
store i32 %28, i32* %3
%29 = load double*, double** %2
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), double* %29)
%31 = load i32, i32* %3
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %31)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%.1f\0A\00"
@.str.1 = [13 x i8] c"Pointer: %p\0A\00"
@.str.2 = [14 x i8] c"Position: %d\0A\00"
define i32 @main() {
%1 = alloca [5 x double]
%2 = bitcast [5 x double]* %1 to i8*
%3 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 1
%4 = bitcast double* %3 to <2 x double>*
store <2 x double> <double 1.100000e+00, double 2.200000e+00>, <2 x double>* %4
%5 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 3
%6 = bitcast double* %5 to <2 x double>*
store <2 x double> <double 3.300000e+00, double 4.400000e+00>, <2 x double>* %6
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double 3.300000e+00)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double 2.200000e+00)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), double* %5)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 3)
ret i32 0
}