#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 *, char const *,
                           char const *, unsigned int, ...);
int /*<<< orphan*/ stderr;
int check_multiple_option_occurrences(const char *prog_name,
                                      unsigned int option_given,
                                      unsigned int min, unsigned int max,
                                      const char *option_desc) {
  int error_occurred = 0;
  if (option_given && (min > 0 || max > 0)) {
    if (min > 0 && max > 0) {
      if (min == max) {
        if (option_given != (unsigned int)min) {
          fprintf(stderr, "%s: %s option occurrences must be %d\n", prog_name,
                  option_desc, min);
          error_occurred = 1;
        }
      } else if (option_given < (unsigned int)min ||
                 option_given > (unsigned int)max) {
        fprintf(stderr, "%s: %s option occurrences must be between %d and %d\n",
                prog_name, option_desc, min, max);
        error_occurred = 1;
      }
    } else if (min > 0) {
      if (option_given < min) {
        fprintf(stderr, "%s: %s option occurrences must be at least %d\n",
                prog_name, option_desc, min);
        error_occurred = 1;
      }
    } else if (max > 0) {
      if (option_given > max) {
        fprintf(stderr, "%s: %s option occurrences must be at most %d\n",
                prog_name, option_desc, max);
        error_occurred = 1;
      }
    }
  }
  return error_occurred;
}


x86 assembly (clang, -O0):
<check_multiple_option_occurrences>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1292 <check_multiple_option_occurrences+0x182>
cmpl   $0x0,-0x10(%rbp)
ja     114e <check_multiple_option_occurrences+0x3e>
cmpl   $0x0,-0x14(%rbp)
jbe    1292 <check_multiple_option_occurrences+0x182>
cmpl   $0x0,-0x10(%rbp)
jbe    11f9 <check_multiple_option_occurrences+0xe9>
cmpl   $0x0,-0x14(%rbp)
jbe    11f9 <check_multiple_option_occurrences+0xe9>
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    11a9 <check_multiple_option_occurrences+0x99>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
je     11a4 <check_multiple_option_occurrences+0x94>
mov    0x2e5f(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%r8d
lea    0xe6a(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x1,-0x24(%rbp)
jmp    11f4 <check_multiple_option_occurrences+0xe4>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jb     11c1 <check_multiple_option_occurrences+0xb1>
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jbe    11ef <check_multiple_option_occurrences+0xdf>
mov    0x2e18(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%r8d
mov    -0x14(%rbp),%r9d
lea    0xe45(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x1,-0x24(%rbp)
jmp    11f4 <check_multiple_option_occurrences+0xe4>
jmp    128d <check_multiple_option_occurrences+0x17d>
cmpl   $0x0,-0x10(%rbp)
jbe    123e <check_multiple_option_occurrences+0x12e>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jae    1239 <check_multiple_option_occurrences+0x129>
mov    0x2dca(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%r8d
lea    0xe30(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x1,-0x24(%rbp)
jmp    1288 <check_multiple_option_occurrences+0x178>
cmpl   $0x0,-0x14(%rbp)
jbe    1283 <check_multiple_option_occurrences+0x173>
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jbe    127e <check_multiple_option_occurrences+0x16e>
mov    0x2d85(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x14(%rbp),%r8d
lea    0xe1a(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x1,-0x24(%rbp)
jmp    1283 <check_multiple_option_occurrences+0x173>
jmp    1288 <check_multiple_option_occurrences+0x178>
jmp    128d <check_multiple_option_occurrences+0x17d>
jmp    1292 <check_multiple_option_occurrences+0x182>
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_multiple_option_occurrences>:
push   %rax
xor    %eax,%eax
test   %esi,%esi
je     11d0 <check_multiple_option_occurrences+0xc0>
mov    %ecx,%r10d
mov    %edx,%r9d
or     %edx,%ecx
je     11d0 <check_multiple_option_occurrences+0xc0>
mov    %rdi,%rdx
test   %r9d,%r9d
je     1156 <check_multiple_option_occurrences+0x46>
test   %r10d,%r10d
je     1156 <check_multiple_option_occurrences+0x46>
cmp    %r10d,%r9d
jne    1178 <check_multiple_option_occurrences+0x68>
cmp    %r9d,%esi
je     11d0 <check_multiple_option_occurrences+0xc0>
mov    0x2e95(%rip),%rax
mov    (%rax),%edi
lea    0xeac(%rip),%rsi
jmp    1170 <check_multiple_option_occurrences+0x60>
test   %r9d,%r9d
je     11a4 <check_multiple_option_occurrences+0x94>
cmp    %r9d,%esi
jae    11d0 <check_multiple_option_occurrences+0xc0>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
lea    0xeeb(%rip),%rsi
mov    %r8,%rcx
mov    %r9d,%r8d
jmp    11c4 <check_multiple_option_occurrences+0xb4>
cmp    %r9d,%esi
jb     1182 <check_multiple_option_occurrences+0x72>
cmp    %r10d,%esi
jbe    11d0 <check_multiple_option_occurrences+0xc0>
mov    0x2e57(%rip),%rax
mov    (%rax),%edi
lea    0xe94(%rip),%rsi
mov    %r8,%rcx
mov    %r9d,%r8d
mov    %r10d,%r9d
xor    %eax,%eax
call   1030 <fprintf@plt>
jmp    11cb <check_multiple_option_occurrences+0xbb>
test   %r10d,%r10d
je     11d0 <check_multiple_option_occurrences+0xc0>
cmp    %r10d,%esi
jbe    11d0 <check_multiple_option_occurrences+0xc0>
mov    0x2e2b(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
mov    %r8,%rcx
mov    %r10d,%r8d
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [38 x i8] c"%s: %s option occurrences must be %d\0A\00"
@.str.1 = [53 x i8] c"%s: %s option occurrences must be between %d and %d\0A\00"
@.str.2 = [47 x i8] c"%s: %s option occurrences must be at least %d\0A\00"
@.str.3 = [46 x i8] c"%s: %s option occurrences must be at most %d\0A\00"
define i32 @check_multiple_option_occurrences(i8* %0, i32 %1, i32 %2, i32 %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
store i8* %0, i8** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i8* %4, i8** %10
store i32 0, i32* %11
%12 = load i32, i32* %7
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %89
14: ; preds = %5
%15 = load i32, i32* %8
%16 = icmp ugt i32 %15, 0
br i1 %16, label %20, label %17
17: ; preds = %14
%18 = load i32, i32* %9
%19 = icmp ugt i32 %18, 0
br i1 %19, label %20, label %89
20: ; preds = %17, %14
%21 = load i32, i32* %8
%22 = icmp ugt i32 %21, 0
br i1 %22, label %23, label %58
23: ; preds = %20
%24 = load i32, i32* %9
%25 = icmp ugt i32 %24, 0
br i1 %25, label %26, label %58
26: ; preds = %23
%27 = load i32, i32* %8
%28 = load i32, i32* %9
%29 = icmp eq i32 %27, %28
br i1 %29, label %30, label %41
30: ; preds = %26
%31 = load i32, i32* %7
%32 = load i32, i32* %8
%33 = icmp ne i32 %31, %32
br i1 %33, label %34, label %40
34: ; preds = %30
%35 = load i32, i32* @stderr
%36 = load i8*, i8** %6
%37 = load i8*, i8** %10
%38 = load i32, i32* %8
%39 = call i32 (i32, i8*, i8*, i8*, i32, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %36, i8* %37, i32 %38)
store i32 1, i32* %11
br label %40
40: ; preds = %34, %30
br label %57
41: ; preds = %26
%42 = load i32, i32* %7
%43 = load i32, i32* %8
%44 = icmp ult i32 %42, %43
br i1 %44, label %49, label %45
45: ; preds = %41
%46 = load i32, i32* %7
%47 = load i32, i32* %9
%48 = icmp ugt i32 %46, %47
br i1 %48, label %49, label %56
49: ; preds = %45, %41
%50 = load i32, i32* @stderr
%51 = load i8*, i8** %6
%52 = load i8*, i8** %10
%53 = load i32, i32* %8
%54 = load i32, i32* %9
%55 = call i32 (i32, i8*, i8*, i8*, i32, ...) @fprintf(i32 %50, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.1, i64 0, i64 0), i8* %51, i8* %52, i32 %53, i32 %54)
store i32 1, i32* %11
br label %56
56: ; preds = %49, %45
br label %57
57: ; preds = %56, %40
br label %88
58: ; preds = %23, %20
%59 = load i32, i32* %8
%60 = icmp ugt i32 %59, 0
br i1 %60, label %61, label %72
61: ; preds = %58
%62 = load i32, i32* %7
%63 = load i32, i32* %8
%64 = icmp ult i32 %62, %63
br i1 %64, label %65, label %71
65: ; preds = %61
%66 = load i32, i32* @stderr
%67 = load i8*, i8** %6
%68 = load i8*, i8** %10
%69 = load i32, i32* %8
%70 = call i32 (i32, i8*, i8*, i8*, i32, ...) @fprintf(i32 %66, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0), i8* %67, i8* %68, i32 %69)
store i32 1, i32* %11
br label %71
71: ; preds = %65, %61
br label %87
72: ; preds = %58
%73 = load i32, i32* %9
%74 = icmp ugt i32 %73, 0
br i1 %74, label %75, label %86
75: ; preds = %72
%76 = load i32, i32* %7
%77 = load i32, i32* %9
%78 = icmp ugt i32 %76, %77
br i1 %78, label %79, label %85
79: ; preds = %75
%80 = load i32, i32* @stderr
%81 = load i8*, i8** %6
%82 = load i8*, i8** %10
%83 = load i32, i32* %9
%84 = call i32 (i32, i8*, i8*, i8*, i32, ...) @fprintf(i32 %80, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0), i8* %81, i8* %82, i32 %83)
store i32 1, i32* %11
br label %85
85: ; preds = %79, %75
br label %86
86: ; preds = %85, %72
br label %87
87: ; preds = %86, %71
br label %88
88: ; preds = %87, %57
br label %89
89: ; preds = %88, %17, %5
%90 = load i32, i32* %11
ret i32 %90
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [38 x i8] c"%s: %s option occurrences must be %d\0A\00"
@.str.1 = [53 x i8] c"%s: %s option occurrences must be between %d and %d\0A\00"
@.str.2 = [47 x i8] c"%s: %s option occurrences must be at least %d\0A\00"
@.str.3 = [46 x i8] c"%s: %s option occurrences must be at most %d\0A\00"
define i32 @check_multiple_option_occurrences(i8* %0, i32 %1, i32 %2, i32 %3, i8* %4) {
%6 = icmp eq i32 %1, 0
br i1 %6, label %40, label %7
7: ; preds = %5
%8 = icmp ne i32 %2, 0
%9 = icmp ne i32 %3, 0
%10 = or i32 %3, %2
%11 = icmp eq i32 %10, 0
br i1 %11, label %40, label %12
12: ; preds = %7
%13 = and i1 %8, %9
br i1 %13, label %14, label %28
14: ; preds = %12
%15 = icmp eq i32 %2, %3
br i1 %15, label %16, label %21
16: ; preds = %14
%17 = icmp eq i32 %1, %2
br i1 %17, label %40, label %18
18: ; preds = %16
%19 = load i32, i32* @stderr
%20 = tail call i32 (i32, i8*, i8*, i8*, i32, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %4, i32 %2)
br label %40
21: ; preds = %14
%22 = icmp ult i32 %1, %2
%23 = icmp ugt i32 %1, %3
%24 = or i1 %22, %23
br i1 %24, label %25, label %40
25: ; preds = %21
%26 = load i32, i32* @stderr
%27 = tail call i32 (i32, i8*, i8*, i8*, i32, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %4, i32 %2, i32 %3)
br label %40
28: ; preds = %12
br i1 %8, label %29, label %34
29: ; preds = %28
%30 = icmp ult i32 %1, %2
br i1 %30, label %31, label %40
31: ; preds = %29
%32 = load i32, i32* @stderr
%33 = tail call i32 (i32, i8*, i8*, i8*, i32, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0), i8* %0, i8* %4, i32 %2)
br label %40
34: ; preds = %28
%35 = icmp ugt i32 %1, %3
%36 = and i1 %9, %35
br i1 %36, label %37, label %40
37: ; preds = %34
%38 = load i32, i32* @stderr
%39 = tail call i32 (i32, i8*, i8*, i8*, i32, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0), i8* %0, i8* %4, i32 %3)
br label %40
40: ; preds = %21, %25, %16, %18, %34, %37, %29, %31, %7, %5
%41 = phi i32 [ 1, %18 ], [ 0, %16 ], [ 1, %25 ], [ 1, %31 ], [ 0, %29 ], [ 1, %37 ], [ 0, %34 ], [ 0, %7 ], [ 0, %5 ], [ 0, %21 ]
ret i32 %41
}