#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 directory {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ EEXIST;
scalar_t__ errno;
int /*<<< orphan*/ extract_dir(int /*<<< orphan*/ *, struct directory *,
                               char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ mkdir(char *, int);
int /*<<< orphan*/ stderr;
void extract_all(FILE *infile, struct directory *root_directory,
                 char *outputdir) {
  if (mkdir(outputdir, 0777) != 0) {
    if (errno != EEXIST) {
      fprintf(stderr,
              "Error: Output directory does not exist, cannot continue\n");
      return;
    }
  }
  extract_dir(infile, root_directory, outputdir);
}


x86 assembly (clang, -O0):
<extract_all>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x1ff,%esi
call   1030 <mkdir@plt>
cmp    $0x0,%rax
je     1195 <extract_all+0x65>
mov    0x2e6d(%rip),%rax
mov    (%rax),%rax
mov    0x2e73(%rip),%rcx
cmp    (%rcx),%rax
je     1190 <extract_all+0x60>
mov    0x2e5b(%rip),%rax
mov    (%rax),%edi
lea    0xe7a(%rip),%rsi
call   1040 <fprintf@plt>
jmp    11a6 <extract_all+0x76>
jmp    1195 <extract_all+0x65>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1050 <extract_dir@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract_all>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rdx,%rdi
mov    $0x1ff,%esi
call   1030 <mkdir@plt>
test   %rax,%rax
je     1166 <extract_all+0x36>
mov    0x2e79(%rip),%rax
mov    (%rax),%rax
mov    0x2e7f(%rip),%rcx
cmp    (%rcx),%rax
jne    1179 <extract_all+0x49>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
pop    %rbx
pop    %r14
pop    %r15
jmp    1050 <extract_dir@plt>
mov    0x2e58(%rip),%rax
mov    (%rax),%edi
lea    0xe77(%rip),%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <fprintf@plt>

LLVM IR (-O0):
%struct.directory = type { i32 }
@errno = global i64 0
@EEXIST = global i64 0
@stderr = global i32 0
@.str = [57 x i8] c"Error: Output directory does not exist, cannot continue\0A\00"
define void @extract_all(i32* %0, %struct.directory* %1, i8* %2) {
%4 = alloca i32*
%5 = alloca %struct.directory*
%6 = alloca i8*
store i32* %0, i32** %4
store %struct.directory* %1, %struct.directory** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %6
%8 = call i64 @mkdir(i8* %7, i32 511)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %18
10: ; preds = %3
%11 = load i64, i64* @errno
%12 = load i64, i64* @EEXIST
%13 = icmp ne i64 %11, %12
br i1 %13, label %14, label %17
14: ; preds = %10
%15 = load i32, i32* @stderr
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
br label %23
17: ; preds = %10
br label %18
18: ; preds = %17, %3
%19 = load i32*, i32** %4
%20 = load %struct.directory*, %struct.directory** %5
%21 = load i8*, i8** %6
%22 = call i32 @extract_dir(i32* %19, %struct.directory* %20, i8* %21)
br label %23
23: ; preds = %18, %14
ret void
}

LLVM IR (-O2):
%struct.directory = type { i32 }
@errno = global i64 0
@EEXIST = global i64 0
@stderr = global i32 0
@.str = [57 x i8] c"Error: Output directory does not exist, cannot continue\0A\00"
define void @extract_all(i32* %0, %struct.directory* %1, i8* %2) {
%4 = tail call i64 @mkdir(i8* %2, i32 511)
%5 = icmp eq i64 %4, 0
br i1 %5, label %13, label %6
6: ; preds = %3
%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 = load i32, i32* @stderr
%12 = tail call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
br label %15
13: ; preds = %6, %3
%14 = tail call i32 @extract_dir(i32* %0, %struct.directory* %1, i8* %2)
br label %15
15: ; preds = %13, %10
ret void
}