#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 *, ...);
double fn_ret_float(int i, double f, char c, char *s) {
  printf("%d\n", i);
  printf("%lf\n", f);
  printf("%c\n", c);
  printf("%s\n", s);
  printf("%lf\n", f + f);
  printf("exiting fn_ret_float\n");
  return f + f;
}


x86 assembly (clang, -O0):
<fn_ret_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
lea    0xebd(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsbl -0x11(%rbp),%esi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
lea    0xe81(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn_ret_float>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%rbx
mov    %esi,%ebp
movsd  %xmm0,0x8(%rsp)
mov    %edi,%esi
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeba(%rip),%r14
mov    %r14,%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xea8(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
movsd  0x8(%rsp),%xmm0
addsd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe7a(%rip),%rdi
call   1030 <puts@plt>
movsd  0x8(%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [5 x i8] c"%lf\0A\00"
@.str.2 = [4 x i8] c"%c\0A\00"
@.str.3 = [4 x i8] c"%s\0A\00"
@.str.4 = [22 x i8] c"exiting fn_ret_float\0A\00"
define double @fn_ret_float(i32 %0, double %1, i8 signext %2, i8* %3) {
%5 = alloca i32
%6 = alloca double
%7 = alloca i8
%8 = alloca i8*
store i32 %0, i32* %5
store double %1, double* %6
store i8 %2, i8* %7
store i8* %3, i8** %8
%9 = load i32, i32* %5
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = load double, double* %6
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double %11)
%13 = load i8, i8* %7
%14 = sext i8 %13 to i32
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %14)
%16 = load i8*, i8** %8
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %16)
%18 = load double, double* %6
%19 = load double, double* %6
%20 = fadd double %18, %19
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double %20)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
%23 = load double, double* %6
%24 = load double, double* %6
%25 = fadd double %23, %24
ret double %25
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [5 x i8] c"%lf\0A\00"
@.str.2 = [4 x i8] c"%c\0A\00"
@str = [21 x i8] c"exiting fn_ret_float\00"
define double @fn_ret_float(i32 %0, double %1, i8 signext %2, i8* nocapture %3) {
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %0)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double %1)
%7 = sext i8 %2 to i32
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%9 = tail call i32 @puts(i8* dereferenceable(1) %3)
%10 = fadd double %1, %1
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double %10)
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
ret double %10
}