#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 /*<<< orphan*/ mi_link(char *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sem_del();
int /*<<< orphan*/ sem_init();
int main(int argc, char *argv[]) {
  if (argc != 4) {
    printf("[mi_ln.c] ERROR: Arguments incorrectes. Ex: mi_ln <nomFS> "
           "<cami_nou> <cami_existent>\n");
    exit(-1);
  }
  sem_init();
  if (bmount(argv[1]) == -1) {
    sem_del();
    return -1;
  }
  mi_link(argv[2], argv[3]);
  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   $0x4,-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    121c <main+0xac>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
call   1080 <mi_link@plt>
mov    $0x0,%al
call   1050 <bumount@plt>
cmp    $0xffffffff,%eax
jne    120e <main+0x9e>
mov    $0x0,%al
call   1030 <sem_del@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    121c <main+0xac>
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    $0x4,%edi
jne    11c5 <main+0x55>
mov    %rsi,%rbx
xor    %eax,%eax
call   1070 <sem_init@plt>
mov    0x8(%rbx),%rdi
call   1060 <bmount@plt>
cmp    $0xffffffff,%eax
je     11b5 <main+0x45>
mov    0x10(%rbx),%rdi
mov    0x18(%rbx),%rsi
call   1080 <mi_link@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    11c1 <main+0x51>
xor    %eax,%eax
call   1040 <sem_del@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
ret
lea    0xe34(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [86 x i8] c"[mi_ln.c] ERROR: Arguments incorrectes. Ex: mi_ln <nomFS> <cami_nou> <cami_existent>\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, 4
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([86 x i8], [86 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 %34
20: ; preds = %11
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 2
%23 = load i8*, i8** %22
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 3
%26 = load i8*, i8** %25
%27 = call i32 @mi_link(i8* %23, i8* %26)
%28 = call i32 (...) @bumount()
%29 = icmp eq i32 %28, -1
br i1 %29, label %30, label %32
30: ; preds = %20
%31 = call i32 (...) @sem_del()
store i32 -1, i32* %3
br label %34
32: ; preds = %20
%33 = call i32 (...) @sem_del()
store i32 0, i32* %3
br label %34
34: ; preds = %32, %30, %18
%35 = load i32, i32* %3
ret i32 %35
}

LLVM IR (-O2):
@str = [85 x i8] c"[mi_ln.c] ERROR: Arguments incorrectes. Ex: mi_ln <nomFS> <cami_nou> <cami_existent>\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 ([85 x i8], [85 x i8]* @str, 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 %25
15: ; preds = %7
%16 = getelementptr inbounds i8*, i8** %1, i64 2
%17 = load i8*, i8** %16
%18 = getelementptr inbounds i8*, i8** %1, i64 3
%19 = load i8*, i8** %18
%20 = tail call i32 @mi_link(i8* %17, i8* %19)
%21 = tail call i32 (...) @bumount()
%22 = icmp eq i32 %21, -1
%23 = tail call i32 (...) @sem_del()
%24 = sext i1 %22 to i32
br label %25
25: ; preds = %15, %13
%26 = phi i32 [ -1, %13 ], [ %24, %15 ]
ret i32 %26
}