#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 *);
int /*<<< orphan*/ bumount(char *);
int mi_dir(char *, char **);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  char *buffer2;
  int t_size, i = 0;
  bmount("prova");
  t_size = mi_dir(argv[1], &buffer2);
  printf("Hi ha %i arxius. \n", t_size / 64);
  bumount("prova");
  if (t_size > 0) {
    for (i = 0; i < t_size; i += 64) {
      printf("%s  \t ", &buffer2[i]);
      if (((i / 64) % 4) == 3)
        printf("\n");
    }
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x20(%rbp)
lea    0xe9c(%rip),%rdi
call   1050 <bmount@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x18(%rbp),%rsi
call   1060 <mi_dir@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0x40,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe61(%rip),%rdi
call   1040 <bumount@plt>
cmpl   $0x0,-0x1c(%rbp)
jle    121c <main+0xdc>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1217 <main+0xd7>
mov    -0x18(%rbp),%rsi
movslq -0x20(%rbp),%rax
add    %rax,%rsi
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
mov    $0x40,%ecx
cltd
idiv   %ecx
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x3,%edx
jne    1204 <main+0xc4>
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1209 <main+0xc9>
mov    -0x20(%rbp),%eax
add    $0x40,%eax
mov    %eax,-0x20(%rbp)
jmp    11b5 <main+0x75>
jmp    121c <main+0xdc>
lea    0xdf4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
lea    0xe9d(%rip),%r14
mov    %r14,%rdi
call   1060 <bmount@plt>
mov    0x8(%rbx),%rdi
lea    0x8(%rsp),%rsi
call   1070 <mi_dir@plt>
mov    %eax,%r15d
lea    0x3f(%r15),%esi
test   %eax,%eax
cmovns %eax,%esi
sar    $0x6,%esi
lea    0xe77(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
call   1050 <bumount@plt>
test   %r15d,%r15d
jle    11df <main+0x8f>
lea    0xe6f(%rip),%r14
xor    %ebx,%ebx
jmp    11b9 <main+0x69>
xchg   %ax,%ax
add    $0x40,%rbx
cmp    %ebx,%r15d
jle    11df <main+0x8f>
mov    0x8(%rsp),%rsi
add    %rbx,%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%eax
not    %eax
test   $0xc0,%al
jne    11b0 <main+0x60>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    11b0 <main+0x60>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"prova\00"
@.str.1 = [19 x i8] c"Hi ha %i arxius. \0A\00"
@.str.2 = [7 x i8] c"%s \09 \00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
%9 = call i32 @bmount(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @mi_dir(i8* %12, i8** %6)
store i32 %13, i32* %7
%14 = load i32, i32* %7
%15 = sdiv i32 %14, 64
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = call i32 @bumount(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%18 = load i32, i32* %7
%19 = icmp sgt i32 %18, 0
br i1 %19, label %20, label %42
20: ; preds = %2
store i32 0, i32* %8
br label %21
21: ; preds = %38, %20
%22 = load i32, i32* %8
%23 = load i32, i32* %7
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %41
25: ; preds = %21
%26 = load i8*, i8** %6
%27 = load i32, i32* %8
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %26, i64 %28
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %29)
%31 = load i32, i32* %8
%32 = sdiv i32 %31, 64
%33 = srem i32 %32, 4
%34 = icmp eq i32 %33, 3
br i1 %34, label %35, label %37
35: ; preds = %25
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %37
37: ; preds = %35, %25
br label %38
38: ; preds = %37
%39 = load i32, i32* %8
%40 = add nsw i32 %39, 64
store i32 %40, i32* %8
br label %21
41: ; preds = %21
br label %42
42: ; preds = %41, %2
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%44 = load i32, i32* %3
ret i32 %44
}

LLVM IR (-O2):
@.str = [6 x i8] c"prova\00"
@.str.1 = [19 x i8] c"Hi ha %i arxius. \0A\00"
@.str.2 = [7 x i8] c"%s \09 \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = tail call i32 @bmount(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = call i32 @mi_dir(i8* %7, i8** %3)
%9 = sdiv i32 %8, 64
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = call i32 @bumount(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%12 = icmp sgt i32 %8, 0
br i1 %12, label %13, label %26
13: ; preds = %2, %22
%14 = phi i64 [ %23, %22 ], [ 0, %2 ]
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i64 %14
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %16)
%18 = and i64 %14, 192
%19 = icmp eq i64 %18, 192
br i1 %19, label %20, label %22
20: ; preds = %13
%21 = call i32 @putchar(i32 10)
br label %22
22: ; preds = %13, %20
%23 = add nuw i64 %14, 64
%24 = trunc i64 %23 to i32
%25 = icmp sgt i32 %8, %24
br i1 %25, label %13, label %26
26: ; preds = %22, %2
%27 = call i32 @putchar(i32 10)
ret i32 0
}