#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*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int mkdir(char *, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *);
int main(void) {
  if (mkdir("mkdir-example.temp", 0700) == -1) {
    printf("Failed to create %s\n", "mkdir-example.temp");
    perror("mkdir");
    exit(EXIT_FAILURE);
  } else
    printf("Created directory: %s\n", "mkdir-example.temp");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xeb5(%rip),%rdi
mov    $0x1c0,%esi
call   1030 <mkdir@plt>
cmp    $0xffffffff,%eax
jne    118b <main+0x4b>
lea    0xeae(%rip),%rdi
lea    0xe94(%rip),%rsi
call   1040 <printf@plt>
lea    0xeb0(%rip),%rdi
call   1050 <perror@plt>
mov    0x2e5c(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
lea    0xe9c(%rip),%rdi
lea    0xe67(%rip),%rsi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeb8(%rip),%rdi
mov    $0x1c0,%esi
call   1030 <mkdir@plt>
cmp    $0xffffffff,%eax
je     116e <main+0x2e>
lea    0xed0(%rip),%rdi
lea    0xe9b(%rip),%rsi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0xe9e(%rip),%rdi
lea    0xe84(%rip),%rsi
call   1040 <printf@plt>
lea    0xea0(%rip),%rdi
call   1050 <perror@plt>
mov    0x2e4c(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"mkdir-example.temp\00"
@.str.1 = [21 x i8] c"Failed to create %s\0A\00"
@.str.2 = [6 x i8] c"mkdir\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [23 x i8] c"Created directory: %s\0A\00"
define i32 @main() {
%1 = call i32 @mkdir(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 448)
%2 = icmp eq i32 %1, -1
br i1 %2, label %3, label %8
3: ; preds = %0
%4 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%6 = load i32, i32* @EXIT_FAILURE
%7 = call i32 @exit(i32 %6)
unreachable
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"mkdir-example.temp\00"
@.str.1 = [21 x i8] c"Failed to create %s\0A\00"
@.str.2 = [6 x i8] c"mkdir\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [23 x i8] c"Created directory: %s\0A\00"
define i32 @main() {
%1 = tail call i32 @mkdir(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 448)
%2 = icmp eq i32 %1, -1
br i1 %2, label %3, label %8
3: ; preds = %0
%4 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @exit(i32 %6)
unreachable
8: ; preds = %0
%9 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
ret i32 0
}