#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 */
struct option {
  char *member_0;
  char member_3;
  int /*<<< orphan*/ member_2;
  int /*<<< orphan*/ const member_1;
};

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int getopt_long(int, char **, char const *, struct option const *, int *);
char *optarg;
#define optional_argument 129
int process(char const *, int, int);
#define required_argument 128
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  const char *option_string = "f:s:e:h::";
  static const struct option options[] = {{"help", optional_argument, 0, 'h'},
                                          {"file", required_argument, 0, 'f'},
                                          {"start", required_argument, 0, 's'},
                                          {"end", required_argument, 0, 'e'},
                                          {0, 0, 0, 0}};
  const char *filename = NULL;
  int start = 0;
  int end = 0;
  int i = 0;
  int item = 0;
  extern int cimplog_debug_level;
  cimplog_debug_level = -1;
  while (-1 != (item = getopt_long(argc, argv, option_string, options, &i))) {
    switch (item) {
    case 'f':
      filename = optarg;
      break;
    case 's':
      start = atoi(optarg);
      break;
    case 'e':
      end = atoi(optarg);
      break;
    default:
      fprintf(stderr, "Usage:\naker-cli -f filename [-s starting_unixtime] [-e "
                      "ending_unixtime]\n\n");
      fprintf(stderr, "    Outputs the schedule according to aker and how it "
                      "interprets a schedule\n");
      fprintf(stderr, "    over a window of time.\n\n");
      fprintf(
          stderr,
          "    If ending_unixtime is 0, process the entire current week.\n");
      return -1;
    }
  }
  if (NULL == filename) {
    fprintf(stderr, "Filename is missing.\n");
    return -2;
  }
  return process(filename, start, end);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea3(%rip),%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
mov    0x2e44(%rip),%rax
movl   $0xffffffff,(%rax)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0x2bec(%rip),%rcx
lea    -0x2c(%rbp),%r8
call   1030 <getopt_long@plt>
mov    %eax,%ecx
mov    %ecx,-0x30(%rbp)
mov    $0xffffffff,%eax
cmp    %ecx,%eax
je     129b <main+0x15b>
mov    -0x30(%rbp),%eax
mov    %eax,-0x34(%rbp)
sub    $0x65,%eax
je     121f <main+0xdf>
jmp    11d3 <main+0x93>
mov    -0x34(%rbp),%eax
sub    $0x66,%eax
je     11f5 <main+0xb5>
jmp    11e4 <main+0xa4>
mov    -0x34(%rbp),%eax
sub    $0x73,%eax
je     1208 <main+0xc8>
jmp    1236 <main+0xf6>
mov    0x2dfc(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    1296 <main+0x156>
mov    0x2de9(%rip),%rax
mov    (%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x24(%rbp)
jmp    1296 <main+0x156>
mov    0x2dd2(%rip),%rax
mov    (%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x28(%rbp)
jmp    1296 <main+0x156>
mov    0x2d9b(%rip),%rax
mov    (%rax),%edi
lea    0xdd8(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2d86(%rip),%rax
mov    (%rax),%edi
lea    0xe0d(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2d71(%rip),%rax
mov    (%rax),%edi
lea    0xe45(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2d5c(%rip),%rax
mov    (%rax),%edi
lea    0xe4d(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    12da <main+0x19a>
jmp    1192 <main+0x52>
xor    %eax,%eax
cmp    -0x20(%rbp),%rax
jne    12c8 <main+0x188>
mov    0x2d2a(%rip),%rax
mov    (%rax),%edi
lea    0xe5a(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    12da <main+0x19a>
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
call   1040 <process@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
movl   $0x0,0xc(%rsp)
mov    0x2e6e(%rip),%rax
movl   $0xffffffff,(%rax)
xor    %eax,%eax
mov    %rax,0x10(%rsp)
lea    0xe8a(%rip),%r15
lea    0x2c13(%rip),%r12
lea    0xc(%rsp),%r13
movl   $0x0,0x8(%rsp)
xor    %r14d,%r14d
jmp    11a2 <main+0x62>
nop
mov    0x2e61(%rip),%rax
mov    (%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,%r14d
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
mov    %r13,%r8
call   1030 <getopt_long@plt>
cmp    $0x65,%eax
je     1190 <main+0x50>
cmp    $0xffffffff,%eax
je     11ef <main+0xaf>
cmp    $0x73,%eax
je     11da <main+0x9a>
cmp    $0x66,%eax
jne    1207 <main+0xc7>
mov    0x2e28(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x10(%rsp)
jmp    11a2 <main+0x62>
mov    0x2e17(%rip),%rax
mov    (%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,0x8(%rsp)
jmp    11a2 <main+0x62>
mov    0x10(%rsp),%rdi
test   %rdi,%rdi
je     124d <main+0x10d>
mov    0x8(%rsp),%esi
mov    %r14d,%edx
call   1040 <process@plt>
jmp    1267 <main+0x127>
mov    0x2dca(%rip),%rbx
mov    (%rbx),%edi
lea    0xe07(%rip),%rsi
call   1050 <fprintf@plt>
mov    (%rbx),%edi
lea    0xe43(%rip),%rsi
call   1050 <fprintf@plt>
mov    (%rbx),%edi
lea    0xe82(%rip),%rsi
call   1050 <fprintf@plt>
mov    (%rbx),%edi
lea    0xe91(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0xffffffff,%eax
jmp    1267 <main+0x127>
mov    0x2d84(%rip),%rax
mov    (%rax),%edi
lea    0xeb4(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0xfffffffe,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.option = type { i8*, i8, i32, i32 }
@.str = [10 x i8] c"f:s:e:h::\00"
@main.options = internal constant [5 x %struct.option] [%struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0), i8 -127, i32 0, i32 104 }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i8 -128, i32 0, i32 102 }, %struct.option { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i32 0, i32 0), i8 -128, i32 0, i32 115 }, %struct.option { i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0), i8 -128, i32 0, i32 101 }, %struct.option zeroinitializer]
@.str.1 = [5 x i8] c"help\00"
@.str.2 = [5 x i8] c"file\00"
@.str.3 = [6 x i8] c"start\00"
@.str.4 = [4 x i8] c"end\00"
@cimplog_debug_level = external global i32
@optarg = global i8* null
@stderr = global i32 0
@.str.5 = [74 x i8] c"Usage:\0Aaker-cli -f filename [-s starting_unixtime] [-e ending_unixtime]\0A\0A\00"
@.str.6 = [77 x i8] c" Outputs the schedule according to aker and how it interprets a schedule\0A\00"
@.str.7 = [29 x i8] c" over a window of time.\0A\0A\00"
@.str.8 = [63 x i8] c" If ending_unixtime is 0, process the entire current week.\0A\00"
@.str.9 = [22 x i8] c"Filename is missing.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %6
store i8* null, i8** %7
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
store i32 0, i32* %11
store i32 -1, i32* @cimplog_debug_level
br label %12
12: ; preds = %37, %2
%13 = load i32, i32* %4
%14 = load i8**, i8*** %5
%15 = load i8*, i8** %6
%16 = call i32 @getopt_long(i32 %13, i8** %14, i8* %15, %struct.option* getelementptr inbounds ([5 x %struct.option], [5 x %struct.option]* @main.options, i64 0, i64 0), i32* %10)
store i32 %16, i32* %11
%17 = icmp ne i32 -1, %16
br i1 %17, label %18, label %38
18: ; preds = %12
%19 = load i32, i32* %11
switch i32 %19, label %28 [
i32 102, label %20
i32 115, label %22
i32 101, label %25
]
20: ; preds = %18
%21 = load i8*, i8** @optarg
store i8* %21, i8** %7
br label %37
22: ; preds = %18
%23 = load i8*, i8** @optarg
%24 = call i32 @atoi(i8* %23)
store i32 %24, i32* %8
br label %37
25: ; preds = %18
%26 = load i8*, i8** @optarg
%27 = call i32 @atoi(i8* %26)
store i32 %27, i32* %9
br label %37
28: ; preds = %18
%29 = load i32, i32* @stderr
%30 = call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.5, i64 0, i64 0))
%31 = load i32, i32* @stderr
%32 = call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.6, i64 0, i64 0))
%33 = load i32, i32* @stderr
%34 = call i32 @fprintf(i32 %33, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0))
%35 = load i32, i32* @stderr
%36 = call i32 @fprintf(i32 %35, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.8, i64 0, i64 0))
store i32 -1, i32* %3
br label %49
37: ; preds = %25, %22, %20
br label %12
38: ; preds = %12
%39 = load i8*, i8** %7
%40 = icmp eq i8* null, %39
br i1 %40, label %41, label %44
41: ; preds = %38
%42 = load i32, i32* @stderr
%43 = call i32 @fprintf(i32 %42, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0))
store i32 -2, i32* %3
br label %49
44: ; preds = %38
%45 = load i8*, i8** %7
%46 = load i32, i32* %8
%47 = load i32, i32* %9
%48 = call i32 @process(i8* %45, i32 %46, i32 %47)
store i32 %48, i32* %3
br label %49
49: ; preds = %44, %41, %28
%50 = load i32, i32* %3
ret i32 %50
}

LLVM IR (-O2):
%struct.option = type { i8*, i8, i32, i32 }
@.str = [10 x i8] c"f:s:e:h::\00"
@main.options = internal constant [5 x %struct.option] [%struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0), i8 -127, i32 0, i32 104 }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i8 -128, i32 0, i32 102 }, %struct.option { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i32 0, i32 0), i8 -128, i32 0, i32 115 }, %struct.option { i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0), i8 -128, i32 0, i32 101 }, %struct.option zeroinitializer]
@.str.1 = [5 x i8] c"help\00"
@.str.2 = [5 x i8] c"file\00"
@.str.3 = [6 x i8] c"start\00"
@.str.4 = [4 x i8] c"end\00"
@cimplog_debug_level = external global i32
@optarg = global i8* null
@stderr = global i32 0
@.str.5 = [74 x i8] c"Usage:\0Aaker-cli -f filename [-s starting_unixtime] [-e ending_unixtime]\0A\0A\00"
@.str.6 = [77 x i8] c" Outputs the schedule according to aker and how it interprets a schedule\0A\00"
@.str.7 = [29 x i8] c" over a window of time.\0A\0A\00"
@.str.8 = [63 x i8] c" If ending_unixtime is 0, process the entire current week.\0A\00"
@.str.9 = [22 x i8] c"Filename is missing.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 0, i32* %3
store i32 -1, i32* @cimplog_debug_level
br label %5
5: ; preds = %15, %2
%6 = phi i8* [ %16, %15 ], [ null, %2 ]
%7 = phi i32 [ %10, %15 ], [ 0, %2 ]
%8 = phi i32 [ %13, %15 ], [ 0, %2 ]
br label %9
9: ; preds = %5, %17
%10 = phi i32 [ %7, %5 ], [ %19, %17 ]
%11 = phi i32 [ %8, %5 ], [ %13, %17 ]
br label %12
12: ; preds = %9, %20
%13 = phi i32 [ %22, %20 ], [ %11, %9 ]
%14 = call i32 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), %struct.option* getelementptr inbounds ([5 x %struct.option], [5 x %struct.option]* @main.options, i64 0, i64 0), i32* %3)
switch i32 %14, label %23 [
i32 -1, label %32
i32 102, label %15
i32 115, label %17
i32 101, label %20
]
15: ; preds = %12
%16 = load i8*, i8** @optarg
br label %5
17: ; preds = %12
%18 = load i8*, i8** @optarg
%19 = call i32 @atoi(i8* %18)
br label %9
20: ; preds = %12
%21 = load i8*, i8** @optarg
%22 = call i32 @atoi(i8* %21)
br label %12
23: ; preds = %12
%24 = load i32, i32* @stderr
%25 = call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.5, i64 0, i64 0))
%26 = load i32, i32* @stderr
%27 = call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.6, i64 0, i64 0))
%28 = load i32, i32* @stderr
%29 = call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0))
%30 = load i32, i32* @stderr
%31 = call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.8, i64 0, i64 0))
br label %39
32: ; preds = %12
%33 = icmp eq i8* %6, null
br i1 %33, label %34, label %37
34: ; preds = %32
%35 = load i32, i32* @stderr
%36 = call i32 @fprintf(i32 %35, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0))
br label %39
37: ; preds = %32
%38 = call i32 @process(i8* %6, i32 %10, i32 %13)
br label %39
39: ; preds = %37, %34, %23
%40 = phi i32 [ -1, %23 ], [ -2, %34 ], [ %38, %37 ]
ret i32 %40
}