#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, ...);
int si7021_read_temperature(float *);
int main() {
  float f, c;
  int status;
  status = si7021_read_temperature(&c);
  if (status) {
    printf("Error %d reading temperature\n", status);
    return -1;
  }
  f = 9.0 * c / 5.0 + 32.0;
  printf("Si7021 returns %fc = %ff\n", c, f);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xc(%rbp),%rdi
call   1040 <si7021_read_temperature@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     1164 <main+0x44>
cvtsi2ssl -0x10(%rbp),%xmm0
lea    0xec7(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11b6 <main+0x96>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe9b(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe87(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe73(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0xc(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe87(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0x4(%rsp),%rdi
call   1040 <si7021_read_temperature@plt>
test   %eax,%eax
je     1148 <main+0x28>
cvtsi2ss %eax,%xmm0
lea    0xede(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm1
mulsd  0xea6(%rip),%xmm1
divsd  0xea6(%rip),%xmm1
addsd  0xea6(%rip),%xmm1
cvtsd2ss %xmm1,%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xebd(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Error %d reading temperature\0A\00"
@.str.1 = [26 x i8] c"Si7021 returns %fc = %ff\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @si7021_read_temperature(float* %3)
store i32 %5, i32* %4
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %0
%9 = load i32, i32* %4
%10 = sitofp i32 %9 to float
%11 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), float %10)
store i32 -1, i32* %1
br label %23
12: ; preds = %0
%13 = load float, float* %3
%14 = fpext float %13 to double
%15 = fmul double 9.000000e+00, %14
%16 = fdiv double %15, 5.000000e+00
%17 = fadd double %16, 3.200000e+01
%18 = fptrunc double %17 to float
store float %18, float* %2
%19 = load float, float* %3
%20 = load float, float* %2
%21 = fpext float %20 to double
%22 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), float %19, double %21)
br label %23
23: ; preds = %12, %8
%24 = load i32, i32* %1
ret i32 %24
}

LLVM IR (-O2):
@.str = [30 x i8] c"Error %d reading temperature\0A\00"
@.str.1 = [26 x i8] c"Si7021 returns %fc = %ff\0A\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = call i32 @si7021_read_temperature(float* %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %0
%6 = sitofp i32 %3 to float
%7 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), float %6)
br label %17
8: ; preds = %0
%9 = load float, float* %1
%10 = fpext float %9 to double
%11 = fmul double %10, 9.000000e+00
%12 = fdiv double %11, 5.000000e+00
%13 = fadd double %12, 3.200000e+01
%14 = fptrunc double %13 to float
%15 = fpext float %14 to double
%16 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), float %9, double %15)
br label %17
17: ; preds = %8, %5
%18 = phi i32 [ -1, %5 ], [ 0, %8 ]
ret i32 %18
}