int main() {
  char ca[] = {'s', 't', 'r', 'i', 'n', 'g'};
  int ia[] = {1, 2, 3, 4, 5, 6};
  char *cpa, *cpb;
  int *ipa, *ipb;
  int n;
  cpa = ca;
  ipa = ia;
  cpb = cpa;
  ipb = ipa;
  cpa++;
  cpb = cpa - 1;
  ipb = ipa + 2;
  n = cpa - cpb;
  printf("cpa - cpb = %d\n", n);
  n = ipb - ipa;
  printf("ipb - ipa = %d\n", n);
  cpa = 0;
  if (cpa == cpb)
    printf("cpa is cpb\n");
  else
    printf("cpa=%X, cpb=%X\n", cpa, cpb);
  printf("\nPress any key to end...");
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xecb(%rip),%eax
mov    %eax,-0xa(%rbp)
mov    0xec5(%rip),%ax
mov    %ax,-0x6(%rbp)
mov    0xec6(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec3(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xec0(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    -0xa(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x40(%rbp)
mov    -0x48(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x50(%rbp)
mov    -0x38(%rbp),%rax
mov    -0x40(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x54(%rbp)
mov    -0x54(%rbp),%esi
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x50(%rbp),%rax
mov    -0x48(%rbp),%rcx
sub    %rcx,%rax
sar    $0x2,%rax
mov    %eax,-0x54(%rbp)
mov    -0x54(%rbp),%esi
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movq   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x40(%rbp),%rax
jne    1213 <main+0xf3>
lea    0xe41(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1229 <main+0x109>
mov    -0x38(%rbp),%rsi
mov    -0x40(%rbp),%rdx
lea    0xe32(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe34(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movw   $0x676e,0x4(%rsp)
movl   $0x69727473,(%rsp)
lea    0xed0(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xecd(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeca(%rip),%rdi
mov    %rsp,%rdx
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec7(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.ca = [6 x i8] c"string"
@__const.main.ia = [6 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6]
@.str = [16 x i8] c"cpa - cpb = %d\0A\00"
@.str.1 = [16 x i8] c"ipb - ipa = %d\0A\00"
@.str.2 = [12 x i8] c"cpa is cpb\0A\00"
@.str.3 = [16 x i8] c"cpa=%X, cpb=%X\0A\00"
@.str.4 = [25 x i8] c"\0APress any key to end...\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x i8]
%3 = alloca [6 x i32]
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32
store i32 0, i32* %1
%9 = bitcast [6 x i8]* %2 to i8*
%10 = bitcast [6 x i32]* %3 to i8*
%11 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
store i8* %11, i8** %4
%12 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 0
store i32* %12, i32** %6
%13 = load i8*, i8** %4
store i8* %13, i8** %5
%14 = load i32*, i32** %6
store i32* %14, i32** %7
%15 = load i8*, i8** %4
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %4
%17 = load i8*, i8** %4
%18 = getelementptr inbounds i8, i8* %17, i64 -1
store i8* %18, i8** %5
%19 = load i32*, i32** %6
%20 = getelementptr inbounds i32, i32* %19, i64 2
store i32* %20, i32** %7
%21 = load i8*, i8** %4
%22 = load i8*, i8** %5
%23 = ptrtoint i8* %21 to i64
%24 = ptrtoint i8* %22 to i64
%25 = sub i64 %23, %24
%26 = trunc i64 %25 to i32
store i32 %26, i32* %8
%27 = load i32, i32* %8
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %27)
%29 = load i32*, i32** %7
%30 = load i32*, i32** %6
%31 = ptrtoint i32* %29 to i64
%32 = ptrtoint i32* %30 to i64
%33 = sub i64 %31, %32
%34 = sdiv exact i64 %33, 4
%35 = trunc i64 %34 to i32
store i32 %35, i32* %8
%36 = load i32, i32* %8
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %36)
store i8* null, i8** %4
%38 = load i8*, i8** %4
%39 = load i8*, i8** %5
%40 = icmp eq i8* %38, %39
br i1 %40, label %41, label %43
41: ; preds = %0
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %47
43: ; preds = %0
%44 = load i8*, i8** %4
%45 = load i8*, i8** %5
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* %44, i8* %45)
br label %47
47: ; preds = %43, %41
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
%49 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@__const.main.ca = [6 x i8] c"string"
@.str = [16 x i8] c"cpa - cpb = %d\0A\00"
@.str.1 = [16 x i8] c"ipb - ipa = %d\0A\00"
@.str.3 = [16 x i8] c"cpa=%X, cpb=%X\0A\00"
@.str.4 = [25 x i8] c"\0APress any key to end...\00"
define i32 @main() {
%1 = alloca [6 x i8]
%2 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 1)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 2)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* null, i8* %2)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
%7 = call i32 (...) @getchar()
ret i32 0
}