#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 */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int mkdir(char *, int);
int stat(char *, struct stat *);
int /*<<< orphan*/ stderr;
int create_LogDir(char DirName[]) {
  struct stat dir_attrib;
  if (stat(DirName, &dir_attrib) == -1) {
    if (mkdir(DirName, 0777) == -1) {
      fprintf(stderr, "%s konnte nicht angelegt werden!\n", DirName);
      return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<create_LogDir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <stat@plt>
cmp    $0xffffffff,%eax
jne    1193 <create_LogDir+0x63>
mov    -0x10(%rbp),%rdi
mov    $0x1ff,%esi
call   1030 <mkdir@plt>
cmp    $0xffffffff,%eax
jne    118e <create_LogDir+0x5e>
mov    0x2e70(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe83(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    119a <create_LogDir+0x6a>
jmp    1193 <create_LogDir+0x63>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_LogDir>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    %rsp,%rsi
call   1050 <stat@plt>
mov    $0x1,%ebp
cmp    $0xffffffff,%eax
jne    1174 <create_LogDir+0x44>
mov    %rbx,%rdi
mov    $0x1ff,%esi
call   1030 <mkdir@plt>
cmp    $0xffffffff,%eax
jne    1174 <create_LogDir+0x44>
mov    0x2e7f(%rip),%rax
mov    (%rax),%edi
lea    0xe96(%rip),%rsi
mov    %rbx,%rdx
call   1040 <fprintf@plt>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@stderr = global i32 0
@.str = [34 x i8] c"%s konnte nicht angelegt werden!\0A\00"
define i32 @create_LogDir(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.stat
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @stat(i8* %5, %struct.stat* %4)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %17
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i32 @mkdir(i8* %9, i32 511)
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %16
12: ; preds = %8
%13 = load i32, i32* @stderr
%14 = load i8*, i8** %3
%15 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %14)
store i32 0, i32* %2
br label %18
16: ; preds = %8
br label %17
17: ; preds = %16, %1
store i32 1, i32* %2
br label %18
18: ; preds = %17, %12
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@stderr = global i32 0
@.str = [34 x i8] c"%s konnte nicht angelegt werden!\0A\00"
define i32 @create_LogDir(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i32 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = tail call i32 @mkdir(i8* %0, i32 511)
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = load i32, i32* @stderr
%11 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %12
12: ; preds = %1, %6, %9
%13 = phi i32 [ 0, %9 ], [ 1, %6 ], [ 1, %1 ]
ret i32 %13
}