#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*/ memset(char *, char, int);
int mi_dir(char *, char *);
int /*<<< orphan*/ mount(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ unmount(char *);
int main(int argc, char **argv) {
  if (argc == 3) {
    mount(argv[1]);
    char buffer[1024 * 60];
    memset(buffer, '\0', (1024 * 60));
    int entradas = mi_dir(argv[2], buffer);
    if (entradas < 0) {
      printf("ERROR (mi_ls.c): Fallo al ejecutar mi_dir(%s, buffer).\n",
             argv[2]);
      return (-1);
    }
    printf("%s\n", buffer);
    printf("\n\n Total listado: %d\n\n", entradas);
    unmount(argv[1]);
  } else {
    printf("Error en los parámetros de mi_ls\n");
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf020,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jne    1217 <main+0xc7>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <mount@plt>
lea    -0xf010(%rbp),%rdi
xor    %esi,%esi
mov    $0xf000,%edx
call   1060 <memset@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    -0xf010(%rbp),%rsi
call   1070 <mi_dir@plt>
mov    %eax,-0xf014(%rbp)
cmpl   $0x0,-0xf014(%rbp)
jge    11dc <main+0x8c>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    122c <main+0xdc>
lea    -0xf010(%rbp),%rsi
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xf014(%rbp),%esi
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <unmount@plt>
jmp    1225 <main+0xd5>
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xf020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0xf000,%rsp
cmp    $0x3,%edi
jne    11c6 <main+0x66>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1050 <mount@plt>
mov    %rsp,%rbp
xor    %r14d,%r14d
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0xf000,%edx
call   1070 <memset@plt>
mov    0x10(%rbx),%rdi
mov    %rbp,%rsi
call   1080 <mi_dir@plt>
test   %eax,%eax
js     11d7 <main+0x77>
mov    %eax,%ebp
mov    %rsp,%rdi
call   1030 <puts@plt>
lea    0xe86(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x8(%rbx),%rdi
call   1040 <unmount@plt>
jmp    11ef <main+0x8f>
lea    0xe82(%rip),%rdi
call   1030 <puts@plt>
xor    %r14d,%r14d
jmp    11ef <main+0x8f>
mov    0x10(%rbx),%rsi
lea    0xe1e(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xffffffff,%r14d
mov    %r14d,%eax
add    $0xf000,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [56 x i8] c"ERROR (mi_ls.c): Fallo al ejecutar mi_dir(%s, buffer).\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [23 x i8] c"\0A\0A Total listado: %d\0A\0A\00"
@.str.3 = [35 x i8] c"Error en los par\C3\A1metros de mi_ls\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [61440 x i8]
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 3
br i1 %9, label %10, label %38
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @mount(i8* %13)
%15 = getelementptr inbounds [61440 x i8], [61440 x i8]* %6, i64 0, i64 0
%16 = call i32 @memset(i8* %15, i8 signext 0, i32 61440)
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 2
%19 = load i8*, i8** %18
%20 = getelementptr inbounds [61440 x i8], [61440 x i8]* %6, i64 0, i64 0
%21 = call i32 @mi_dir(i8* %19, i8* %20)
store i32 %21, i32* %7
%22 = load i32, i32* %7
%23 = icmp slt i32 %22, 0
br i1 %23, label %24, label %29
24: ; preds = %10
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 2
%27 = load i8*, i8** %26
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i8* %27)
store i32 -1, i32* %3
br label %41
29: ; preds = %10
%30 = getelementptr inbounds [61440 x i8], [61440 x i8]* %6, i64 0, i64 0
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %30)
%32 = load i32, i32* %7
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %32)
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 1
%36 = load i8*, i8** %35
%37 = call i32 @unmount(i8* %36)
br label %40
38: ; preds = %2
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
br label %40
40: ; preds = %38, %29
store i32 0, i32* %3
br label %41
41: ; preds = %40, %24
%42 = load i32, i32* %3
ret i32 %42
}

LLVM IR (-O2):
@.str = [56 x i8] c"ERROR (mi_ls.c): Fallo al ejecutar mi_dir(%s, buffer).\0A\00"
@.str.2 = [23 x i8] c"\0A\0A Total listado: %d\0A\0A\00"
@str = [34 x i8] c"Error en los par\C3\A1metros de mi_ls\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [61440 x i8]
%4 = icmp eq i32 %0, 3
br i1 %4, label %5, label %23
5: ; preds = %2
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = tail call i32 @mount(i8* %7)
%9 = getelementptr inbounds [61440 x i8], [61440 x i8]* %3, i64 0, i64 0
%10 = call i32 @memset(i8* %9, i8 signext 0, i32 61440)
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = call i32 @mi_dir(i8* %12, i8* %9)
%14 = icmp slt i32 %13, 0
br i1 %14, label %20, label %15
15: ; preds = %5
%16 = call i32 @puts(i8* %9)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %13)
%18 = load i8*, i8** %6
%19 = call i32 @unmount(i8* %18)
br label %25
20: ; preds = %5
%21 = load i8*, i8** %11
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i8* %21)
br label %25
23: ; preds = %2
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
br label %25
25: ; preds = %23, %15, %20
%26 = phi i32 [ -1, %20 ], [ 0, %15 ], [ 0, %23 ]
ret i32 %26
}