#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 */
char *strdup(char *);
int /*<<< orphan*/ timlib_strcat(char *, char *);
int /*<<< orphan*/ timlib_strcpy(char *, char *, int);
char *query_append_where_clause(char *source_where_clause,
                                char *append_where_clause) {
  char where_clause[131072];
  *where_clause = '\0';
  timlib_strcpy(where_clause, source_where_clause, 131072);
  timlib_strcat(where_clause, " and ");
  timlib_strcat(where_clause, append_where_clause);
  return strdup(where_clause);
}


x86 assembly (clang, -O0):
<query_append_where_clause>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20010,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movb   $0x0,-0x20010(%rbp)
lea    -0x20010(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x20000,%edx
call   1030 <timlib_strcpy@plt>
lea    -0x20010(%rbp),%rdi
lea    0xe93(%rip),%rsi
call   1040 <timlib_strcat@plt>
lea    -0x20010(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <timlib_strcat@plt>
lea    -0x20010(%rbp),%rdi
call   1050 <strdup@plt>
add    $0x20010,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<query_append_where_clause>:
push   %r14
push   %rbx
sub    $0x20008,%rsp
mov    %rsi,%r14
mov    %rdi,%rsi
movb   $0x0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x20000,%edx
call   1030 <timlib_strcpy@plt>
lea    0xea5(%rip),%rsi
mov    %rbx,%rdi
call   1040 <timlib_strcat@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <timlib_strcat@plt>
mov    %rbx,%rdi
call   1050 <strdup@plt>
add    $0x20008,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c" and \00"
define i8* @query_append_where_clause(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [131072 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = getelementptr inbounds [131072 x i8], [131072 x i8]* %5, i64 0, i64 0
store i8 0, i8* %6
%7 = getelementptr inbounds [131072 x i8], [131072 x i8]* %5, i64 0, i64 0
%8 = load i8*, i8** %3
%9 = call i32 @timlib_strcpy(i8* %7, i8* %8, i32 131072)
%10 = getelementptr inbounds [131072 x i8], [131072 x i8]* %5, i64 0, i64 0
%11 = call i32 @timlib_strcat(i8* %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%12 = getelementptr inbounds [131072 x i8], [131072 x i8]* %5, i64 0, i64 0
%13 = load i8*, i8** %4
%14 = call i32 @timlib_strcat(i8* %12, i8* %13)
%15 = getelementptr inbounds [131072 x i8], [131072 x i8]* %5, i64 0, i64 0
%16 = call i8* @strdup(i8* %15)
ret i8* %16
}

LLVM IR (-O2):
@.str = [6 x i8] c" and \00"
define noalias i8* @query_append_where_clause(i8* %0, i8* %1) {
%3 = alloca [131072 x i8]
%4 = getelementptr inbounds [131072 x i8], [131072 x i8]* %3, i64 0, i64 0
store i8 0, i8* %4
%5 = call i32 @timlib_strcpy(i8* %4, i8* %0, i32 131072)
%6 = call i32 @timlib_strcat(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @timlib_strcat(i8* %4, i8* %1)
%8 = call i8* @strdup(i8* %4)
ret i8* %8
}