int main(int argc, char *argv[]) {
  int *p;
  p = (int *)malloc(sizeof(int));
  (*p) = 100;
  (*p)++;
  (*p) *= 5;
  printf("%p\n", &p);
  printf("p = %p, *p = %d (hex=%x,oct=%o)\n", p, *p, *p, *p);
  printf("Ooops: %d\n", p);
  printf("Hex:   %x\n", p);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x64,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
imul   $0x5,(%rax),%ecx
mov    %ecx,(%rax)
lea    0xe9e(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    (%rax),%r8d
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,(%rsp)
movl   $0x1f9,(%rax)
lea    0xec4(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rsp),%rsi
mov    (%rsi),%ecx
lea    0xeb1(%rip),%rdi
mov    %ecx,%edx
mov    %ecx,%r8d
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rsp),%rsi
lea    0xebb(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rsp),%rsi
lea    0xeb4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%p\0A\00"
@.str.1 = [33 x i8] c"p = %p, *p = %d (hex=%x,oct=%o)\0A\00"
@.str.2 = [11 x i8] c"Ooops: %d\0A\00"
@.str.3 = [11 x i8] c"Hex: %x\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32*
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = call i8* @malloc(i64 4)
%7 = bitcast i8* %6 to i32*
store i32* %7, i32** %5
%8 = load i32*, i32** %5
store i32 100, i32* %8
%9 = load i32*, i32** %5
%10 = load i32, i32* %9
%11 = add nsw i32 %10, 1
store i32 %11, i32* %9
%12 = load i32*, i32** %5
%13 = load i32, i32* %12
%14 = mul nsw i32 %13, 5
store i32 %14, i32* %12
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32** %5)
%16 = load i32*, i32** %5
%17 = load i32*, i32** %5
%18 = load i32, i32* %17
%19 = load i32*, i32** %5
%20 = load i32, i32* %19
%21 = load i32*, i32** %5
%22 = load i32, i32* %21
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i32* %16, i32 %18, i32 %20, i32 %22)
%24 = load i32*, i32** %5
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32* %24)
%26 = load i32*, i32** %5
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32* %26)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%p\0A\00"
@.str.1 = [33 x i8] c"p = %p, *p = %d (hex=%x,oct=%o)\0A\00"
@.str.2 = [11 x i8] c"Ooops: %d\0A\00"
@.str.3 = [11 x i8] c"Hex: %x\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32*
%4 = bitcast i32** %3 to i8*
%5 = tail call dereferenceable_or_null(4) i8* @malloc(i64 4)
%6 = bitcast i32** %3 to i8**
store i8* %5, i8** %6
%7 = bitcast i8* %5 to i32*
store i32 505, i32* %7
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32** %3)
%9 = load i32*, i32** %3
%10 = load i32, i32* %9
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i32* %9, i32 %10, i32 %10, i32 %10)
%12 = load i32*, i32** %3
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32* %12)
%14 = load i32*, i32** %3
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32* %14)
ret i32 0
}