int main() {
  int *a = 100;
  int b = 200, *c, **d;
  c = &a;
  d = &c;
  printf("a=%d &a=%d\n", a, &a);
  printf("*c=%d c=%d\n", *c, c);
  printf("**d=%d *d=%d\n", **d, *d);
  printf("addr of b = %d\n", &b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x64,%eax
mov    %rax,-0x10(%rbp)
movl   $0xc8,-0x14(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xeb6(%rip),%rdi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
mov    -0x20(%rbp),%rdx
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%esi
mov    -0x28(%rbp),%rax
mov    (%rax),%rdx
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe94(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movq   $0x64,(%rsp)
movl   $0xc8,0xc(%rsp)
lea    0xed4(%rip),%rdi
mov    %rsp,%rbx
mov    $0x64,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rsp),%esi
lea    0xec4(%rip),%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rsp),%esi
lea    0xebc(%rip),%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb9(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"a=%d &a=%d\0A\00"
@.str.1 = [12 x i8] c"*c=%d c=%d\0A\00"
@.str.2 = [14 x i8] c"**d=%d *d=%d\0A\00"
@.str.3 = [16 x i8] c"addr of b = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32**
store i32 0, i32* %1
store i32* inttoptr (i64 100 to i32*), i32** %2
store i32 200, i32* %3
%6 = bitcast i32** %2 to i32*
store i32* %6, i32** %4
store i32** %4, i32*** %5
%7 = load i32*, i32** %2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32* %7, i32** %2)
%9 = load i32*, i32** %4
%10 = load i32, i32* %9
%11 = load i32*, i32** %4
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %10, i32* %11)
%13 = load i32**, i32*** %5
%14 = load i32*, i32** %13
%15 = load i32, i32* %14
%16 = load i32**, i32*** %5
%17 = load i32*, i32** %16
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %15, i32* %17)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32* %3)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"a=%d &a=%d\0A\00"
@.str.1 = [12 x i8] c"*c=%d c=%d\0A\00"
@.str.2 = [14 x i8] c"**d=%d *d=%d\0A\00"
@.str.3 = [16 x i8] c"addr of b = %d\0A\00"
define i32 @main() {
%1 = alloca i32*
%2 = alloca i32
%3 = bitcast i32** %1 to i8*
store i32* inttoptr (i64 100 to i32*), i32** %1
%4 = bitcast i32* %2 to i8*
store i32 200, i32* %2
%5 = bitcast i32** %1 to i32*
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32* inttoptr (i64 100 to i32*), i32** %1)
%7 = load i32, i32* %5
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %7, i32** %1)
%9 = load i32, i32* %5
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %9, i32** %1)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32* %2)
ret i32 0
}