#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 */
struct stat {
  scalar_t__ st_mode;
};
typedef int /*<<< orphan*/ fullDest;

/* Variables and functions */
scalar_t__ ENOENT;
scalar_t__ PATH_MAX;
scalar_t__ S_ISDIR(scalar_t__);
scalar_t__ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
scalar_t__ rename(char const *, char *);
scalar_t__ stat(char const *, struct stat *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcat(char *, char const *);
int /*<<< orphan*/ strcpy(char *, char const *);
char *strerror(scalar_t__);
int strlen(char const *);
char *strrchr(char const *, char);
int mv_main(int argc, char *argv[]) {
  const char *dest;
  struct stat st;
  int i;
  if (argc < 3) {
    fprintf(stderr, "USAGE: %s <source...> <destination>\n", argv[0]);
    return -1;
  }
  dest = argv[argc - 1];
  if (stat(dest, &st)) {
    if (errno != ENOENT) {
      fprintf(stderr, "failed on %s - %s\n", dest, strerror(errno));
      return -1;
    }
    st.st_mode = 0;
  }
  for (i = 1; i < argc - 1; i++) {
    const char *source = argv[i];
    char fullDest[PATH_MAX + 1 + PATH_MAX + 1];
    if (strlen(dest) + 1 + strlen(source) + 1 > sizeof(fullDest)) {
      fprintf(stderr, "path too long\n");
      return -1;
    }
    strcpy(fullDest, dest);
    if (S_ISDIR(st.st_mode)) {
      const char *fileName = strrchr(source, '/');
      if (fullDest[strlen(fullDest) - 1] != '/') {
        strcat(fullDest, "/");
      }
      strcat(fullDest, fileName ? fileName + 1 : source);
    }
    if (rename(source, fullDest)) {
      fprintf(stderr, "failed on '%s' - %s\n", source, strerror(errno));
      return -1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<mv_main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    11d6 <mv_main+0x46>
mov    0x2e25(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe3d(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    145f <mv_main+0x2cf>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1080 <stat@plt>
cmp    $0x0,%rax
je     126b <mv_main+0xdb>
mov    0x2dc7(%rip),%rax
mov    (%rax),%rax
mov    0x2dad(%rip),%rcx
cmp    (%rcx),%rax
je     1263 <mv_main+0xd3>
mov    0x2db5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    0x2d99(%rip),%rax
mov    (%rax),%rdi
call   10b0 <strerror@plt>
mov    -0x5c(%rbp),%edi
mov    -0x58(%rbp),%rdx
mov    %rax,%rcx
lea    0xdd5(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    145f <mv_main+0x2cf>
movq   $0x0,-0x20(%rbp)
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1458 <mv_main+0x2c8>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x30(%rbp)
mov    0x2d56(%rip),%rax
mov    (%rax),%rcx
lea    0x2(%rcx,%rcx,1),%rax
mov    %rax,-0x68(%rbp)
mov    %rsp,%rdx
mov    %rdx,-0x38(%rbp)
lea    0x11(%rcx,%rcx,1),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x70(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
mov    -0x30(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x68(%rbp),%rcx
mov    %eax,%edx
mov    -0x60(%rbp),%eax
add    %edx,%eax
add    $0x1,%eax
cltq
cmp    %rcx,%rax
jbe    1322 <mv_main+0x192>
mov    0x2cd9(%rip),%rax
mov    (%rax),%edi
lea    0xd30(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x44(%rbp)
jmp    1429 <mv_main+0x299>
mov    -0x70(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x20(%rbp),%rdi
call   1050 <S_ISDIR@plt>
cmp    $0x0,%rax
je     13b7 <mv_main+0x227>
mov    -0x30(%rbp),%rdi
mov    $0x2f,%esi
call   1060 <strrchr@plt>
mov    -0x70(%rbp),%rdi
mov    %rax,-0x50(%rbp)
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x70(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2f,%eax
je     1386 <mv_main+0x1f6>
mov    -0x70(%rbp),%rdi
lea    0xcc6(%rip),%rsi
call   10a0 <strcat@plt>
cmpq   $0x0,-0x50(%rbp)
je     13a2 <mv_main+0x212>
mov    -0x50(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x78(%rbp)
jmp    13aa <mv_main+0x21a>
mov    -0x30(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x70(%rbp),%rdi
mov    -0x78(%rbp),%rsi
call   10a0 <strcat@plt>
mov    -0x70(%rbp),%rsi
mov    -0x30(%rbp),%rdi
call   1090 <rename@plt>
cmp    $0x0,%rax
je     1422 <mv_main+0x292>
mov    0x2c03(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x84(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    0x2be4(%rip),%rax
mov    (%rax),%rdi
call   10b0 <strerror@plt>
mov    -0x84(%rbp),%edi
mov    -0x80(%rbp),%rdx
mov    %rax,%rcx
lea    0xc41(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x44(%rbp)
jmp    1429 <mv_main+0x299>
movl   $0x0,-0x44(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,%rsp
mov    -0x44(%rbp),%eax
test   %eax,%eax
je     1445 <mv_main+0x2b5>
jmp    1440 <mv_main+0x2b0>
jmp    145f <mv_main+0x2cf>
jmp    144a <mv_main+0x2ba>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1272 <mv_main+0xe2>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mv_main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%r14
cmp    $0x2,%edi
jg     11cd <mv_main+0x3d>
mov    0x2e28(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
lea    0xe44(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0xffffffff,%eax
jmp    1381 <mv_main+0x1f1>
mov    %edi,%ebx
add    $0xffffffff,%ebx
mov    (%r14,%rbx,8),%rdi
lea    -0x40(%rbp),%rsi
mov    %rdi,-0x38(%rbp)
call   1080 <stat@plt>
test   %rax,%rax
je     120a <mv_main+0x7a>
mov    0x2de1(%rip),%rax
mov    (%rax),%rdi
mov    0x2dc7(%rip),%rax
cmp    (%rax),%rdi
jne    1305 <mv_main+0x175>
movq   $0x0,-0x40(%rbp)
mov    $0x1,%r12d
mov    %r14,-0x50(%rbp)
mov    %rbx,-0x48(%rbp)
nopl   0x0(%rax,%rax,1)
mov    %rsp,-0x30(%rbp)
mov    (%r14,%r12,8),%r15
mov    0x2dc1(%rip),%rax
mov    (%rax),%rax
lea    (%rax,%rax,1),%rcx
add    $0x2,%rcx
mov    %rcx,-0x58(%rbp)
mov    %rsp,%r13
add    %rax,%rax
add    $0x11,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
mov    -0x38(%rbp),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %eax,%r14d
mov    %r15,%rdi
call   1040 <strlen@plt>
add    %r14d,%eax
add    $0x2,%eax
cltq
cmp    %rax,-0x58(%rbp)
jb     1331 <mv_main+0x1a1>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    -0x40(%rbp),%rdi
call   1050 <S_ISDIR@plt>
test   %rax,%rax
je     12d8 <mv_main+0x148>
mov    %r15,%rdi
mov    $0x2f,%esi
call   1060 <strrchr@plt>
mov    %rax,%r14
mov    %r13,%rdi
call   1040 <strlen@plt>
cltq
cmpb   $0x2f,-0x1(%rax,%r13,1)
je     12c5 <mv_main+0x135>
mov    %r13,%rdi
lea    0xd87(%rip),%rsi
call   10a0 <strcat@plt>
lea    0x1(%r14),%rsi
test   %r14,%r14
cmove  %r15,%rsi
mov    %r13,%rdi
call   10a0 <strcat@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1090 <rename@plt>
test   %rax,%rax
jne    134a <mv_main+0x1ba>
mov    -0x30(%rbp),%rsp
add    $0x1,%r12
mov    -0x48(%rbp),%rbx
cmp    %r12,%rbx
mov    -0x50(%rbp),%r14
jne    1220 <mv_main+0x90>
xor    %eax,%eax
jmp    1381 <mv_main+0x1f1>
mov    0x2ccc(%rip),%rax
mov    (%rax),%ebx
call   10b0 <strerror@plt>
lea    0xd0b(%rip),%rsi
mov    %ebx,%edi
mov    -0x38(%rbp),%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0xffffffff,%eax
jmp    1381 <mv_main+0x1f1>
mov    0x2ca0(%rip),%rax
mov    (%rax),%edi
lea    0xcf7(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
jmp    1378 <mv_main+0x1e8>
mov    0x2c87(%rip),%rax
mov    (%rax),%ebx
mov    0x2c76(%rip),%rax
mov    (%rax),%rdi
call   10b0 <strerror@plt>
lea    0xce0(%rip),%rsi
mov    %ebx,%edi
mov    %r15,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0xffffffff,%eax
mov    -0x30(%rbp),%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i64 }
@stderr = global i32 0
@.str = [37 x i8] c"USAGE: %s <source...> <destination>\0A\00"
@errno = global i64 0
@ENOENT = global i64 0
@.str.1 = [19 x i8] c"failed on %s - %s\0A\00"
@PATH_MAX = global i64 0
@.str.2 = [15 x i8] c"path too long\0A\00"
@.str.3 = [2 x i8] c"/\00"
@.str.4 = [21 x i8] c"failed on '%s' - %s\0A\00"
define i32 @mv_main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca %struct.stat
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i64
%12 = alloca i32
%13 = alloca i8*
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 3
br i1 %15, label %16, label %22
16: ; preds = %2
%17 = load i32, i32* @stderr
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 0
%20 = load i8*, i8** %19
%21 = call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %20)
store i32 -1, i32* %3
br label %124
22: ; preds = %2
%23 = load i8**, i8*** %5
%24 = load i32, i32* %4
%25 = sub nsw i32 %24, 1
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %23, i64 %26
%28 = load i8*, i8** %27
store i8* %28, i8** %6
%29 = load i8*, i8** %6
%30 = call i64 @stat(i8* %29, %struct.stat* %7)
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %44
32: ; preds = %22
%33 = load i64, i64* @errno
%34 = load i64, i64* @ENOENT
%35 = icmp ne i64 %33, %34
br i1 %35, label %36, label %42
36: ; preds = %32
%37 = load i32, i32* @stderr
%38 = load i8*, i8** %6
%39 = load i64, i64* @errno
%40 = call i8* @strerror(i64 %39)
%41 = call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %38, i8* %40)
store i32 -1, i32* %3
br label %124
42: ; preds = %32
%43 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 0
store i64 0, i64* %43
br label %44
44: ; preds = %42, %22
store i32 1, i32* %8
br label %45
45: ; preds = %120, %44
%46 = load i32, i32* %8
%47 = load i32, i32* %4
%48 = sub nsw i32 %47, 1
%49 = icmp slt i32 %46, %48
br i1 %49, label %50, label %123
50: ; preds = %45
%51 = load i8**, i8*** %5
%52 = load i32, i32* %8
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8*, i8** %51, i64 %53
%55 = load i8*, i8** %54
store i8* %55, i8** %9
%56 = load i64, i64* @PATH_MAX
%57 = add nsw i64 %56, 1
%58 = load i64, i64* @PATH_MAX
%59 = add nsw i64 %57, %58
%60 = add nsw i64 %59, 1
%61 = call i8* @llvm.stacksave()
store i8* %61, i8** %10
%62 = alloca i8, i64 %60
store i64 %60, i64* %11
%63 = load i8*, i8** %6
%64 = call i32 @strlen(i8* %63)
%65 = add nsw i32 %64, 1
%66 = load i8*, i8** %9
%67 = call i32 @strlen(i8* %66)
%68 = add nsw i32 %65, %67
%69 = add nsw i32 %68, 1
%70 = sext i32 %69 to i64
%71 = icmp ugt i64 %70, %60
br i1 %71, label %72, label %75
72: ; preds = %50
%73 = load i32, i32* @stderr
%74 = call i32 (i32, i8*, ...) @fprintf(i32 %73, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %3
store i32 1, i32* %12
br label %116
75: ; preds = %50
%76 = load i8*, i8** %6
%77 = call i32 @strcpy(i8* %62, i8* %76)
%78 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 0
%79 = load i64, i64* %78
%80 = call i64 @S_ISDIR(i64 %79)
%81 = icmp ne i64 %80, 0
br i1 %81, label %82, label %105
82: ; preds = %75
%83 = load i8*, i8** %9
%84 = call i8* @strrchr(i8* %83, i8 signext 47)
store i8* %84, i8** %13
%85 = call i32 @strlen(i8* %62)
%86 = sub nsw i32 %85, 1
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds i8, i8* %62, i64 %87
%89 = load i8, i8* %88
%90 = sext i8 %89 to i32
%91 = icmp ne i32 %90, 47
br i1 %91, label %92, label %94
92: ; preds = %82
%93 = call i32 @strcat(i8* %62, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %94
94: ; preds = %92, %82
%95 = load i8*, i8** %13
%96 = icmp ne i8* %95, null
br i1 %96, label %97, label %100
97: ; preds = %94
%98 = load i8*, i8** %13
%99 = getelementptr inbounds i8, i8* %98, i64 1
br label %102
100: ; preds = %94
%101 = load i8*, i8** %9
br label %102
102: ; preds = %100, %97
%103 = phi i8* [ %99, %97 ], [ %101, %100 ]
%104 = call i32 @strcat(i8* %62, i8* %103)
br label %105
105: ; preds = %102, %75
%106 = load i8*, i8** %9
%107 = call i64 @rename(i8* %106, i8* %62)
%108 = icmp ne i64 %107, 0
br i1 %108, label %109, label %115
109: ; preds = %105
%110 = load i32, i32* @stderr
%111 = load i8*, i8** %9
%112 = load i64, i64* @errno
%113 = call i8* @strerror(i64 %112)
%114 = call i32 (i32, i8*, ...) @fprintf(i32 %110, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %111, i8* %113)
store i32 -1, i32* %3
store i32 1, i32* %12
br label %116
115: ; preds = %105
store i32 0, i32* %12
br label %116
116: ; preds = %115, %109, %72
%117 = load i8*, i8** %10
%118 = load i32, i32* %12
switch i32 %118, label %126 [
i32 0, label %119
i32 1, label %124
]
119: ; preds = %116
br label %120
120: ; preds = %119
%121 = load i32, i32* %8
%122 = add nsw i32 %121, 1
store i32 %122, i32* %8
br label %45
123: ; preds = %45
store i32 0, i32* %3
br label %124
124: ; preds = %123, %116, %36, %16
%125 = load i32, i32* %3
ret i32 %125
126: ; preds = %116
unreachable
}

LLVM IR (-O2):
%struct.stat = type { i64 }
@stderr = global i32 0
@.str = [37 x i8] c"USAGE: %s <source...> <destination>\0A\00"
@errno = global i64 0
@ENOENT = global i64 0
@.str.1 = [19 x i8] c"failed on %s - %s\0A\00"
@PATH_MAX = global i64 0
@.str.2 = [15 x i8] c"path too long\0A\00"
@.str.3 = [2 x i8] c"/\00"
@.str.4 = [21 x i8] c"failed on '%s' - %s\0A\00"
define i32 @mv_main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.stat
%4 = bitcast %struct.stat* %3 to i8*
%5 = icmp slt i32 %0, 3
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %1
%9 = tail call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %8)
br label %78
10: ; preds = %2
%11 = add nsw i32 %0, -1
%12 = zext i32 %11 to i64
%13 = getelementptr inbounds i8*, i8** %1, i64 %12
%14 = load i8*, i8** %13
%15 = call i64 @stat(i8* %14, %struct.stat* %3)
%16 = icmp eq i64 %15, 0
br i1 %16, label %27, label %17
17: ; preds = %10
%18 = load i64, i64* @errno
%19 = load i64, i64* @ENOENT
%20 = icmp eq i64 %18, %19
br i1 %20, label %25, label %21
21: ; preds = %17
%22 = load i32, i32* @stderr
%23 = call i8* @strerror(i64 %18)
%24 = call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %14, i8* %23)
br label %78
25: ; preds = %17
%26 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
store i64 0, i64* %26
br label %27
27: ; preds = %10, %25
%28 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
br label %29
29: ; preds = %27, %75
%30 = phi i64 [ 1, %27 ], [ %76, %75 ]
%31 = getelementptr inbounds i8*, i8** %1, i64 %30
%32 = load i8*, i8** %31
%33 = load i64, i64* @PATH_MAX
%34 = shl i64 %33, 1
%35 = add i64 %34, 2
%36 = call i8* @llvm.stacksave()
%37 = alloca i8, i64 %35
%38 = call i32 @strlen(i8* %14)
%39 = call i32 @strlen(i8* %32)
%40 = add i32 %38, 2
%41 = add i32 %40, %39
%42 = sext i32 %41 to i64
%43 = icmp ult i64 %35, %42
br i1 %43, label %44, label %47
44: ; preds = %29
%45 = load i32, i32* @stderr
%46 = call i32 (i32, i8*, ...) @fprintf(i32 %45, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %78
47: ; preds = %29
%48 = call i32 @strcpy(i8* %37, i8* %14)
%49 = load i64, i64* %28
%50 = call i64 @S_ISDIR(i64 %49)
%51 = icmp eq i64 %50, 0
br i1 %51, label %67, label %52
52: ; preds = %47
%53 = call i8* @strrchr(i8* dereferenceable(1) %32, i8 signext 47)
%54 = call i32 @strlen(i8* %37)
%55 = add nsw i32 %54, -1
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds i8, i8* %37, i64 %56
%58 = load i8, i8* %57
%59 = icmp eq i8 %58, 47
br i1 %59, label %62, label %60
60: ; preds = %52
%61 = call i32 @strcat(i8* %37, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %62
62: ; preds = %60, %52
%63 = icmp eq i8* %53, null
%64 = getelementptr inbounds i8, i8* %53, i64 1
%65 = select i1 %63, i8* %32, i8* %64
%66 = call i32 @strcat(i8* %37, i8* %65)
br label %67
67: ; preds = %62, %47
%68 = call i64 @rename(i8* %32, i8* %37)
%69 = icmp eq i64 %68, 0
br i1 %69, label %75, label %70
70: ; preds = %67
%71 = load i32, i32* @stderr
%72 = load i64, i64* @errno
%73 = call i8* @strerror(i64 %72)
%74 = call i32 (i32, i8*, ...) @fprintf(i32 %71, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %32, i8* %73)
br label %78
75: ; preds = %67
%76 = add nuw nsw i64 %30, 1
%77 = icmp eq i64 %76, %12
br i1 %77, label %78, label %29
78: ; preds = %75, %44, %70, %21, %6
%79 = phi i32 [ -1, %6 ], [ -1, %21 ], [ -1, %70 ], [ -1, %44 ], [ 0, %75 ]
ret i32 %79
}