#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 */
void *DS3231_Read(int);
float getTemp() {
  register float t = 0.0;
  unsigned char lowByte = 0;
  signed char highByte = 0;
  lowByte = DS3231_Read(0x12);
  highByte = DS3231_Read(0x11);
  lowByte >>= 6;
  lowByte &= 0x03;
  t = ((float)lowByte);
  t *= 0.25;
  t += highByte;
  return t;
}


x86 assembly (clang, -O0):
<getTemp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x0,-0x5(%rbp)
movb   $0x0,-0x6(%rbp)
mov    $0x12,%edi
call   1030 <DS3231_Read@plt>
mov    %al,-0x5(%rbp)
mov    $0x11,%edi
call   1030 <DS3231_Read@plt>
mov    %al,-0x6(%rbp)
movzbl -0x5(%rbp),%eax
shr    $0x6,%eax
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x3,%al
mov    %al,-0x5(%rbp)
movzbl -0x5(%rbp),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe8f(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movsbl -0x6(%rbp),%eax
cvtsi2ss %eax,%xmm0
addss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getTemp>:
push   %rbx
mov    $0x12,%edi
call   1030 <DS3231_Read@plt>
mov    %rax,%rbx
mov    $0x11,%edi
call   1030 <DS3231_Read@plt>
shr    $0x6,%bl
movzbl %bl,%ecx
cvtsi2sd %ecx,%xmm0
mulsd  0xec6(%rip),%xmm0
cvtsd2ss %xmm0,%xmm1
movsbl %al,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
addss  %xmm1,%xmm0
pop    %rbx
ret

LLVM IR (-O0):
define float @getTemp() {
%1 = alloca float
%2 = alloca i8
%3 = alloca i8
store float 0.000000e+00, float* %1
store i8 0, i8* %2
store i8 0, i8* %3
%4 = call i8* @DS3231_Read(i32 18)
%5 = ptrtoint i8* %4 to i8
store i8 %5, i8* %2
%6 = call i8* @DS3231_Read(i32 17)
%7 = ptrtoint i8* %6 to i8
store i8 %7, i8* %3
%8 = load i8, i8* %2
%9 = zext i8 %8 to i32
%10 = ashr i32 %9, 6
%11 = trunc i32 %10 to i8
store i8 %11, i8* %2
%12 = load i8, i8* %2
%13 = zext i8 %12 to i32
%14 = and i32 %13, 3
%15 = trunc i32 %14 to i8
store i8 %15, i8* %2
%16 = load i8, i8* %2
%17 = uitofp i8 %16 to float
store float %17, float* %1
%18 = load float, float* %1
%19 = fpext float %18 to double
%20 = fmul double %19, 2.500000e-01
%21 = fptrunc double %20 to float
store float %21, float* %1
%22 = load i8, i8* %3
%23 = sext i8 %22 to i32
%24 = sitofp i32 %23 to float
%25 = load float, float* %1
%26 = fadd float %25, %24
store float %26, float* %1
%27 = load float, float* %1
ret float %27
}

LLVM IR (-O2):
define float @getTemp() {
%1 = tail call i8* @DS3231_Read(i32 18)
%2 = ptrtoint i8* %1 to i64
%3 = tail call i8* @DS3231_Read(i32 17)
%4 = ptrtoint i8* %3 to i64
%5 = trunc i64 %4 to i32
%6 = trunc i64 %2 to i8
%7 = lshr i8 %6, 6
%8 = uitofp i8 %7 to double
%9 = fmul double %8, 2.500000e-01
%10 = fptrunc double %9 to float
%11 = shl i32 %5, 24
%12 = ashr exact i32 %11, 24
%13 = sitofp i32 %12 to float
%14 = fadd float %10, %13
ret float %14
}