#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 */
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ mkdir(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ write_error_with_error_number_var(char *, char const *,
                                                     int /*<<< orphan*/);
unsigned char make_dir(const char *dir_name, mode_t mode) {
  if (mkdir(dir_name, mode)) {
    write_error_with_error_number_var("Could not create folder %s with mode "
                                      "%d. Missing permissions? Exiting.",
                                      dir_name, mode);
    exit(EXIT_FAILURE);
  }
  return 1;
}


x86 assembly (clang, -O0):
<make_dir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <mkdir@plt>
cmp    $0x0,%rax
je     1176 <make_dir+0x46>
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
lea    0xe9d(%rip),%rdi
call   1030 <write_error_with_error_number_var@plt>
mov    0x2e71(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_dir>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
call   1040 <mkdir@plt>
test   %rax,%rax
jne    114b <make_dir+0x1b>
mov    $0x1,%al
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xeae(%rip),%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1030 <write_error_with_error_number_var@plt>
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [71 x i8] c"Could not create folder %s with mode %d. Missing permissions? Exiting.\00"
@EXIT_FAILURE = global i32 0
define zeroext i8 @make_dir(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = call i64 @mkdir(i8* %5, i32 %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %15
9: ; preds = %2
%10 = load i8*, i8** %3
%11 = load i32, i32* %4
%12 = call i32 @write_error_with_error_number_var(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0), i8* %10, i32 %11)
%13 = load i32, i32* @EXIT_FAILURE
%14 = call i32 @exit(i32 %13)
unreachable
15: ; preds = %2
ret i8 1
}

LLVM IR (-O2):
@.str = [71 x i8] c"Could not create folder %s with mode %d. Missing permissions? Exiting.\00"
@EXIT_FAILURE = global i32 0
define zeroext i8 @make_dir(i8* %0, i32 %1) {
%3 = tail call i64 @mkdir(i8* %0, i32 %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = tail call i32 @write_error_with_error_number_var(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1)
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %2
ret i8 1
}