#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 */
char *conf_get_str(char *, char *);
int sscanf(char *, char *, int *, int *, int *);
int /*<<< orphan*/ warn(char *, char *, char *, char *);
int conf_match_num(char *section, char *tag, int x) {
  char *value = conf_get_str(section, tag);
  int val, min, max, n;
  if (!value)
    return (0);
  n = sscanf(value, "%d,%d:%d", &val, &min, &max);
  switch (n) {
  case 1:
    return (x == val);
  case 3:
    return (min <= x && max >= x);
  default:
    warn("conf_match_num: section %s tag %s: "
         "invalid number spec %s",
         section, tag, value);
  }
  return (0);
}


x86 assembly (clang, -O0):
<conf_match_num>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <conf_get_str@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    116b <conf_match_num+0x3b>
movl   $0x0,-0x4(%rbp)
jmp    1211 <conf_match_num+0xe1>
mov    -0x28(%rbp),%rdi
lea    0xe8a(%rip),%rsi
lea    -0x2c(%rbp),%rdx
lea    -0x30(%rbp),%rcx
lea    -0x34(%rbp),%r8
call   1050 <sscanf@plt>
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%eax
mov    %eax,-0x3c(%rbp)
sub    $0x1,%eax
je     11af <conf_match_num+0x7f>
jmp    119e <conf_match_num+0x6e>
mov    -0x3c(%rbp),%eax
sub    $0x3,%eax
je     11c5 <conf_match_num+0x95>
jmp    11f2 <conf_match_num+0xc2>
mov    -0x1c(%rbp),%eax
cmp    -0x2c(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    1211 <conf_match_num+0xe1>
mov    -0x30(%rbp),%ecx
xor    %eax,%eax
cmp    -0x1c(%rbp),%ecx
mov    %al,-0x3d(%rbp)
jg     11e2 <conf_match_num+0xb2>
mov    -0x34(%rbp),%eax
cmp    -0x1c(%rbp),%eax
setge  %al
mov    %al,-0x3d(%rbp)
mov    -0x3d(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    1211 <conf_match_num+0xe1>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x28(%rbp),%rcx
lea    0xe04(%rip),%rdi
call   1030 <warn@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<conf_match_num>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %edx,%r14d
mov    %rsi,%r15
mov    %rdi,%rbp
call   1040 <conf_get_str@plt>
test   %rax,%rax
je     11ab <conf_match_num+0x7b>
mov    %rax,%rbx
lea    0xea9(%rip),%rsi
lea    0x14(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0xc(%rsp),%r8
mov    %rax,%rdi
call   1050 <sscanf@plt>
cmp    $0x3,%eax
je     1182 <conf_match_num+0x52>
cmp    $0x1,%eax
jne    1196 <conf_match_num+0x66>
cmp    %r14d,0x14(%rsp)
sete   %al
jmp    11ad <conf_match_num+0x7d>
cmp    %r14d,0x10(%rsp)
setle  %cl
cmp    %r14d,0xc(%rsp)
setge  %al
and    %cl,%al
jmp    11ad <conf_match_num+0x7d>
lea    0xe6c(%rip),%rdi
mov    %rbp,%rsi
mov    %r15,%rdx
mov    %rbx,%rcx
call   1030 <warn@plt>
xor    %eax,%eax
movzbl %al,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%d,%d:%d\00"
@.str.1 = [58 x i8] c"conf_match_num: section %s tag %s: invalid number spec %s\00"
define i32 @conf_match_num(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%13 = load i8*, i8** %5
%14 = load i8*, i8** %6
%15 = call i8* @conf_get_str(i8* %13, i8* %14)
store i8* %15, i8** %8
%16 = load i8*, i8** %8
%17 = icmp ne i8* %16, null
br i1 %17, label %19, label %18
18: ; preds = %3
store i32 0, i32* %4
br label %45
19: ; preds = %3
%20 = load i8*, i8** %8
%21 = call i32 @sscanf(i8* %20, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %9, i32* %10, i32* %11)
store i32 %21, i32* %12
%22 = load i32, i32* %12
switch i32 %22, label %39 [
i32 1, label %23
i32 3, label %28
]
23: ; preds = %19
%24 = load i32, i32* %7
%25 = load i32, i32* %9
%26 = icmp eq i32 %24, %25
%27 = zext i1 %26 to i32
store i32 %27, i32* %4
br label %45
28: ; preds = %19
%29 = load i32, i32* %10
%30 = load i32, i32* %7
%31 = icmp sle i32 %29, %30
br i1 %31, label %32, label %36
32: ; preds = %28
%33 = load i32, i32* %11
%34 = load i32, i32* %7
%35 = icmp sge i32 %33, %34
br label %36
36: ; preds = %32, %28
%37 = phi i1 [ false, %28 ], [ %35, %32 ]
%38 = zext i1 %37 to i32
store i32 %38, i32* %4
br label %45
39: ; preds = %19
%40 = load i8*, i8** %5
%41 = load i8*, i8** %6
%42 = load i8*, i8** %8
%43 = call i32 @warn(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0), i8* %40, i8* %41, i8* %42)
br label %44
44: ; preds = %39
store i32 0, i32* %4
br label %45
45: ; preds = %44, %36, %23, %18
%46 = load i32, i32* %4
ret i32 %46
}

LLVM IR (-O2):
@.str = [9 x i8] c"%d,%d:%d\00"
@.str.1 = [58 x i8] c"conf_match_num: section %s tag %s: invalid number spec %s\00"
define i32 @conf_match_num(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = tail call i8* @conf_get_str(i8* %0, i8* %1)
%8 = bitcast i32* %4 to i8*
%9 = bitcast i32* %5 to i8*
%10 = bitcast i32* %6 to i8*
%11 = icmp eq i8* %7, null
br i1 %11, label %25, label %12
12: ; preds = %3
%13 = call i32 @sscanf(i8* %7, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %4, i32* %5, i32* %6)
switch i32 %13, label %23 [
i32 1, label %14
i32 3, label %17
]
14: ; preds = %12
%15 = load i32, i32* %4
%16 = icmp eq i32 %15, %2
br label %25
17: ; preds = %12
%18 = load i32, i32* %5
%19 = icmp sle i32 %18, %2
%20 = load i32, i32* %6
%21 = icmp sge i32 %20, %2
%22 = select i1 %19, i1 %21, i1 false
br label %25
23: ; preds = %12
%24 = call i32 @warn(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %1, i8* %7)
br label %25
25: ; preds = %3, %23, %17, %14
%26 = phi i1 [ false, %23 ], [ %22, %17 ], [ %16, %14 ], [ false, %3 ]
%27 = zext i1 %26 to i32
ret i32 %27
}