#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*/ O_RDONLY;
int /*<<< orphan*/ exit(int);
int mkdir(char *, int);
int open(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, ...);
void infc_files_dir(char *dirname, char *prog) {
  int cd, mk;
  if ((cd = open(dirname, O_RDONLY, 0)) == -1)
    if ((mk = mkdir(dirname, 0755)) != 0) {
      printf("%s: Unable to create quarantine folder: %s\n", prog,
             "SCQuarantine");
      printf(
          "%s: Please create one manually in your home directory. Thank you.\n",
          prog);
      exit(1);
    }
}


x86 assembly (clang, -O0):
<infc_files_dir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e8d(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1050 <open@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
jne    11c4 <infc_files_dir+0x84>
mov    -0x8(%rbp),%rdi
mov    $0x1ed,%esi
call   1030 <mkdir@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
je     11bf <infc_files_dir+0x7f>
mov    -0x10(%rbp),%rsi
lea    0xe6b(%rip),%rdi
lea    0xe90(%rip),%rdx
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
jmp    11c4 <infc_files_dir+0x84>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<infc_files_dir>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    0x2e97(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1050 <open@plt>
cmp    $0xffffffff,%eax
jne    1170 <infc_files_dir+0x30>
mov    %rbx,%rdi
mov    $0x1ed,%esi
call   1030 <mkdir@plt>
test   %eax,%eax
jne    1178 <infc_files_dir+0x38>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe81(%rip),%rdi
lea    0xea6(%rip),%rdx
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea2(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@O_RDONLY = global i32 0
@.str = [44 x i8] c"%s: Unable to create quarantine folder: %s\0A\00"
@.str.1 = [13 x i8] c"SCQuarantine\00"
@.str.2 = [67 x i8] c"%s: Please create one manually in your home directory. Thank you.\0A\00"
define void @infc_files_dir(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = load i32, i32* @O_RDONLY
%9 = call i32 @open(i8* %7, i32 %8, i32 0)
store i32 %9, i32* %5
%10 = icmp eq i32 %9, -1
br i1 %10, label %11, label %22
11: ; preds = %2
%12 = load i8*, i8** %3
%13 = call i32 @mkdir(i8* %12, i32 493)
store i32 %13, i32* %6
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %21
15: ; preds = %11
%16 = load i8*, i8** %4
%17 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %16, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%18 = load i8*, i8** %4
%19 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.2, i64 0, i64 0), i8* %18)
%20 = call i32 @exit(i32 1)
unreachable
21: ; preds = %11
br label %22
22: ; preds = %21, %2
ret void
}

LLVM IR (-O2):
@O_RDONLY = global i32 0
@.str = [44 x i8] c"%s: Unable to create quarantine folder: %s\0A\00"
@.str.1 = [13 x i8] c"SCQuarantine\00"
@.str.2 = [67 x i8] c"%s: Please create one manually in your home directory. Thank you.\0A\00"
define void @infc_files_dir(i8* nocapture %0, i8* %1) {
%3 = load i32, i32* @O_RDONLY
%4 = tail call i32 @open(i8* %0, i32 %3, i32 0)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %13
6: ; preds = %2
%7 = tail call i32 @mkdir(i8* %0, i32 493)
%8 = icmp eq i32 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %6
%10 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%11 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.2, i64 0, i64 0), i8* %1)
%12 = tail call i32 @exit(i32 1)
unreachable
13: ; preds = %6, %2
ret void
}