#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*/ bread(char *, unsigned int **);
int /*<<< orphan*/ bumount(char *);
int /*<<< orphan*/ printf(char *, unsigned int);
int main(int argc, char **argv) {
  int s = 1, n = 0;
  unsigned int buffer[1024];
  bmount("prova");
  bread(argv[1], &buffer);
  for (s = 0; s < 1024; s++)
    printf("%i, ", buffer[s]);
  bumount("prova");
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1020,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xe92(%rip),%rdi
call   1060 <bmount@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x1020(%rbp),%rsi
call   1050 <bread@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x400,-0x14(%rbp)
jge    11c0 <main+0x80>
movslq -0x14(%rbp),%rax
mov    -0x1020(%rbp,%rax,4),%esi
lea    0xe59(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    118e <main+0x4e>
lea    0xe39(%rip),%rdi
call   1040 <bumount@plt>
mov    $0x1,%eax
add    $0x1020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x1008,%rsp
mov    %rsi,%rbx
lea    0xeac(%rip),%rdi
call   1060 <bmount@plt>
mov    0x8(%rbx),%rdi
mov    %rsp,%rsi
call   1050 <bread@plt>
xor    %ebx,%ebx
lea    0xe98(%rip),%r14
xchg   %ax,%ax
mov    (%rsp,%rbx,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    $0x400,%rbx
jne    1170 <main+0x30>
lea    0xe71(%rip),%rdi
call   1040 <bumount@plt>
mov    $0x1,%eax
add    $0x1008,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c"prova\00"
@.str.1 = [5 x i8] c"%i, \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca [1024 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %6
store i32 0, i32* %7
%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 = bitcast [1024 x i32]* %8 to i32**
%14 = call i32 @bread(i8* %12, i32** %13)
store i32 0, i32* %6
br label %15
15: ; preds = %24, %2
%16 = load i32, i32* %6
%17 = icmp slt i32 %16, 1024
br i1 %17, label %18, label %27
18: ; preds = %15
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [1024 x i32], [1024 x i32]* %8, i64 0, i64 %20
%22 = load i32, i32* %21
%23 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %22)
br label %24
24: ; preds = %18
%25 = load i32, i32* %6
%26 = add nsw i32 %25, 1
store i32 %26, i32* %6
br label %15
27: ; preds = %15
%28 = call i32 @bumount(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i32 1
}

LLVM IR (-O2):
@.str = [6 x i8] c"prova\00"
@.str.1 = [5 x i8] c"%i, \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i32]
%4 = bitcast [1024 x i32]* %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 = bitcast [1024 x i32]* %3 to i32**
%9 = call i32 @bread(i8* %7, i32** %8)
br label %10
10: ; preds = %2, %10
%11 = phi i64 [ 0, %2 ], [ %15, %10 ]
%12 = getelementptr inbounds [1024 x i32], [1024 x i32]* %3, i64 0, i64 %11
%13 = load i32, i32* %12
%14 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = add nuw nsw i64 %11, 1
%16 = icmp eq i64 %15, 1024
br i1 %16, label %17, label %10
17: ; preds = %10
%18 = call i32 @bumount(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i32 1
}