#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_alt_where_clause(char *model_name,
                                              char *alternative_name,
                                              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,
          "model = '%s' and alt = '%s' and station = '%s' and datatype = '%s' "
          "and date between '%s' and '%s'",
          model_name, alternative_name, station_name, stage_datatype_name,
          last_day_previous_year_string, end_date_string);
  return where_clause;
}


x86 assembly (clang, -O0):
<annual_hydroperiod_get_alt_where_clause>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x24(%rbp),%edx
lea    0xec6(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
lea    -0x50(%rbp),%rdi
mov    -0x24(%rbp),%edx
lea    0xeba(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    -0x20(%rbp),%r9
lea    -0x40(%rbp),%r10
lea    -0x50(%rbp),%rax
lea    0x2ecb(%rip),%rdi
lea    0xe96(%rip),%rsi
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
mov    $0x0,%al
call   1030 <sprintf@plt>
lea    0x2ead(%rip),%rax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<annual_hydroperiod_get_alt_where_clause>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r8d,%ebp
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
lea    0xecc(%rip),%rsi
mov    %rsp,%rdi
mov    %r8d,%edx
xor    %eax,%eax
call   1030 <sprintf@plt>
lea    0xec1(%rip),%rsi
lea    0x10(%rsp),%r13
mov    %r13,%rdi
mov    %ebp,%edx
xor    %eax,%eax
call   1030 <sprintf@plt>
lea    0x2ee0(%rip),%rbp
lea    0xeab(%rip),%rsi
mov    %rbp,%rdi
mov    %rbx,%rdx
mov    %r12,%rcx
mov    %r15,%r8
mov    %r14,%r9
xor    %eax,%eax
push   %r13
lea    0x8(%rsp),%rbx
push   %rbx
call   1030 <sprintf@plt>
add    $0x10,%rsp
mov    %rbp,%rax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@annual_hydroperiod_get_alt_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 = [98 x i8] c"model = '%s' and alt = '%s' and station = '%s' and datatype = '%s' and date between '%s' and '%s'\00"
define i8* @annual_hydroperiod_get_alt_where_clause(i8* %0, i8* %1, i8* %2, i8* %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca [16 x i8]
%12 = alloca [16 x i8]
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%13 = getelementptr inbounds [16 x i8], [16 x i8]* %11, i64 0, i64 0
%14 = load i32, i32* %10
%15 = call i32 (i8*, i8*, ...) @sprintf(i8* %13, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = getelementptr inbounds [16 x i8], [16 x i8]* %12, i64 0, i64 0
%17 = load i32, i32* %10
%18 = call i32 (i8*, i8*, ...) @sprintf(i8* %16, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%19 = load i8*, i8** %6
%20 = load i8*, i8** %7
%21 = load i8*, i8** %8
%22 = load i8*, i8** %9
%23 = getelementptr inbounds [16 x i8], [16 x i8]* %11, i64 0, i64 0
%24 = getelementptr inbounds [16 x i8], [16 x i8]* %12, i64 0, i64 0
%25 = call i32 (i8*, i8*, ...) @sprintf(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @annual_hydroperiod_get_alt_where_clause.where_clause, i64 0, i64 0), i8* getelementptr inbounds ([98 x i8], [98 x i8]* @.str.2, i64 0, i64 0), i8* %19, i8* %20, i8* %21, i8* %22, i8* %23, i8* %24)
ret i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @annual_hydroperiod_get_alt_where_clause.where_clause, i64 0, i64 0)
}

LLVM IR (-O2):
@annual_hydroperiod_get_alt_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 = [98 x i8] c"model = '%s' and alt = '%s' and station = '%s' and datatype = '%s' and date between '%s' and '%s'\00"
define i8* @annual_hydroperiod_get_alt_where_clause(i8* %0, i8* %1, i8* %2, i8* %3, i32 %4) {
%6 = alloca [16 x i8]
%7 = alloca [16 x i8]
%8 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%9 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%10 = call i32 (i8*, i8*, ...) @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %4)
%11 = call i32 (i8*, i8*, ...) @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%12 = call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) getelementptr inbounds ([1024 x i8], [1024 x i8]* @annual_hydroperiod_get_alt_where_clause.where_clause, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([98 x i8], [98 x i8]* @.str.2, i64 0, i64 0), i8* %0, i8* %1, i8* %2, i8* %3, i8* %8, i8* %9)
ret i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @annual_hydroperiod_get_alt_where_clause.where_clause, i64 0, i64 0)
}