#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 S_IRWXG;
int S_IRWXO;
int S_IRWXU;
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ errno;
scalar_t__ mkdir(char *, int);
int /*<<< orphan*/ send_errno(int /*<<< orphan*/);
int /*<<< orphan*/ send_success();
void do_mkdir(int argc, char **argv) {
  assert(argc == 1);
  if (mkdir(argv[0], S_IRWXU | S_IRWXG | S_IRWXO) == 0) {
    send_success();
  } else {
    send_errno(errno);
  }
}


x86 assembly (clang, -O0):
<do_mkdir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    0x2e72(%rip),%rax
mov    (%rax),%esi
mov    0x2e61(%rip),%rax
or     (%rax),%esi
mov    0x2e70(%rip),%rax
or     (%rax),%esi
call   1030 <mkdir@plt>
cmp    $0x0,%rax
jne    119d <do_mkdir+0x5d>
mov    $0x0,%al
call   1050 <send_success@plt>
jmp    11ab <do_mkdir+0x6b>
mov    0x2e24(%rip),%rax
mov    (%rax),%edi
call   1060 <send_errno@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_mkdir>:
push   %rbx
mov    %rsi,%rbx
xor    %eax,%eax
cmp    $0x1,%edi
sete   %al
mov    %eax,%edi
call   1040 <assert@plt>
mov    0x2e86(%rip),%rax
mov    0x2e77(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    (%rbx),%rdi
mov    0x2e81(%rip),%rax
or     (%rax),%esi
call   1030 <mkdir@plt>
test   %rax,%rax
je     118a <do_mkdir+0x4a>
mov    0x2e46(%rip),%rax
mov    (%rax),%edi
pop    %rbx
jmp    1060 <send_errno@plt>
xor    %eax,%eax
pop    %rbx
jmp    1050 <send_success@plt>

LLVM IR (-O0):
@S_IRWXU = global i32 0
@S_IRWXG = global i32 0
@S_IRWXO = global i32 0
@errno = global i32 0
define void @do_mkdir(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* %3
%6 = icmp eq i32 %5, 1
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load i8**, i8*** %4
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = load i32, i32* @S_IRWXU
%13 = load i32, i32* @S_IRWXG
%14 = or i32 %12, %13
%15 = load i32, i32* @S_IRWXO
%16 = or i32 %14, %15
%17 = call i64 @mkdir(i8* %11, i32 %16)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %2
%20 = call i32 (...) @send_success()
br label %24
21: ; preds = %2
%22 = load i32, i32* @errno
%23 = call i32 @send_errno(i32 %22)
br label %24
24: ; preds = %21, %19
ret void
}

LLVM IR (-O2):
@S_IRWXU = global i32 0
@S_IRWXG = global i32 0
@S_IRWXO = global i32 0
@errno = global i32 0
define void @do_mkdir(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = load i8*, i8** %1
%7 = load i32, i32* @S_IRWXU
%8 = load i32, i32* @S_IRWXG
%9 = or i32 %8, %7
%10 = load i32, i32* @S_IRWXO
%11 = or i32 %9, %10
%12 = tail call i64 @mkdir(i8* %6, i32 %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = tail call i32 (...) @send_success()
br label %19
16: ; preds = %2
%17 = load i32, i32* @errno
%18 = tail call i32 @send_errno(i32 %17)
br label %19
19: ; preds = %16, %14
ret void
}