#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 *);
char *appaserver_library_get_default_role_name(char *application_name,
                                               char *login_name) {
  char sys_string[1024];
  char *results;
  sprintf(sys_string,
          "get_folder_data	application=%s			"
          "			select=role			"
          "			folder=login_default_role	"
          "			where=\"login_name = '%s'\"	",
          application_name, login_name);
  results = pipe2string(sys_string);
  if (!results)
    return "";
  else
    return results;
}


x86 assembly (clang, -O0):
<appaserver_library_get_default_role_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    -0x420(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xeb7(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x420(%rbp),%rdi
call   1030 <pipe2string@plt>
mov    %rax,-0x428(%rbp)
cmpq   $0x0,-0x428(%rbp)
jne    117f <appaserver_library_get_default_role_name+0x5f>
lea    0xef6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    118a <appaserver_library_get_default_role_name+0x6a>
mov    -0x428(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<appaserver_library_get_default_role_name>:
push   %rbx
sub    $0x400,%rsp
mov    %rsi,%rcx
mov    %rdi,%rdx
lea    0xecb(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <pipe2string@plt>
test   %rax,%rax
lea    0xf1a(%rip),%rcx
cmove  %rcx,%rax
add    $0x400,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [109 x i8] c"get_folder_data\09application=%s\09\09\09\09\09\09select=role\09\09\09\09\09\09folder=login_default_role\09\09\09\09where=\22login_name = '%s'\22\09\00"
@.str.1 = [1 x i8] zeroinitializer
define i8* @appaserver_library_get_default_role_name(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca [1024 x i8]
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%9 = load i8*, i8** %4
%10 = load i8*, i8** %5
%11 = call i32 @sprintf(i8* %8, i8* getelementptr inbounds ([109 x i8], [109 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %10)
%12 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%13 = call i8* @pipe2string(i8* %12)
store i8* %13, i8** %7
%14 = load i8*, i8** %7
%15 = icmp ne i8* %14, null
br i1 %15, label %17, label %16
16: ; preds = %2
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8** %3
br label %19
17: ; preds = %2
%18 = load i8*, i8** %7
store i8* %18, i8** %3
br label %19
19: ; preds = %17, %16
%20 = load i8*, i8** %3
ret i8* %20
}

LLVM IR (-O2):
@.str = [109 x i8] c"get_folder_data\09application=%s\09\09\09\09\09\09select=role\09\09\09\09\09\09folder=login_default_role\09\09\09\09where=\22login_name = '%s'\22\09\00"
@.str.1 = [1 x i8] zeroinitializer
define i8* @appaserver_library_get_default_role_name(i8* %0, i8* %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([109 x i8], [109 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%6 = call i8* @pipe2string(i8* %4)
%7 = icmp eq i8* %6, null
%8 = select i1 %7, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* %6
ret i8* %8
}