#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 *create_clone_filename_get_directory_name(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
scalar_t__ strcmp(char *, char *);
char *strdup(char *);
char *create_clone_filename_get_clone_application_compressed_filename(
    char **directory_name, char *application_name,
    char *appaserver_data_directory, char system_folders_yn,
    char *export_output) {
  char buffer[1024];
  *directory_name = create_clone_filename_get_directory_name(
      appaserver_data_directory, *directory_name);
  if (system_folders_yn == 'y') {
    if (export_output && strcmp(export_output, "shell_script") == 0) {
      sprintf(buffer, "%s/insert_%s_appaserver.sh.gz", *directory_name,
              application_name);
    } else if (export_output && strcmp(export_output, "spreadsheet") == 0) {
      sprintf(buffer, "%s/%s_appaserver.csv.gz", *directory_name,
              application_name);
    } else {
      sprintf(buffer, "%s/insert_%s_appaserver.sql.gz", *directory_name,
              application_name);
    }
  } else {
    if (export_output && strcmp(export_output, "shell_script") == 0) {
      sprintf(buffer, "%s/insert_%s_application.sh.gz", *directory_name,
              application_name);
    } else if (export_output && strcmp(export_output, "spreadsheet") == 0) {
      sprintf(buffer, "%s/%s.csv.gz", *directory_name, application_name);
    } else {
      sprintf(buffer, "%s/insert_%s_application.sql.gz", *directory_name,
              application_name);
    }
  }
  return strdup(buffer);
}


x86 assembly (clang, -O0):
<create_clone_filename_get_clone_application_compressed_filename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
mov    %cl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %al,-0x19(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
call   1040 <create_clone_filename_get_directory_name@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
movsbl -0x19(%rbp),%eax
cmp    $0x79,%eax
jne    123f <create_clone_filename_get_clone_application_compressed_filename+0xff>
cmpq   $0x0,-0x28(%rbp)
je     11cf <create_clone_filename_get_clone_application_compressed_filename+0x8f>
mov    -0x28(%rbp),%rdi
lea    0xe63(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11cf <create_clone_filename_get_clone_application_compressed_filename+0x8f>
lea    -0x430(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rcx
lea    0xe48(%rip),%rsi
call   1050 <sprintf@plt>
jmp    123a <create_clone_filename_get_clone_application_compressed_filename+0xfa>
cmpq   $0x0,-0x28(%rbp)
je     1217 <create_clone_filename_get_clone_application_compressed_filename+0xd7>
mov    -0x28(%rbp),%rdi
lea    0xe46(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1217 <create_clone_filename_get_clone_application_compressed_filename+0xd7>
lea    -0x430(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rcx
lea    0xe2a(%rip),%rsi
call   1050 <sprintf@plt>
jmp    1235 <create_clone_filename_get_clone_application_compressed_filename+0xf5>
lea    -0x430(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rcx
lea    0xe1f(%rip),%rsi
call   1050 <sprintf@plt>
jmp    123a <create_clone_filename_get_clone_application_compressed_filename+0xfa>
jmp    12f7 <create_clone_filename_get_clone_application_compressed_filename+0x1b7>
cmpq   $0x0,-0x28(%rbp)
je     1287 <create_clone_filename_get_clone_application_compressed_filename+0x147>
mov    -0x28(%rbp),%rdi
lea    0xdab(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1287 <create_clone_filename_get_clone_application_compressed_filename+0x147>
lea    -0x430(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rcx
lea    0xdf1(%rip),%rsi
call   1050 <sprintf@plt>
jmp    12f2 <create_clone_filename_get_clone_application_compressed_filename+0x1b2>
cmpq   $0x0,-0x28(%rbp)
je     12cf <create_clone_filename_get_clone_application_compressed_filename+0x18f>
mov    -0x28(%rbp),%rdi
lea    0xd8e(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    12cf <create_clone_filename_get_clone_application_compressed_filename+0x18f>
lea    -0x430(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rcx
lea    0xdc8(%rip),%rsi
call   1050 <sprintf@plt>
jmp    12ed <create_clone_filename_get_clone_application_compressed_filename+0x1ad>
lea    -0x430(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rcx
lea    0xdb2(%rip),%rsi
call   1050 <sprintf@plt>
jmp    12f2 <create_clone_filename_get_clone_application_compressed_filename+0x1b2>
jmp    12f7 <create_clone_filename_get_clone_application_compressed_filename+0x1b7>
lea    -0x430(%rbp),%rdi
call   1060 <strdup@plt>
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_clone_filename_get_clone_application_compressed_filename>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x408,%rsp
mov    %r8,%r15
mov    %ecx,%ebp
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi),%rsi
mov    %rdx,%rdi
call   1040 <create_clone_filename_get_directory_name@plt>
mov    %rax,(%rbx)
cmp    $0x79,%bpl
jne    11a8 <create_clone_filename_get_clone_application_compressed_filename+0x68>
test   %r15,%r15
je     119f <create_clone_filename_get_clone_application_compressed_filename+0x5f>
lea    0xe88(%rip),%rsi
mov    %r15,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11e4 <create_clone_filename_get_clone_application_compressed_filename+0xa4>
lea    0xe9f(%rip),%rsi
mov    %r15,%rdi
call   1030 <strcmp@plt>
mov    %rax,%rcx
mov    (%rbx),%rax
test   %rcx,%rcx
je     1202 <create_clone_filename_get_clone_application_compressed_filename+0xc2>
lea    0xea9(%rip),%rsi
jmp    1212 <create_clone_filename_get_clone_application_compressed_filename+0xd2>
test   %r15,%r15
je     11db <create_clone_filename_get_clone_application_compressed_filename+0x9b>
lea    0xe4c(%rip),%rsi
mov    %r15,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11f3 <create_clone_filename_get_clone_application_compressed_filename+0xb3>
lea    0xe63(%rip),%rsi
mov    %r15,%rdi
call   1030 <strcmp@plt>
mov    %rax,%rcx
mov    (%rbx),%rax
test   %rcx,%rcx
je     120b <create_clone_filename_get_clone_application_compressed_filename+0xcb>
lea    0xeb8(%rip),%rsi
jmp    1212 <create_clone_filename_get_clone_application_compressed_filename+0xd2>
mov    (%rbx),%rdx
lea    0xe1f(%rip),%rsi
mov    %rsp,%rdi
jmp    1218 <create_clone_filename_get_clone_application_compressed_filename+0xd8>
mov    (%rbx),%rdx
lea    0xe71(%rip),%rsi
mov    %rsp,%rdi
jmp    1218 <create_clone_filename_get_clone_application_compressed_filename+0xd8>
lea    0xe2e(%rip),%rsi
jmp    1212 <create_clone_filename_get_clone_application_compressed_filename+0xd2>
lea    0xe7b(%rip),%rsi
mov    %rsp,%rdi
mov    %rax,%rdx
mov    %r14,%rcx
call   1050 <sprintf@plt>
mov    %rsp,%rdi
call   1060 <strdup@plt>
add    $0x408,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"shell_script\00"
@.str.1 = [30 x i8] c"%s/insert_%s_appaserver.sh.gz\00"
@.str.2 = [12 x i8] c"spreadsheet\00"
@.str.3 = [24 x i8] c"%s/%s_appaserver.csv.gz\00"
@.str.4 = [31 x i8] c"%s/insert_%s_appaserver.sql.gz\00"
@.str.5 = [31 x i8] c"%s/insert_%s_application.sh.gz\00"
@.str.6 = [13 x i8] c"%s/%s.csv.gz\00"
@.str.7 = [32 x i8] c"%s/insert_%s_application.sql.gz\00"
define i8* @create_clone_filename_get_clone_application_compressed_filename(i8** %0, i8* %1, i8* %2, i8 signext %3, i8* %4) {
%6 = alloca i8**
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8
%10 = alloca i8*
%11 = alloca [1024 x i8]
store i8** %0, i8*** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8 %3, i8* %9
store i8* %4, i8** %10
%12 = load i8*, i8** %8
%13 = load i8**, i8*** %6
%14 = load i8*, i8** %13
%15 = call i8* @create_clone_filename_get_directory_name(i8* %12, i8* %14)
%16 = load i8**, i8*** %6
store i8* %15, i8** %16
%17 = load i8, i8* %9
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 121
br i1 %19, label %20, label %54
20: ; preds = %5
%21 = load i8*, i8** %10
%22 = icmp ne i8* %21, null
br i1 %22, label %23, label %33
23: ; preds = %20
%24 = load i8*, i8** %10
%25 = call i64 @strcmp(i8* %24, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %33
27: ; preds = %23
%28 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%29 = load i8**, i8*** %6
%30 = load i8*, i8** %29
%31 = load i8*, i8** %7
%32 = call i32 @sprintf(i8* %28, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %30, i8* %31)
br label %53
33: ; preds = %23, %20
%34 = load i8*, i8** %10
%35 = icmp ne i8* %34, null
br i1 %35, label %36, label %46
36: ; preds = %33
%37 = load i8*, i8** %10
%38 = call i64 @strcmp(i8* %37, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %46
40: ; preds = %36
%41 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%42 = load i8**, i8*** %6
%43 = load i8*, i8** %42
%44 = load i8*, i8** %7
%45 = call i32 @sprintf(i8* %41, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %43, i8* %44)
br label %52
46: ; preds = %36, %33
%47 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%48 = load i8**, i8*** %6
%49 = load i8*, i8** %48
%50 = load i8*, i8** %7
%51 = call i32 @sprintf(i8* %47, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i8* %49, i8* %50)
br label %52
52: ; preds = %46, %40
br label %53
53: ; preds = %52, %27
br label %88
54: ; preds = %5
%55 = load i8*, i8** %10
%56 = icmp ne i8* %55, null
br i1 %56, label %57, label %67
57: ; preds = %54
%58 = load i8*, i8** %10
%59 = call i64 @strcmp(i8* %58, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%60 = icmp eq i64 %59, 0
br i1 %60, label %61, label %67
61: ; preds = %57
%62 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%63 = load i8**, i8*** %6
%64 = load i8*, i8** %63
%65 = load i8*, i8** %7
%66 = call i32 @sprintf(i8* %62, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i8* %64, i8* %65)
br label %87
67: ; preds = %57, %54
%68 = load i8*, i8** %10
%69 = icmp ne i8* %68, null
br i1 %69, label %70, label %80
70: ; preds = %67
%71 = load i8*, i8** %10
%72 = call i64 @strcmp(i8* %71, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%73 = icmp eq i64 %72, 0
br i1 %73, label %74, label %80
74: ; preds = %70
%75 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%76 = load i8**, i8*** %6
%77 = load i8*, i8** %76
%78 = load i8*, i8** %7
%79 = call i32 @sprintf(i8* %75, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i8* %77, i8* %78)
br label %86
80: ; preds = %70, %67
%81 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%82 = load i8**, i8*** %6
%83 = load i8*, i8** %82
%84 = load i8*, i8** %7
%85 = call i32 @sprintf(i8* %81, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0), i8* %83, i8* %84)
br label %86
86: ; preds = %80, %74
br label %87
87: ; preds = %86, %61
br label %88
88: ; preds = %87, %53
%89 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%90 = call i8* @strdup(i8* %89)
ret i8* %90
}

LLVM IR (-O2):
@.str = [13 x i8] c"shell_script\00"
@.str.1 = [30 x i8] c"%s/insert_%s_appaserver.sh.gz\00"
@.str.2 = [12 x i8] c"spreadsheet\00"
@.str.3 = [24 x i8] c"%s/%s_appaserver.csv.gz\00"
@.str.4 = [31 x i8] c"%s/insert_%s_appaserver.sql.gz\00"
@.str.5 = [31 x i8] c"%s/insert_%s_application.sh.gz\00"
@.str.6 = [13 x i8] c"%s/%s.csv.gz\00"
@.str.7 = [32 x i8] c"%s/insert_%s_application.sql.gz\00"
define noalias i8* @create_clone_filename_get_clone_application_compressed_filename(i8** nocapture %0, i8* %1, i8* %2, i8 signext %3, i8* %4) {
%6 = alloca [1024 x i8]
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%8 = load i8*, i8** %0
%9 = tail call i8* @create_clone_filename_get_directory_name(i8* %2, i8* %8)
store i8* %9, i8** %0
%10 = icmp eq i8 %3, 121
%11 = icmp eq i8* %4, null
br i1 %10, label %12, label %28
12: ; preds = %5
br i1 %11, label %25, label %13
13: ; preds = %12
%14 = tail call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %13
%17 = load i8*, i8** %0
%18 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %17, i8* %1)
br label %44
19: ; preds = %13
%20 = tail call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
%22 = load i8*, i8** %0
br i1 %21, label %23, label %25
23: ; preds = %19
%24 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %22, i8* %1)
br label %44
25: ; preds = %19, %12
%26 = phi i8* [ %9, %12 ], [ %22, %19 ]
%27 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i8* %26, i8* %1)
br label %44
28: ; preds = %5
br i1 %11, label %41, label %29
29: ; preds = %28
%30 = tail call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %29
%33 = load i8*, i8** %0
%34 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i8* %33, i8* %1)
br label %44
35: ; preds = %29
%36 = tail call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
%38 = load i8*, i8** %0
br i1 %37, label %39, label %41
39: ; preds = %35
%40 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i8* %38, i8* %1)
br label %44
41: ; preds = %35, %28
%42 = phi i8* [ %9, %28 ], [ %38, %35 ]
%43 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0), i8* %42, i8* %1)
br label %44
44: ; preds = %32, %41, %39, %16, %25, %23
%45 = call i8* @strdup(i8* %7)
ret i8* %45
}