int main() {
  int n_inodo = 100;
  char origen[1024] =
      "... then the kernel chooses the address at which to create the mapping; "
      "this is the most portable method of creating a new mapping.  If addr is "
      "not NULL, then the kernel takes it as a hint about where to place the "
      "mapping; on Linux, the mapping will be created at the next higher page "
      "boundary.  The address of the new mapping is returned as the result of "
      "the call.";
  char buffer[1024];
  printf("Prova d'escritures mapejades\n");
  bmount("prova");
  mi_write_f(n_inodo, &origen, 0, 1024);
  mi_read_f(n_inodo, &buffer, 0, 1024);
  printf("\n Resultat: %s \n", &buffer);
  bumount("prova");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x810,%rsp
movl   $0x64,-0x4(%rbp)
lea    -0x410(%rbp),%rdi
lea    0xe80(%rip),%rsi
mov    $0x400,%edx
call   1080 <memcpy@plt>
lea    0x126f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0x127f(%rip),%rdi
mov    $0x0,%al
call   1070 <bmount@plt>
mov    -0x4(%rbp),%edi
lea    -0x410(%rbp),%rsi
xor    %edx,%edx
mov    $0x400,%ecx
mov    $0x0,%al
call   1040 <mi_write_f@plt>
mov    -0x4(%rbp),%edi
lea    -0x810(%rbp),%rsi
xor    %edx,%edx
mov    $0x400,%ecx
mov    $0x0,%al
call   1030 <mi_read_f@plt>
lea    0x1247(%rip),%rdi
lea    -0x810(%rbp),%rsi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0x122c(%rip),%rdi
mov    $0x0,%al
call   1060 <bumount@plt>
xor    %eax,%eax
add    $0x810,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x808,%rsp
lea    0xe7f(%rip),%rsi
lea    0x400(%rsp),%rbx
mov    $0x400,%edx
mov    %rbx,%rdi
call   1090 <memcpy@plt>
lea    0x127a(%rip),%rdi
call   1040 <puts@plt>
lea    0x1257(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1080 <bmount@plt>
mov    $0x64,%edi
mov    %rbx,%rsi
xor    %edx,%edx
mov    $0x400,%ecx
xor    %eax,%eax
call   1050 <mi_write_f@plt>
mov    %rsp,%rbx
mov    $0x64,%edi
mov    %rbx,%rsi
xor    %edx,%edx
mov    $0x400,%ecx
xor    %eax,%eax
call   1030 <mi_read_f@plt>
lea    0x121d(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1070 <bumount@plt>
xor    %eax,%eax
add    $0x808,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.origen = [1024 x i8] c"... then the kernel chooses the address at which to create the mapping; this is the most portable method of creating a new mapping. If addr is not NULL, then the kernel takes it as a hint about where to place the mapping; on Linux, the mapping will be created at the next higher page boundary. The address of the new mapping is returned as the result of the call.\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [30 x i8] c"Prova d'escritures mapejades\0A\00"
@.str.1 = [6 x i8] c"prova\00"
@.str.2 = [17 x i8] c"\0A Resultat: %s \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1024 x i8]
%3 = alloca [1024 x i8]
store i32 100, i32* %1
%4 = bitcast [1024 x i8]* %2 to i8*
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) bitcast (i32 (...)* @bmount to i32 (i8*, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%7 = load i32, i32* %1
%8 = call i32 (i32, [1024 x i8]*, i32, i32, ...) bitcast (i32 (...)* @mi_write_f to i32 (i32, [1024 x i8]*, i32, i32, ...)*)(i32 %7, [1024 x i8]* %2, i32 0, i32 1024)
%9 = load i32, i32* %1
%10 = call i32 (i32, [1024 x i8]*, i32, i32, ...) bitcast (i32 (...)* @mi_read_f to i32 (i32, [1024 x i8]*, i32, i32, ...)*)(i32 %9, [1024 x i8]* %3, i32 0, i32 1024)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), [1024 x i8]* %3)
%12 = call i32 (i8*, ...) bitcast (i32 (...)* @bumount to i32 (i8*, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@__const.main.origen = [1024 x i8] c"... then the kernel chooses the address at which to create the mapping; this is the most portable method of creating a new mapping. If addr is not NULL, then the kernel takes it as a hint about where to place the mapping; on Linux, the mapping will be created at the next higher page boundary. The address of the new mapping is returned as the result of the call.\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str.1 = [6 x i8] c"prova\00"
@.str.2 = [17 x i8] c"\0A Resultat: %s \0A\00"
@str = [29 x i8] c"Prova d'escritures mapejades\00"
define i32 @main() {
%1 = alloca [1024 x i8]
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) bitcast (i32 (...)* @bmount to i32 (i8*, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (i32, [1024 x i8]*, i32, i32, ...) bitcast (i32 (...)* @mi_write_f to i32 (i32, [1024 x i8]*, i32, i32, ...)*)(i32 100, [1024 x i8]* %1, i32 0, i32 1024)
%8 = call i32 (i32, [1024 x i8]*, i32, i32, ...) bitcast (i32 (...)* @mi_read_f to i32 (i32, [1024 x i8]*, i32, i32, ...)*)(i32 100, [1024 x i8]* %2, i32 0, i32 1024)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), [1024 x i8]* %2)
%10 = call i32 (i8*, ...) bitcast (i32 (...)* @bumount to i32 (i8*, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}