#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 */
scalar_t__ calloc(int, int);
int /*<<< orphan*/ main_function(char *, char *, char *);
int /*<<< orphan*/ printf(char *, char *);
char *removePath(char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int main(int argc, char **argv) {
  if (argc > 1) {
    int new_location_length = strlen(argv[1]);
    int new_prefix_length = strlen(argv[2]);
    int new_separator_length = strlen(argv[3]);
    char *location = (char *)calloc(new_location_length, sizeof(char));
    char *prefix = (char *)calloc(new_prefix_length, sizeof(char));
    char *separator = (char *)calloc(new_separator_length, sizeof(char));
    strcpy(location, argv[1]);
    strcpy(prefix, argv[2]);
    strcpy(separator, argv[3]);
    main_function(location, prefix, separator);
  } else {
    printf("Usage: "
           "%s"
           " "
           "C:\\mydir prefix"
           "",
           removePath(argv[0]));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    122c <main+0xcc>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%edi
mov    $0x1,%esi
call   1070 <calloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%edi
mov    $0x1,%esi
call   1070 <calloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x1c(%rbp),%edi
mov    $0x1,%esi
call   1070 <calloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1030 <strcpy@plt>
mov    -0x38(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
call   1030 <strcpy@plt>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdx
call   1080 <main_function@plt>
jmp    1247 <main+0xe7>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <removePath@plt>
mov    %rax,%rsi
lea    0xdbe(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%rbx
cmp    $0x2,%edi
jl     11fa <main+0x9a>
mov    0x8(%rbx),%rdi
call   1050 <strlen@plt>
mov    %eax,%ebp
mov    0x10(%rbx),%rdi
call   1050 <strlen@plt>
mov    %eax,%r15d
mov    0x18(%rbx),%rdi
call   1050 <strlen@plt>
mov    %eax,%r12d
mov    %ebp,%edi
mov    $0x1,%esi
call   1070 <calloc@plt>
mov    %rax,%r14
mov    %r15d,%edi
mov    $0x1,%esi
call   1070 <calloc@plt>
mov    %rax,%r15
mov    %r12d,%edi
mov    $0x1,%esi
call   1070 <calloc@plt>
mov    %rax,%rbp
mov    0x8(%rbx),%rsi
mov    %r14,%rdi
call   1030 <strcpy@plt>
mov    0x10(%rbx),%rsi
mov    %r15,%rdi
call   1030 <strcpy@plt>
mov    0x18(%rbx),%rsi
mov    %rbp,%rdi
call   1030 <strcpy@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbp,%rdx
call   1080 <main_function@plt>
jmp    1211 <main+0xb1>
mov    (%rbx),%rdi
call   1040 <removePath@plt>
lea    0xdf7(%rip),%rdi
mov    %rax,%rsi
call   1060 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Usage: %s C:\\mydir prefix\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* %4
%13 = icmp sgt i32 %12, 1
br i1 %13, label %14, label %55
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @strlen(i8* %17)
store i32 %18, i32* %6
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 2
%21 = load i8*, i8** %20
%22 = call i32 @strlen(i8* %21)
store i32 %22, i32* %7
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 3
%25 = load i8*, i8** %24
%26 = call i32 @strlen(i8* %25)
store i32 %26, i32* %8
%27 = load i32, i32* %6
%28 = call i64 @calloc(i32 %27, i32 1)
%29 = inttoptr i64 %28 to i8*
store i8* %29, i8** %9
%30 = load i32, i32* %7
%31 = call i64 @calloc(i32 %30, i32 1)
%32 = inttoptr i64 %31 to i8*
store i8* %32, i8** %10
%33 = load i32, i32* %8
%34 = call i64 @calloc(i32 %33, i32 1)
%35 = inttoptr i64 %34 to i8*
store i8* %35, i8** %11
%36 = load i8*, i8** %9
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 1
%39 = load i8*, i8** %38
%40 = call i32 @strcpy(i8* %36, i8* %39)
%41 = load i8*, i8** %10
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 2
%44 = load i8*, i8** %43
%45 = call i32 @strcpy(i8* %41, i8* %44)
%46 = load i8*, i8** %11
%47 = load i8**, i8*** %5
%48 = getelementptr inbounds i8*, i8** %47, i64 3
%49 = load i8*, i8** %48
%50 = call i32 @strcpy(i8* %46, i8* %49)
%51 = load i8*, i8** %9
%52 = load i8*, i8** %10
%53 = load i8*, i8** %11
%54 = call i32 @main_function(i8* %51, i8* %52, i8* %53)
br label %61
55: ; preds = %2
%56 = load i8**, i8*** %5
%57 = getelementptr inbounds i8*, i8** %56, i64 0
%58 = load i8*, i8** %57
%59 = call i8* @removePath(i8* %58)
%60 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %59)
br label %61
61: ; preds = %55, %14
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"Usage: %s C:\\mydir prefix\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %27
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @strlen(i8* %6)
%8 = getelementptr inbounds i8*, i8** %1, i64 2
%9 = load i8*, i8** %8
%10 = tail call i32 @strlen(i8* %9)
%11 = getelementptr inbounds i8*, i8** %1, i64 3
%12 = load i8*, i8** %11
%13 = tail call i32 @strlen(i8* %12)
%14 = tail call i64 @calloc(i32 %7, i32 1)
%15 = inttoptr i64 %14 to i8*
%16 = tail call i64 @calloc(i32 %10, i32 1)
%17 = inttoptr i64 %16 to i8*
%18 = tail call i64 @calloc(i32 %13, i32 1)
%19 = inttoptr i64 %18 to i8*
%20 = load i8*, i8** %5
%21 = tail call i32 @strcpy(i8* %15, i8* %20)
%22 = load i8*, i8** %8
%23 = tail call i32 @strcpy(i8* %17, i8* %22)
%24 = load i8*, i8** %11
%25 = tail call i32 @strcpy(i8* %19, i8* %24)
%26 = tail call i32 @main_function(i8* %15, i8* %17, i8* %19)
br label %31
27: ; preds = %2
%28 = load i8*, i8** %1
%29 = tail call i8* @removePath(i8* %28)
%30 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %29)
br label %31
31: ; preds = %27, %4
ret i32 0
}