#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 */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ fullMoons(int /*<<< orphan*/, int /*<<< orphan*/);
char *getCustom(int, char **, int);
int getCustomCount(int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stringToLong(char const *, long *);
int sub_fullmoon(int argc, char *argv[]) {
  const char *arg_decimal_1 = NULL;
  const char *arg_decimal_2 = NULL;
  long month_1 = 0;
  long month_2 = 0;
  int result = EXIT_SUCCESS;
  if (getCustomCount(argc) != 3) {
    fprintf(stderr, "fullmoon expects exactly two additional arguments!\n");
    result = EXIT_FAILURE;
  }
  if (result != EXIT_FAILURE) {
    arg_decimal_1 = getCustom(argc, argv, 1);
    arg_decimal_2 = getCustom(argc, argv, 2);
  }
  if (result != EXIT_FAILURE) {
    if (!stringToLong(arg_decimal_1, &month_1)) {
      fprintf(stderr, "Could not parse first argument as decimal integer!\n");
      result = EXIT_FAILURE;
    }
  }
  if (result != EXIT_FAILURE) {
    if (!stringToLong(arg_decimal_2, &month_2)) {
      fprintf(stderr, "Could not parse second argument as decimal integer!\n");
      result = EXIT_FAILURE;
    }
  }
  if (result != EXIT_FAILURE) {
    if ((month_1 < (-1197)) || (month_1 > (5926)) || (month_2 < (-1197)) ||
        (month_2 > (5926))) {
      fprintf(stderr, "Arguments must be in range %d to %d!\n", (-1197),
              (5926));
      result = EXIT_FAILURE;
    }
  }
  if (result != EXIT_FAILURE) {
    if (month_2 < month_1) {
      fprintf(stderr, "Second argument must not be less than first!\n");
      result = EXIT_FAILURE;
    }
  }
  if (result != EXIT_FAILURE) {
    fullMoons((int32_t)month_1, (int32_t)month_2);
  }
  return result;
}


x86 assembly (clang, -O0):
<sub_fullmoon>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
mov    0x2e4a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <getCustomCount@plt>
cmp    $0x3,%eax
je     11bf <sub_fullmoon+0x6f>
mov    0x2e3d(%rip),%rax
mov    (%rax),%edi
lea    0xe54(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2e1e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    0x2e0f(%rip),%rcx
cmp    (%rcx),%eax
je     11fb <sub_fullmoon+0xab>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x1,%edx
call   1050 <getCustom@plt>
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x2,%edx
call   1050 <getCustom@plt>
mov    %rax,-0x20(%rbp)
mov    -0x34(%rbp),%eax
mov    0x2dd3(%rip),%rcx
cmp    (%rcx),%eax
je     124b <sub_fullmoon+0xfb>
mov    -0x18(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1030 <stringToLong@plt>
cmp    $0x0,%eax
jne    1246 <sub_fullmoon+0xf6>
mov    0x2db6(%rip),%rax
mov    (%rax),%edi
lea    0xe01(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2d97(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
jmp    124b <sub_fullmoon+0xfb>
mov    -0x34(%rbp),%eax
mov    0x2d83(%rip),%rcx
cmp    (%rcx),%eax
je     129b <sub_fullmoon+0x14b>
mov    -0x20(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1030 <stringToLong@plt>
cmp    $0x0,%eax
jne    1296 <sub_fullmoon+0x146>
mov    0x2d66(%rip),%rax
mov    (%rax),%edi
lea    0xde5(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2d47(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
jmp    129b <sub_fullmoon+0x14b>
mov    -0x34(%rbp),%eax
mov    0x2d33(%rip),%rcx
cmp    (%rcx),%eax
je     1317 <sub_fullmoon+0x1c7>
cmpq   $0xfffffffffffffb53,-0x28(%rbp)
ff
jl     12e5 <sub_fullmoon+0x195>
cmpq   $0x1726,-0x28(%rbp)
jg     12e5 <sub_fullmoon+0x195>
cmpq   $0xfffffffffffffb53,-0x30(%rbp)
ff
jl     12e5 <sub_fullmoon+0x195>
cmpq   $0x1726,-0x30(%rbp)
jle    1312 <sub_fullmoon+0x1c2>
mov    0x2cf4(%rip),%rax
mov    (%rax),%edi
lea    0xda8(%rip),%rsi
mov    $0xfffffb53,%edx
mov    $0x1726,%ecx
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2ccb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
jmp    1317 <sub_fullmoon+0x1c7>
mov    -0x34(%rbp),%eax
mov    0x2cb7(%rip),%rcx
cmp    (%rcx),%eax
je     135f <sub_fullmoon+0x20f>
mov    -0x30(%rbp),%rax
cmp    -0x28(%rbp),%rax
jge    135a <sub_fullmoon+0x20a>
mov    0x2ca2(%rip),%rax
mov    (%rax),%edi
lea    0xd7c(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2c83(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
jmp    135f <sub_fullmoon+0x20f>
mov    -0x34(%rbp),%eax
mov    0x2c6f(%rip),%rcx
cmp    (%rcx),%eax
je     1382 <sub_fullmoon+0x232>
mov    -0x28(%rbp),%rax
mov    %eax,%edi
mov    -0x30(%rbp),%rax
mov    %eax,%esi
call   1070 <fullMoons@plt>
mov    -0x34(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sub_fullmoon>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
movq   $0x0,0x8(%rsp)
movq   $0x0,(%rsp)
mov    0x2e57(%rip),%rax
mov    (%rax),%r12d
call   1040 <getCustomCount@plt>
cmp    $0x3,%eax
jne    11a1 <sub_fullmoon+0x51>
mov    0x2e4b(%rip),%r15
mov    (%r15),%eax
cmp    %eax,%r12d
jne    11c6 <sub_fullmoon+0x76>
xor    %r14d,%r14d
xor    %ebx,%ebx
cmp    %eax,%r12d
je     11f2 <sub_fullmoon+0xa2>
jmp    11fa <sub_fullmoon+0xaa>
mov    0x2e38(%rip),%rax
mov    (%rax),%edi
lea    0xe4f(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    0x2e19(%rip),%rax
mov    (%rax),%eax
jmp    12a7 <sub_fullmoon+0x157>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1050 <getCustom@plt>
mov    %rax,%r14
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1050 <getCustom@plt>
mov    %rax,%rbx
mov    (%r15),%eax
cmp    %eax,%r12d
jne    11fa <sub_fullmoon+0xaa>
mov    %r12d,%eax
jmp    12a7 <sub_fullmoon+0x157>
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1030 <stringToLong@plt>
test   %eax,%eax
je     127b <sub_fullmoon+0x12b>
mov    (%r15),%eax
cmp    %eax,%r12d
je     12a7 <sub_fullmoon+0x157>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1030 <stringToLong@plt>
test   %eax,%eax
je     128d <sub_fullmoon+0x13d>
mov    (%r15),%eax
cmp    %eax,%r12d
je     12a7 <sub_fullmoon+0x157>
mov    $0xffffffffffffe8d9,%rcx
add    0x8(%rsp),%rcx
cmp    $0xffffffffffffe42c,%rcx
jb     12b4 <sub_fullmoon+0x164>
mov    (%rsp),%rcx
cmp    $0xfffffffffffffb53,%rcx
jl     12b4 <sub_fullmoon+0x164>
cmp    $0x1727,%rcx
jge    12b4 <sub_fullmoon+0x164>
cmp    %eax,%r12d
je     12a7 <sub_fullmoon+0x157>
mov    (%rsp),%rcx
cmp    0x8(%rsp),%rcx
jge    12d7 <sub_fullmoon+0x187>
mov    0x2d70(%rip),%rax
mov    (%rax),%edi
lea    0xe4a(%rip),%rsi
jmp    129d <sub_fullmoon+0x14d>
mov    0x2d5e(%rip),%rax
mov    (%rax),%edi
lea    0xda9(%rip),%rsi
jmp    129d <sub_fullmoon+0x14d>
mov    0x2d4c(%rip),%rax
mov    (%rax),%edi
lea    0xdcb(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%r15),%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2d25(%rip),%rax
mov    (%rax),%edi
lea    0xdd9(%rip),%rsi
mov    $0xfffffb53,%edx
mov    $0x1726,%ecx
xor    %eax,%eax
call   1060 <fprintf@plt>
jmp    12a4 <sub_fullmoon+0x154>
cmp    %eax,%r12d
je     11f2 <sub_fullmoon+0xa2>
mov    0x8(%rsp),%edi
mov    (%rsp),%esi
call   1070 <fullMoons@plt>
jmp    11f2 <sub_fullmoon+0xa2>

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
@stderr = global i32 0
@.str = [52 x i8] c"fullmoon expects exactly two additional arguments!\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [52 x i8] c"Could not parse first argument as decimal integer!\0A\00"
@.str.2 = [53 x i8] c"Could not parse second argument as decimal integer!\0A\00"
@.str.3 = [38 x i8] c"Arguments must be in range %d to %d!\0A\00"
@.str.4 = [46 x i8] c"Second argument must not be less than first!\0A\00"
define i32 @sub_fullmoon(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i8* null, i8** %5
store i8* null, i8** %6
store i64 0, i64* %7
store i64 0, i64* %8
%10 = load i32, i32* @EXIT_SUCCESS
store i32 %10, i32* %9
%11 = load i32, i32* %3
%12 = call i32 @getCustomCount(i32 %11)
%13 = icmp ne i32 %12, 3
br i1 %13, label %14, label %18
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%17 = load i32, i32* @EXIT_FAILURE
store i32 %17, i32* %9
br label %18
18: ; preds = %14, %2
%19 = load i32, i32* %9
%20 = load i32, i32* @EXIT_FAILURE
%21 = icmp ne i32 %19, %20
br i1 %21, label %22, label %29
22: ; preds = %18
%23 = load i32, i32* %3
%24 = load i8**, i8*** %4
%25 = call i8* @getCustom(i32 %23, i8** %24, i32 1)
store i8* %25, i8** %5
%26 = load i32, i32* %3
%27 = load i8**, i8*** %4
%28 = call i8* @getCustom(i32 %26, i8** %27, i32 2)
store i8* %28, i8** %6
br label %29
29: ; preds = %22, %18
%30 = load i32, i32* %9
%31 = load i32, i32* @EXIT_FAILURE
%32 = icmp ne i32 %30, %31
br i1 %32, label %33, label %42
33: ; preds = %29
%34 = load i8*, i8** %5
%35 = call i32 @stringToLong(i8* %34, i64* %7)
%36 = icmp ne i32 %35, 0
br i1 %36, label %41, label %37
37: ; preds = %33
%38 = load i32, i32* @stderr
%39 = call i32 (i32, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0))
%40 = load i32, i32* @EXIT_FAILURE
store i32 %40, i32* %9
br label %41
41: ; preds = %37, %33
br label %42
42: ; preds = %41, %29
%43 = load i32, i32* %9
%44 = load i32, i32* @EXIT_FAILURE
%45 = icmp ne i32 %43, %44
br i1 %45, label %46, label %55
46: ; preds = %42
%47 = load i8*, i8** %6
%48 = call i32 @stringToLong(i8* %47, i64* %8)
%49 = icmp ne i32 %48, 0
br i1 %49, label %54, label %50
50: ; preds = %46
%51 = load i32, i32* @stderr
%52 = call i32 (i32, i8*, ...) @fprintf(i32 %51, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0))
%53 = load i32, i32* @EXIT_FAILURE
store i32 %53, i32* %9
br label %54
54: ; preds = %50, %46
br label %55
55: ; preds = %54, %42
%56 = load i32, i32* %9
%57 = load i32, i32* @EXIT_FAILURE
%58 = icmp ne i32 %56, %57
br i1 %58, label %59, label %76
59: ; preds = %55
%60 = load i64, i64* %7
%61 = icmp slt i64 %60, -1197
br i1 %61, label %71, label %62
62: ; preds = %59
%63 = load i64, i64* %7
%64 = icmp sgt i64 %63, 5926
br i1 %64, label %71, label %65
65: ; preds = %62
%66 = load i64, i64* %8
%67 = icmp slt i64 %66, -1197
br i1 %67, label %71, label %68
68: ; preds = %65
%69 = load i64, i64* %8
%70 = icmp sgt i64 %69, 5926
br i1 %70, label %71, label %75
71: ; preds = %68, %65, %62, %59
%72 = load i32, i32* @stderr
%73 = call i32 (i32, i8*, ...) @fprintf(i32 %72, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i32 -1197, i32 5926)
%74 = load i32, i32* @EXIT_FAILURE
store i32 %74, i32* %9
br label %75
75: ; preds = %71, %68
br label %76
76: ; preds = %75, %55
%77 = load i32, i32* %9
%78 = load i32, i32* @EXIT_FAILURE
%79 = icmp ne i32 %77, %78
br i1 %79, label %80, label %89
80: ; preds = %76
%81 = load i64, i64* %8
%82 = load i64, i64* %7
%83 = icmp slt i64 %81, %82
br i1 %83, label %84, label %88
84: ; preds = %80
%85 = load i32, i32* @stderr
%86 = call i32 (i32, i8*, ...) @fprintf(i32 %85, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0))
%87 = load i32, i32* @EXIT_FAILURE
store i32 %87, i32* %9
br label %88
88: ; preds = %84, %80
br label %89
89: ; preds = %88, %76
%90 = load i32, i32* %9
%91 = load i32, i32* @EXIT_FAILURE
%92 = icmp ne i32 %90, %91
br i1 %92, label %93, label %99
93: ; preds = %89
%94 = load i64, i64* %7
%95 = trunc i64 %94 to i32
%96 = load i64, i64* %8
%97 = trunc i64 %96 to i32
%98 = call i32 @fullMoons(i32 %95, i32 %97)
br label %99
99: ; preds = %93, %89
%100 = load i32, i32* %9
ret i32 %100
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@stderr = global i32 0
@.str = [52 x i8] c"fullmoon expects exactly two additional arguments!\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [52 x i8] c"Could not parse first argument as decimal integer!\0A\00"
@.str.2 = [53 x i8] c"Could not parse second argument as decimal integer!\0A\00"
@.str.3 = [38 x i8] c"Arguments must be in range %d to %d!\0A\00"
@.str.4 = [46 x i8] c"Second argument must not be less than first!\0A\00"
define i32 @sub_fullmoon(i32 %0, i8** %1) {
%3 = alloca i64
%4 = alloca i64
%5 = bitcast i64* %3 to i8*
store i64 0, i64* %3
%6 = bitcast i64* %4 to i8*
store i64 0, i64* %4
%7 = load i32, i32* @EXIT_SUCCESS
%8 = tail call i32 @getCustomCount(i32 %0)
%9 = icmp eq i32 %8, 3
br i1 %9, label %14, label %10
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = tail call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%13 = load i32, i32* @EXIT_FAILURE
br label %77
14: ; preds = %2
%15 = load i32, i32* @EXIT_FAILURE
%16 = icmp eq i32 %7, %15
br i1 %16, label %21, label %17
17: ; preds = %14
%18 = tail call i8* @getCustom(i32 %0, i8** %1, i32 1)
%19 = tail call i8* @getCustom(i32 %0, i8** %1, i32 2)
%20 = load i32, i32* @EXIT_FAILURE
br label %21
21: ; preds = %17, %14
%22 = phi i32 [ %20, %17 ], [ %15, %14 ]
%23 = phi i8* [ %18, %17 ], [ null, %14 ]
%24 = phi i8* [ %19, %17 ], [ null, %14 ]
%25 = icmp eq i32 %7, %22
br i1 %25, label %77, label %26
26: ; preds = %21
%27 = call i32 @stringToLong(i8* %23, i64* %3)
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %33
29: ; preds = %26
%30 = load i32, i32* @stderr
%31 = call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0))
%32 = load i32, i32* @EXIT_FAILURE
br label %77
33: ; preds = %26
%34 = load i32, i32* @EXIT_FAILURE
%35 = icmp eq i32 %7, %34
br i1 %35, label %77, label %36
36: ; preds = %33
%37 = call i32 @stringToLong(i8* %24, i64* %4)
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %43
39: ; preds = %36
%40 = load i32, i32* @stderr
%41 = call i32 (i32, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0))
%42 = load i32, i32* @EXIT_FAILURE
br label %77
43: ; preds = %36
%44 = load i32, i32* @EXIT_FAILURE
%45 = icmp eq i32 %7, %44
br i1 %45, label %77, label %46
46: ; preds = %43
%47 = load i64, i64* %3
%48 = add i64 %47, -5927
%49 = icmp ult i64 %48, -7124
%50 = load i64, i64* %4
%51 = icmp slt i64 %50, -1197
%52 = select i1 %49, i1 true, i1 %51
%53 = icmp sgt i64 %50, 5926
%54 = select i1 %52, i1 true, i1 %53
br i1 %54, label %55, label %59
55: ; preds = %46
%56 = load i32, i32* @stderr
%57 = call i32 (i32, i8*, ...) @fprintf(i32 %56, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i32 -1197, i32 5926)
%58 = load i32, i32* @EXIT_FAILURE
br label %77
59: ; preds = %46
%60 = icmp eq i32 %7, %44
br i1 %60, label %77, label %61
61: ; preds = %59
%62 = load i64, i64* %4
%63 = load i64, i64* %3
%64 = icmp slt i64 %62, %63
br i1 %64, label %65, label %69
65: ; preds = %61
%66 = load i32, i32* @stderr
%67 = call i32 (i32, i8*, ...) @fprintf(i32 %66, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0))
%68 = load i32, i32* @EXIT_FAILURE
br label %77
69: ; preds = %61
%70 = icmp eq i32 %7, %44
br i1 %70, label %77, label %71
71: ; preds = %69
%72 = load i64, i64* %3
%73 = trunc i64 %72 to i32
%74 = load i64, i64* %4
%75 = trunc i64 %74 to i32
%76 = call i32 @fullMoons(i32 %73, i32 %75)
br label %77
77: ; preds = %10, %21, %29, %33, %39, %43, %55, %59, %65, %71, %69
%78 = phi i32 [ %7, %71 ], [ %7, %69 ], [ %44, %59 ], [ %68, %65 ], [ %44, %43 ], [ %58, %55 ], [ %34, %33 ], [ %42, %39 ], [ %13, %10 ], [ %7, %21 ], [ %32, %29 ]
ret i32 %78
}