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

/* Variables and functions */
scalar_t__ EEXIST;
int /*<<< orphan*/ LOGGER_log(char *, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ S_IRWXU;
scalar_t__ errno;
int mkdir(char *, int /*<<< orphan*/);
int /*<<< orphan*/ strerror(scalar_t__);
int OLE_open_directory(struct OLE_object *ole, char *directory) {
  int result = 0;
  result = mkdir(directory, S_IRWXU);
  if ((result != 0) && (errno != EEXIST)) {
    LOGGER_log("%s:%d:OLE_open_directory:ERROR: %s",
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/inflex/ripMIME/refs/heads/"
               "master/ripOLE/ole.c",
               1457, strerror(errno));
  } else
    result = 0;
  return result;
}


x86 assembly (clang, -O0):
<OLE_open_directory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2e96(%rip),%rax
mov    (%rax),%esi
call   1030 <mkdir@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11ae <OLE_open_directory+0x7e>
mov    0x2e63(%rip),%rax
mov    (%rax),%rax
mov    0x2e61(%rip),%rcx
cmp    (%rcx),%rax
je     11ae <OLE_open_directory+0x7e>
mov    0x2e49(%rip),%rax
mov    (%rax),%rdi
call   1040 <strerror@plt>
mov    %eax,%ecx
lea    0xe68(%rip),%rdi
lea    0xe84(%rip),%rsi
mov    $0x5b1,%edx
call   1050 <LOGGER_log@plt>
jmp    11b5 <OLE_open_directory+0x85>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OLE_open_directory>:
push   %rbx
mov    %rsi,%rdi
mov    0x2ead(%rip),%rax
mov    (%rax),%esi
call   1030 <mkdir@plt>
mov    %eax,%ebx
xor    %eax,%eax
test   %ebx,%ebx
je     1181 <OLE_open_directory+0x51>
mov    0x2e7f(%rip),%rcx
mov    (%rcx),%rdi
mov    0x2e7d(%rip),%rcx
cmp    (%rcx),%rdi
je     1181 <OLE_open_directory+0x51>
call   1040 <strerror@plt>
lea    0xe94(%rip),%rdi
lea    0xeb0(%rip),%rsi
mov    $0x5b1,%edx
mov    %eax,%ecx
call   1050 <LOGGER_log@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.OLE_object = type { i32 }
@S_IRWXU = global i32 0
@errno = global i64 0
@EEXIST = global i64 0
@.str = [35 x i8] c"%s:%d:OLE_open_directory:ERROR: %s\00"
@.str.1 = [136 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/inflex/ripMIME/refs/heads/master/ripOLE/ole.c\00"
define i32 @OLE_open_directory(%struct.OLE_object* %0, i8* %1) {
%3 = alloca %struct.OLE_object*
%4 = alloca i8*
%5 = alloca i32
store %struct.OLE_object* %0, %struct.OLE_object** %3
store i8* %1, i8** %4
store i32 0, i32* %5
%6 = load i8*, i8** %4
%7 = load i32, i32* @S_IRWXU
%8 = call i32 @mkdir(i8* %6, i32 %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %19
11: ; preds = %2
%12 = load i64, i64* @errno
%13 = load i64, i64* @EEXIST
%14 = icmp ne i64 %12, %13
br i1 %14, label %15, label %19
15: ; preds = %11
%16 = load i64, i64* @errno
%17 = call i32 @strerror(i64 %16)
%18 = call i32 @LOGGER_log(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([136 x i8], [136 x i8]* @.str.1, i64 0, i64 0), i32 1457, i32 %17)
br label %20
19: ; preds = %11, %2
store i32 0, i32* %5
br label %20
20: ; preds = %19, %15
%21 = load i32, i32* %5
ret i32 %21
}

LLVM IR (-O2):
%struct.OLE_object = type { i32 }
@S_IRWXU = global i32 0
@errno = global i64 0
@EEXIST = global i64 0
@.str = [35 x i8] c"%s:%d:OLE_open_directory:ERROR: %s\00"
@.str.1 = [136 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/inflex/ripMIME/refs/heads/master/ripOLE/ole.c\00"
define i32 @OLE_open_directory(%struct.OLE_object* nocapture readnone %0, i8* nocapture %1) {
%3 = load i32, i32* @S_IRWXU
%4 = tail call i32 @mkdir(i8* %1, i32 %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %13, label %6
6: ; preds = %2
%7 = load i64, i64* @errno
%8 = load i64, i64* @EEXIST
%9 = icmp eq i64 %7, %8
br i1 %9, label %13, label %10
10: ; preds = %6
%11 = tail call i32 @strerror(i64 %7)
%12 = tail call i32 @LOGGER_log(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([136 x i8], [136 x i8]* @.str.1, i64 0, i64 0), i32 1457, i32 %11)
br label %13
13: ; preds = %2, %6, %10
%14 = phi i32 [ %4, %10 ], [ 0, %6 ], [ 0, %2 ]
ret i32 %14
}