#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 *, char *, char *, char *);
char *strdup(char *);
char *relation_sys_string(char *where, char *order_clause) {
  char sys_string[1024];
  sprintf(sys_string, "select.sh '%s' %s \"%s\" \"%s\"",
          "folder,"
          "related_folder,"
          "related_attribute,"
          "pair_1tom_order,"
          "omit_1tom_detail_yn,"
          "prompt_mto1_recursive_yn,"
          "relation_type_isa_yn,"
          "copy_common_attributes_yn,"
          "automatic_preselection_yn,"
          "drop_down_multi_select_yn,"
          "join_1tom_each_row_yn,"
          "omit_lookup_before_drop_down_yn,"
          "ajax_fill_drop_down_yn,"
          "hint_message",
          "relation", where, (order_clause) ? order_clause : "");
  return strdup(sys_string);
}


x86 assembly (clang, -O0):
<relation_sys_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x410(%rbp),%rax
mov    %rax,-0x420(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x418(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1167 <relation_sys_string+0x47>
mov    -0x10(%rbp),%rax
mov    %rax,-0x428(%rbp)
jmp    117a <relation_sys_string+0x5a>
lea    0xead(%rip),%rax
mov    %rax,-0x428(%rbp)
jmp    117a <relation_sys_string+0x5a>
mov    -0x418(%rbp),%r8
mov    -0x420(%rbp),%rdi
mov    -0x428(%rbp),%r9
lea    0xe6a(%rip),%rsi
lea    0xe7f(%rip),%rdx
lea    0xf9a(%rip),%rcx
call   1030 <sprintf@plt>
lea    -0x410(%rbp),%rdi
call   1040 <strdup@plt>
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<relation_sys_string>:
push   %rbx
sub    $0x400,%rsp
mov    %rdi,%r8
test   %rsi,%rsi
lea    0xee6(%rip),%r9
cmovne %rsi,%r9
lea    0xec0(%rip),%rsi
lea    0xed5(%rip),%rdx
lea    0xff0(%rip),%rcx
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <strdup@plt>
add    $0x400,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"select.sh '%s' %s \22%s\22 \22%s\22\00"
@.str.1 = [290 x i8] c"folder,related_folder,related_attribute,pair_1tom_order,omit_1tom_detail_yn,prompt_mto1_recursive_yn,relation_type_isa_yn,copy_common_attributes_yn,automatic_preselection_yn,drop_down_multi_select_yn,join_1tom_each_row_yn,omit_lookup_before_drop_down_yn,ajax_fill_drop_down_yn,hint_message\00"
@.str.2 = [9 x i8] c"relation\00"
@.str.3 = [1 x i8] zeroinitializer
define i8* @relation_sys_string(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [1024 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%7 = load i8*, i8** %3
%8 = load i8*, i8** %4
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = load i8*, i8** %4
br label %13
12: ; preds = %2
br label %13
13: ; preds = %12, %10
%14 = phi i8* [ %11, %10 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), %12 ]
%15 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([290 x i8], [290 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %7, i8* %14)
%16 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%17 = call i8* @strdup(i8* %16)
ret i8* %17
}

LLVM IR (-O2):
@.str = [28 x i8] c"select.sh '%s' %s \22%s\22 \22%s\22\00"
@.str.1 = [290 x i8] c"folder,related_folder,related_attribute,pair_1tom_order,omit_1tom_detail_yn,prompt_mto1_recursive_yn,relation_type_isa_yn,copy_common_attributes_yn,automatic_preselection_yn,drop_down_multi_select_yn,join_1tom_each_row_yn,omit_lookup_before_drop_down_yn,ajax_fill_drop_down_yn,hint_message\00"
@.str.2 = [9 x i8] c"relation\00"
@.str.3 = [1 x i8] zeroinitializer
define noalias i8* @relation_sys_string(i8* %0, i8* %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = icmp eq i8* %1, null
%6 = select i1 %5, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i8* %1
%7 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([290 x i8], [290 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %0, i8* %6)
%8 = call i8* @strdup(i8* %4)
ret i8* %8
}