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

/* Variables and functions */
int EOF;
int /*<<< orphan*/ errors_2p(int /*<<< orphan*/ *, int /*<<< orphan*/ *, char *,
                             char const *, int, int /*<<< orphan*/, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ file_exist(char *, char *, int);
int /*<<< orphan*/ *fopen(char *, char *);
int fputc(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ make_directories(char *);
int printf(char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char const *);
int strlen(char *);
int /*<<< orphan*/ strncat(char *, char const *, int);
char const *strrchr(char const *, char);
int small_unpack(FILE *input, const char *arg_unpack, const char *d_input,
                 const int tam, const char *path) {
  FILE *output;
  char *last = strrchr(path, '/');
  char aux[1024];
  char dir[1024];
  strcpy(dir, arg_unpack);
  if (dir[strlen(dir) - 1] != '/') {
    strcat(dir, "/");
  }
  char o_path[1024];
  strcpy(o_path, path);
  file_exist(dir, o_path, 1);
  strcat(dir, o_path);
  if (last != NULL) {
    strcpy(aux, arg_unpack);
    if (aux[strlen(aux) - 1] != '/') {
      strcat(aux, "/");
    }
    strncat(aux, path, last - path);
    make_directories(aux);
    strcpy(o_path, strrchr(path, '/') + 1);
    file_exist(aux, o_path, 1);
  }
  printf("Unpacking \"%s\"...\n", dir);
  if ((output = fopen(dir, "w")) == NULL) {
    errors_2p(input, NULL, "ERROR creating the directory", dir, 4, 0, 1);
  } else {
    int k, c;
    for (k = 1; k <= tam; k++) {
      if ((c = fgetc(input)) != EOF) {
        if ((fputc(c, output)) == EOF) {
          fclose(output);
          errors_2p(input, NULL, "ERROR writing", d_input, 3, 0, 1);
        }
      } else {
        fclose(output);
        errors_2p(input, NULL, "ERROR reading", dir, 2, 0, 1);
      }
    }
    fclose(output);
  }
  return printf("Unpacked \"%s\"\n\n", dir);
}


x86 assembly (clang, -O0):
<small_unpack>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    $0x2f,%esi
call   1080 <strrchr@plt>
mov    %rax,-0x38(%rbp)
lea    -0x840(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x840(%rbp),%rdi
call   1060 <strlen@plt>
sub    $0x1,%eax
cltq
movsbl -0x840(%rbp,%rax,1),%eax
ff
cmp    $0x2f,%eax
je     1245 <small_unpack+0x75>
lea    -0x840(%rbp),%rdi
lea    0xdc0(%rip),%rsi
call   10f0 <strcat@plt>
lea    -0xc40(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x840(%rbp),%rdi
lea    -0xc40(%rbp),%rsi
mov    $0x1,%edx
call   10d0 <file_exist@plt>
lea    -0x840(%rbp),%rdi
lea    -0xc40(%rbp),%rsi
call   10f0 <strcat@plt>
cmpq   $0x0,-0x38(%rbp)
je     1340 <small_unpack+0x170>
lea    -0x440(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x440(%rbp),%rdi
call   1060 <strlen@plt>
sub    $0x1,%eax
cltq
movsbl -0x440(%rbp,%rax,1),%eax
ff
cmp    $0x2f,%eax
je     12d0 <small_unpack+0x100>
lea    -0x440(%rbp),%rdi
lea    0xd35(%rip),%rsi
call   10f0 <strcat@plt>
lea    -0x440(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x38(%rbp),%rax
mov    -0x28(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%edx
call   1090 <strncat@plt>
lea    -0x440(%rbp),%rdi
call   1040 <make_directories@plt>
lea    -0xc40(%rbp),%rax
mov    %rax,-0xc50(%rbp)
mov    -0x28(%rbp),%rdi
mov    $0x2f,%esi
call   1080 <strrchr@plt>
mov    -0xc50(%rbp),%rdi
mov    %rax,%rsi
add    $0x1,%rsi
call   1030 <strcpy@plt>
lea    -0x440(%rbp),%rdi
lea    -0xc40(%rbp),%rsi
mov    $0x1,%edx
call   10d0 <file_exist@plt>
lea    -0x840(%rbp),%rsi
lea    0xcb4(%rip),%rdi
call   1070 <printf@plt>
lea    -0x840(%rbp),%rdi
lea    0xcb4(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
jne    13a4 <small_unpack+0x1d4>
mov    -0x8(%rbp),%rdi
lea    -0x840(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%esi
lea    0xc8d(%rip),%rdx
mov    $0x4,%r8d
xor    %r9d,%r9d
movl   $0x1,(%rsp)
call   10c0 <errors_2p@plt>
jmp    1485 <small_unpack+0x2b5>
movl   $0x1,-0xc44(%rbp)
mov    -0xc44(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jg     147c <small_unpack+0x2ac>
mov    -0x8(%rbp),%rdi
call   10a0 <fgetc@plt>
mov    %eax,-0xc48(%rbp)
mov    0x2c15(%rip),%rcx
cmp    (%rcx),%eax
je     142f <small_unpack+0x25f>
mov    -0xc48(%rbp),%edi
mov    -0x30(%rbp),%rsi
call   10b0 <fputc@plt>
mov    0x2bf7(%rip),%rcx
cmp    (%rcx),%eax
jne    142a <small_unpack+0x25a>
mov    -0x30(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%esi
lea    0xc1f(%rip),%rdx
mov    $0x3,%r8d
xor    %r9d,%r9d
movl   $0x1,(%rsp)
call   10c0 <errors_2p@plt>
jmp    1463 <small_unpack+0x293>
mov    -0x30(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x8(%rbp),%rdi
lea    -0x840(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%esi
lea    0xbf4(%rip),%rdx
mov    $0x2,%r8d
xor    %r9d,%r9d
movl   $0x1,(%rsp)
call   10c0 <errors_2p@plt>
jmp    1468 <small_unpack+0x298>
mov    -0xc44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc44(%rbp)
jmp    13ae <small_unpack+0x1de>
mov    -0x30(%rbp),%rdi
call   1050 <fclose@plt>
lea    -0x840(%rbp),%rsi
lea    0xbbd(%rip),%rdi
call   1070 <printf@plt>
add    $0xc60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<small_unpack>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc28,%rsp
mov    %r8,%r15
mov    %ecx,%ebp
mov    %rdx,0x18(%rsp)
mov    %rsi,%rbx
mov    %rdi,%r12
mov    %r8,%rdi
mov    $0x2f,%esi
call   1080 <strrchr@plt>
mov    %rax,%r13
lea    0x20(%rsp),%r14
mov    %r14,%rdi
mov    %rbx,0x10(%rsp)
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %r14,%rdi
call   1060 <strlen@plt>
cltq
cmpb   $0x2f,-0x1(%rax,%r14,1)
je     1239 <small_unpack+0x69>
lea    0xdd1(%rip),%rsi
lea    0x20(%rsp),%rdi
call   10f0 <strcat@plt>
lea    0x820(%rsp),%rbx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
lea    0x20(%rsp),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x1,%edx
call   10d0 <file_exist@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   10f0 <strcat@plt>
test   %r13,%r13
je     1301 <small_unpack+0x131>
lea    0x420(%rsp),%rbx
mov    %rbx,%rdi
mov    0x10(%rsp),%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1060 <strlen@plt>
cltq
cmpb   $0x2f,-0x1(%rax,%rbx,1)
je     12af <small_unpack+0xdf>
lea    0xd5e(%rip),%rsi
lea    0x420(%rsp),%rdi
call   10f0 <strcat@plt>
sub    %r15d,%r13d
lea    0x420(%rsp),%r14
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r13d,%edx
call   1090 <strncat@plt>
mov    %r14,%rdi
call   1040 <make_directories@plt>
mov    %r15,%rdi
mov    $0x2f,%esi
call   1080 <strrchr@plt>
lea    0x1(%rax),%rsi
lea    0x820(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x1,%edx
call   10d0 <file_exist@plt>
lea    0xcfa(%rip),%rdi
lea    0x20(%rsp),%rbx
mov    %rbx,%rsi
call   1070 <printf@plt>
lea    0xcf9(%rip),%rsi
mov    %rbx,%rdi
call   10e0 <fopen@plt>
test   %rax,%rax
je     13cb <small_unpack+0x1fb>
mov    %rax,%rbx
test   %ebp,%ebp
jle    13c1 <small_unpack+0x1f1>
mov    0x2ca9(%rip),%r14
lea    0xcfc(%rip),%r15
lea    0x20(%rsp),%r13
jmp    137d <small_unpack+0x1ad>
nopl   (%rax)
mov    %rbx,%rdi
call   1050 <fclose@plt>
movl   $0x1,(%rsp)
mov    %r12,%rdi
xor    %esi,%esi
mov    %r15,%rdx
mov    %r13,%rcx
mov    $0x2,%r8d
xor    %r9d,%r9d
call   10c0 <errors_2p@plt>
add    $0xffffffff,%ebp
je     13c1 <small_unpack+0x1f1>
mov    %r12,%rdi
call   10a0 <fgetc@plt>
cmp    (%r14),%eax
je     1350 <small_unpack+0x180>
mov    %eax,%edi
mov    %rbx,%rsi
call   10b0 <fputc@plt>
cmp    (%r14),%eax
jne    1378 <small_unpack+0x1a8>
mov    %rbx,%rdi
call   1050 <fclose@plt>
movl   $0x1,(%rsp)
mov    %r12,%rdi
xor    %esi,%esi
lea    0xc80(%rip),%rdx
mov    0x18(%rsp),%rcx
mov    $0x3,%r8d
jmp    1370 <small_unpack+0x1a0>
mov    %rbx,%rdi
call   1050 <fclose@plt>
jmp    13f1 <small_unpack+0x221>
movl   $0x1,(%rsp)
lea    0xc3e(%rip),%rdx
lea    0x20(%rsp),%rcx
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x4,%r8d
xor    %r9d,%r9d
call   10c0 <errors_2p@plt>
lea    0xc58(%rip),%rdi
lea    0x20(%rsp),%rsi
call   1070 <printf@plt>
add    $0xc28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"/\00"
@.str.1 = [19 x i8] c"Unpacking \22%s\22...\0A\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [29 x i8] c"ERROR creating the directory\00"
@EOF = global i32 0
@.str.4 = [14 x i8] c"ERROR writing\00"
@.str.5 = [14 x i8] c"ERROR reading\00"
@.str.6 = [16 x i8] c"Unpacked \22%s\22\0A\0A\00"
define i32 @small_unpack(i32* %0, i8* %1, i8* %2, i32 %3, i8* %4) {
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32*
%12 = alloca i8*
%13 = alloca [1024 x i8]
%14 = alloca [1024 x i8]
%15 = alloca [1024 x i8]
%16 = alloca i32
%17 = alloca i32
store i32* %0, i32** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i32 %3, i32* %9
store i8* %4, i8** %10
%18 = load i8*, i8** %10
%19 = call i8* @strrchr(i8* %18, i8 signext 47)
store i8* %19, i8** %12
%20 = getelementptr inbounds [1024 x i8], [1024 x i8]* %14, i64 0, i64 0
%21 = load i8*, i8** %7
%22 = call i32 @strcpy(i8* %20, i8* %21)
%23 = getelementptr inbounds [1024 x i8], [1024 x i8]* %14, i64 0, i64 0
%24 = call i32 @strlen(i8* %23)
%25 = sub nsw i32 %24, 1
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [1024 x i8], [1024 x i8]* %14, i64 0, i64 %26
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp ne i32 %29, 47
br i1 %30, label %31, label %34
31: ; preds = %5
%32 = getelementptr inbounds [1024 x i8], [1024 x i8]* %14, i64 0, i64 0
%33 = call i32 @strcat(i8* %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %34
34: ; preds = %31, %5
%35 = getelementptr inbounds [1024 x i8], [1024 x i8]* %15, i64 0, i64 0
%36 = load i8*, i8** %10
%37 = call i32 @strcpy(i8* %35, i8* %36)
%38 = getelementptr inbounds [1024 x i8], [1024 x i8]* %14, i64 0, i64 0
%39 = getelementptr inbounds [1024 x i8], [1024 x i8]* %15, i64 0, i64 0
%40 = call i32 @file_exist(i8* %38, i8* %39, i32 1)
%41 = getelementptr inbounds [1024 x i8], [1024 x i8]* %14, i64 0, i64 0
%42 = getelementptr inbounds [1024 x i8], [1024 x i8]* %15, i64 0, i64 0
%43 = call i32 @strcat(i8* %41, i8* %42)
%44 = load i8*, i8** %12
%45 = icmp ne i8* %44, null
br i1 %45, label %46, label %81
46: ; preds = %34
%47 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%48 = load i8*, i8** %7
%49 = call i32 @strcpy(i8* %47, i8* %48)
%50 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%51 = call i32 @strlen(i8* %50)
%52 = sub nsw i32 %51, 1
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 %53
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = icmp ne i32 %56, 47
br i1 %57, label %58, label %61
58: ; preds = %46
%59 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%60 = call i32 @strcat(i8* %59, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %61
61: ; preds = %58, %46
%62 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%63 = load i8*, i8** %10
%64 = load i8*, i8** %12
%65 = load i8*, i8** %10
%66 = ptrtoint i8* %64 to i64
%67 = ptrtoint i8* %65 to i64
%68 = sub i64 %66, %67
%69 = trunc i64 %68 to i32
%70 = call i32 @strncat(i8* %62, i8* %63, i32 %69)
%71 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%72 = call i32 @make_directories(i8* %71)
%73 = getelementptr inbounds [1024 x i8], [1024 x i8]* %15, i64 0, i64 0
%74 = load i8*, i8** %10
%75 = call i8* @strrchr(i8* %74, i8 signext 47)
%76 = getelementptr inbounds i8, i8* %75, i64 1
%77 = call i32 @strcpy(i8* %73, i8* %76)
%78 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%79 = getelementptr inbounds [1024 x i8], [1024 x i8]* %15, i64 0, i64 0
%80 = call i32 @file_exist(i8* %78, i8* %79, i32 1)
br label %81
81: ; preds = %61, %34
%82 = getelementptr inbounds [1024 x i8], [1024 x i8]* %14, i64 0, i64 0
%83 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %82)
%84 = getelementptr inbounds [1024 x i8], [1024 x i8]* %14, i64 0, i64 0
%85 = call i32* @fopen(i8* %84, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %85, i32** %11
%86 = icmp eq i32* %85, null
br i1 %86, label %87, label %91
87: ; preds = %81
%88 = load i32*, i32** %6
%89 = getelementptr inbounds [1024 x i8], [1024 x i8]* %14, i64 0, i64 0
%90 = call i32 @errors_2p(i32* %88, i32* null, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i8* %89, i32 4, i32 0, i32 1)
br label %127
91: ; preds = %81
store i32 1, i32* %16
br label %92
92: ; preds = %121, %91
%93 = load i32, i32* %16
%94 = load i32, i32* %9
%95 = icmp sle i32 %93, %94
br i1 %95, label %96, label %124
96: ; preds = %92
%97 = load i32*, i32** %6
%98 = call i32 @fgetc(i32* %97)
store i32 %98, i32* %17
%99 = load i32, i32* @EOF
%100 = icmp ne i32 %98, %99
br i1 %100, label %101, label %114
101: ; preds = %96
%102 = load i32, i32* %17
%103 = load i32*, i32** %11
%104 = call i32 @fputc(i32 %102, i32* %103)
%105 = load i32, i32* @EOF
%106 = icmp eq i32 %104, %105
br i1 %106, label %107, label %113
107: ; preds = %101
%108 = load i32*, i32** %11
%109 = call i32 @fclose(i32* %108)
%110 = load i32*, i32** %6
%111 = load i8*, i8** %8
%112 = call i32 @errors_2p(i32* %110, i32* null, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8* %111, i32 3, i32 0, i32 1)
br label %113
113: ; preds = %107, %101
br label %120
114: ; preds = %96
%115 = load i32*, i32** %11
%116 = call i32 @fclose(i32* %115)
%117 = load i32*, i32** %6
%118 = getelementptr inbounds [1024 x i8], [1024 x i8]* %14, i64 0, i64 0
%119 = call i32 @errors_2p(i32* %117, i32* null, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i8* %118, i32 2, i32 0, i32 1)
br label %120
120: ; preds = %114, %113
br label %121
121: ; preds = %120
%122 = load i32, i32* %16
%123 = add nsw i32 %122, 1
store i32 %123, i32* %16
br label %92
124: ; preds = %92
%125 = load i32*, i32** %11
%126 = call i32 @fclose(i32* %125)
br label %127
127: ; preds = %124, %87
%128 = getelementptr inbounds [1024 x i8], [1024 x i8]* %14, i64 0, i64 0
%129 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8* %128)
ret i32 %129
}

LLVM IR (-O2):
@.str = [2 x i8] c"/\00"
@.str.1 = [19 x i8] c"Unpacking \22%s\22...\0A\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [29 x i8] c"ERROR creating the directory\00"
@EOF = global i32 0
@.str.4 = [14 x i8] c"ERROR writing\00"
@.str.5 = [14 x i8] c"ERROR reading\00"
@.str.6 = [16 x i8] c"Unpacked \22%s\22\0A\0A\00"
define i32 @small_unpack(i32* %0, i8* %1, i8* %2, i32 %3, i8* %4) {
%6 = alloca [1024 x i8]
%7 = alloca [1024 x i8]
%8 = alloca [1024 x i8]
%9 = tail call i8* @strrchr(i8* dereferenceable(1) %4, i8 signext 47)
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%12 = call i32 @strcpy(i8* %11, i8* %1)
%13 = call i32 @strlen(i8* %11)
%14 = add nsw i32 %13, -1
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 47
br i1 %18, label %21, label %19
19: ; preds = %5
%20 = call i32 @strcat(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %21
21: ; preds = %19, %5
%22 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%23 = call i32 @strcpy(i8* %22, i8* %4)
%24 = call i32 @file_exist(i8* %11, i8* %22, i32 1)
%25 = call i32 @strcat(i8* %11, i8* %22)
%26 = icmp eq i8* %9, null
br i1 %26, label %48, label %27
27: ; preds = %21
%28 = call i32 @strcpy(i8* %10, i8* %1)
%29 = call i32 @strlen(i8* %10)
%30 = add nsw i32 %29, -1
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 %31
%33 = load i8, i8* %32
%34 = icmp eq i8 %33, 47
br i1 %34, label %37, label %35
35: ; preds = %27
%36 = call i32 @strcat(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %37
37: ; preds = %35, %27
%38 = ptrtoint i8* %9 to i64
%39 = ptrtoint i8* %4 to i64
%40 = sub i64 %38, %39
%41 = trunc i64 %40 to i32
%42 = call i32 @strncat(i8* %10, i8* %4, i32 %41)
%43 = call i32 @make_directories(i8* %10)
%44 = call i8* @strrchr(i8* dereferenceable(1) %4, i8 signext 47)
%45 = getelementptr inbounds i8, i8* %44, i64 1
%46 = call i32 @strcpy(i8* %22, i8* %45)
%47 = call i32 @file_exist(i8* %10, i8* %22, i32 1)
br label %48
48: ; preds = %37, %21
%49 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%50 = call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%51 = icmp eq i32* %50, null
br i1 %51, label %54, label %52
52: ; preds = %48
%53 = icmp slt i32 %3, 1
br i1 %53, label %74, label %56
54: ; preds = %48
%55 = call i32 @errors_2p(i32* %0, i32* null, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i8* %11, i32 4, i32 0, i32 1)
br label %76
56: ; preds = %52, %71
%57 = phi i32 [ %72, %71 ], [ 1, %52 ]
%58 = call i32 @fgetc(i32* %0)
%59 = load i32, i32* @EOF
%60 = icmp eq i32 %58, %59
br i1 %60, label %68, label %61
61: ; preds = %56
%62 = call i32 @fputc(i32 %58, i32* %50)
%63 = load i32, i32* @EOF
%64 = icmp eq i32 %62, %63
br i1 %64, label %65, label %71
65: ; preds = %61
%66 = call i32 @fclose(i32* %50)
%67 = call i32 @errors_2p(i32* %0, i32* null, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8* %2, i32 3, i32 0, i32 1)
br label %71
68: ; preds = %56
%69 = call i32 @fclose(i32* %50)
%70 = call i32 @errors_2p(i32* %0, i32* null, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i8* %11, i32 2, i32 0, i32 1)
br label %71
71: ; preds = %68, %65, %61
%72 = add nuw i32 %57, 1
%73 = icmp eq i32 %57, %3
br i1 %73, label %74, label %56
74: ; preds = %71, %52
%75 = call i32 @fclose(i32* %50)
br label %76
76: ; preds = %74, %54
%77 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8* %11)
ret i32 %77
}