#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 *);
int /*<<< orphan*/ show_float(int);
int /*<<< orphan*/ show_int(int);
int /*<<< orphan*/ show_pointer(int *);
void test_show_bytes(int val) {
  int i = val;
  int f = (float)val;
  int *p = &val;
  printf("Bytes of an integer:\n");
  show_int(i);
  printf("Bytes of a float:\n");
  show_float(f);
  printf("Bytes of a pointer:\n");
  show_pointer(p);
}


x86 assembly (clang, -O0):
<test_show_bytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
cvtsi2ssl -0x4(%rbp),%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0xc(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
call   1050 <show_int@plt>
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%edi
call   1040 <show_float@plt>
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1060 <show_pointer@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_show_bytes>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
cvtsi2ss %edi,%xmm0
mov    %edi,0x4(%rsp)
cvttss2si %xmm0,%ebp
lea    0xea8(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%edi
call   1050 <show_int@plt>
lea    0xeaa(%rip),%rdi
call   1030 <puts@plt>
mov    %ebp,%edi
call   1040 <show_float@plt>
lea    0xea9(%rip),%rdi
call   1030 <puts@plt>
lea    0x4(%rsp),%rdi
call   1060 <show_pointer@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Bytes of an integer:\0A\00"
@.str.1 = [19 x i8] c"Bytes of a float:\0A\00"
@.str.2 = [21 x i8] c"Bytes of a pointer:\0A\00"
define void @test_show_bytes(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
store i32 %0, i32* %2
%6 = load i32, i32* %2
store i32 %6, i32* %3
%7 = load i32, i32* %2
%8 = sitofp i32 %7 to float
%9 = fptosi float %8 to i32
store i32 %9, i32* %4
store i32* %2, i32** %5
%10 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* %3
%12 = call i32 @show_int(i32 %11)
%13 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%14 = load i32, i32* %4
%15 = call i32 @show_float(i32 %14)
%16 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%17 = load i32*, i32** %5
%18 = call i32 @show_pointer(i32* %17)
ret void
}

LLVM IR (-O2):
@str = [21 x i8] c"Bytes of an integer:\00"
@str.3 = [18 x i8] c"Bytes of a float:\00"
@str.4 = [20 x i8] c"Bytes of a pointer:\00"
define void @test_show_bytes(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = sitofp i32 %0 to float
%4 = fptosi float %3 to i32
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @show_int(i32 %0)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.3, i64 0, i64 0))
%8 = tail call i32 @show_float(i32 %4)
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.4, i64 0, i64 0))
%10 = call i32 @show_pointer(i32* %2)
ret void
}