int main() {
  const int *a1;
  int const *a2;
  int b = 10;
  a1 = &b;
  printf("a1 ---> %8X\n", a1);
  printf("*a1 ---> %7X\n", *a1);
  printf("%8X\n", ++a1);
  int c = 10;
  int *const a3 = &c;
  printf("a3  ---> %8X\n", a3);
  printf("*a3 ---> %8X\n", *a3);
  printf("++(*a3) --> %5X\n", ++(*a3));
  int d = 10;
  int const *const a4 = &d;
  printf("a4  --> %8X\n", a4);
  printf("*a4  --> %7X\n", *a4);
  d = 11;
  printf("*a4  --> %7X\n", *a4);
  printf("a4  --> %8X\n", a4);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0xa,-0x14(%rbp)
lea    -0x14(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
add    $0x4,%rsi
mov    %rsi,-0x8(%rbp)
lea    0xef0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xa,-0x18(%rbp)
lea    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
add    $0x1,%esi
mov    %esi,(%rax)
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xa,-0x24(%rbp)
lea    -0x24(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rsi
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%rax
mov    (%rax),%esi
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xb,-0x24(%rbp)
mov    -0x30(%rbp),%rax
mov    (%rax),%esi
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%rsi
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movl   $0xa,0xc(%rsp)
lea    0xed8(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
lea    0xece(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x10(%rsp),%rsi
lea    0xefe(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movl   $0xa,0x4(%rsp)
lea    0xeb3(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
lea    0xeaa(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
add    $0x1,%esi
mov    %esi,0x4(%rsp)
lea    0xe9f(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movl   $0xa,0x8(%rsp)
lea    0xe9a(%rip),%r15
lea    0x8(%rsp),%r14
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x8(%rsp),%esi
lea    0xe8a(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movl   $0xb,0x8(%rsp)
mov    %rbx,%rdi
mov    $0xb,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [13 x i8] c"a1 ---> %8X\0A\00"
@.str.1 = [14 x i8] c"*a1 ---> %7X\0A\00"
@.str.2 = [5 x i8] c"%8X\0A\00"
@.str.3 = [14 x i8] c"a3 ---> %8X\0A\00"
@.str.4 = [14 x i8] c"*a3 ---> %8X\0A\00"
@.str.5 = [17 x i8] c"++(*a3) --> %5X\0A\00"
@.str.6 = [13 x i8] c"a4 --> %8X\0A\00"
@.str.7 = [14 x i8] c"*a4 --> %7X\0A\00"
define i32 @main() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32*
store i32 10, i32* %3
store i32* %3, i32** %1
%8 = load i32*, i32** %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32* %8)
%10 = load i32*, i32** %1
%11 = load i32, i32* %10
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = load i32*, i32** %1
%14 = getelementptr inbounds i32, i32* %13, i32 1
store i32* %14, i32** %1
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32* %14)
store i32 10, i32* %4
store i32* %4, i32** %5
%16 = load i32*, i32** %5
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32* %16)
%18 = load i32*, i32** %5
%19 = load i32, i32* %18
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 %19)
%21 = load i32*, i32** %5
%22 = load i32, i32* %21
%23 = add nsw i32 %22, 1
store i32 %23, i32* %21
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i32 %23)
store i32 10, i32* %6
store i32* %6, i32** %7
%25 = load i32*, i32** %7
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i32* %25)
%27 = load i32*, i32** %7
%28 = load i32, i32* %27
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 %28)
store i32 11, i32* %6
%30 = load i32*, i32** %7
%31 = load i32, i32* %30
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 %31)
%33 = load i32*, i32** %7
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i32* %33)
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"a1 ---> %8X\0A\00"
@.str.1 = [14 x i8] c"*a1 ---> %7X\0A\00"
@.str.2 = [5 x i8] c"%8X\0A\00"
@.str.3 = [14 x i8] c"a3 ---> %8X\0A\00"
@.str.4 = [14 x i8] c"*a3 ---> %8X\0A\00"
@.str.5 = [17 x i8] c"++(*a3) --> %5X\0A\00"
@.str.6 = [13 x i8] c"a4 --> %8X\0A\00"
@.str.7 = [14 x i8] c"*a4 --> %7X\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
store i32 10, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = getelementptr inbounds i32, i32* %1, i64 1
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32* %8)
%10 = bitcast i32* %2 to i8*
store i32 10, i32* %2
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%12 = load i32, i32* %2
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 %12)
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 1
store i32 %15, i32* %2
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i32 %15)
%17 = bitcast i32* %3 to i8*
store i32 10, i32* %3
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i32* %3)
%19 = load i32, i32* %3
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 %19)
store i32 11, i32* %3
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 11)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i32* %3)
ret i32 0
}