#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char *get_table_name(char *, char *);
int /*<<< orphan*/ *popen(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, char *);
FILE *appaserver_user_insert_open(char *application_name, char *error_filename,
                                  char *frameset_menu_horizontal_yn) {
  char sys_string[1024];
  char *field;
  char *table_name;
  FILE *output_pipe;
  if (frameset_menu_horizontal_yn && *frameset_menu_horizontal_yn) {
    field = "login_name,"
            "password,"
            "person_full_name,"
            "frameset_menu_horizontal_yn,"
            "user_date_format";
  } else {
    field = "login_name,"
            "password,"
            "person_full_name,"
            "user_date_format";
  }
  table_name = get_table_name(application_name, "appaserver_user");
  sprintf(sys_string,
          "insert_statement.e table=%s field=%s del='^'	|"
          "sql.e 2>%s					 ",
          table_name, field, error_filename);
  output_pipe = popen(sys_string, "w");
  return output_pipe;
}


x86 assembly (clang, -O0):
<appaserver_user_insert_open>:
push   %rbp
mov    %rsp,%rbp
sub    $0x440,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1175 <appaserver_user_insert_open+0x45>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1175 <appaserver_user_insert_open+0x45>
lea    0xe97(%rip),%rax
mov    %rax,-0x428(%rbp)
jmp    1183 <appaserver_user_insert_open+0x53>
lea    0xed6(%rip),%rax
mov    %rax,-0x428(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xefa(%rip),%rsi
call   1030 <get_table_name@plt>
mov    %rax,-0x430(%rbp)
lea    -0x420(%rbp),%rdi
mov    -0x430(%rbp),%rdx
mov    -0x428(%rbp),%rcx
mov    -0x10(%rbp),%r8
lea    0xede(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x420(%rbp),%rdi
lea    0xf0a(%rip),%rsi
call   1040 <popen@plt>
mov    %rax,-0x438(%rbp)
mov    -0x438(%rbp),%rax
add    $0x440,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<appaserver_user_insert_open>:
push   %r15
push   %r14
push   %rbx
sub    $0x400,%rsp
mov    %rsi,%r14
test   %rdx,%rdx
je     1152 <appaserver_user_insert_open+0x22>
cmpb   $0x0,(%rdx)
je     1152 <appaserver_user_insert_open+0x22>
lea    0xeb0(%rip),%rbx
jmp    1159 <appaserver_user_insert_open+0x29>
lea    0xef9(%rip),%rbx
lea    0xf28(%rip),%rsi
call   1030 <get_table_name@plt>
lea    0xf2c(%rip),%rsi
mov    %rsp,%r15
mov    %r15,%rdi
mov    %rax,%rdx
mov    %rbx,%rcx
mov    %r14,%r8
call   1050 <sprintf@plt>
lea    0xf50(%rip),%rsi
mov    %r15,%rdi
call   1040 <popen@plt>
add    $0x400,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [82 x i8] c"login_name,password,person_full_name,frameset_menu_horizontal_yn,user_date_format\00"
@.str.1 = [54 x i8] c"login_name,password,person_full_name,user_date_format\00"
@.str.2 = [16 x i8] c"appaserver_user\00"
@.str.3 = [63 x i8] c"insert_statement.e table=%s field=%s del='^'\09|sql.e 2>%s\09\09\09\09\09 \00"
@.str.4 = [2 x i8] c"w\00"
define i32* @appaserver_user_insert_open(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [1024 x i8]
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%11 = load i8*, i8** %6
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %19
13: ; preds = %3
%14 = load i8*, i8** %6
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %13
store i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str, i64 0, i64 0), i8** %8
br label %20
19: ; preds = %13, %3
store i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0), i8** %8
br label %20
20: ; preds = %19, %18
%21 = load i8*, i8** %4
%22 = call i8* @get_table_name(i8* %21, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
store i8* %22, i8** %9
%23 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%24 = load i8*, i8** %9
%25 = load i8*, i8** %8
%26 = load i8*, i8** %5
%27 = call i32 @sprintf(i8* %23, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.3, i64 0, i64 0), i8* %24, i8* %25, i8* %26)
%28 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%29 = call i32* @popen(i8* %28, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %29, i32** %10
%30 = load i32*, i32** %10
ret i32* %30
}

LLVM IR (-O2):
@.str = [82 x i8] c"login_name,password,person_full_name,frameset_menu_horizontal_yn,user_date_format\00"
@.str.1 = [54 x i8] c"login_name,password,person_full_name,user_date_format\00"
@.str.2 = [16 x i8] c"appaserver_user\00"
@.str.3 = [63 x i8] c"insert_statement.e table=%s field=%s del='^'\09|sql.e 2>%s\09\09\09\09\09 \00"
@.str.4 = [2 x i8] c"w\00"
define noalias i32* @appaserver_user_insert_open(i8* %0, i8* %1, i8* %2) {
%4 = alloca [1024 x i8]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%6 = icmp eq i8* %2, null
br i1 %6, label %10, label %7
7: ; preds = %3
%8 = load i8, i8* %2
%9 = icmp eq i8 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %7, %3
br label %11
11: ; preds = %7, %10
%12 = phi i8* [ getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0), %10 ], [ getelementptr inbounds ([82 x i8], [82 x i8]* @.str, i64 0, i64 0), %7 ]
%13 = tail call i8* @get_table_name(i8* %0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @.str.3, i64 0, i64 0), i8* %13, i8* %12, i8* %1)
%15 = call i32* @popen(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
ret i32* %15
}