#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 /*<<< orphan*/ bmount(char const *);
int /*<<< orphan*/ bumount();
int mi_link(char const *, char const *);
int mi_unlink(char const *);
int /*<<< orphan*/ puts(char *);
int main(int argc, char const *argv[]) {
  if (argc != 4) {
    puts(
        "Uso: mi_mv <nombre_dispositivo> <pathname original> <pathname nuevo>");
    return -1;
  }
  const char *camino1 = argv[2], *camino2 = argv[3];
  int resultado;
  bmount(argv[1]);
  resultado = mi_link(camino1, camino2);
  if (resultado < 0)
    return resultado;
  resultado = mi_unlink(camino1);
  if (resultado < 0)
    return resultado;
  bumount();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     1188 <main+0x38>
lea    0xe89(%rip),%rdi
call   1030 <puts@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1201 <main+0xb1>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <bmount@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1070 <mi_link@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    11d2 <main+0x82>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1201 <main+0xb1>
mov    -0x18(%rbp),%rdi
call   1060 <mi_unlink@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    11f3 <main+0xa3>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1201 <main+0xb1>
mov    $0x0,%al
call   1040 <bumount@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x4,%edi
jne    1190 <main+0x40>
mov    0x8(%rsi),%rdi
mov    0x10(%rsi),%r14
mov    0x18(%rsi),%rbx
call   1050 <bmount@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <mi_link@plt>
test   %eax,%eax
js     11a3 <main+0x53>
mov    %r14,%rdi
call   1060 <mi_unlink@plt>
test   %eax,%eax
js     11a3 <main+0x53>
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <bumount@plt>
jmp    11a5 <main+0x55>
lea    0xe69(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%ebx
jmp    11a5 <main+0x55>
mov    %eax,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [69 x i8] c"Uso: mi_mv <nombre_dispositivo> <pathname original> <pathname nuevo>\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 4
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 @puts(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %40
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 2
%16 = load i8*, i8** %15
store i8* %16, i8** %6
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 3
%19 = load i8*, i8** %18
store i8* %19, i8** %7
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i32 @bmount(i8* %22)
%24 = load i8*, i8** %6
%25 = load i8*, i8** %7
%26 = call i32 @mi_link(i8* %24, i8* %25)
store i32 %26, i32* %8
%27 = load i32, i32* %8
%28 = icmp slt i32 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %13
%30 = load i32, i32* %8
store i32 %30, i32* %3
br label %40
31: ; preds = %13
%32 = load i8*, i8** %6
%33 = call i32 @mi_unlink(i8* %32)
store i32 %33, i32* %8
%34 = load i32, i32* %8
%35 = icmp slt i32 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %31
%37 = load i32, i32* %8
store i32 %37, i32* %3
br label %40
38: ; preds = %31
%39 = call i32 (...) @bumount()
store i32 0, i32* %3
br label %40
40: ; preds = %38, %36, %29, %11
%41 = load i32, i32* %3
ret i32 %41
}

LLVM IR (-O2):
@.str = [69 x i8] c"Uso: mi_mv <nombre_dispositivo> <pathname original> <pathname nuevo>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 4
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0))
br label %21
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 2
%8 = load i8*, i8** %7
%9 = getelementptr inbounds i8*, i8** %1, i64 3
%10 = load i8*, i8** %9
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32 @bmount(i8* %12)
%14 = tail call i32 @mi_link(i8* %8, i8* %10)
%15 = icmp slt i32 %14, 0
br i1 %15, label %21, label %16
16: ; preds = %6
%17 = tail call i32 @mi_unlink(i8* %8)
%18 = icmp slt i32 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %16
%20 = tail call i32 (...) @bumount()
br label %21
21: ; preds = %19, %6, %16, %4
%22 = phi i32 [ -1, %4 ], [ 0, %19 ], [ %14, %6 ], [ %17, %16 ]
ret i32 %22
}