#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 EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ atoi(char *);
int bmount(char *);
int bumount();
int mi_creat(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  if (argc != 4) {
    printf("ERROR: mi_mkdir => main: Faltan argumentos!!! El número permitido "
           "de argumentos son 4. \n");
    return (EXIT_FAILURE);
  } else {
    if (bmount(argv[1]) == -1) {
      printf("ERROR: mi_mkdir => main: Error al abrir (bmount) el sistema de "
             "ficheros.\n");
      return (EXIT_FAILURE);
    }
    int resultado = mi_creat(argv[3], atoi(argv[2]));
    if (resultado < 0) {
      printf(
          "ERROR: mi_mkdir => main: Error al crear el directorio/fichero.\n");
      return resultado;
    }
    if (bumount() == -1) {
      printf("ERROR: mi_mkdir => main =>Error al desmontar(bumount) el sistema "
             "de ficheros.\n");
      return (EXIT_FAILURE);
    }
  }
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     118d <main+0x3d>
lea    0xe89(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e5d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1246 <main+0xf6>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <bmount@plt>
cmp    $0xffffffff,%eax
jne    11c0 <main+0x70>
lea    0xeb0(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e2a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1246 <main+0xf6>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1070 <atoi@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
call   1030 <mi_creat@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1208 <main+0xb8>
lea    0xeac(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1246 <main+0xf6>
mov    $0x0,%al
call   1050 <bumount@plt>
cmp    $0xffffffff,%eax
jne    1235 <main+0xe5>
lea    0xec5(%rip),%rdi
call   1040 <printf@plt>
mov    0x2db5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1246 <main+0xf6>
jmp    123a <main+0xea>
mov    0x2d97(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x4,%edi
jne    1197 <main+0x47>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1060 <bmount@plt>
cmp    $0xffffffff,%eax
je     11a0 <main+0x50>
mov    0x10(%rbx),%rdi
mov    0x18(%rbx),%rbx
call   1070 <atoi@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <mi_creat@plt>
test   %eax,%eax
js     11a9 <main+0x59>
xor    %eax,%eax
call   1050 <bumount@plt>
cmp    $0xffffffff,%eax
je     11b9 <main+0x69>
mov    0x2e43(%rip),%rax
jmp    11cc <main+0x7c>
lea    0xf38(%rip),%rdi
jmp    11c0 <main+0x70>
lea    0xee6(%rip),%rdi
jmp    11c0 <main+0x70>
mov    %eax,%ebx
lea    0xe9c(%rip),%rdi
call   1030 <puts@plt>
jmp    11ce <main+0x7e>
lea    0xe40(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e14(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [90 x i8] c"ERROR: mi_mkdir => main: Faltan argumentos!!! El n\C3\BAmero permitido de argumentos son 4. \0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [74 x i8] c"ERROR: mi_mkdir => main: Error al abrir (bmount) el sistema de ficheros.\0A\00"
@.str.2 = [64 x i8] c"ERROR: mi_mkdir => main: Error al crear el directorio/fichero.\0A\00"
@.str.3 = [79 x i8] c"ERROR: mi_mkdir => main =>Error al desmontar(bumount) el sistema de ficheros.\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 4
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = call i32 @printf(i8* getelementptr inbounds ([90 x i8], [90 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* @EXIT_FAILURE
store i32 %11, i32* %3
br label %44
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @bmount(i8* %15)
%17 = icmp eq i32 %16, -1
br i1 %17, label %18, label %21
18: ; preds = %12
%19 = call i32 @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.1, i64 0, i64 0))
%20 = load i32, i32* @EXIT_FAILURE
store i32 %20, i32* %3
br label %44
21: ; preds = %12
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 3
%24 = load i8*, i8** %23
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 2
%27 = load i8*, i8** %26
%28 = call i32 @atoi(i8* %27)
%29 = call i32 @mi_creat(i8* %24, i32 %28)
store i32 %29, i32* %6
%30 = load i32, i32* %6
%31 = icmp slt i32 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %21
%33 = call i32 @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.2, i64 0, i64 0))
%34 = load i32, i32* %6
store i32 %34, i32* %3
br label %44
35: ; preds = %21
%36 = call i32 (...) @bumount()
%37 = icmp eq i32 %36, -1
br i1 %37, label %38, label %41
38: ; preds = %35
%39 = call i32 @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.3, i64 0, i64 0))
%40 = load i32, i32* @EXIT_FAILURE
store i32 %40, i32* %3
br label %44
41: ; preds = %35
br label %42
42: ; preds = %41
%43 = load i32, i32* @EXIT_SUCCESS
store i32 %43, i32* %3
br label %44
44: ; preds = %42, %38, %32, %18, %9
%45 = load i32, i32* %3
ret i32 %45
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
@str = [78 x i8] c"ERROR: mi_mkdir => main =>Error al desmontar(bumount) el sistema de ficheros.\00"
@str.4 = [63 x i8] c"ERROR: mi_mkdir => main: Error al crear el directorio/fichero.\00"
@str.5 = [73 x i8] c"ERROR: mi_mkdir => main: Error al abrir (bmount) el sistema de ficheros.\00"
@str.6 = [89 x i8] c"ERROR: mi_mkdir => main: Faltan argumentos!!! El n\C3\BAmero permitido de argumentos son 4. \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 4
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([89 x i8], [89 x i8]* @str.6, i64 0, i64 0))
%6 = load i32, i32* @EXIT_FAILURE
br label %33
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @bmount(i8* %9)
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @str.5, i64 0, i64 0))
%14 = load i32, i32* @EXIT_FAILURE
br label %33
15: ; preds = %7
%16 = getelementptr inbounds i8*, i8** %1, i64 3
%17 = load i8*, i8** %16
%18 = getelementptr inbounds i8*, i8** %1, i64 2
%19 = load i8*, i8** %18
%20 = tail call i32 @atoi(i8* %19)
%21 = tail call i32 @mi_creat(i8* %17, i32 %20)
%22 = icmp slt i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %15
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @str.4, i64 0, i64 0))
br label %33
25: ; preds = %15
%26 = tail call i32 (...) @bumount()
%27 = icmp eq i32 %26, -1
br i1 %27, label %28, label %31
28: ; preds = %25
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str, i64 0, i64 0))
%30 = load i32, i32* @EXIT_FAILURE
br label %33
31: ; preds = %25
%32 = load i32, i32* @EXIT_SUCCESS
br label %33
33: ; preds = %28, %23, %31, %12, %4
%34 = phi i32 [ %6, %4 ], [ %14, %12 ], [ %32, %31 ], [ %30, %28 ], [ %21, %23 ]
ret i32 %34
}