#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 bmount(char *);
int bumount();
int /*<<< orphan*/ escribir_fichero(char *, char *);
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  if (argc != 3) {
    printf("ERROR: mi_escribir => main: Faltan argumentos!!! El número "
           "permitido de argumentos son 3. \n");
    return (EXIT_FAILURE);
  } else {
    if (bmount(argv[1]) == -1) {
      printf("ERROR: mi_escribir => main: Error al abrir (bmount) el sistema "
             "de ficheros.\n");
      return (EXIT_FAILURE);
    }
    escribir_fichero(argv[1], argv[2]);
    if (bumount() == -1) {
      printf("ERROR: mi_escribir => 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    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     117d <main+0x3d>
lea    0xe99(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e6d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1203 <main+0xc3>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <bmount@plt>
cmp    $0xffffffff,%eax
jne    11b0 <main+0x70>
lea    0xec3(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e3a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1203 <main+0xc3>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1030 <escribir_fichero@plt>
mov    $0x0,%al
call   1050 <bumount@plt>
cmp    $0xffffffff,%eax
jne    11f2 <main+0xb2>
lea    0xece(%rip),%rdi
call   1040 <printf@plt>
mov    0x2df8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1203 <main+0xc3>
jmp    11f7 <main+0xb7>
mov    0x2dda(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x3,%edi
jne    1179 <main+0x39>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1060 <bmount@plt>
cmp    $0xffffffff,%eax
je     1182 <main+0x42>
mov    0x8(%rbx),%rdi
mov    0x10(%rbx),%rsi
call   1030 <escribir_fichero@plt>
xor    %eax,%eax
call   1050 <bumount@plt>
cmp    $0xffffffff,%eax
je     118b <main+0x4b>
mov    0x2e61(%rip),%rax
jmp    119e <main+0x5e>
lea    0xf1d(%rip),%rdi
jmp    1192 <main+0x52>
lea    0xec8(%rip),%rdi
jmp    1192 <main+0x52>
lea    0xe6e(%rip),%rdi
call   1040 <puts@plt>
mov    0x2e42(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [93 x i8] c"ERROR: mi_escribir => main: Faltan argumentos!!! El n\C3\BAmero permitido de argumentos son 3. \0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [77 x i8] c"ERROR: mi_escribir => main: Error al abrir (bmount) el sistema de ficheros.\0A\00"
@.str.2 = [82 x i8] c"ERROR: mi_escribir => 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**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 3
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([93 x i8], [93 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* @EXIT_FAILURE
store i32 %10, i32* %3
br label %36
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @bmount(i8* %14)
%16 = icmp eq i32 %15, -1
br i1 %16, label %17, label %20
17: ; preds = %11
%18 = call i32 @printf(i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.1, i64 0, i64 0))
%19 = load i32, i32* @EXIT_FAILURE
store i32 %19, i32* %3
br label %36
20: ; preds = %11
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 2
%26 = load i8*, i8** %25
%27 = call i32 @escribir_fichero(i8* %23, i8* %26)
%28 = call i32 (...) @bumount()
%29 = icmp eq i32 %28, -1
br i1 %29, label %30, label %33
30: ; preds = %20
%31 = call i32 @printf(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str.2, i64 0, i64 0))
%32 = load i32, i32* @EXIT_FAILURE
store i32 %32, i32* %3
br label %36
33: ; preds = %20
br label %34
34: ; preds = %33
%35 = load i32, i32* @EXIT_SUCCESS
store i32 %35, i32* %3
br label %36
36: ; preds = %34, %30, %17, %8
%37 = load i32, i32* %3
ret i32 %37
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
@str = [81 x i8] c"ERROR: mi_escribir => main =>Error al desmontar(bumount) el sistema de ficheros.\00"
@str.3 = [76 x i8] c"ERROR: mi_escribir => main: Error al abrir (bmount) el sistema de ficheros.\00"
@str.4 = [92 x i8] c"ERROR: mi_escribir => main: Faltan argumentos!!! El n\C3\BAmero permitido de argumentos son 3. \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %4, label %16
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @bmount(i8* %6)
%8 = icmp eq i32 %7, -1
br i1 %8, label %16, label %9
9: ; preds = %4
%10 = load i8*, i8** %5
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = tail call i32 @escribir_fichero(i8* %10, i8* %12)
%14 = tail call i32 (...) @bumount()
%15 = icmp eq i32 %14, -1
br i1 %15, label %16, label %19
16: ; preds = %9, %4, %2
%17 = phi i8* [ getelementptr inbounds ([92 x i8], [92 x i8]* @str.4, i64 0, i64 0), %2 ], [ getelementptr inbounds ([76 x i8], [76 x i8]* @str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([81 x i8], [81 x i8]* @str, i64 0, i64 0), %9 ]
%18 = tail call i32 @puts(i8* dereferenceable(1) %17)
br label %19
19: ; preds = %16, %9
%20 = phi i32* [ @EXIT_SUCCESS, %9 ], [ @EXIT_FAILURE, %16 ]
%21 = load i32, i32* %20
ret i32 %21
}