#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*/ fprintf(int /*<<< orphan*/, char *);
float int_read_sensor_temp(int);
int /*<<< orphan*/ stderr;
float read_sensor_temp(int sensor) {
  float a, b;
  while ((a = int_read_sensor_temp(sensor)) !=
         (b = int_read_sensor_temp(sensor))) {
    fprintf(stderr, "read_sensor_temp: DB18B20 Glitching\n");
  }
  return b;
}


x86 assembly (clang, -O0):
<read_sensor_temp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <int_read_sensor_temp@plt>
movss  %xmm0,-0x10(%rbp)
movss  %xmm0,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <int_read_sensor_temp@plt>
movaps %xmm0,%xmm1
movss  -0x10(%rbp),%xmm0
movss  %xmm1,-0xc(%rbp)
ucomiss %xmm1,%xmm0
jne    1166 <read_sensor_temp+0x46>
jp     1166 <read_sensor_temp+0x46>
jmp    1180 <read_sensor_temp+0x60>
mov    0x2e73(%rip),%rax
mov    (%rax),%edi
lea    0xe8a(%rip),%rsi
call   1030 <fprintf@plt>
jmp    112b <read_sensor_temp+0xb>
movss  -0xc(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_sensor_temp>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
call   1040 <int_read_sensor_temp@plt>
movss  %xmm0,0xc(%rsp)
mov    %ebx,%edi
call   1040 <int_read_sensor_temp@plt>
movss  0xc(%rsp),%xmm1
ucomiss %xmm0,%xmm1
jne    114a <read_sensor_temp+0x2a>
jnp    118c <read_sensor_temp+0x6c>
mov    0x2e8f(%rip),%r15
lea    0xea8(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%r15),%edi
mov    %r14,%rsi
call   1030 <fprintf@plt>
mov    %ebx,%edi
call   1040 <int_read_sensor_temp@plt>
movss  %xmm0,0xc(%rsp)
mov    %ebx,%edi
call   1040 <int_read_sensor_temp@plt>
movss  0xc(%rsp),%xmm1
ucomiss %xmm0,%xmm1
jne    1160 <read_sensor_temp+0x40>
jp     1160 <read_sensor_temp+0x40>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [37 x i8] c"read_sensor_temp: DB18B20 Glitching\0A\00"
define float @read_sensor_temp(i32 %0) {
%2 = alloca i32
%3 = alloca float
%4 = alloca float
store i32 %0, i32* %2
br label %5
5: ; preds = %11, %1
%6 = load i32, i32* %2
%7 = call float @int_read_sensor_temp(i32 %6)
store float %7, float* %3
%8 = load i32, i32* %2
%9 = call float @int_read_sensor_temp(i32 %8)
store float %9, float* %4
%10 = fcmp une float %7, %9
br i1 %10, label %11, label %14
11: ; preds = %5
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
br label %5
14: ; preds = %5
%15 = load float, float* %4
ret float %15
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [37 x i8] c"read_sensor_temp: DB18B20 Glitching\0A\00"
define float @read_sensor_temp(i32 %0) {
%2 = tail call float @int_read_sensor_temp(i32 %0)
%3 = tail call float @int_read_sensor_temp(i32 %0)
%4 = fcmp une float %2, %3
br i1 %4, label %5, label %11
5: ; preds = %1, %5
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%8 = tail call float @int_read_sensor_temp(i32 %0)
%9 = tail call float @int_read_sensor_temp(i32 %0)
%10 = fcmp une float %8, %9
br i1 %10, label %5, label %11
11: ; preds = %5, %1
%12 = phi float [ %3, %1 ], [ %9, %5 ]
ret float %12
}