#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 bmount(char *);
int bumount();
int /*<<< orphan*/ exit(int);
int mi_unlink(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sem_del();
int /*<<< orphan*/ sem_init();
int main(int argc, char *argv[]) {
  if (argc != 3) {
    printf(
        "[mi_rm.c] ERROR: Arguments incorrectes. Ex: mi_rm <nomFS> <cami>\n");
    exit(-1);
  }
  sem_init();
  if (bmount(argv[1]) == -1) {
    sem_del();
    return -1;
  }
  if (mi_unlink(argv[2]) == -1) {
    printf("[mi_rm.c] ERROR: No s'ha pogut eliminar!\n");
  }
  if (bumount() == -1) {
    sem_del();
    return -1;
  }
  sem_del();
  return 0;
}


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     11a6 <main+0x36>
lea    0xe69(%rip),%rdi
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1090 <exit@plt>
mov    $0x0,%al
call   1070 <sem_init@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <bmount@plt>
cmp    $0xffffffff,%eax
jne    11d6 <main+0x66>
mov    $0x0,%al
call   1030 <sem_del@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1229 <main+0xb9>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1080 <mi_unlink@plt>
cmp    $0xffffffff,%eax
jne    11f8 <main+0x88>
lea    0xe4f(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <bumount@plt>
cmp    $0xffffffff,%eax
jne    121b <main+0xab>
mov    $0x0,%al
call   1030 <sem_del@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1229 <main+0xb9>
mov    $0x0,%al
call   1030 <sem_del@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x3,%edi
jne    11d2 <main+0x62>
mov    %rsi,%rbx
xor    %eax,%eax
call   1070 <sem_init@plt>
mov    0x8(%rbx),%rdi
call   1060 <bmount@plt>
cmp    $0xffffffff,%eax
je     11c2 <main+0x52>
mov    0x10(%rbx),%rdi
call   1080 <mi_unlink@plt>
cmp    $0xffffffff,%eax
jne    11a8 <main+0x38>
lea    0xe5d(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <bumount@plt>
xor    %ebx,%ebx
cmp    $0xffffffff,%eax
sete   %bl
xor    %eax,%eax
call   1040 <sem_del@plt>
neg    %ebx
jmp    11ce <main+0x5e>
xor    %eax,%eax
call   1040 <sem_del@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
ret
lea    0xe50(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [66 x i8] c"[mi_rm.c] ERROR: Arguments incorrectes. Ex: mi_rm <nomFS> <cami>\0A\00"
@.str.1 = [42 x i8] c"[mi_rm.c] ERROR: No s'ha pogut eliminar!\0A\00"
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 ([66 x i8], [66 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @exit(i32 -1)
unreachable
11: ; preds = %2
%12 = call i32 (...) @sem_init()
%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 %20
18: ; preds = %11
%19 = call i32 (...) @sem_del()
store i32 -1, i32* %3
br label %35
20: ; preds = %11
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 2
%23 = load i8*, i8** %22
%24 = call i32 @mi_unlink(i8* %23)
%25 = icmp eq i32 %24, -1
br i1 %25, label %26, label %28
26: ; preds = %20
%27 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
br label %28
28: ; preds = %26, %20
%29 = call i32 (...) @bumount()
%30 = icmp eq i32 %29, -1
br i1 %30, label %31, label %33
31: ; preds = %28
%32 = call i32 (...) @sem_del()
store i32 -1, i32* %3
br label %35
33: ; preds = %28
%34 = call i32 (...) @sem_del()
store i32 0, i32* %3
br label %35
35: ; preds = %33, %31, %18
%36 = load i32, i32* %3
ret i32 %36
}

LLVM IR (-O2):
@str = [41 x i8] c"[mi_rm.c] ERROR: No s'ha pogut eliminar!\00"
@str.2 = [65 x i8] c"[mi_rm.c] ERROR: Arguments incorrectes. Ex: mi_rm <nomFS> <cami>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @str.2, i64 0, i64 0))
%6 = tail call i32 @exit(i32 -1)
unreachable
7: ; preds = %2
%8 = tail call i32 (...) @sem_init()
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @bmount(i8* %10)
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %15
13: ; preds = %7
%14 = tail call i32 (...) @sem_del()
br label %27
15: ; preds = %7
%16 = getelementptr inbounds i8*, i8** %1, i64 2
%17 = load i8*, i8** %16
%18 = tail call i32 @mi_unlink(i8* %17)
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %22
20: ; preds = %15
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
br label %22
22: ; preds = %20, %15
%23 = tail call i32 (...) @bumount()
%24 = icmp eq i32 %23, -1
%25 = tail call i32 (...) @sem_del()
%26 = sext i1 %24 to i32
br label %27
27: ; preds = %22, %13
%28 = phi i32 [ -1, %13 ], [ %26, %22 ]
ret i32 %28
}