#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 */
int /*<<< orphan*/ __raise__(int /*<<< orphan*/ *, char *, int);
scalar_t__ _big_file_mkdir(char *);
char *_path_join(char const *, char *);
char *_strdup(char const *);
int /*<<< orphan*/ free(char *);
scalar_t__ strlen(char *);
int _big_file_mksubdir_r(const char *pathname, const char *subdir) {
  char *subdirname = _strdup(subdir);
  char *p;
  char *mydirname;
  for (p = subdirname; *p; p++) {
    if (*p != '/')
      continue;
    *p = 0;
    mydirname = _path_join(pathname, subdirname);
    if (strlen(mydirname) != 0) {
      {
        if (0 != _big_file_mkdir(mydirname)) {
          __raise__(NULL,
                    "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                    "outputs/2022-01-22/02-19-57/repos/rainwoodman/fastPM/refs/"
                    "heads/master/depends/bigfile/bigfile.c",
                    1984);
          goto ex_mkdir;
        };
      };
    }
    free(mydirname);
    *p = '/';
  }
  mydirname = _path_join(pathname, subdirname);
  {
    if (0 != _big_file_mkdir(mydirname)) {
      __raise__(NULL,
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/rainwoodman/fastPM/refs/"
                "heads/master/depends/bigfile/bigfile.c",
                1991);
      goto ex_mkdir;
    };
  };
  free(subdirname);
  free(mydirname);
  return 0;
ex_mkdir:
  free(subdirname);
  free(mydirname);
  return -1;
}


x86 assembly (clang, -O0):
<_big_file_mksubdir_r>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1080 <_strdup@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmpb   $0x0,(%rax)
je     1229 <_big_file_mksubdir_r+0xc9>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
je     11a7 <_big_file_mksubdir_r+0x47>
jmp    1218 <_big_file_mksubdir_r+0xb8>
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <_path_join@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x0,%rax
je     1208 <_big_file_mksubdir_r+0xa8>
mov    -0x30(%rbp),%rdi
call   1070 <_big_file_mkdir@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     1203 <_big_file_mksubdir_r+0xa3>
xor    %eax,%eax
mov    %eax,%edi
lea    0xe0c(%rip),%rsi
mov    $0x7c0,%edx
call   1060 <__raise__@plt>
jmp    1289 <_big_file_mksubdir_r+0x129>
jmp    1208 <_big_file_mksubdir_r+0xa8>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rax
movb   $0x2f,(%rax)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1185 <_big_file_mksubdir_r+0x25>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <_path_join@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
call   1070 <_big_file_mkdir@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     126b <_big_file_mksubdir_r+0x10b>
xor    %eax,%eax
mov    %eax,%edi
lea    0xda4(%rip),%rsi
mov    $0x7c7,%edx
call   1060 <__raise__@plt>
jmp    1289 <_big_file_mksubdir_r+0x129>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
jmp    12a2 <_big_file_mksubdir_r+0x142>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_big_file_mksubdir_r>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r15
mov    %rsi,%rdi
call   1070 <_strdup@plt>
mov    %rax,%r14
mov    %rax,%rbp
jmp    1178 <_big_file_mksubdir_r+0x28>
nopw   0x0(%rax,%rax,1)
test   %al,%al
je     11b2 <_big_file_mksubdir_r+0x62>
add    $0x1,%rbp
movzbl 0x0(%rbp),%eax
cmp    $0x2f,%al
jne    1170 <_big_file_mksubdir_r+0x20>
movb   $0x0,0x0(%rbp)
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <_path_join@plt>
mov    %rax,%rbx
cmpb   $0x0,(%rax)
je     11a4 <_big_file_mksubdir_r+0x54>
mov    %rbx,%rdi
call   1060 <_big_file_mkdir@plt>
test   %rax,%rax
jne    11d6 <_big_file_mksubdir_r+0x86>
mov    %rbx,%rdi
call   1030 <free@plt>
movb   $0x2f,0x0(%rbp)
jmp    1174 <_big_file_mksubdir_r+0x24>
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <_path_join@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <_big_file_mkdir@plt>
mov    $0x7c7,%edx
test   %rax,%rax
jne    11db <_big_file_mksubdir_r+0x8b>
xor    %ebp,%ebp
jmp    11ee <_big_file_mksubdir_r+0x9e>
mov    $0x7c0,%edx
lea    0xe1e(%rip),%rsi
xor    %edi,%edi
call   1050 <__raise__@plt>
mov    $0xffffffff,%ebp
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [153 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/rainwoodman/fastPM/refs/heads/master/depends/bigfile/bigfile.c\00"
define i32 @_big_file_mksubdir_r(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%9 = load i8*, i8** %5
%10 = call i8* @_strdup(i8* %9)
store i8* %10, i8** %6
%11 = load i8*, i8** %6
store i8* %11, i8** %7
br label %12
12: ; preds = %41, %2
%13 = load i8*, i8** %7
%14 = load i8, i8* %13
%15 = icmp ne i8 %14, 0
br i1 %15, label %16, label %44
16: ; preds = %12
%17 = load i8*, i8** %7
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %19, 47
br i1 %20, label %21, label %22
21: ; preds = %16
br label %41
22: ; preds = %16
%23 = load i8*, i8** %7
store i8 0, i8* %23
%24 = load i8*, i8** %4
%25 = load i8*, i8** %6
%26 = call i8* @_path_join(i8* %24, i8* %25)
store i8* %26, i8** %8
%27 = load i8*, i8** %8
%28 = call i64 @strlen(i8* %27)
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %37
30: ; preds = %22
%31 = load i8*, i8** %8
%32 = call i64 @_big_file_mkdir(i8* %31)
%33 = icmp ne i64 0, %32
br i1 %33, label %34, label %36
34: ; preds = %30
%35 = call i32 @__raise__(i32* null, i8* getelementptr inbounds ([153 x i8], [153 x i8]* @.str, i64 0, i64 0), i32 1984)
br label %58
36: ; preds = %30
br label %37
37: ; preds = %36, %22
%38 = load i8*, i8** %8
%39 = call i32 @free(i8* %38)
%40 = load i8*, i8** %7
store i8 47, i8* %40
br label %41
41: ; preds = %37, %21
%42 = load i8*, i8** %7
%43 = getelementptr inbounds i8, i8* %42, i32 1
store i8* %43, i8** %7
br label %12
44: ; preds = %12
%45 = load i8*, i8** %4
%46 = load i8*, i8** %6
%47 = call i8* @_path_join(i8* %45, i8* %46)
store i8* %47, i8** %8
%48 = load i8*, i8** %8
%49 = call i64 @_big_file_mkdir(i8* %48)
%50 = icmp ne i64 0, %49
br i1 %50, label %51, label %53
51: ; preds = %44
%52 = call i32 @__raise__(i32* null, i8* getelementptr inbounds ([153 x i8], [153 x i8]* @.str, i64 0, i64 0), i32 1991)
br label %58
53: ; preds = %44
%54 = load i8*, i8** %6
%55 = call i32 @free(i8* %54)
%56 = load i8*, i8** %8
%57 = call i32 @free(i8* %56)
store i32 0, i32* %3
br label %63
58: ; preds = %51, %34
%59 = load i8*, i8** %6
%60 = call i32 @free(i8* %59)
%61 = load i8*, i8** %8
%62 = call i32 @free(i8* %61)
store i32 -1, i32* %3
br label %63
63: ; preds = %58, %53
%64 = load i32, i32* %3
ret i32 %64
}

LLVM IR (-O2):
@.str = [153 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/rainwoodman/fastPM/refs/heads/master/depends/bigfile/bigfile.c\00"
define i32 @_big_file_mksubdir_r(i8* %0, i8* %1) {
%3 = tail call i8* @_strdup(i8* %1)
br label %4
4: ; preds = %16, %2
%5 = phi i8* [ %3, %2 ], [ %17, %16 ]
%6 = load i8, i8* %5
switch i8 %6, label %16 [
i8 0, label %18
i8 47, label %7
]
7: ; preds = %4
store i8 0, i8* %5
%8 = tail call i8* @_path_join(i8* %0, i8* %3)
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %7
%12 = tail call i64 @_big_file_mkdir(i8* %8)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %22
14: ; preds = %11, %7
%15 = tail call i32 @free(i8* %8)
store i8 47, i8* %5
br label %16
16: ; preds = %4, %14
%17 = getelementptr inbounds i8, i8* %5, i64 1
br label %4
18: ; preds = %4
%19 = tail call i8* @_path_join(i8* %0, i8* %3)
%20 = tail call i64 @_big_file_mkdir(i8* %19)
%21 = icmp eq i64 %20, 0
br i1 %21, label %26, label %22
22: ; preds = %11, %18
%23 = phi i32 [ 1991, %18 ], [ 1984, %11 ]
%24 = phi i8* [ %19, %18 ], [ %8, %11 ]
%25 = tail call i32 @__raise__(i32* null, i8* getelementptr inbounds ([153 x i8], [153 x i8]* @.str, i64 0, i64 0), i32 %23)
br label %26
26: ; preds = %18, %22
%27 = phi i8* [ %24, %22 ], [ %19, %18 ]
%28 = phi i32 [ -1, %22 ], [ 0, %18 ]
%29 = tail call i32 @free(i8* %3)
%30 = tail call i32 @free(i8* %27)
ret i32 %28
}