#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 *, char *);
scalar_t__ strcmp(char *, char *);
char *create_clone_filename_get_clone_folder_filename(
    char *destination, char **directory_name, char *application_name,
    char *appaserver_data_directory, char *folder_name, char *export_output) {
  *directory_name = create_clone_filename_get_directory_name(
      appaserver_data_directory, *directory_name);
  if (export_output && strcmp(export_output, "shell_script") == 0) {
    sprintf(destination, "%s/insert_%s_%s.sh", *directory_name,
            application_name, folder_name);
  } else {
    sprintf(destination, "%s/insert_%s_%s.sql", *directory_name,
            application_name, folder_name);
  }
  return destination;
}


x86 assembly (clang, -O0):
<create_clone_filename_get_clone_folder_filename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
call   1040 <create_clone_filename_get_directory_name@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
cmpq   $0x0,-0x30(%rbp)
je     11b3 <create_clone_filename_get_clone_folder_filename+0x83>
mov    -0x30(%rbp),%rdi
lea    0xe80(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11b3 <create_clone_filename_get_clone_folder_filename+0x83>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x28(%rbp),%r8
lea    0xe64(%rip),%rsi
call   1050 <sprintf@plt>
jmp    11d2 <create_clone_filename_get_clone_folder_filename+0xa2>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x28(%rbp),%r8
lea    0xe53(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_clone_filename_get_clone_folder_filename>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %r9,%r13
mov    %r8,%r14
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rdi,%r12
mov    (%rsi),%rsi
mov    %rcx,%rdi
call   1040 <create_clone_filename_get_directory_name@plt>
mov    %rax,(%rbx)
test   %r13,%r13
je     1175 <create_clone_filename_get_clone_folder_filename+0x45>
lea    0xe9e(%rip),%rsi
mov    %r13,%rdi
call   1030 <strcmp@plt>
mov    %rax,%rcx
mov    (%rbx),%rax
test   %rcx,%rcx
je     117e <create_clone_filename_get_clone_folder_filename+0x4e>
lea    0xea4(%rip),%rsi
jmp    1185 <create_clone_filename_get_clone_folder_filename+0x55>
lea    0xe88(%rip),%rsi
mov    %r12,%rdi
mov    %rax,%rdx
mov    %r15,%rcx
mov    %r14,%r8
call   1050 <sprintf@plt>
mov    %r12,%rax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [13 x i8] c"shell_script\00"
@.str.1 = [19 x i8] c"%s/insert_%s_%s.sh\00"
@.str.2 = [20 x i8] c"%s/insert_%s_%s.sql\00"
define i8* @create_clone_filename_get_clone_folder_filename(i8* %0, i8** %1, i8* %2, i8* %3, i8* %4, i8* %5) {
%7 = alloca i8*
%8 = alloca i8**
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
store i8* %0, i8** %7
store i8** %1, i8*** %8
store i8* %2, i8** %9
store i8* %3, i8** %10
store i8* %4, i8** %11
store i8* %5, i8** %12
%13 = load i8*, i8** %10
%14 = load i8**, i8*** %8
%15 = load i8*, i8** %14
%16 = call i8* @create_clone_filename_get_directory_name(i8* %13, i8* %15)
%17 = load i8**, i8*** %8
store i8* %16, i8** %17
%18 = load i8*, i8** %12
%19 = icmp ne i8* %18, null
br i1 %19, label %20, label %31
20: ; preds = %6
%21 = load i8*, i8** %12
%22 = call i64 @strcmp(i8* %21, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %31
24: ; preds = %20
%25 = load i8*, i8** %7
%26 = load i8**, i8*** %8
%27 = load i8*, i8** %26
%28 = load i8*, i8** %9
%29 = load i8*, i8** %11
%30 = call i32 @sprintf(i8* %25, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %27, i8* %28, i8* %29)
br label %38
31: ; preds = %20, %6
%32 = load i8*, i8** %7
%33 = load i8**, i8*** %8
%34 = load i8*, i8** %33
%35 = load i8*, i8** %9
%36 = load i8*, i8** %11
%37 = call i32 @sprintf(i8* %32, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %34, i8* %35, i8* %36)
br label %38
38: ; preds = %31, %24
%39 = load i8*, i8** %7
ret i8* %39
}

LLVM IR (-O2):
@.str = [13 x i8] c"shell_script\00"
@.str.1 = [19 x i8] c"%s/insert_%s_%s.sh\00"
@.str.2 = [20 x i8] c"%s/insert_%s_%s.sql\00"
define i8* @create_clone_filename_get_clone_folder_filename(i8* returned writeonly %0, i8** nocapture %1, i8* %2, i8* %3, i8* %4, i8* %5) {
%7 = load i8*, i8** %1
%8 = tail call i8* @create_clone_filename_get_directory_name(i8* %3, i8* %7)
store i8* %8, i8** %1
%9 = icmp eq i8* %5, null
br i1 %9, label %16, label %10
10: ; preds = %6
%11 = tail call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
%13 = load i8*, i8** %1
br i1 %12, label %14, label %16
14: ; preds = %10
%15 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %13, i8* %2, i8* %4)
br label %19
16: ; preds = %10, %6
%17 = phi i8* [ %8, %6 ], [ %13, %10 ]
%18 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %17, i8* %2, i8* %4)
br label %19
19: ; preds = %16, %14
ret i8* %0
}