#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 */
double getDouble();
scalar_t__ printf(char *, double, double);
double getLimDbl(double lowerLimit, double upperLimit) {
  double val;
  do {
    val = getDouble();
  } while (
      (val < lowerLimit || val > upperLimit) &&
      printf("Invalid value, %lf < value < %lf: ", lowerLimit, upperLimit));
  return val;
}


x86 assembly (clang, -O0):
<getLimDbl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getDouble@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
ucomisd %xmm1,%xmm0
ja     1167 <getLimDbl+0x47>
movsd  -0x18(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x10(%rbp),%xmm0
mov    %al,-0x19(%rbp)
jbe    1187 <getLimDbl+0x67>
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1132 <getLimDbl+0x12>
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getLimDbl>:
push   %rbx
sub    $0x20,%rsp
movsd  %xmm1,0x8(%rsp)
lea    0xece(%rip),%rbx
movsd  %xmm0,0x18(%rsp)
jmp    1159 <getLimDbl+0x39>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
movsd  0x18(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
call   1030 <printf@plt>
test   %rax,%rax
je     1184 <getLimDbl+0x64>
xor    %eax,%eax
call   1040 <getDouble@plt>
movapd %xmm0,%xmm1
movsd  0x18(%rsp),%xmm0
movsd  %xmm1,0x10(%rsp)
ucomisd %xmm1,%xmm0
ja     1140 <getLimDbl+0x20>
movsd  0x10(%rsp),%xmm0
ucomisd 0x8(%rsp),%xmm0
ja     1140 <getLimDbl+0x20>
movsd  0x10(%rsp),%xmm0
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [35 x i8] c"Invalid value, %lf < value < %lf: \00"
define double @getLimDbl(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
store double %1, double* %4
br label %6
6: ; preds = %21, %2
%7 = call double (...) @getDouble()
store double %7, double* %5
br label %8
8: ; preds = %6
%9 = load double, double* %5
%10 = load double, double* %3
%11 = fcmp olt double %9, %10
br i1 %11, label %16, label %12
12: ; preds = %8
%13 = load double, double* %5
%14 = load double, double* %4
%15 = fcmp ogt double %13, %14
br i1 %15, label %16, label %21
16: ; preds = %12, %8
%17 = load double, double* %3
%18 = load double, double* %4
%19 = call i64 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), double %17, double %18)
%20 = icmp ne i64 %19, 0
br label %21
21: ; preds = %16, %12
%22 = phi i1 [ false, %12 ], [ %20, %16 ]
br i1 %22, label %6, label %23
23: ; preds = %21
%24 = load double, double* %5
ret double %24
}

LLVM IR (-O2):
@.str = [35 x i8] c"Invalid value, %lf < value < %lf: \00"
define double @getLimDbl(double %0, double %1) {
br label %3
3: ; preds = %8, %2
%4 = tail call double (...) @getDouble()
%5 = fcmp olt double %4, %0
%6 = fcmp ogt double %4, %1
%7 = or i1 %5, %6
br i1 %7, label %8, label %11
8: ; preds = %3
%9 = tail call i64 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), double %0, double %1)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %3
11: ; preds = %3, %8
ret double %4
}