#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(float);
int /*<<< orphan*/ show_int(int);
int /*<<< orphan*/ show_pointer(int *);
void test_show_bytes(int val) {
  int ival = val;
  float fval = (float)ival;
  int *pval = &ival;
  printf("Stack variable ival = %d\n", ival);
  printf("(int)ival:\n");
  show_int(ival);
  printf("(float)ival:\n", ival);
  show_float(fval);
  printf("&ival:\n", ival);
  show_pointer(pval);
}


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 -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
call   1050 <show_int@plt>
mov    -0x8(%rbp),%esi
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm0
call   1040 <show_float@plt>
mov    -0x8(%rbp),%esi
lea    0xe85(%rip),%rdi
mov    $0x0,%al
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   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
mov    %edi,0xc(%rsp)
cvtsi2ss %edi,%xmm0
movss  %xmm0,0x8(%rsp)
lea    0xe94(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe9e(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%edi
call   1060 <show_int@plt>
lea    0xe96(%rip),%rdi
call   1030 <puts@plt>
movss  0x8(%rsp),%xmm0
call   1050 <show_float@plt>
lea    0xe8c(%rip),%rdi
call   1030 <puts@plt>
lea    0xc(%rsp),%rdi
call   1070 <show_pointer@plt>
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [26 x i8] c"Stack variable ival = %d\0A\00"
@str = [11 x i8] c"(int)ival:\00"
@str.4 = [13 x i8] c"(float)ival:\00"
@str.5 = [7 x i8] c"&ival:\00"
define void @test_show_bytes(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 %0, i32* %2
%4 = sitofp i32 %0 to float
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %0)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 @show_int(i32 %0)
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.4, i64 0, i64 0))
%9 = tail call i32 @show_float(float %4)
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.5, i64 0, i64 0))
%11 = call i32 @show_pointer(i32* %2)
ret void
}