#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 *pipe2string(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, ...);
void process_generic_output_get_period_of_record_date(
    char **date_string, char *application_name, char *value_folder_name,
    char *function, char *date_attribute, char *where_clause) {
  char sys_string[1024];
  char *return_pointer;
  char select[128];
  sprintf(select, "%s(%s)", function, date_attribute);
  sprintf(sys_string,
          "get_folder_data	application=%s		"
          "			folder=%s		"
          "			select=\"%s\"		"
          "			where=\"%s\"		"
          "			order=none		",
          application_name, value_folder_name, select, where_clause);
  if (!(return_pointer = pipe2string(sys_string)))
    return;
  *date_string = return_pointer;
}


x86 assembly (clang, -O0):
<process_generic_output_get_period_of_record_date>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4c0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
lea    -0x4c0(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
lea    0xea7(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x430(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    -0x4c0(%rbp),%r8
mov    -0x30(%rbp),%r9
lea    0xe86(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x430(%rbp),%rdi
call   1030 <pipe2string@plt>
mov    %rax,-0x438(%rbp)
cmp    $0x0,%rax
jne    11aa <process_generic_output_get_period_of_record_date+0x8a>
jmp    11b8 <process_generic_output_get_period_of_record_date+0x98>
mov    -0x438(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
add    $0x4c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_generic_output_get_period_of_record_date>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x488,%rsp
mov    %r9,%r15
mov    %rdx,%r12
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xebc(%rip),%rsi
mov    %rsp,%r13
mov    %r13,%rdi
mov    %rcx,%rdx
mov    %r8,%rcx
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0xea9(%rip),%rsi
lea    0x80(%rsp),%rbp
mov    %rbp,%rdi
mov    %rbx,%rdx
mov    %r12,%rcx
mov    %r13,%r8
mov    %r15,%r9
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %rbp,%rdi
call   1030 <pipe2string@plt>
test   %rax,%rax
je     118c <process_generic_output_get_period_of_record_date+0x6c>
mov    %rax,(%r14)
add    $0x488,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%s(%s)\00"
@.str.1 = [93 x i8] c"get_folder_data\09application=%s\09\09\09\09\09folder=%s\09\09\09\09\09select=\22%s\22\09\09\09\09\09where=\22%s\22\09\09\09\09\09order=none\09\09\00"
define void @process_generic_output_get_period_of_record_date(i8** %0, i8* %1, i8* %2, i8* %3, i8* %4, i8* %5) {
%7 = alloca i8**
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca [1024 x i8]
%14 = alloca i8*
%15 = alloca [128 x i8]
store i8** %0, i8*** %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store i8* %3, i8** %10
store i8* %4, i8** %11
store i8* %5, i8** %12
%16 = getelementptr inbounds [128 x i8], [128 x i8]* %15, i64 0, i64 0
%17 = load i8*, i8** %10
%18 = load i8*, i8** %11
%19 = call i32 (i8*, i8*, i8*, i8*, ...) @sprintf(i8* %16, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %17, i8* %18)
%20 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%21 = load i8*, i8** %8
%22 = load i8*, i8** %9
%23 = getelementptr inbounds [128 x i8], [128 x i8]* %15, i64 0, i64 0
%24 = load i8*, i8** %12
%25 = call i32 (i8*, i8*, i8*, i8*, ...) @sprintf(i8* %20, i8* getelementptr inbounds ([93 x i8], [93 x i8]* @.str.1, i64 0, i64 0), i8* %21, i8* %22, i8* %23, i8* %24)
%26 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%27 = call i8* @pipe2string(i8* %26)
store i8* %27, i8** %14
%28 = icmp ne i8* %27, null
br i1 %28, label %30, label %29
29: ; preds = %6
br label %33
30: ; preds = %6
%31 = load i8*, i8** %14
%32 = load i8**, i8*** %7
store i8* %31, i8** %32
br label %33
33: ; preds = %30, %29
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%s(%s)\00"
@.str.1 = [93 x i8] c"get_folder_data\09application=%s\09\09\09\09\09folder=%s\09\09\09\09\09select=\22%s\22\09\09\09\09\09where=\22%s\22\09\09\09\09\09order=none\09\09\00"
define void @process_generic_output_get_period_of_record_date(i8** nocapture writeonly %0, i8* %1, i8* %2, i8* %3, i8* %4, i8* %5) {
%7 = alloca [1024 x i8]
%8 = alloca [128 x i8]
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%10 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%11 = call i32 (i8*, i8*, i8*, i8*, ...) @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %4)
%12 = call i32 (i8*, i8*, i8*, i8*, ...) @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([93 x i8], [93 x i8]* @.str.1, i64 0, i64 0), i8* %1, i8* %2, i8* %10, i8* %5)
%13 = call i8* @pipe2string(i8* %9)
%14 = icmp eq i8* %13, null
br i1 %14, label %16, label %15
15: ; preds = %6
store i8* %13, i8** %0
br label %16
16: ; preds = %6, %15
ret void
}