#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*/ sprintf(char *, char *, char *, char *, ...);
char *strdup(char *);
char *merged_waterquality_sys_string(char *begin_date, char *end_date,
                                     char *station, char *parameter,
                                     char *units) {
  char sys_string[1024];
  char where_clause[512];
  sprintf(where_clause,
          "station = '%s' and 				      	"
          "parameter = '%s' and 				      	"
          "units = '%s' and 				      	"
          "collection_date >= '%s' and collection_date <= '%s'	",
          station, parameter, units, begin_date, end_date);
  sprintf(sys_string,
          "get_folder_data	application=waterquality    "
          "			folder=results		    "
          "			select=\"%s\"		    "
          "			where=\"%s\"		    "
          "			quick=yes		   |"
          "cat						    ",
          "collection_date,collection_time,concentration", where_clause);
  return strdup(sys_string);
}


x86 assembly (clang, -O0):
<merged_waterquality_sys_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x640,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
lea    -0x630(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x8(%rbp),%r9
mov    -0x10(%rbp),%rax
lea    0xe9f(%rip),%rsi
mov    %rax,(%rsp)
mov    $0x0,%al
call   1030 <sprintf@plt>
lea    -0x430(%rbp),%rdi
lea    -0x630(%rbp),%rcx
lea    0xf0e(%rip),%rsi
lea    0xf91(%rip),%rdx
mov    $0x0,%al
call   1030 <sprintf@plt>
lea    -0x430(%rbp),%rdi
call   1040 <strdup@plt>
add    $0x640,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<merged_waterquality_sys_string>:
push   %r14
push   %rbx
sub    $0x618,%rsp
mov    %rdi,%r9
mov    %rsi,(%rsp)
lea    0xec8(%rip),%rsi
lea    0x10(%rsp),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <sprintf@plt>
lea    0xf41(%rip),%rsi
lea    0xfc4(%rip),%rdx
lea    0x210(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rcx
xor    %eax,%eax
call   1030 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <strdup@plt>
add    $0x618,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [143 x i8] c"station = '%s' and \09\09\09\09 \09parameter = '%s' and \09\09\09\09 \09units = '%s' and \09\09\09\09 \09collection_date >= '%s' and collection_date <= '%s'\09\00"
@.str.1 = [138 x i8] c"get_folder_data\09application=waterquality \09\09\09folder=results\09\09 \09\09\09select=\22%s\22\09\09 \09\09\09where=\22%s\22\09\09 \09\09\09quick=yes\09\09 |cat\09\09\09\09\09\09 \00"
@.str.2 = [46 x i8] c"collection_date,collection_time,concentration\00"
define i8* @merged_waterquality_sys_string(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca [1024 x i8]
%12 = alloca [512 x i8]
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i8* %4, i8** %10
%13 = getelementptr inbounds [512 x i8], [512 x i8]* %12, i64 0, i64 0
%14 = load i8*, i8** %8
%15 = load i8*, i8** %9
%16 = load i8*, i8** %10
%17 = load i8*, i8** %6
%18 = load i8*, i8** %7
%19 = call i32 (i8*, i8*, i8*, i8*, ...) @sprintf(i8* %13, i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str, i64 0, i64 0), i8* %14, i8* %15, i8* %16, i8* %17, i8* %18)
%20 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%21 = getelementptr inbounds [512 x i8], [512 x i8]* %12, i64 0, i64 0
%22 = call i32 (i8*, i8*, i8*, i8*, ...) @sprintf(i8* %20, i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0), i8* %21)
%23 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%24 = call i8* @strdup(i8* %23)
ret i8* %24
}

LLVM IR (-O2):
@.str = [143 x i8] c"station = '%s' and \09\09\09\09 \09parameter = '%s' and \09\09\09\09 \09units = '%s' and \09\09\09\09 \09collection_date >= '%s' and collection_date <= '%s'\09\00"
@.str.1 = [138 x i8] c"get_folder_data\09application=waterquality \09\09\09folder=results\09\09 \09\09\09select=\22%s\22\09\09 \09\09\09where=\22%s\22\09\09 \09\09\09quick=yes\09\09 |cat\09\09\09\09\09\09 \00"
@.str.2 = [46 x i8] c"collection_date,collection_time,concentration\00"
define noalias i8* @merged_waterquality_sys_string(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4) {
%6 = alloca [1024 x i8]
%7 = alloca [512 x i8]
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%9 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%10 = call i32 (i8*, i8*, i8*, i8*, ...) @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([143 x i8], [143 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %3, i8* %4, i8* %0, i8* %1)
%11 = call i32 (i8*, i8*, i8*, i8*, ...) @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([138 x i8], [138 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0), i8* %9)
%12 = call i8* @strdup(i8* %8)
ret i8* %12
}