#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 *annual_hydroperiod_get_where_clause(char *station_name,
                                          char *stage_datatype_name, int year) {
  static char where_clause[1024];
  char last_day_previous_year_string[16];
  char end_date_string[16];
  sprintf(last_day_previous_year_string, "%d-01-01", year);
  sprintf(end_date_string, "%d-12-31", year);
  sprintf(where_clause,
          "station = '%s' and datatype = '%s' and measurement_date between "
          "'%s' and '%s'",
          station_name, stage_datatype_name, last_day_previous_year_string,
          end_date_string);
  return where_clause;
}


x86 assembly (clang, -O0):
<annual_hydroperiod_get_where_clause>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xecf(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
lea    -0x40(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xec3(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    -0x30(%rbp),%r8
lea    -0x40(%rbp),%r9
lea    0x2edc(%rip),%rdi
lea    0xea7(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
lea    0x2ec7(%rip),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<annual_hydroperiod_get_where_clause>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    %edx,%ebx
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xed4(%rip),%rsi
lea    0x10(%rsp),%r12
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <sprintf@plt>
lea    0xec7(%rip),%rsi
mov    %rsp,%r13
mov    %r13,%rdi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <sprintf@plt>
lea    0x2ee8(%rip),%rbx
lea    0xeb3(%rip),%rsi
mov    %rbx,%rdi
mov    %r15,%rdx
mov    %r14,%rcx
mov    %r12,%r8
mov    %r13,%r9
xor    %eax,%eax
call   1030 <sprintf@plt>
mov    %rbx,%rax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@annual_hydroperiod_get_where_clause.where_clause = internal global [1024 x i8] zeroinitializer
@.str = [9 x i8] c"%d-01-01\00"
@.str.1 = [9 x i8] c"%d-12-31\00"
@.str.2 = [78 x i8] c"station = '%s' and datatype = '%s' and measurement_date between '%s' and '%s'\00"
define i8* @annual_hydroperiod_get_where_clause(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca [16 x i8]
%8 = alloca [16 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%9 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%10 = load i32, i32* %6
%11 = call i32 (i8*, i8*, ...) @sprintf(i8* %9, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = getelementptr inbounds [16 x i8], [16 x i8]* %8, i64 0, i64 0
%13 = load i32, i32* %6
%14 = call i32 (i8*, i8*, ...) @sprintf(i8* %12, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = load i8*, i8** %4
%16 = load i8*, i8** %5
%17 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%18 = getelementptr inbounds [16 x i8], [16 x i8]* %8, i64 0, i64 0
%19 = call i32 (i8*, i8*, ...) @sprintf(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @annual_hydroperiod_get_where_clause.where_clause, i64 0, i64 0), i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.2, i64 0, i64 0), i8* %15, i8* %16, i8* %17, i8* %18)
ret i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @annual_hydroperiod_get_where_clause.where_clause, i64 0, i64 0)
}

LLVM IR (-O2):
@annual_hydroperiod_get_where_clause.where_clause = internal global [1024 x i8] zeroinitializer
@.str = [9 x i8] c"%d-01-01\00"
@.str.1 = [9 x i8] c"%d-12-31\00"
@.str.2 = [78 x i8] c"station = '%s' and datatype = '%s' and measurement_date between '%s' and '%s'\00"
define i8* @annual_hydroperiod_get_where_clause(i8* %0, i8* %1, i32 %2) {
%4 = alloca [16 x i8]
%5 = alloca [16 x i8]
%6 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%7 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%8 = call i32 (i8*, i8*, ...) @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %2)
%9 = call i32 (i8*, i8*, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %2)
%10 = call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) getelementptr inbounds ([1024 x i8], [1024 x i8]* @annual_hydroperiod_get_where_clause.where_clause, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @.str.2, i64 0, i64 0), i8* %0, i8* %1, i8* %6, i8* %7)
ret i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @annual_hydroperiod_get_where_clause.where_clause, i64 0, i64 0)
}