#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 */
scalar_t__ EEXIST;
scalar_t__ errno;
scalar_t__ mkdir(char *, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
void dump_mkdir(char *dname) {
  if (mkdir(dname, 0755)) {
    if (errno != EEXIST) {
      char errmsg[256];
      snprintf(errmsg, 256, "WARNING: Unable to create directory: %s", dname);
      perror(errmsg);
    }
  }
}


x86 assembly (clang, -O0):
<dump_mkdir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x1ed,%esi
call   1030 <mkdir@plt>
cmp    $0x0,%rax
je     119e <dump_mkdir+0x6e>
mov    0x2e7a(%rip),%rax
mov    (%rax),%rax
mov    0x2e78(%rip),%rcx
cmp    (%rcx),%rax
je     1199 <dump_mkdir+0x69>
lea    -0x110(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x100,%esi
lea    0xe78(%rip),%rdx
call   1040 <snprintf@plt>
lea    -0x110(%rbp),%rdi
call   1050 <perror@plt>
jmp    119e <dump_mkdir+0x6e>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_mkdir>:
push   %r14
push   %rbx
sub    $0x108,%rsp
mov    %rdi,%rbx
mov    $0x1ed,%esi
call   1030 <mkdir@plt>
test   %rax,%rax
je     1162 <dump_mkdir+0x32>
mov    0x2e85(%rip),%rax
mov    (%rax),%rax
mov    0x2e83(%rip),%rcx
cmp    (%rcx),%rax
jne    116d <dump_mkdir+0x3d>
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe8c(%rip),%rdx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x100,%esi
mov    %rbx,%rcx
call   1040 <snprintf@plt>
mov    %r14,%rdi
call   1050 <perror@plt>
jmp    1162 <dump_mkdir+0x32>

LLVM IR (-O0):
@errno = global i64 0
@EEXIST = global i64 0
@.str = [40 x i8] c"WARNING: Unable to create directory: %s\00"
define void @dump_mkdir(i8* %0) {
%2 = alloca i8*
%3 = alloca [256 x i8]
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @mkdir(i8* %4, i32 493)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %18
7: ; preds = %1
%8 = load i64, i64* @errno
%9 = load i64, i64* @EEXIST
%10 = icmp ne i64 %8, %9
br i1 %10, label %11, label %17
11: ; preds = %7
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%13 = load i8*, i8** %2
%14 = call i32 @snprintf(i8* %12, i32 256, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%16 = call i32 @perror(i8* %15)
br label %17
17: ; preds = %11, %7
br label %18
18: ; preds = %17, %1
ret void
}

LLVM IR (-O2):
@errno = global i64 0
@EEXIST = global i64 0
@.str = [40 x i8] c"WARNING: Unable to create directory: %s\00"
define void @dump_mkdir(i8* %0) {
%2 = alloca [256 x i8]
%3 = tail call i64 @mkdir(i8* %0, i32 493)
%4 = icmp eq i64 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %1
%6 = load i64, i64* @errno
%7 = load i64, i64* @EEXIST
%8 = icmp eq i64 %6, %7
br i1 %8, label %13, label %9
9: ; preds = %5
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%11 = call i32 @snprintf(i8* %10, i32 256, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %0)
%12 = call i32 @perror(i8* %10)
br label %13
13: ; preds = %5, %9, %1
ret void
}