#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*/ piece(char *, char, char *, int);
char *pipe2string(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, ...);
char *strdup(char *);
void additional_drop_down_attribute_populate_folder_attribute(
    char **folder_name, char **attribute_name, char *application_name,
    char *drop_down_folder_name) {
  char sys_string[1024];
  char *results_string;
  char return_folder_name[128];
  char return_attribute_name[128];
  char where_clause[128];
  char *from_folder_name = "additional_drop_down_attribute";
  sprintf(where_clause, "drop_down_folder = '%s'", drop_down_folder_name);
  sprintf(sys_string,
          "get_folder_data	application=%s		"
          "			select=folder,attribute	"
          "			folder=%s		"
          "			where=\"%s\"		",
          application_name, from_folder_name, where_clause);
  if ((results_string = pipe2string(sys_string))) {
    piece(return_folder_name, '^', results_string, 0);
    piece(return_attribute_name, '^', results_string, 1);
    *folder_name = strdup(return_folder_name);
    *attribute_name = strdup(return_attribute_name);
  }
}


x86 assembly (clang, -O0):
<additional_drop_down_attribute_populate_folder_attribute>:
push   %rbp
mov    %rsp,%rbp
sub    $0x5c0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    0xe9e(%rip),%rax
mov    %rax,-0x5b8(%rbp)
lea    -0x5b0(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xea4(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x420(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x5b8(%rbp),%rcx
lea    -0x5b0(%rbp),%r8
lea    0xe95(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x420(%rbp),%rdi
call   1030 <pipe2string@plt>
mov    %rax,-0x428(%rbp)
cmp    $0x0,%rax
je     1229 <additional_drop_down_attribute_populate_folder_attribute+0xe9>
lea    -0x4b0(%rbp),%rdi
mov    -0x428(%rbp),%rdx
mov    $0x5e,%esi
xor    %ecx,%ecx
call   1050 <piece@plt>
lea    -0x530(%rbp),%rdi
mov    -0x428(%rbp),%rdx
mov    $0x5e,%esi
mov    $0x1,%ecx
call   1050 <piece@plt>
lea    -0x4b0(%rbp),%rdi
call   1060 <strdup@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
lea    -0x530(%rbp),%rdi
call   1060 <strdup@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
add    $0x5c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<additional_drop_down_attribute_populate_folder_attribute>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x580,%rsp
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xebf(%rip),%rsi
mov    %rsp,%r12
mov    %r12,%rdi
mov    %rcx,%rdx
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0xec0(%rip),%rsi
lea    0xe82(%rip),%rcx
lea    0x180(%rsp),%r13
mov    %r13,%rdi
mov    %rbx,%rdx
mov    %r12,%r8
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %r13,%rdi
call   1030 <pipe2string@plt>
test   %rax,%rax
je     11f3 <additional_drop_down_attribute_populate_folder_attribute+0xb3>
mov    %rax,%rbx
lea    0x100(%rsp),%r12
mov    %r12,%rdi
mov    $0x5e,%esi
mov    %rax,%rdx
xor    %ecx,%ecx
call   1050 <piece@plt>
lea    0x80(%rsp),%r13
mov    %r13,%rdi
mov    $0x5e,%esi
mov    %rbx,%rdx
mov    $0x1,%ecx
call   1050 <piece@plt>
mov    %r12,%rdi
call   1060 <strdup@plt>
mov    %rax,(%r15)
mov    %r13,%rdi
call   1060 <strdup@plt>
mov    %rax,(%r14)
add    $0x580,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [31 x i8] c"additional_drop_down_attribute\00"
@.str.1 = [24 x i8] c"drop_down_folder = '%s'\00"
@.str.2 = [89 x i8] c"get_folder_data\09application=%s\09\09\09\09\09select=folder,attribute\09\09\09\09folder=%s\09\09\09\09\09where=\22%s\22\09\09\00"
define void @additional_drop_down_attribute_populate_folder_attribute(i8** nocapture writeonly %0, i8** nocapture writeonly %1, i8* %2, i8* %3) {
%5 = alloca [1024 x i8]
%6 = alloca [128 x i8]
%7 = alloca [128 x i8]
%8 = alloca [128 x i8]
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%10 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%11 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%12 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%13 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %12, i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%14 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([89 x i8], [89 x i8]* @.str.2, i64 0, i64 0), i8* %2, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %12)
%15 = call i8* @pipe2string(i8* %9)
%16 = icmp eq i8* %15, null
br i1 %16, label %22, label %17
17: ; preds = %4
%18 = call i32 @piece(i8* %10, i8 signext 94, i8* %15, i32 0)
%19 = call i32 @piece(i8* %11, i8 signext 94, i8* %15, i32 1)
%20 = call i8* @strdup(i8* %10)
store i8* %20, i8** %0
%21 = call i8* @strdup(i8* %11)
store i8* %21, i8** %1
br label %22
22: ; preds = %17, %4
ret void
}