#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 {
  int dummy;
};

/* Variables and functions */
scalar_t__ EEXIST;
int S_IROTH;
int S_IRWXG;
int S_IRWXU;
int S_IXOTH;
int /*<<< orphan*/ _big_file_raise(char *, char *, int, char const *,
                                   int /*<<< orphan*/);
scalar_t__ errno;
int mkdir(char const *, int);
scalar_t__ stat(char const *, struct stat *);
int /*<<< orphan*/ strerror(scalar_t__);
int /*<<< orphan*/ utimes(char const *, int /*<<< orphan*/ *);
int _big_file_mkdir(const char *dirname) {
  struct stat buf;
  int mkdirret;
  mkdirret = mkdir(dirname, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
  {
    if ((mkdirret != 0 && errno != EEXIST && stat(dirname, &buf))) {
      _big_file_raise("Failed to create directory structure at `%s' (%s)",
                      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                      "outputs/2022-01-22/02-19-57/repos/rainwoodman/bigfile/"
                      "refs/heads/master/src/bigfile.c",
                      1956, dirname, strerror(errno));
      goto ex_mkdir;
    };
  };
  utimes(dirname, NULL);
  return 0;
ex_mkdir:
  return -1;
}


x86 assembly (clang, -O0):
<_big_file_mkdir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2e81(%rip),%rax
mov    (%rax),%esi
mov    0x2e68(%rip),%rax
or     (%rax),%esi
mov    0x2e3f(%rip),%rax
or     (%rax),%esi
mov    0x2e5e(%rip),%rax
or     (%rax),%esi
call   1030 <mkdir@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     1202 <_big_file_mkdir+0xb2>
mov    0x2e23(%rip),%rax
mov    (%rax),%rax
mov    0x2e21(%rip),%rcx
cmp    (%rcx),%rax
je     1202 <_big_file_mkdir+0xb2>
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <stat@plt>
cmp    $0x0,%rax
je     1202 <_big_file_mkdir+0xb2>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    0x2dea(%rip),%rax
mov    (%rax),%rdi
call   1070 <strerror@plt>
mov    -0x28(%rbp),%rcx
mov    %eax,%r8d
lea    0xe14(%rip),%rdi
lea    0xe3f(%rip),%rsi
mov    $0x7a4,%edx
call   1060 <_big_file_raise@plt>
jmp    121b <_big_file_mkdir+0xcb>
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <utimes@plt>
movl   $0x0,-0x4(%rbp)
jmp    1222 <_big_file_mkdir+0xd2>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_big_file_mkdir>:
push   %r14
push   %rbx
push   %rax
mov    0x2e8d(%rip),%rax
mov    0x2e76(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2e4b(%rip),%rax
or     (%rax),%esi
mov    %rdi,%r14
mov    0x2e67(%rip),%rax
or     (%rax),%esi
call   1030 <mkdir@plt>
test   %eax,%eax
je     11d7 <_big_file_mkdir+0x87>
mov    0x2e35(%rip),%rbx
mov    (%rbx),%rax
mov    0x2e33(%rip),%rcx
cmp    (%rcx),%rax
je     11d7 <_big_file_mkdir+0x87>
mov    %rsp,%rsi
mov    %r14,%rdi
call   1050 <stat@plt>
test   %rax,%rax
je     11d7 <_big_file_mkdir+0x87>
mov    (%rbx),%rdi
call   1070 <strerror@plt>
lea    0xe47(%rip),%rdi
lea    0xe72(%rip),%rsi
mov    $0x7a4,%edx
mov    %r14,%rcx
mov    %eax,%r8d
call   1060 <_big_file_raise@plt>
mov    $0xffffffff,%ebx
jmp    11e3 <_big_file_mkdir+0x93>
xor    %ebx,%ebx
mov    %r14,%rdi
xor    %esi,%esi
call   1040 <utimes@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@S_IRWXU = global i32 0
@S_IRWXG = global i32 0
@S_IROTH = global i32 0
@S_IXOTH = global i32 0
@errno = global i64 0
@EEXIST = global i64 0
@.str = [50 x i8] c"Failed to create directory structure at `%s' (%s)\00"
@.str.1 = [142 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/rainwoodman/bigfile/refs/heads/master/src/bigfile.c\00"
define i32 @_big_file_mkdir(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.stat
%5 = alloca i32
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = load i32, i32* @S_IRWXU
%8 = load i32, i32* @S_IRWXG
%9 = or i32 %7, %8
%10 = load i32, i32* @S_IROTH
%11 = or i32 %9, %10
%12 = load i32, i32* @S_IXOTH
%13 = or i32 %11, %12
%14 = call i32 @mkdir(i8* %6, i32 %13)
store i32 %14, i32* %5
%15 = load i32, i32* %5
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %30
17: ; preds = %1
%18 = load i64, i64* @errno
%19 = load i64, i64* @EEXIST
%20 = icmp ne i64 %18, %19
br i1 %20, label %21, label %30
21: ; preds = %17
%22 = load i8*, i8** %3
%23 = call i64 @stat(i8* %22, %struct.stat* %4)
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %30
25: ; preds = %21
%26 = load i8*, i8** %3
%27 = load i64, i64* @errno
%28 = call i32 @strerror(i64 %27)
%29 = call i32 @_big_file_raise(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str.1, i64 0, i64 0), i32 1956, i8* %26, i32 %28)
br label %33
30: ; preds = %21, %17, %1
%31 = load i8*, i8** %3
%32 = call i32 @utimes(i8* %31, i32* null)
store i32 0, i32* %2
br label %34
33: ; preds = %25
store i32 -1, i32* %2
br label %34
34: ; preds = %33, %30
%35 = load i32, i32* %2
ret i32 %35
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@S_IRWXU = global i32 0
@S_IRWXG = global i32 0
@S_IROTH = global i32 0
@S_IXOTH = global i32 0
@errno = global i64 0
@EEXIST = global i64 0
@.str = [50 x i8] c"Failed to create directory structure at `%s' (%s)\00"
@.str.1 = [142 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/rainwoodman/bigfile/refs/heads/master/src/bigfile.c\00"
define i32 @_big_file_mkdir(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = load i32, i32* @S_IRWXU
%5 = load i32, i32* @S_IRWXG
%6 = or i32 %5, %4
%7 = load i32, i32* @S_IROTH
%8 = or i32 %6, %7
%9 = load i32, i32* @S_IXOTH
%10 = or i32 %8, %9
%11 = tail call i32 @mkdir(i8* %0, i32 %10)
%12 = icmp eq i32 %11, 0
br i1 %12, label %24, label %13
13: ; preds = %1
%14 = load i64, i64* @errno
%15 = load i64, i64* @EEXIST
%16 = icmp eq i64 %14, %15
br i1 %16, label %24, label %17
17: ; preds = %13
%18 = call i64 @stat(i8* %0, %struct.stat* %2)
%19 = icmp eq i64 %18, 0
br i1 %19, label %24, label %20
20: ; preds = %17
%21 = load i64, i64* @errno
%22 = call i32 @strerror(i64 %21)
%23 = call i32 @_big_file_raise(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str.1, i64 0, i64 0), i32 1956, i8* %0, i32 %22)
br label %26
24: ; preds = %17, %13, %1
%25 = call i32 @utimes(i8* %0, i32* null)
br label %26
26: ; preds = %20, %24
%27 = phi i32 [ -1, %20 ], [ 0, %24 ]
ret i32 %27
}