main() {
  int x[2];
  x[1] = 5;
  set(x, 2);
  set(&x[1], 3);
  assert(*x == 2);
  assert(x[1] == 3);
  assert(0 == 1 + (x[0] - x[1]));
  assert(x == &x);
  assert(x == &x[0]);
  assert(x == x + 0);
  assert(x + 1 == &x[1]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
lea    -0xc(%rbp),%rdi
mov    $0x2,%esi
mov    $0x0,%al
call   1040 <set@plt>
lea    -0xc(%rbp),%rdi
add    $0x4,%rdi
mov    $0x3,%esi
mov    $0x0,%al
call   1040 <set@plt>
cmpl   $0x2,-0xc(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1030 <assert@plt>
cmpl   $0x3,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1030 <assert@plt>
mov    -0xc(%rbp),%ecx
sub    -0x8(%rbp),%ecx
add    $0x1,%ecx
xor    %eax,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1030 <assert@plt>
lea    -0xc(%rbp),%rax
lea    -0xc(%rbp),%rcx
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1030 <assert@plt>
lea    -0xc(%rbp),%rax
lea    -0xc(%rbp),%rcx
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1030 <assert@plt>
lea    -0xc(%rbp),%rax
lea    -0xc(%rbp),%rcx
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1030 <assert@plt>
lea    -0xc(%rbp),%rax
add    $0x4,%rax
lea    -0xc(%rbp),%rcx
add    $0x4,%rcx
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
movl   $0x5,0xc(%rsp)
lea    0x8(%rsp),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <set@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <set@plt>
xor    %edi,%edi
cmpl   $0x2,0x8(%rsp)
sete   %dil
xor    %eax,%eax
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x3,0xc(%rsp)
sete   %dil
xor    %eax,%eax
call   1030 <assert@plt>
mov    0x8(%rsp),%eax
sub    0xc(%rsp),%eax
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
xor    %eax,%eax
call   1030 <assert@plt>
mov    $0x1,%edi
xor    %eax,%eax
call   1030 <assert@plt>
mov    $0x1,%edi
xor    %eax,%eax
call   1030 <assert@plt>
mov    $0x1,%edi
xor    %eax,%eax
call   1030 <assert@plt>
mov    $0x1,%edi
xor    %eax,%eax
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x i32]
store i32 0, i32* %1
%3 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
store i32 5, i32* %3
%4 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%5 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @set to i32 (i32*, i32, ...)*)(i32* %4, i32 2)
%6 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%7 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @set to i32 (i32*, i32, ...)*)(i32* %6, i32 3)
%8 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%9 = load i32, i32* %8
%10 = icmp eq i32 %9, 2
%11 = zext i1 %10 to i32
%12 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %11)
%13 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%14 = load i32, i32* %13
%15 = icmp eq i32 %14, 3
%16 = zext i1 %15 to i32
%17 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %16)
%18 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%19 = load i32, i32* %18
%20 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%21 = load i32, i32* %20
%22 = sub nsw i32 %19, %21
%23 = add nsw i32 1, %22
%24 = icmp eq i32 0, %23
%25 = zext i1 %24 to i32
%26 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %25)
%27 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%28 = bitcast [2 x i32]* %2 to i32*
%29 = icmp eq i32* %27, %28
%30 = zext i1 %29 to i32
%31 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %30)
%32 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%33 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%34 = icmp eq i32* %32, %33
%35 = zext i1 %34 to i32
%36 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %35)
%37 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%38 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%39 = getelementptr inbounds i32, i32* %38, i64 0
%40 = icmp eq i32* %37, %39
%41 = zext i1 %40 to i32
%42 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %41)
%43 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%44 = getelementptr inbounds i32, i32* %43, i64 1
%45 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%46 = icmp eq i32* %44, %45
%47 = zext i1 %46 to i32
%48 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %47)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [2 x i32]
%2 = bitcast [2 x i32]* %1 to i8*
%3 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 1
store i32 5, i32* %3
%4 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
%5 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @set to i32 (i32*, i32, ...)*)(i32* %4, i32 2)
%6 = call i32 (i32*, i32, ...) bitcast (i32 (...)* @set to i32 (i32*, i32, ...)*)(i32* %3, i32 3)
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 2
%9 = zext i1 %8 to i32
%10 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %9)
%11 = load i32, i32* %3
%12 = icmp eq i32 %11, 3
%13 = zext i1 %12 to i32
%14 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %13)
%15 = load i32, i32* %4
%16 = load i32, i32* %3
%17 = sub nsw i32 %15, %16
%18 = icmp eq i32 %17, -1
%19 = zext i1 %18 to i32
%20 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %19)
%21 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 1)
%22 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 1)
%23 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 1)
%24 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 1)
ret i32 0
}