#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 float int32_t;

/* Variables and functions */
scalar_t__ RAND_MAX;
float rand();
float sin(int);
int time(int /*<<< orphan*/ *);
int32_t target_get_temperature(void) {
  static const float PI = 3.141592653;
  float random_real = rand() / (float)RAND_MAX;
  return (0.6f * (random_real - 0.5) + sin((2 * PI / 90) * time(NULL))) * 25 +
         15;
}


x86 assembly (clang, -O0):
<target_get_temperature>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <rand@plt>
mov    0x2ea2(%rip),%rax
cvtsi2ssq (%rax),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeb3(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
cvtsi2ss %eax,%xmm1
movss  0xe9d(%rip),%xmm0
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%edi
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
cvtss2sd %xmm1,%xmm1
movsd  0xe6c(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe4c(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe48(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<target_get_temperature>:
push   %rax
xor    %eax,%eax
call   1050 <rand@plt>
mov    0x2ea9(%rip),%rax
cvtsi2ssq (%rax),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
addsd  0xeac(%rip),%xmm0
movsd  %xmm0,(%rsp)
xor    %edi,%edi
call   1040 <time@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  0xeb1(%rip),%xmm0
cvttss2si %xmm0,%edi
call   1030 <sin@plt>
movsd  (%rsp),%xmm1
mulsd  0xe83(%rip),%xmm1
cvtss2sd %xmm0,%xmm0
addsd  %xmm0,%xmm1
mulsd  0xe7b(%rip),%xmm1
addsd  0xe7b(%rip),%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@target_get_temperature.PI = internal constant float 0x400921FB60000000
@RAND_MAX = global i64 0
define float @target_get_temperature() {
%1 = alloca float
%2 = call float (...) @rand()
%3 = load i64, i64* @RAND_MAX
%4 = sitofp i64 %3 to float
%5 = fdiv float %2, %4
store float %5, float* %1
%6 = load float, float* %1
%7 = fpext float %6 to double
%8 = fsub double %7, 5.000000e-01
%9 = call i32 @time(i32* null)
%10 = sitofp i32 %9 to float
%11 = fmul float 0x3FB1DF46A0000000, %10
%12 = fptosi float %11 to i32
%13 = call float @sin(i32 %12)
%14 = fpext float %13 to double
%15 = call double @llvm.fmuladd.f64(double 0x3FE3333340000000, double %8, double %14)
%16 = call double @llvm.fmuladd.f64(double %15, double 2.500000e+01, double 1.500000e+01)
%17 = fptrunc double %16 to float
ret float %17
}

LLVM IR (-O2):
@RAND_MAX = global i64 0
define float @target_get_temperature() {
%1 = tail call float (...) @rand()
%2 = load i64, i64* @RAND_MAX
%3 = sitofp i64 %2 to float
%4 = fdiv float %1, %3
%5 = fpext float %4 to double
%6 = fadd double %5, -5.000000e-01
%7 = tail call i32 @time(i32* null)
%8 = sitofp i32 %7 to float
%9 = fmul float %8, 0x3FB1DF46A0000000
%10 = fptosi float %9 to i32
%11 = tail call float @sin(i32 %10)
%12 = fpext float %11 to double
%13 = tail call double @llvm.fmuladd.f64(double %6, double 0x3FE3333340000000, double %12)
%14 = tail call double @llvm.fmuladd.f64(double %13, double 2.500000e+01, double 1.500000e+01)
%15 = fptrunc double %14 to float
ret float %15
}