#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*/ logMsg(int, char *, char *, int, int);
long strToLong(char *, int);
int isNumericOk(char *value, int minValue, int maxValue) {
  long longVal = strToLong(value, -1);
  if ((longVal == -1) || (longVal < minValue) || (longVal > maxValue)) {
    logMsg(4,
           "Attempt to update numeric config with invalid/out-of-range value "
           "of %s (min=%d max=%d)",
           value, minValue, maxValue);
    return 0;
  } else {
    return 1;
  }
}


x86 assembly (clang, -O0):
<isNumericOk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0xffffffff,%esi
call   1030 <strToLong@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0xffffffffffffffff,-0x20(%rbp)
je     1171 <isNumericOk+0x51>
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmp    %rcx,%rax
jl     1171 <isNumericOk+0x51>
mov    -0x20(%rbp),%rax
movslq -0x18(%rbp),%rcx
cmp    %rcx,%rax
jle    1199 <isNumericOk+0x79>
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    $0x4,%edi
lea    0xe78(%rip),%rsi
call   1040 <logMsg@plt>
movl   $0x0,-0x4(%rbp)
jmp    11a0 <isNumericOk+0x80>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isNumericOk>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%r14d
mov    %rdi,%rbp
mov    $0xffffffff,%esi
call   1030 <strToLong@plt>
movslq %ebx,%rcx
cmp    %rcx,%rax
jg     1151 <isNumericOk+0x31>
cmp    $0xffffffffffffffff,%rax
je     1151 <isNumericOk+0x31>
movslq %r14d,%rdx
mov    $0x1,%ecx
cmp    %rdx,%rax
jge    116d <isNumericOk+0x4d>
lea    0xea8(%rip),%rsi
mov    $0x4,%edi
mov    %rbp,%rdx
mov    %r14d,%ecx
mov    %ebx,%r8d
call   1040 <logMsg@plt>
xor    %ecx,%ecx
mov    %ecx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [87 x i8] c"Attempt to update numeric config with invalid/out-of-range value of %s (min=%d max=%d)\00"
define i32 @isNumericOk(i8* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i64
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%9 = load i8*, i8** %5
%10 = call i64 @strToLong(i8* %9, i32 -1)
store i64 %10, i64* %8
%11 = load i64, i64* %8
%12 = icmp eq i64 %11, -1
br i1 %12, label %23, label %13
13: ; preds = %3
%14 = load i64, i64* %8
%15 = load i32, i32* %6
%16 = sext i32 %15 to i64
%17 = icmp slt i64 %14, %16
br i1 %17, label %23, label %18
18: ; preds = %13
%19 = load i64, i64* %8
%20 = load i32, i32* %7
%21 = sext i32 %20 to i64
%22 = icmp sgt i64 %19, %21
br i1 %22, label %23, label %28
23: ; preds = %18, %13, %3
%24 = load i8*, i8** %5
%25 = load i32, i32* %6
%26 = load i32, i32* %7
%27 = call i32 @logMsg(i32 4, i8* getelementptr inbounds ([87 x i8], [87 x i8]* @.str, i64 0, i64 0), i8* %24, i32 %25, i32 %26)
store i32 0, i32* %4
br label %29
28: ; preds = %18
store i32 1, i32* %4
br label %29
29: ; preds = %28, %23
%30 = load i32, i32* %4
ret i32 %30
}

LLVM IR (-O2):
@.str = [87 x i8] c"Attempt to update numeric config with invalid/out-of-range value of %s (min=%d max=%d)\00"
define i32 @isNumericOk(i8* %0, i32 %1, i32 %2) {
%4 = tail call i64 @strToLong(i8* %0, i32 -1)
%5 = icmp eq i64 %4, -1
%6 = sext i32 %1 to i64
%7 = icmp slt i64 %4, %6
%8 = or i1 %5, %7
%9 = sext i32 %2 to i64
%10 = icmp sgt i64 %4, %9
%11 = or i1 %10, %8
br i1 %11, label %12, label %14
12: ; preds = %3
%13 = tail call i32 @logMsg(i32 4, i8* getelementptr inbounds ([87 x i8], [87 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1, i32 %2)
br label %14
14: ; preds = %3, %12
%15 = phi i32 [ 0, %12 ], [ 1, %3 ]
ret i32 %15
}