#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*/ scanf(char *, float *);
double to_celsius(float);
double to_fahrenheit(float);
void test_temp_conv() {
  float temp;
  printf("Temperature: ");
  scanf("%f", &temp);
  printf("%.3f\tF=>C\t%.3f\n", temp, to_celsius(temp));
  printf("%.3f\tC=>F\t%.3f\n", temp, to_fahrenheit(temp));
}


x86 assembly (clang, -O0):
<test_temp_conv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeb1(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1060 <scanf@plt>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movss  -0x4(%rbp),%xmm0
call   1050 <to_celsius@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
lea    0xe84(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <to_fahrenheit@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
lea    0xe66(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_temp_conv>:
sub    $0x18,%rsp
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb5(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
call   1050 <to_celsius@plt>
movaps %xmm0,%xmm1
lea    0xe8f(%rip),%rdi
movsd  0x10(%rsp),%xmm0
mov    $0x2,%al
call   1040 <printf@plt>
movss  0xc(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
call   1030 <to_fahrenheit@plt>
movaps %xmm0,%xmm1
lea    0xe70(%rip),%rdi
movsd  0x10(%rsp),%xmm0
mov    $0x2,%al
call   1040 <printf@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Temperature: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [16 x i8] c"%.3f\09F=>C\09%.3f\0A\00"
@.str.3 = [16 x i8] c"%.3f\09C=>F\09%.3f\0A\00"
define void @test_temp_conv() {
%1 = alloca float
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%4 = load float, float* %1
%5 = fpext float %4 to double
%6 = load float, float* %1
%7 = call double @to_celsius(float %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), double %5, double %7)
%9 = load float, float* %1
%10 = fpext float %9 to double
%11 = load float, float* %1
%12 = call double @to_fahrenheit(float %11)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), double %10, double %12)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"Temperature: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [16 x i8] c"%.3f\09F=>C\09%.3f\0A\00"
@.str.3 = [16 x i8] c"%.3f\09C=>F\09%.3f\0A\00"
define void @test_temp_conv() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%5 = load float, float* %1
%6 = fpext float %5 to double
%7 = call double @to_celsius(float %5)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), double %6, double %7)
%9 = load float, float* %1
%10 = fpext float %9 to double
%11 = call double @to_fahrenheit(float %9)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), double %10, double %11)
ret void
}