#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*/ add_dot_to_path();
int /*<<< orphan*/ add_src_appaserver_to_path();
int /*<<< orphan*/ add_utility_to_path();
int atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
double julian_yyyy_mm_dd_time_hhmm_to_julian(char *, char *);
int /*<<< orphan*/ output_slot_list_sort_ascending(char *, double, double,
                                                   double, char);
int /*<<< orphan*/ output_slot_list_sort_descending(char *, double, double,
                                                    double, char);
int /*<<< orphan*/ output_starting_argv_stderr(int, char **);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  char *begin_date;
  char *end_date;
  int slots_per_day;
  double begin_julian, end_julian;
  double minutes_per_slot;
  double julian_minutes_per_slot;
  char *aggregate_level;
  char delimiter;
  output_starting_argv_stderr(argc, argv);
  if (argc != 6) {
    fprintf(stderr,
            "Usage: %s begin_date end_date slots_per_day aggregate_level "
            "delimiter\n",
            argv[0]);
    exit(1);
  }
  begin_date = argv[1];
  end_date = argv[2];
  slots_per_day = atoi(argv[3]);
  aggregate_level = argv[4];
  delimiter = *argv[5];
  add_dot_to_path();
  add_utility_to_path();
  add_src_appaserver_to_path();
  begin_julian = julian_yyyy_mm_dd_time_hhmm_to_julian(begin_date, "0000");
  end_julian = julian_yyyy_mm_dd_time_hhmm_to_julian(end_date, "2359");
  if (strcmp(aggregate_level, "half_hour") == 0) {
    slots_per_day = 48;
  } else if (strcmp(aggregate_level, "hourly") == 0) {
    slots_per_day = 24;
  }
  minutes_per_slot = 1440.0 / slots_per_day;
  julian_minutes_per_slot = minutes_per_slot / 1440.0;
  if (strcmp(aggregate_level, "real_time") == 0 ||
      strcmp(aggregate_level, "half_hour") == 0 ||
      strcmp(aggregate_level, "hourly") == 0 ||
      strcmp(aggregate_level, "daily") == 0) {
    output_slot_list_sort_ascending(aggregate_level, begin_julian, end_julian,
                                    julian_minutes_per_slot, delimiter);
  } else {
    output_slot_list_sort_descending(aggregate_level, begin_julian, end_julian,
                                     julian_minutes_per_slot, delimiter);
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1080 <output_starting_argv_stderr@plt>
cmpl   $0x6,-0x8(%rbp)
je     1202 <main+0x52>
mov    0x2dfd(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe15(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rax
mov    %rax,-0x50(%rbp)
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rax
mov    (%rax),%al
mov    %al,-0x51(%rbp)
mov    $0x0,%al
call   1070 <add_dot_to_path@plt>
mov    $0x0,%al
call   10d0 <add_utility_to_path@plt>
mov    $0x0,%al
call   10c0 <add_src_appaserver_to_path@plt>
mov    -0x18(%rbp),%rdi
lea    0xdec(%rip),%rsi
call   1090 <julian_yyyy_mm_dd_time_hhmm_to_julian@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xddc(%rip),%rsi
call   1090 <julian_yyyy_mm_dd_time_hhmm_to_julian@plt>
movsd  %xmm0,-0x38(%rbp)
mov    -0x50(%rbp),%rdi
lea    0xdcc(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    12a8 <main+0xf8>
movl   $0x30,-0x24(%rbp)
jmp    12ce <main+0x11e>
mov    -0x50(%rbp),%rdi
lea    0xdb0(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    12c9 <main+0x119>
movl   $0x18,-0x24(%rbp)
jmp    12ce <main+0x11e>
cvtsi2sdl -0x24(%rbp),%xmm1
movsd  0xd25(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  0xd0f(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x50(%rbp),%rdi
lea    0xd65(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     1362 <main+0x1b2>
mov    -0x50(%rbp),%rdi
lea    0xd3a(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     1362 <main+0x1b2>
mov    -0x50(%rbp),%rdi
lea    0xd2a(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     1362 <main+0x1b2>
mov    -0x50(%rbp),%rdi
lea    0xd21(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1383 <main+0x1d3>
mov    -0x50(%rbp),%rdi
movsd  -0x30(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm2
movsbl -0x51(%rbp),%esi
call   1050 <output_slot_list_sort_ascending@plt>
jmp    139f <main+0x1ef>
mov    -0x50(%rbp),%rdi
movsd  -0x30(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm2
movsbl -0x51(%rbp),%esi
call   1030 <output_slot_list_sort_descending@plt>
xor    %edi,%edi
call   10b0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%rbp
mov    %edi,%ebx
call   1080 <output_starting_argv_stderr@plt>
cmp    $0x6,%ebx
jne    1247 <main+0x97>
mov    0x8(%rbp),%rbx
mov    0x10(%rbp),%r15
mov    0x18(%rbp),%rdi
call   10a0 <atoi@plt>
mov    %eax,%r14d
mov    0x20(%rbp),%r12
mov    0x28(%rbp),%rax
mov    (%rax),%bpl
xor    %eax,%eax
call   1070 <add_dot_to_path@plt>
xor    %eax,%eax
call   10d0 <add_utility_to_path@plt>
xor    %eax,%eax
call   10c0 <add_src_appaserver_to_path@plt>
lea    0xe59(%rip),%rsi
mov    %rbx,%rdi
call   1090 <julian_yyyy_mm_dd_time_hhmm_to_julian@plt>
movsd  %xmm0,0x18(%rsp)
lea    0xe49(%rip),%rsi
mov    %r15,%rdi
call   1090 <julian_yyyy_mm_dd_time_hhmm_to_julian@plt>
movsd  %xmm0,0x10(%rsp)
lea    0xe39(%rip),%rsi
mov    %r12,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    126a <main+0xba>
movsd  0xdbb(%rip),%xmm0
jmp    1290 <main+0xe0>
mov    0x2d92(%rip),%rax
mov    (%rax),%edi
mov    0x0(%rbp),%rdx
lea    0xdbd(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
lea    0xe02(%rip),%rsi
mov    %r12,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1288 <main+0xd8>
xorps  %xmm0,%xmm0
cvtsi2sd %r14d,%xmm0
jmp    1290 <main+0xe0>
movsd  0xd78(%rip),%xmm0
movsd  0xd78(%rip),%xmm1
movapd %xmm1,%xmm2
divsd  %xmm0,%xmm2
divsd  %xmm1,%xmm2
movsd  %xmm2,0x8(%rsp)
lea    0xdc9(%rip),%rsi
mov    %r12,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     12fa <main+0x14a>
lea    0xda4(%rip),%rsi
mov    %r12,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     12fa <main+0x14a>
lea    0xd9a(%rip),%rsi
mov    %r12,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     12fa <main+0x14a>
lea    0xd97(%rip),%rsi
mov    %r12,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    131f <main+0x16f>
movsbl %bpl,%esi
mov    %r12,%rdi
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
call   1050 <output_slot_list_sort_ascending@plt>
xor    %edi,%edi
call   10b0 <exit@plt>
movsbl %bpl,%esi
mov    %r12,%rdi
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
call   1030 <output_slot_list_sort_descending@plt>
xor    %edi,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [71 x i8] c"Usage: %s begin_date end_date slots_per_day aggregate_level delimiter\0A\00"
@.str.1 = [5 x i8] c"0000\00"
@.str.2 = [5 x i8] c"2359\00"
@.str.3 = [10 x i8] c"half_hour\00"
@.str.4 = [7 x i8] c"hourly\00"
@.str.5 = [10 x i8] c"real_time\00"
@.str.6 = [6 x i8] c"daily\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 double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca i8*
%14 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%15 = load i32, i32* %4
%16 = load i8**, i8*** %5
%17 = call i32 @output_starting_argv_stderr(i32 %15, i8** %16)
%18 = load i32, i32* %4
%19 = icmp ne i32 %18, 6
br i1 %19, label %20, label %27
20: ; preds = %2
%21 = load i32, i32* @stderr
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 0
%24 = load i8*, i8** %23
%25 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0), i8* %24)
%26 = call i32 @exit(i32 1)
unreachable
27: ; preds = %2
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
store i8* %30, i8** %6
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 2
%33 = load i8*, i8** %32
store i8* %33, i8** %7
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 3
%36 = load i8*, i8** %35
%37 = call i32 @atoi(i8* %36)
store i32 %37, i32* %8
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 4
%40 = load i8*, i8** %39
store i8* %40, i8** %13
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 5
%43 = load i8*, i8** %42
%44 = load i8, i8* %43
store i8 %44, i8* %14
%45 = call i32 (...) @add_dot_to_path()
%46 = call i32 (...) @add_utility_to_path()
%47 = call i32 (...) @add_src_appaserver_to_path()
%48 = load i8*, i8** %6
%49 = call double @julian_yyyy_mm_dd_time_hhmm_to_julian(i8* %48, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
store double %49, double* %9
%50 = load i8*, i8** %7
%51 = call double @julian_yyyy_mm_dd_time_hhmm_to_julian(i8* %50, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
store double %51, double* %10
%52 = load i8*, i8** %13
%53 = call i64 @strcmp(i8* %52, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%54 = icmp eq i64 %53, 0
br i1 %54, label %55, label %56
55: ; preds = %27
store i32 48, i32* %8
br label %62
56: ; preds = %27
%57 = load i8*, i8** %13
%58 = call i64 @strcmp(i8* %57, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%59 = icmp eq i64 %58, 0
br i1 %59, label %60, label %61
60: ; preds = %56
store i32 24, i32* %8
br label %61
61: ; preds = %60, %56
br label %62
62: ; preds = %61, %55
%63 = load i32, i32* %8
%64 = sitofp i32 %63 to double
%65 = fdiv double 1.440000e+03, %64
store double %65, double* %11
%66 = load double, double* %11
%67 = fdiv double %66, 1.440000e+03
store double %67, double* %12
%68 = load i8*, i8** %13
%69 = call i64 @strcmp(i8* %68, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%70 = icmp eq i64 %69, 0
br i1 %70, label %83, label %71
71: ; preds = %62
%72 = load i8*, i8** %13
%73 = call i64 @strcmp(i8* %72, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%74 = icmp eq i64 %73, 0
br i1 %74, label %83, label %75
75: ; preds = %71
%76 = load i8*, i8** %13
%77 = call i64 @strcmp(i8* %76, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%78 = icmp eq i64 %77, 0
br i1 %78, label %83, label %79
79: ; preds = %75
%80 = load i8*, i8** %13
%81 = call i64 @strcmp(i8* %80, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%82 = icmp eq i64 %81, 0
br i1 %82, label %83, label %90
83: ; preds = %79, %75, %71, %62
%84 = load i8*, i8** %13
%85 = load double, double* %9
%86 = load double, double* %10
%87 = load double, double* %12
%88 = load i8, i8* %14
%89 = call i32 @output_slot_list_sort_ascending(i8* %84, double %85, double %86, double %87, i8 signext %88)
br label %97
90: ; preds = %79
%91 = load i8*, i8** %13
%92 = load double, double* %9
%93 = load double, double* %10
%94 = load double, double* %12
%95 = load i8, i8* %14
%96 = call i32 @output_slot_list_sort_descending(i8* %91, double %92, double %93, double %94, i8 signext %95)
br label %97
97: ; preds = %90, %83
%98 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [71 x i8] c"Usage: %s begin_date end_date slots_per_day aggregate_level delimiter\0A\00"
@.str.1 = [5 x i8] c"0000\00"
@.str.2 = [5 x i8] c"2359\00"
@.str.3 = [10 x i8] c"half_hour\00"
@.str.4 = [7 x i8] c"hourly\00"
@.str.5 = [10 x i8] c"real_time\00"
@.str.6 = [6 x i8] c"daily\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @output_starting_argv_stderr(i32 %0, i8** %1)
%4 = icmp eq i32 %0, 6
br i1 %4, label %10, label %5
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = load i8*, i8** %1
%8 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = getelementptr inbounds i8*, i8** %1, i64 2
%14 = load i8*, i8** %13
%15 = getelementptr inbounds i8*, i8** %1, i64 3
%16 = load i8*, i8** %15
%17 = tail call i32 @atoi(i8* %16)
%18 = getelementptr inbounds i8*, i8** %1, i64 4
%19 = load i8*, i8** %18
%20 = getelementptr inbounds i8*, i8** %1, i64 5
%21 = load i8*, i8** %20
%22 = load i8, i8* %21
%23 = tail call i32 (...) @add_dot_to_path()
%24 = tail call i32 (...) @add_utility_to_path()
%25 = tail call i32 (...) @add_src_appaserver_to_path()
%26 = tail call double @julian_yyyy_mm_dd_time_hhmm_to_julian(i8* %12, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%27 = tail call double @julian_yyyy_mm_dd_time_hhmm_to_julian(i8* %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%28 = tail call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
br i1 %29, label %35, label %30
30: ; preds = %10
%31 = tail call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
%33 = sitofp i32 %17 to double
%34 = select i1 %32, double 2.400000e+01, double %33
br label %35
35: ; preds = %30, %10
%36 = phi double [ 4.800000e+01, %10 ], [ %34, %30 ]
%37 = fdiv double 1.440000e+03, %36
%38 = fdiv double %37, 1.440000e+03
%39 = tail call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%40 = icmp eq i64 %39, 0
br i1 %40, label %50, label %41
41: ; preds = %35
%42 = tail call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%43 = icmp eq i64 %42, 0
br i1 %43, label %50, label %44
44: ; preds = %41
%45 = tail call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%46 = icmp eq i64 %45, 0
br i1 %46, label %50, label %47
47: ; preds = %44
%48 = tail call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%49 = icmp eq i64 %48, 0
br i1 %49, label %50, label %52
50: ; preds = %47, %44, %41, %35
%51 = tail call i32 @output_slot_list_sort_ascending(i8* %19, double %26, double %27, double %38, i8 signext %22)
br label %54
52: ; preds = %47
%53 = tail call i32 @output_slot_list_sort_descending(i8* %19, double %26, double %27, double %38, i8 signext %22)
br label %54
54: ; preds = %52, %50
%55 = tail call i32 @exit(i32 0)
unreachable
}