#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*/ DIR;

/* Variables and functions */
int /*<<< orphan*/ closedir(int /*<<< orphan*/ *);
char *dirname(char *);
int /*<<< orphan*/ *opendir(char const *);
int /*<<< orphan*/ printf(char *, char const *, char const *);
int /*<<< orphan*/ sprintf(char *, char *, char const *, ...);
int /*<<< orphan*/ strcpy(char *, char const *);
int /*<<< orphan*/ system(char *);
void DoCopy(const char *ccFn, const char *ccFnto, int iListFile) {
  char cTemp[256];
  strcpy(cTemp, ccFnto);
  char *cPathNsf = dirname(cTemp);
  char cCmd[256] = "";
  sprintf(cCmd, "mkdir -p \"%s\"", cPathNsf);
  DIR *df;
  if ((df = opendir(ccFnto)) == NULL)
    system(cCmd);
  else
    closedir(df);
  sprintf(cCmd, "cp \"%s\" \"%s\"", ccFn, cPathNsf);
  system(cCmd);
  if (iListFile)
    printf("%s==>%s\n", ccFn, ccFnto);
}


x86 assembly (clang, -O0):
<DoCopy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x240,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
lea    -0x120(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x120(%rbp),%rdi
call   1070 <dirname@plt>
mov    %rax,-0x128(%rbp)
lea    -0x230(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1080 <memset@plt>
lea    -0x230(%rbp),%rdi
mov    -0x128(%rbp),%rdx
lea    0xe1f(%rip),%rsi
mov    $0x0,%al
call   10a0 <sprintf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <opendir@plt>
mov    %rax,-0x238(%rbp)
cmp    $0x0,%rax
jne    1213 <DoCopy+0x93>
lea    -0x230(%rbp),%rdi
call   1050 <system@plt>
jmp    121f <DoCopy+0x9f>
mov    -0x238(%rbp),%rdi
call   1090 <closedir@plt>
lea    -0x230(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x128(%rbp),%rcx
lea    0xdd6(%rip),%rsi
mov    $0x0,%al
call   10a0 <sprintf@plt>
lea    -0x230(%rbp),%rdi
call   1050 <system@plt>
cmpl   $0x0,-0x14(%rbp)
je     1269 <DoCopy+0xe9>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xdb7(%rip),%rdi
call   1060 <printf@plt>
add    $0x240,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DoCopy>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x200,%rsp
mov    %edx,%r15d
mov    %rsi,%r12
mov    %rdi,%r14
lea    0x100(%rsp),%rbp
mov    %rbp,%rdi
call   1030 <strcpy@plt>
mov    %rbp,%rdi
call   1070 <dirname@plt>
mov    %rax,%rbp
xorps  %xmm0,%xmm0
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
lea    0xdec(%rip),%rsi
mov    %rsp,%rdi
mov    %rax,%rdx
xor    %eax,%eax
call   1090 <sprintf@plt>
mov    %r12,%rdi
call   1040 <opendir@plt>
test   %rax,%rax
je     1238 <DoCopy+0xc8>
mov    %rax,%rdi
call   1080 <closedir@plt>
jmp    1240 <DoCopy+0xd0>
mov    %rsp,%rdi
call   1050 <system@plt>
lea    0xdc7(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r14,%rdx
mov    %rbp,%rcx
xor    %eax,%eax
call   1090 <sprintf@plt>
mov    %rbx,%rdi
call   1050 <system@plt>
test   %r15d,%r15d
je     1279 <DoCopy+0x109>
lea    0xdad(%rip),%rdi
mov    %r14,%rsi
mov    %r12,%rdx
call   1060 <printf@plt>
add    $0x200,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"mkdir -p \22%s\22\00"
@.str.1 = [13 x i8] c"cp \22%s\22 \22%s\22\00"
@.str.2 = [9 x i8] c"%s==>%s\0A\00"
define void @DoCopy(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca [256 x i8]
%8 = alloca i8*
%9 = alloca [256 x i8]
%10 = alloca i32*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%12 = load i8*, i8** %5
%13 = call i32 @strcpy(i8* %11, i8* %12)
%14 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%15 = call i8* @dirname(i8* %14)
store i8* %15, i8** %8
%16 = bitcast [256 x i8]* %9 to i8*
%17 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%18 = load i8*, i8** %8
%19 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %17, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %18)
%20 = load i8*, i8** %5
%21 = call i32* @opendir(i8* %20)
store i32* %21, i32** %10
%22 = icmp eq i32* %21, null
br i1 %22, label %23, label %26
23: ; preds = %3
%24 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%25 = call i32 @system(i8* %24)
br label %29
26: ; preds = %3
%27 = load i32*, i32** %10
%28 = call i32 @closedir(i32* %27)
br label %29
29: ; preds = %26, %23
%30 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%31 = load i8*, i8** %4
%32 = load i8*, i8** %8
%33 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %30, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %31, i8* %32)
%34 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%35 = call i32 @system(i8* %34)
%36 = load i32, i32* %6
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %42
38: ; preds = %29
%39 = load i8*, i8** %4
%40 = load i8*, i8** %5
%41 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %39, i8* %40)
br label %42
42: ; preds = %38, %29
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"mkdir -p \22%s\22\00"
@.str.1 = [13 x i8] c"cp \22%s\22 \22%s\22\00"
@.str.2 = [9 x i8] c"%s==>%s\0A\00"
define void @DoCopy(i8* %0, i8* %1, i32 %2) {
%4 = alloca [256 x i8]
%5 = alloca [256 x i8]
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%7 = call i32 @strcpy(i8* %6, i8* %1)
%8 = call i8* @dirname(i8* %6)
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%10 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %8)
%11 = call i32* @opendir(i8* %1)
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %15
13: ; preds = %3
%14 = call i32 @system(i8* %9)
br label %17
15: ; preds = %3
%16 = call i32 @closedir(i32* %11)
br label %17
17: ; preds = %15, %13
%18 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %8)
%19 = call i32 @system(i8* %9)
%20 = icmp eq i32 %2, 0
br i1 %20, label %23, label %21
21: ; preds = %17
%22 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %0, i8* %1)
br label %23
23: ; preds = %21, %17
ret void
}