#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_relative_source_directory_to_path(char *);
int /*<<< orphan*/ add_src_appaserver_to_path();
int /*<<< orphan*/ add_utility_to_path();
int /*<<< orphan*/ environ_set_environment(char *, char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
char *hydrology_library_get_expected_count_list_string(char *, char *, char *,
                                                       char);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, char *, ...);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ system(char *);
scalar_t__ timlib_parse_database_string(char **, char *);
int main(int argc, char **argv) {
  char *application_name;
  char *station;
  char *datatype;
  char *aggregate_string;
  char *begin_measurement_date_string;
  char *end_measurement_date_string;
  char *database_string = {0};
  char sys_string[1024];
  if (argc != 7) {
    fprintf(stderr,
            "Usage: %s application station datatype aggregate_string "
            "begin_measurement_date end_measurement_date\n",
            argv[0]);
    exit(1);
  }
  application_name = argv[1];
  station = argv[2];
  datatype = argv[3];
  aggregate_string = argv[4];
  begin_measurement_date_string = argv[5];
  end_measurement_date_string = argv[6];
  if (timlib_parse_database_string(&database_string, application_name)) {
    environ_set_environment("APPASERVER_DATABASE", database_string);
  }
  add_dot_to_path();
  add_utility_to_path();
  add_src_appaserver_to_path();
  add_relative_source_directory_to_path(application_name);
  if (strcmp(aggregate_string, "real_time") == 0) {
    sprintf(sys_string,
            "time_ticker.e '^' '%s' '%s' '%s' '%s'		|"
            "cat						 ",
            aggregate_string, begin_measurement_date_string,
            end_measurement_date_string,
            hydrology_library_get_expected_count_list_string(
                application_name, station, datatype, '|'));
  } else {
    sprintf(sys_string,
            "time_ticker.e '^' '%s' '%s' '%s' ''		|"
            "cat						 ",
            aggregate_string, begin_measurement_date_string,
            end_measurement_date_string);
  }
  system(sys_string);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x470,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x48(%rbp)
cmpl   $0x7,-0x8(%rbp)
je     1211 <main+0x51>
mov    0x2dee(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdfe(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <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),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    0x30(%rax),%rax
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rsi
lea    -0x48(%rbp),%rdi
call   10a0 <timlib_parse_database_string@plt>
cmp    $0x0,%rax
je     1280 <main+0xc0>
mov    -0x48(%rbp),%rsi
lea    0xdea(%rip),%rdi
call   1030 <environ_set_environment@plt>
mov    $0x0,%al
call   1090 <add_dot_to_path@plt>
mov    $0x0,%al
call   10e0 <add_utility_to_path@plt>
mov    $0x0,%al
call   10d0 <add_src_appaserver_to_path@plt>
mov    -0x18(%rbp),%rdi
call   1040 <add_relative_source_directory_to_path@plt>
mov    -0x30(%rbp),%rdi
lea    0xdd0(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    132f <main+0x16f>
lea    -0x450(%rbp),%rax
mov    %rax,-0x470(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x468(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x460(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x458(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    $0x7c,%ecx
call   1060 <hydrology_library_get_expected_count_list_string@plt>
mov    -0x470(%rbp),%rdi
mov    -0x468(%rbp),%rdx
mov    -0x460(%rbp),%rcx
mov    -0x458(%rbp),%r8
mov    %rax,%r9
lea    0xd60(%rip),%rsi
mov    $0x0,%al
call   10b0 <sprintf@plt>
jmp    1350 <main+0x190>
lea    -0x450(%rbp),%rdi
mov    -0x30(%rbp),%rdx
mov    -0x38(%rbp),%rcx
mov    -0x40(%rbp),%r8
lea    0xd6d(%rip),%rsi
mov    $0x0,%al
call   10b0 <sprintf@plt>
lea    -0x450(%rbp),%rdi
call   1050 <system@plt>
xor    %edi,%edi
call   10c0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x418,%rsp
movq   $0x0,0x8(%rsp)
cmp    $0x7,%edi
jne    1283 <main+0xc3>
mov    0x8(%rsi),%rbx
mov    0x10(%rsi),%r13
mov    0x18(%rsi),%rbp
mov    0x20(%rsi),%r12
mov    0x28(%rsi),%r15
mov    0x30(%rsi),%r14
lea    0x8(%rsp),%rdi
mov    %rbx,%rsi
call   10a0 <timlib_parse_database_string@plt>
test   %rax,%rax
je     121e <main+0x5e>
mov    0x8(%rsp),%rsi
lea    0xe4c(%rip),%rdi
call   1030 <environ_set_environment@plt>
xor    %eax,%eax
call   1090 <add_dot_to_path@plt>
xor    %eax,%eax
call   10e0 <add_utility_to_path@plt>
xor    %eax,%eax
call   10d0 <add_src_appaserver_to_path@plt>
mov    %rbx,%rdi
call   1040 <add_relative_source_directory_to_path@plt>
lea    0xe37(%rip),%rsi
mov    %r12,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    12a5 <main+0xe5>
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %rbp,%rdx
mov    $0x7c,%ecx
call   1060 <hydrology_library_get_expected_count_list_string@plt>
lea    0xe1a(%rip),%rsi
lea    0x10(%rsp),%rdi
mov    %r12,%rdx
mov    %r15,%rcx
mov    %r14,%r8
mov    %rax,%r9
xor    %eax,%eax
call   10b0 <sprintf@plt>
jmp    12c1 <main+0x101>
mov    0x2d56(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xd6a(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
lea    0xe0a(%rip),%rsi
lea    0x10(%rsp),%rdi
mov    %r12,%rdx
mov    %r15,%rcx
mov    %r14,%r8
xor    %eax,%eax
call   10b0 <sprintf@plt>
lea    0x10(%rsp),%rdi
call   1050 <system@plt>
xor    %edi,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [101 x i8] c"Usage: %s application station datatype aggregate_string begin_measurement_date end_measurement_date\0A\00"
@.str.1 = [20 x i8] c"APPASERVER_DATABASE\00"
@.str.2 = [10 x i8] c"real_time\00"
@.str.3 = [51 x i8] c"time_ticker.e '^' '%s' '%s' '%s' '%s'\09\09|cat\09\09\09\09\09\09 \00"
@.str.4 = [49 x i8] c"time_ticker.e '^' '%s' '%s' '%s' ''\09\09|cat\09\09\09\09\09\09 \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 i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca [1024 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %12
%14 = load i32, i32* %4
%15 = icmp ne i32 %14, 7
br i1 %15, label %16, label %23
16: ; preds = %2
%17 = load i32, i32* @stderr
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 0
%20 = load i8*, i8** %19
%21 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([101 x i8], [101 x i8]* @.str, i64 0, i64 0), i8* %20)
%22 = call i32 @exit(i32 1)
unreachable
23: ; preds = %2
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
store i8* %26, i8** %6
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 2
%29 = load i8*, i8** %28
store i8* %29, i8** %7
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 3
%32 = load i8*, i8** %31
store i8* %32, i8** %8
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 4
%35 = load i8*, i8** %34
store i8* %35, i8** %9
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 5
%38 = load i8*, i8** %37
store i8* %38, i8** %10
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 6
%41 = load i8*, i8** %40
store i8* %41, i8** %11
%42 = load i8*, i8** %6
%43 = call i64 @timlib_parse_database_string(i8** %12, i8* %42)
%44 = icmp ne i64 %43, 0
br i1 %44, label %45, label %48
45: ; preds = %23
%46 = load i8*, i8** %12
%47 = call i32 @environ_set_environment(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %46)
br label %48
48: ; preds = %45, %23
%49 = call i32 (...) @add_dot_to_path()
%50 = call i32 (...) @add_utility_to_path()
%51 = call i32 (...) @add_src_appaserver_to_path()
%52 = load i8*, i8** %6
%53 = call i32 @add_relative_source_directory_to_path(i8* %52)
%54 = load i8*, i8** %9
%55 = call i64 @strcmp(i8* %54, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%56 = icmp eq i64 %55, 0
br i1 %56, label %57, label %67
57: ; preds = %48
%58 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%59 = load i8*, i8** %9
%60 = load i8*, i8** %10
%61 = load i8*, i8** %11
%62 = load i8*, i8** %6
%63 = load i8*, i8** %7
%64 = load i8*, i8** %8
%65 = call i8* @hydrology_library_get_expected_count_list_string(i8* %62, i8* %63, i8* %64, i8 signext 124)
%66 = call i32 (i8*, i8*, i8*, i8*, i8*, ...) @sprintf(i8* %58, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0), i8* %59, i8* %60, i8* %61, i8* %65)
br label %73
67: ; preds = %48
%68 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%69 = load i8*, i8** %9
%70 = load i8*, i8** %10
%71 = load i8*, i8** %11
%72 = call i32 (i8*, i8*, i8*, i8*, i8*, ...) @sprintf(i8* %68, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.4, i64 0, i64 0), i8* %69, i8* %70, i8* %71)
br label %73
73: ; preds = %67, %57
%74 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%75 = call i32 @system(i8* %74)
%76 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [101 x i8] c"Usage: %s application station datatype aggregate_string begin_measurement_date end_measurement_date\0A\00"
@.str.1 = [20 x i8] c"APPASERVER_DATABASE\00"
@.str.2 = [10 x i8] c"real_time\00"
@.str.3 = [51 x i8] c"time_ticker.e '^' '%s' '%s' '%s' '%s'\09\09|cat\09\09\09\09\09\09 \00"
@.str.4 = [49 x i8] c"time_ticker.e '^' '%s' '%s' '%s' ''\09\09|cat\09\09\09\09\09\09 \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = alloca [1024 x i8]
%5 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%7 = icmp eq i32 %0, 7
br i1 %7, label %13, label %8
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %1
%11 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([101 x i8], [101 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = tail call i32 @exit(i32 1)
unreachable
13: ; preds = %2
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = getelementptr inbounds i8*, i8** %1, i64 2
%17 = load i8*, i8** %16
%18 = getelementptr inbounds i8*, i8** %1, i64 3
%19 = load i8*, i8** %18
%20 = getelementptr inbounds i8*, i8** %1, i64 4
%21 = load i8*, i8** %20
%22 = getelementptr inbounds i8*, i8** %1, i64 5
%23 = load i8*, i8** %22
%24 = getelementptr inbounds i8*, i8** %1, i64 6
%25 = load i8*, i8** %24
%26 = call i64 @timlib_parse_database_string(i8** %3, i8* %15)
%27 = icmp eq i64 %26, 0
br i1 %27, label %31, label %28
28: ; preds = %13
%29 = load i8*, i8** %3
%30 = call i32 @environ_set_environment(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %29)
br label %31
31: ; preds = %28, %13
%32 = call i32 (...) @add_dot_to_path()
%33 = call i32 (...) @add_utility_to_path()
%34 = call i32 (...) @add_src_appaserver_to_path()
%35 = call i32 @add_relative_source_directory_to_path(i8* %15)
%36 = call i64 @strcmp(i8* %21, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %41
38: ; preds = %31
%39 = call i8* @hydrology_library_get_expected_count_list_string(i8* %15, i8* %17, i8* %19, i8 signext 124)
%40 = call i32 (i8*, i8*, i8*, i8*, i8*, ...) @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0), i8* %21, i8* %23, i8* %25, i8* %39)
br label %43
41: ; preds = %31
%42 = call i32 (i8*, i8*, i8*, i8*, i8*, ...) @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.4, i64 0, i64 0), i8* %21, i8* %23, i8* %25)
br label %43
43: ; preds = %41, %38
%44 = call i32 @system(i8* %6)
%45 = call i32 @exit(i32 0)
unreachable
}