#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 *, ...);
void three() {
  int a[] = {18, 17, 16, 15, 14, 13, 12, 11};
  int *start = a, *end = &a[7];
  printf("address start = %p, end = %p\n", start, end);
  printf("*(start+2) = %d, *(--end) = %d\n", *(start + 2), *(--end));
  printf("(--end) - (start+2) = %ld\n", (--end) - (start + 2));
}


x86 assembly (clang, -O0):
<three>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0xee1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xede(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xedb(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xed8(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    -0x20(%rbp),%rax
add    $0x1c,%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%esi
mov    -0x30(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffffc,%rcx
mov    %rcx,-0x30(%rbp)
mov    -0x4(%rax),%edx
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%rsi
add    $0xfffffffffffffffc,%rsi
mov    %rsi,-0x30(%rbp)
mov    -0x28(%rbp),%rax
add    $0x8,%rax
sub    %rax,%rsi
sar    $0x2,%rsi
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<three>:
sub    $0x28,%rsp
movaps 0xef5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x1c(%rsp),%rdx
lea    0xee9(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x8(%rsp),%esi
mov    0x18(%rsp),%edx
lea    0xeee(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf00(%rip),%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x28,%rsp
ret

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

LLVM IR (-O2):
@__const.three.a = [8 x i32] [i32 18, i32 17, i32 16, i32 15, i32 14, i32 13, i32 12, i32 11]
@.str = [30 x i8] c"address start = %p, end = %p\0A\00"
@.str.1 = [32 x i8] c"*(start+2) = %d, *(--end) = %d\0A\00"
@.str.2 = [27 x i8] c"(--end) - (start+2) = %ld\0A\00"
define void @three() {
%1 = alloca [8 x i32]
%2 = bitcast [8 x i32]* %1 to i8*
%3 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%4 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 7
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4)
%6 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 2
%7 = load i32, i32* %6
%8 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 6
%9 = load i32, i32* %8
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %7, i32 %9)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i64 3)
ret void
}