#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 *, float);
float steinhart(int, int);
int main() {
  float temperature = 0.0;
  int resistance = 22165;
  temperature = steinhart(resistance, 3380);
  printf("%.2f C\r\n", temperature);
  temperature = steinhart(18010, 3380);
  printf("%.2f C\r\n", temperature);
  temperature = steinhart(10000, 3380);
  printf("%.2f C\r\n", temperature);
  temperature = steinhart(8309, 3380);
  printf("%.2f C\r\n", temperature);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movl   $0x5695,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    $0xd34,%esi
call   1030 <steinhart@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
lea    0xea4(%rip),%rdi
call   1040 <printf@plt>
mov    $0x465a,%edi
mov    $0xd34,%esi
call   1030 <steinhart@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
lea    0xe7f(%rip),%rdi
call   1040 <printf@plt>
mov    $0x2710,%edi
mov    $0xd34,%esi
call   1030 <steinhart@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
lea    0xe5a(%rip),%rdi
call   1040 <printf@plt>
mov    $0x2075,%edi
mov    $0xd34,%esi
call   1030 <steinhart@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
lea    0xe35(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x5695,%edi
mov    $0xd34,%esi
call   1030 <steinhart@plt>
lea    0xec9(%rip),%rbx
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    $0x465a,%edi
mov    $0xd34,%esi
call   1030 <steinhart@plt>
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    $0x2710,%edi
mov    $0xd34,%esi
call   1030 <steinhart@plt>
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    $0x2075,%edi
mov    $0xd34,%esi
call   1030 <steinhart@plt>
mov    %rbx,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%.2f C\0D\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca i32
store i32 0, i32* %1
store float 0.000000e+00, float* %2
store i32 22165, i32* %3
%4 = load i32, i32* %3
%5 = call float @steinhart(i32 %4, i32 3380)
store float %5, float* %2
%6 = load float, float* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), float %6)
%8 = call float @steinhart(i32 18010, i32 3380)
store float %8, float* %2
%9 = load float, float* %2
%10 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), float %9)
%11 = call float @steinhart(i32 10000, i32 3380)
store float %11, float* %2
%12 = load float, float* %2
%13 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), float %12)
%14 = call float @steinhart(i32 8309, i32 3380)
store float %14, float* %2
%15 = load float, float* %2
%16 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), float %15)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"%.2f C\0D\0A\00"
define i32 @main() {
%1 = tail call float @steinhart(i32 22165, i32 3380)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), float %1)
%3 = tail call float @steinhart(i32 18010, i32 3380)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), float %3)
%5 = tail call float @steinhart(i32 10000, i32 3380)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), float %5)
%7 = tail call float @steinhart(i32 8309, i32 3380)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), float %7)
ret i32 0
}