#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, long);
int /*<<< orphan*/ show_float(float);
int /*<<< orphan*/ show_int(int);
int /*<<< orphan*/ show_pointer(void *);
int main() {
  int x = 0x12345678;
  float f = 0x1;
  int *p = &x;
  show_int(x);
  show_float(f);
  show_pointer((void *)p);
  printf("p pointer addr %p\n", (void *)p);
  printf("*p pointer addr %p\n", (void *)&p);
  printf("*p val 0x%lx\n", (long)&p);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x12345678,-0x8(%rbp)
movss  0xea2(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <show_int@plt>
movss  -0xc(%rbp),%xmm0
call   1040 <show_float@plt>
mov    -0x18(%rbp),%rdi
call   1060 <show_pointer@plt>
mov    -0x18(%rbp),%rsi
lea    0xe74(%rip),%rdi
call   1030 <printf@plt>
lea    -0x18(%rbp),%rsi
lea    0xe63(%rip),%rdi
call   1030 <printf@plt>
lea    -0x18(%rbp),%rsi
lea    0xe67(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x12345678,0x4(%rsp)
12
lea    0x4(%rsp),%rbx
mov    %rbx,0x8(%rsp)
mov    $0x12345678,%edi
call   1050 <show_int@plt>
movss  0xe97(%rip),%xmm0
call   1040 <show_float@plt>
mov    %rbx,%rdi
call   1060 <show_pointer@plt>
lea    0xe88(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
lea    0xe78(%rip),%rdi
lea    0x8(%rsp),%rbx
mov    %rbx,%rsi
call   1030 <printf@plt>
lea    0xe78(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"p pointer addr %p\0A\00"
@.str.1 = [20 x i8] c"*p pointer addr %p\0A\00"
@.str.2 = [14 x i8] c"*p val 0x%lx\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca i32*
store i32 0, i32* %1
store i32 305419896, i32* %2
store float 1.000000e+00, float* %3
store i32* %2, i32** %4
%5 = load i32, i32* %2
%6 = call i32 @show_int(i32 %5)
%7 = load float, float* %3
%8 = call i32 @show_float(float %7)
%9 = load i32*, i32** %4
%10 = bitcast i32* %9 to i8*
%11 = call i32 @show_pointer(i8* %10)
%12 = load i32*, i32** %4
%13 = bitcast i32* %12 to i8*
%14 = ptrtoint i8* %13 to i64
%15 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i64 %14)
%16 = bitcast i32** %4 to i8*
%17 = ptrtoint i8* %16 to i64
%18 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i64 %17)
%19 = ptrtoint i32** %4 to i64
%20 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i64 %19)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"p pointer addr %p\0A\00"
@.str.1 = [20 x i8] c"*p pointer addr %p\0A\00"
@.str.2 = [14 x i8] c"*p val 0x%lx\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = bitcast i32* %1 to i8*
store i32 305419896, i32* %1
%4 = bitcast i32** %2 to i8*
store i32* %1, i32** %2
%5 = call i32 @show_int(i32 305419896)
%6 = call i32 @show_float(float 1.000000e+00)
%7 = call i32 @show_pointer(i8* %3)
%8 = ptrtoint i32* %1 to i64
%9 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i64 %8)
%10 = ptrtoint i32** %2 to i64
%11 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i64 %10)
%12 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i64 %10)
ret i32 0
}