#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 */
scalar_t__ ERANGE;
int /*<<< orphan*/ assert(int);
scalar_t__ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, double, double);
int /*<<< orphan*/ opt_err(char *);
int /*<<< orphan*/ opt_err_pfx();
int /*<<< orphan*/ opt_err_sfx();
char *opt_name();
int /*<<< orphan*/ stderr;
double strtod(char *, char **);
int opt_store_double_lim(char *arg, void *data) {
  char *end;
  double val;
  double *p = data;
  assert(arg && data);
  errno = 0;
  val = strtod(arg, &end);
  if (end == arg || end[0])
    opt_err("the value of %s must be a number");
  if (errno == ERANGE || val < p[1] || val > p[2]) {
    opt_err_pfx();
    fprintf(stderr, "the value of %s must be in the range %g to %g", opt_name(),
            p[1], p[2]);
    opt_err_sfx();
  }
  p[0] = val;
  return 0;
}


x86 assembly (clang, -O0):
<opt_store_double_lim>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x29(%rbp)
je     11a3 <opt_store_double_lim+0x33>
cmpq   $0x0,-0x10(%rbp)
setne  %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
mov    0x2e19(%rip),%rax
movq   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <strtod@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x8(%rbp),%rax
je     11ee <opt_store_double_lim+0x7e>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11fa <opt_store_double_lim+0x8a>
lea    0xe0b(%rip),%rdi
call   1090 <opt_err@plt>
mov    0x2dcf(%rip),%rax
mov    (%rax),%rax
mov    0x2ddd(%rip),%rcx
cmp    (%rcx),%rax
je     1240 <opt_store_double_lim+0xd0>
movsd  -0x20(%rbp),%xmm1
mov    -0x28(%rbp),%rax
movsd  0x8(%rax),%xmm0
ucomisd %xmm1,%xmm0
ja     1240 <opt_store_double_lim+0xd0>
movsd  -0x20(%rbp),%xmm0
mov    -0x28(%rbp),%rax
ucomisd 0x10(%rax),%xmm0
jbe    1285 <opt_store_double_lim+0x115>
mov    $0x0,%al
call   1060 <opt_err_pfx@plt>
mov    0x2d8a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    $0x0,%al
call   1030 <opt_name@plt>
mov    -0x30(%rbp),%edi
mov    %rax,%rdx
mov    -0x28(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x28(%rbp),%rax
movsd  0x10(%rax),%xmm1
lea    0xda8(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x0,%al
call   1050 <opt_err_sfx@plt>
movsd  -0x20(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<opt_store_double_lim>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
test   %rdi,%rdi
setne  %al
test   %rsi,%rsi
setne  %cl
and    %al,%cl
movzbl %cl,%edi
call   1070 <assert@plt>
mov    0x2e34(%rip),%r15
movq   $0x0,(%r15)
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <strtod@plt>
movsd  %xmm0,(%rsp)
mov    0x8(%rsp),%rax
cmp    %rbx,%rax
je     11c4 <opt_store_double_lim+0x54>
cmpb   $0x0,(%rax)
je     11d0 <opt_store_double_lim+0x60>
lea    0xe35(%rip),%rdi
call   1090 <opt_err@plt>
mov    (%r15),%rax
mov    0x2e0e(%rip),%rcx
cmp    (%rcx),%rax
je     11f9 <opt_store_double_lim+0x89>
movsd  0x8(%r14),%xmm0
ucomisd (%rsp),%xmm0
ja     11f9 <opt_store_double_lim+0x89>
movsd  (%rsp),%xmm0
ucomisd 0x10(%r14),%xmm0
jbe    1234 <opt_store_double_lim+0xc4>
xor    %eax,%eax
call   1060 <opt_err_pfx@plt>
mov    0x2dd1(%rip),%rax
mov    (%rax),%ebx
xor    %eax,%eax
call   1030 <opt_name@plt>
movsd  0x8(%r14),%xmm0
movsd  0x10(%r14),%xmm1
lea    0xdfe(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1080 <fprintf@plt>
xor    %eax,%eax
call   1050 <opt_err_sfx@plt>
movsd  (%rsp),%xmm0
movsd  %xmm0,(%r14)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@errno = global i64 0
@.str = [33 x i8] c"the value of %s must be a number\00"
@ERANGE = global i64 0
@stderr = global i32 0
@.str.1 = [46 x i8] c"the value of %s must be in the range %g to %g\00"
define i32 @opt_store_double_lim(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca double
%7 = alloca double*
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to double*
store double* %9, double** %7
%10 = load i8*, i8** %3
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = load i8*, i8** %4
%14 = icmp ne i8* %13, null
br label %15
15: ; preds = %12, %2
%16 = phi i1 [ false, %2 ], [ %14, %12 ]
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
store i64 0, i64* @errno
%19 = load i8*, i8** %3
%20 = call double @strtod(i8* %19, i8** %5)
store double %20, double* %6
%21 = load i8*, i8** %5
%22 = load i8*, i8** %3
%23 = icmp eq i8* %21, %22
br i1 %23, label %30, label %24
24: ; preds = %15
%25 = load i8*, i8** %5
%26 = getelementptr inbounds i8, i8* %25, i64 0
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %24, %15
%31 = call i32 @opt_err(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
br label %32
32: ; preds = %30, %24
%33 = load i64, i64* @errno
%34 = load i64, i64* @ERANGE
%35 = icmp eq i64 %33, %34
br i1 %35, label %48, label %36
36: ; preds = %32
%37 = load double, double* %6
%38 = load double*, double** %7
%39 = getelementptr inbounds double, double* %38, i64 1
%40 = load double, double* %39
%41 = fcmp olt double %37, %40
br i1 %41, label %48, label %42
42: ; preds = %36
%43 = load double, double* %6
%44 = load double*, double** %7
%45 = getelementptr inbounds double, double* %44, i64 2
%46 = load double, double* %45
%47 = fcmp ogt double %43, %46
br i1 %47, label %48, label %60
48: ; preds = %42, %36, %32
%49 = call i32 (...) @opt_err_pfx()
%50 = load i32, i32* @stderr
%51 = call i8* (...) @opt_name()
%52 = load double*, double** %7
%53 = getelementptr inbounds double, double* %52, i64 1
%54 = load double, double* %53
%55 = load double*, double** %7
%56 = getelementptr inbounds double, double* %55, i64 2
%57 = load double, double* %56
%58 = call i32 @fprintf(i32 %50, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0), i8* %51, double %54, double %57)
%59 = call i32 (...) @opt_err_sfx()
br label %60
60: ; preds = %48, %42
%61 = load double, double* %6
%62 = load double*, double** %7
%63 = getelementptr inbounds double, double* %62, i64 0
store double %61, double* %63
ret i32 0
}

LLVM IR (-O2):
@errno = global i64 0
@.str = [33 x i8] c"the value of %s must be a number\00"
@ERANGE = global i64 0
@stderr = global i32 0
@.str.1 = [46 x i8] c"the value of %s must be in the range %g to %g\00"
define i32 @opt_store_double_lim(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = icmp ne i8* %0, null
%6 = icmp ne i8* %1, null
%7 = and i1 %5, %6
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
store i64 0, i64* @errno
%10 = call double @strtod(i8* %0, i8** %3)
%11 = load i8*, i8** %3
%12 = icmp eq i8* %11, %0
br i1 %12, label %16, label %13
13: ; preds = %2
%14 = load i8, i8* %11
%15 = icmp eq i8 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %13, %2
%17 = tail call i32 @opt_err(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %16, %13
%19 = load i64, i64* @errno
%20 = load i64, i64* @ERANGE
%21 = icmp eq i64 %19, %20
br i1 %21, label %32, label %22
22: ; preds = %18
%23 = getelementptr inbounds i8, i8* %1, i64 8
%24 = bitcast i8* %23 to double*
%25 = load double, double* %24
%26 = fcmp olt double %10, %25
br i1 %26, label %32, label %27
27: ; preds = %22
%28 = getelementptr inbounds i8, i8* %1, i64 16
%29 = bitcast i8* %28 to double*
%30 = load double, double* %29
%31 = fcmp ogt double %10, %30
br i1 %31, label %32, label %44
32: ; preds = %18, %27, %22
%33 = tail call i32 (...) @opt_err_pfx()
%34 = load i32, i32* @stderr
%35 = tail call i8* (...) @opt_name()
%36 = getelementptr inbounds i8, i8* %1, i64 8
%37 = bitcast i8* %36 to double*
%38 = load double, double* %37
%39 = getelementptr inbounds i8, i8* %1, i64 16
%40 = bitcast i8* %39 to double*
%41 = load double, double* %40
%42 = tail call i32 @fprintf(i32 %34, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0), i8* %35, double %38, double %41)
%43 = tail call i32 (...) @opt_err_sfx()
br label %44
44: ; preds = %32, %27
%45 = bitcast i8* %1 to double*
store double %10, double* %45
ret i32 0
}