#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 */
float log(float);
double steinhart(int resistance, int beta) {
  float tmp = 0.0;
  int R25 = 10000;
  tmp = (float)resistance / (float)R25;
  tmp = log(tmp);
  tmp /= beta;
  tmp += 1.0 / 298.15;
  tmp = 1.0 / tmp;
  tmp -= 273.15;
  return tmp;
}


x86 assembly (clang, -O0):
<steinhart>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movl   $0x2710,-0x10(%rbp)
cvtsi2ssl -0x4(%rbp),%xmm0
cvtsi2ssl -0x10(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <log@plt>
movss  %xmm0,-0xc(%rbp)
cvtsi2ssl -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe9d(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe77(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe51(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<steinhart>:
push   %rbx
cvtsi2ss %edi,%xmm0
mov    %esi,%ebx
divss  0xee1(%rip),%xmm0
call   1030 <log@plt>
cvtsi2ss %ebx,%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
addsd  0xed0(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  0xec0(%rip),%xmm1
divss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
addsd  0xeb9(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
pop    %rbx
ret

LLVM IR (-O0):
define double @steinhart(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store float 0.000000e+00, float* %5
store i32 10000, i32* %6
%7 = load i32, i32* %3
%8 = sitofp i32 %7 to float
%9 = load i32, i32* %6
%10 = sitofp i32 %9 to float
%11 = fdiv float %8, %10
store float %11, float* %5
%12 = load float, float* %5
%13 = call float @log(float %12)
store float %13, float* %5
%14 = load i32, i32* %4
%15 = sitofp i32 %14 to float
%16 = load float, float* %5
%17 = fdiv float %16, %15
store float %17, float* %5
%18 = load float, float* %5
%19 = fpext float %18 to double
%20 = fadd double %19, 0x3F6B79E1DCB5DB83
%21 = fptrunc double %20 to float
store float %21, float* %5
%22 = load float, float* %5
%23 = fpext float %22 to double
%24 = fdiv double 1.000000e+00, %23
%25 = fptrunc double %24 to float
store float %25, float* %5
%26 = load float, float* %5
%27 = fpext float %26 to double
%28 = fsub double %27, 2.731500e+02
%29 = fptrunc double %28 to float
store float %29, float* %5
%30 = load float, float* %5
%31 = fpext float %30 to double
ret double %31
}

LLVM IR (-O2):
define double @steinhart(i32 %0, i32 %1) {
%3 = sitofp i32 %0 to float
%4 = fdiv float %3, 1.000000e+04
%5 = tail call float @log(float %4)
%6 = sitofp i32 %1 to float
%7 = fdiv float %5, %6
%8 = fpext float %7 to double
%9 = fadd double %8, 0x3F6B79E1DCB5DB83
%10 = fptrunc double %9 to float
%11 = fdiv float 1.000000e+00, %10
%12 = fpext float %11 to double
%13 = fadd double %12, -2.731500e+02
%14 = fptrunc double %13 to float
%15 = fpext float %14 to double
ret double %15
}