#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_dir(char const *, char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ puts(char *);
int main(int argc, char const *argv[]) {
  if (argc != 3) {
    puts("Uso: mi_ls <nombre_dispositivo> <path>");
    return -1;
  }
  const char *camino = argv[2];
  char buffer[1000000];
  int resultado;
  bmount(argv[1]);
  resultado = mi_dir(camino, buffer);
  if (resultado < 0)
    return resultado;
  printf("%s", buffer);
  bumount();
  return resultado;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf4270,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     118b <main+0x3b>
lea    0xe86(%rip),%rdi
call   1030 <puts@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11f8 <main+0xa8>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <bmount@plt>
mov    -0x18(%rbp),%rdi
lea    -0xf4260(%rbp),%rsi
call   1070 <mi_dir@plt>
mov    %eax,-0xf4264(%rbp)
cmpl   $0x0,-0xf4264(%rbp)
jge    11d5 <main+0x85>
mov    -0xf4264(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11f8 <main+0xa8>
lea    -0xf4260(%rbp),%rsi
lea    0xe44(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <bumount@plt>
mov    -0xf4264(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xf4270,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0xf4240,%rsp
cmp    $0x3,%edi
jne    1193 <main+0x43>
mov    0x10(%rsi),%rbx
mov    0x8(%rsi),%rdi
call   1060 <bmount@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1070 <mi_dir@plt>
mov    %eax,%ebx
test   %eax,%eax
js     11a4 <main+0x54>
lea    0xea5(%rip),%rdi
mov    %rsp,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <bumount@plt>
jmp    11a4 <main+0x54>
lea    0xe66(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0xf4240,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [39 x i8] c"Uso: mi_ls <nombre_dispositivo> <path>\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca [1000000 x 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, 3
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 @puts(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %33
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 1
%19 = load i8*, i8** %18
%20 = call i32 @bmount(i8* %19)
%21 = load i8*, i8** %6
%22 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %7, i64 0, i64 0
%23 = call i32 @mi_dir(i8* %21, i8* %22)
store i32 %23, i32* %8
%24 = load i32, i32* %8
%25 = icmp slt i32 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %13
%27 = load i32, i32* %8
store i32 %27, i32* %3
br label %33
28: ; preds = %13
%29 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %7, i64 0, i64 0
%30 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %29)
%31 = call i32 (...) @bumount()
%32 = load i32, i32* %8
store i32 %32, i32* %3
br label %33
33: ; preds = %28, %26, %11
%34 = load i32, i32* %3
ret i32 %34
}

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