#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, ...);
int main(void) {
  char c[] = {'a', 'b'};
  char *pc = c;
  pc++;
  printf("*pc=%c\n c=%p\npc=%p\npc-c=%ld\n", *pc, c, pc, pc - c);
  int i[] = {10, 20};
  int *pi = i;
  pi++;
  printf("*pi=%d\n i=%p\npi=%p\npi-i=%ld\n", *pi, i, pi, pi - i);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xee1(%rip),%ax
mov    %ax,-0x2(%rbp)
lea    -0x2(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%esi
lea    -0x2(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x10(%rbp),%r8
lea    -0x2(%rbp),%rax
sub    %rax,%r8
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0xed6(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
lea    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x20(%rbp),%r8
lea    -0x18(%rbp),%rax
sub    %rax,%r8
sar    $0x2,%r8
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movw   $0x6261,0xe(%rsp)
lea    0xf(%rsp),%rcx
lea    0xed9(%rip),%rdi
lea    0xe(%rsp),%rdx
mov    $0x1,%r8d
mov    $0x62,%esi
xor    %eax,%eax
call   1030 <printf@plt>
movabs $0x140000000a,%rax
mov    %rax,0x10(%rsp)
lea    0x14(%rsp),%rcx
lea    0xec4(%rip),%rdi
lea    0x10(%rsp),%rdx
mov    $0x1,%r8d
mov    $0x14,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.c = [2 x i8] c"ab"
@.str = [29 x i8] c"*pc=%c\0A c=%p\0Apc=%p\0Apc-c=%ld\0A\00"
@__const.main.i = [2 x i32] [i32 10, i32 20]
@.str.1 = [29 x i8] c"*pi=%d\0A i=%p\0Api=%p\0Api-i=%ld\0A\00"
define i32 @main() {
%1 = alloca [2 x i8]
%2 = alloca i8*
%3 = alloca [2 x i32]
%4 = alloca i32*
%5 = bitcast [2 x i8]* %1 to i8*
%6 = getelementptr inbounds [2 x i8], [2 x i8]* %1, i64 0, i64 0
store i8* %6, i8** %2
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i32 1
store i8* %8, i8** %2
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = getelementptr inbounds [2 x i8], [2 x i8]* %1, i64 0, i64 0
%13 = load i8*, i8** %2
%14 = load i8*, i8** %2
%15 = getelementptr inbounds [2 x i8], [2 x i8]* %1, i64 0, i64 0
%16 = ptrtoint i8* %14 to i64
%17 = ptrtoint i8* %15 to i64
%18 = sub i64 %16, %17
%19 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %11, i8* %12, i8* %13, i64 %18)
%20 = bitcast [2 x i32]* %3 to i8*
%21 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
store i32* %21, i32** %4
%22 = load i32*, i32** %4
%23 = getelementptr inbounds i32, i32* %22, i32 1
store i32* %23, i32** %4
%24 = load i32*, i32** %4
%25 = load i32, i32* %24
%26 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%27 = load i32*, i32** %4
%28 = load i32*, i32** %4
%29 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%30 = ptrtoint i32* %28 to i64
%31 = ptrtoint i32* %29 to i64
%32 = sub i64 %30, %31
%33 = sdiv exact i64 %32, 4
%34 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %25, i32* %26, i32* %27, i64 %33)
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"*pc=%c\0A c=%p\0Apc=%p\0Apc-c=%ld\0A\00"
@.str.1 = [29 x i8] c"*pi=%d\0A i=%p\0Api=%p\0Api-i=%ld\0A\00"
define i32 @main() {
%1 = alloca i16
%2 = alloca i64
%3 = bitcast i16* %1 to i8*
store i16 25185, i16* %1
%4 = getelementptr inbounds i8, i8* %3, i64 1
%5 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 98, i16* %1, i8* %4, i64 1)
%6 = bitcast i64* %2 to i8*
store i64 85899345930, i64* %2
%7 = bitcast i64* %2 to i32*
%8 = getelementptr inbounds i32, i32* %7, i64 1
%9 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 20, i64* %2, i32* %8, i64 1)
ret i32 0
}