#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 */
typedef int /*<<< orphan*/ two_bytes;
typedef int /*<<< orphan*/ one_byte;
typedef int /*<<< orphan*/ four_bytes;
typedef int /*<<< orphan*/ eight_bytes;

/* Variables and functions */
int /*<<< orphan*/ my_function(double);
int /*<<< orphan*/ printf(char *, double);
int main() {
  char one_byte = 0;
  short two_bytes = 0;
  int four_bytes = 0;
  double eight_bytes = 0;
  printf("Size of char: %zu byte\n", sizeof(one_byte));
  printf("Size of short: %zu bytes\n", sizeof(two_bytes));
  printf("Size of int: %zu bytes\n", sizeof(four_bytes));
  printf("Size of double: %zu bytes\n", sizeof(eight_bytes));
  one_byte = 65;
  printf("char using %%c %c\n", one_byte);
  printf("char using %%d %d\n", one_byte);
  eight_bytes = four_bytes = two_bytes = one_byte;
  one_byte = 555222;
  printf("char using %%d %d\n", one_byte);
  four_bytes = 555222;
  one_byte = four_bytes;
  one_byte = 55;
  two_bytes = 5555;
  four_bytes = 5555555;
  eight_bytes = 555555555;
  printf("original %d\n", one_byte);
  printf("original %d\n", two_bytes);
  printf("original %d\n", four_bytes);
  printf("original %.0lf\n", eight_bytes);
  my_function(one_byte);
  my_function(two_bytes);
  my_function(four_bytes);
  my_function(eight_bytes);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x0,-0x5(%rbp)
movw   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
lea    0xed1(%rip),%rdi
movsd  0xea9(%rip),%xmm0
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
movsd  0xe9d(%rip),%xmm0
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
movsd  0xe91(%rip),%xmm0
call   1030 <printf@plt>
lea    0xedf(%rip),%rdi
movsd  0xe85(%rip),%xmm0
call   1030 <printf@plt>
movb   $0x41,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cvtsi2sd %eax,%xmm0
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
movsbl -0x5(%rbp),%eax
cvtsi2sd %eax,%xmm0
lea    0xed9(%rip),%rdi
mov    %rdi,-0x28(%rbp)
call   1030 <printf@plt>
mov    -0x28(%rbp),%rdi
movsbl -0x5(%rbp),%eax
mov    %ax,%cx
mov    %cx,-0x8(%rbp)
mov    %eax,-0xc(%rbp)
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x18(%rbp)
movb   $0xd6,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cvtsi2sd %eax,%xmm0
call   1030 <printf@plt>
movl   $0x878d6,-0xc(%rbp)
mov    -0xc(%rbp),%al
mov    %al,-0x5(%rbp)
movb   $0x37,-0x5(%rbp)
movw   $0x15b3,-0x8(%rbp)
movl   $0x54c563,-0xc(%rbp)
movabs $0x41c08e8d71800000,%rax
8e c0 41
mov    %rax,-0x18(%rbp)
movsbl -0x5(%rbp),%eax
cvtsi2sd %eax,%xmm0
lea    0xe7c(%rip),%rdi
mov    %rdi,-0x20(%rbp)
call   1030 <printf@plt>
mov    -0x20(%rbp),%rdi
movswl -0x8(%rbp),%eax
cvtsi2sd %eax,%xmm0
call   1030 <printf@plt>
mov    -0x20(%rbp),%rdi
cvtsi2sdl -0xc(%rbp),%xmm0
call   1030 <printf@plt>
movsd  -0x18(%rbp),%xmm0
lea    0xe55(%rip),%rdi
call   1030 <printf@plt>
movsbl -0x5(%rbp),%eax
cvtsi2sd %eax,%xmm0
call   1040 <my_function@plt>
movswl -0x8(%rbp),%eax
cvtsi2sd %eax,%xmm0
call   1040 <my_function@plt>
cvtsi2sdl -0xc(%rbp),%xmm0
call   1040 <my_function@plt>
movsd  -0x18(%rbp),%xmm0
call   1040 <my_function@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xf28(%rip),%rdi
movsd  0xed0(%rip),%xmm0
call   1030 <printf@plt>
lea    0xf2c(%rip),%rdi
movsd  0xec4(%rip),%xmm0
call   1030 <printf@plt>
lea    0xf32(%rip),%rdi
movsd  0xeb8(%rip),%xmm0
call   1030 <printf@plt>
lea    0xf36(%rip),%rdi
movsd  0xeac(%rip),%xmm0
call   1030 <printf@plt>
lea    0xf3d(%rip),%rdi
movsd  0xea0(%rip),%xmm0
call   1030 <printf@plt>
lea    0xf3c(%rip),%rbx
mov    %rbx,%rdi
movsd  0xe89(%rip),%xmm0
call   1030 <printf@plt>
movsd  0xe84(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0xf28(%rip),%rbx
movsd  0xe75(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0xe6d(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0xe65(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0xefe(%rip),%rdi
movsd  0xe56(%rip),%xmm0
call   1030 <printf@plt>
movsd  0xe31(%rip),%xmm0
call   1040 <my_function@plt>
movsd  0xe2c(%rip),%xmm0
call   1040 <my_function@plt>
movsd  0xe27(%rip),%xmm0
call   1040 <my_function@plt>
movsd  0xe22(%rip),%xmm0
call   1040 <my_function@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Size of char: %zu byte\0A\00"
@.str.1 = [26 x i8] c"Size of short: %zu bytes\0A\00"
@.str.2 = [24 x i8] c"Size of int: %zu bytes\0A\00"
@.str.3 = [27 x i8] c"Size of double: %zu bytes\0A\00"
@.str.4 = [19 x i8] c"char using %%c %c\0A\00"
@.str.5 = [19 x i8] c"char using %%d %d\0A\00"
@.str.6 = [13 x i8] c"original %d\0A\00"
@.str.7 = [16 x i8] c"original %.0lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i16
%4 = alloca i32
%5 = alloca double
store i32 0, i32* %1
store i8 0, i8* %2
store i16 0, i16* %3
store i32 0, i32* %4
store double 0.000000e+00, double* %5
%6 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), double 1.000000e+00)
%7 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), double 2.000000e+00)
%8 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), double 4.000000e+00)
%9 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), double 8.000000e+00)
store i8 65, i8* %2
%10 = load i8, i8* %2
%11 = sitofp i8 %10 to double
%12 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), double %11)
%13 = load i8, i8* %2
%14 = sitofp i8 %13 to double
%15 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), double %14)
%16 = load i8, i8* %2
%17 = sext i8 %16 to i16
store i16 %17, i16* %3
%18 = sext i16 %17 to i32
store i32 %18, i32* %4
%19 = sitofp i32 %18 to double
store double %19, double* %5
store i8 -42, i8* %2
%20 = load i8, i8* %2
%21 = sitofp i8 %20 to double
%22 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), double %21)
store i32 555222, i32* %4
%23 = load i32, i32* %4
%24 = trunc i32 %23 to i8
store i8 %24, i8* %2
store i8 55, i8* %2
store i16 5555, i16* %3
store i32 5555555, i32* %4
store double 0x41C08E8D71800000, double* %5
%25 = load i8, i8* %2
%26 = sitofp i8 %25 to double
%27 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), double %26)
%28 = load i16, i16* %3
%29 = sitofp i16 %28 to double
%30 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), double %29)
%31 = load i32, i32* %4
%32 = sitofp i32 %31 to double
%33 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), double %32)
%34 = load double, double* %5
%35 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), double %34)
%36 = load i8, i8* %2
%37 = sitofp i8 %36 to double
%38 = call i32 @my_function(double %37)
%39 = load i16, i16* %3
%40 = sitofp i16 %39 to double
%41 = call i32 @my_function(double %40)
%42 = load i32, i32* %4
%43 = sitofp i32 %42 to double
%44 = call i32 @my_function(double %43)
%45 = load double, double* %5
%46 = call i32 @my_function(double %45)
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"Size of char: %zu byte\0A\00"
@.str.1 = [26 x i8] c"Size of short: %zu bytes\0A\00"
@.str.2 = [24 x i8] c"Size of int: %zu bytes\0A\00"
@.str.3 = [27 x i8] c"Size of double: %zu bytes\0A\00"
@.str.4 = [19 x i8] c"char using %%c %c\0A\00"
@.str.5 = [19 x i8] c"char using %%d %d\0A\00"
@.str.6 = [13 x i8] c"original %d\0A\00"
@.str.7 = [16 x i8] c"original %.0lf\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), double 1.000000e+00)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), double 2.000000e+00)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), double 4.000000e+00)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), double 8.000000e+00)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), double 6.500000e+01)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), double 6.500000e+01)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), double -4.200000e+01)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), double 5.500000e+01)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), double 5.555000e+03)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), double 0x41553158C0000000)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), double 0x41C08E8D71800000)
%12 = tail call i32 @my_function(double 5.500000e+01)
%13 = tail call i32 @my_function(double 5.555000e+03)
%14 = tail call i32 @my_function(double 0x41553158C0000000)
%15 = tail call i32 @my_function(double 0x41C08E8D71800000)
ret i32 0
}