#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*/ inicializar_vector(int *);
double omp_get_wtime();
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int contenedor[100000000];
  int i, j, valor, resultado;
  double tiempoProcedural = 0, tiempoCarga = 0, t_ini, t_ini0, t_fin, SpeedUps;
  resultado = 0;
  t_ini0 = omp_get_wtime();
  inicializar_vector(contenedor);
  t_ini = omp_get_wtime();
  for (i = 0; i < 100000000; i++) {
    resultado = resultado + contenedor[i];
    contenedor[i] = resultado;
  }
  t_fin = omp_get_wtime();
  tiempoCarga = (t_ini - t_ini0);
  tiempoProcedural = (t_fin - t_ini);
  SpeedUps = tiempoProcedural / tiempoProcedural;
  printf("Caracteristicas del sistema\n");
  printf("Numero de hilos disponibles: \n");
  printf("Hilos usados para la inicializacion de vector: \n");
  printf("Hilos usados para Calculos: \n");
  printf(" Tiempo de carga de vector procedural: %.2f segundos\n", tiempoCarga);
  printf(" Tiempo de total de calculo procedural: %.2f segundos\n",
         tiempoProcedural);
  printf(" Speedups procedural: %.2f \n\n", SpeedUps);
  printf("%s\n", "Ultimos valores obtenidos: ");
  printf("%d\n", contenedor[999995]);
  printf("%d\n", contenedor[999996]);
  printf("%d\n", contenedor[999997]);
  printf("%d\n", contenedor[999998]);
  printf("%d\n", contenedor[999999]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x17d78450,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x17d78428(%rbp)
e8
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x17d78430(%rbp)
e8
movl   $0x0,-0x17d78420(%rbp)
mov    $0x0,%al
call   1030 <omp_get_wtime@plt>
movsd  %xmm0,-0x17d78440(%rbp)
e8
lea    -0x17d78410(%rbp),%rdi
call   1050 <inicializar_vector@plt>
mov    $0x0,%al
call   1030 <omp_get_wtime@plt>
movsd  %xmm0,-0x17d78438(%rbp)
e8
movl   $0x0,-0x17d78414(%rbp)
cmpl   $0x5f5e100,-0x17d78414(%rbp)
e1 f5 05
jge    11e8 <main+0xb8>
mov    -0x17d78420(%rbp),%eax
movslq -0x17d78414(%rbp),%rcx
add    -0x17d78410(%rbp,%rcx,4),%eax
mov    %eax,-0x17d78420(%rbp)
mov    -0x17d78420(%rbp),%ecx
movslq -0x17d78414(%rbp),%rax
mov    %ecx,-0x17d78410(%rbp,%rax,4)
mov    -0x17d78414(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x17d78414(%rbp)
jmp    1196 <main+0x66>
mov    $0x0,%al
call   1030 <omp_get_wtime@plt>
movsd  %xmm0,-0x17d78448(%rbp)
e8
movsd  -0x17d78438(%rbp),%xmm0
e8
subsd  -0x17d78440(%rbp),%xmm0
e8
movsd  %xmm0,-0x17d78430(%rbp)
e8
movsd  -0x17d78448(%rbp),%xmm0
e8
subsd  -0x17d78438(%rbp),%xmm0
e8
movsd  %xmm0,-0x17d78428(%rbp)
e8
movsd  -0x17d78428(%rbp),%xmm0
e8
divsd  -0x17d78428(%rbp),%xmm0
e8
movsd  %xmm0,-0x17d78450(%rbp)
e8
lea    0xdba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdc9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdda(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdfd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsd  -0x17d78430(%rbp),%xmm0
e8
lea    0xe05(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x17d78428(%rbp),%xmm0
e8
lea    0xe25(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x17d78450(%rbp),%xmm0
e8
lea    0xe46(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe56(%rip),%rdi
lea    0xe53(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x179a7b24(%rbp),%esi
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x179a7b20(%rbp),%esi
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x179a7b1c(%rbp),%esi
lea    0xe33(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x179a7b18(%rbp),%esi
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x179a7b14(%rbp),%esi
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x17d78450,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x17d78420,%rsp
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <omp_get_wtime@plt>
movsd  %xmm0,0x8(%rsp)
lea    0x20(%rsp),%rdi
call   1060 <inicializar_vector@plt>
xor    %eax,%eax
call   1040 <omp_get_wtime@plt>
movsd  %xmm0,0x10(%rsp)
mov    $0x4,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    0x10(%rsp,%rax,4),%ebx
mov    %ebx,0x10(%rsp,%rax,4)
add    0x14(%rsp,%rax,4),%ebx
mov    %ebx,0x14(%rsp,%rax,4)
add    0x18(%rsp,%rax,4),%ebx
mov    %ebx,0x18(%rsp,%rax,4)
add    0x1c(%rsp,%rax,4),%ebx
mov    %ebx,0x1c(%rsp,%rax,4)
add    0x20(%rsp,%rax,4),%ebx
mov    %ebx,0x20(%rsp,%rax,4)
add    $0x5,%rax
cmp    $0x5f5e104,%rax
jne    1180 <main+0x40>
xor    %eax,%eax
call   1040 <omp_get_wtime@plt>
movsd  0x10(%rsp),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,0x18(%rsp)
subsd  0x8(%rsp),%xmm1
movsd  %xmm1,0x10(%rsp)
movapd %xmm0,%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
lea    0xebf(%rip),%rdi
call   1030 <puts@plt>
lea    0xecf(%rip),%rdi
call   1030 <puts@plt>
lea    0xee1(%rip),%rdi
call   1030 <puts@plt>
lea    0xf05(%rip),%rdi
call   1030 <puts@plt>
lea    0xde4(%rip),%rdi
movsd  0x10(%rsp),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xe06(%rip),%rdi
movsd  0x18(%rsp),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xe29(%rip),%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xe33(%rip),%rdi
call   1030 <puts@plt>
mov    0x3d090c(%rsp),%esi
lea    0xe3c(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x3d0910(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x3d0914(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x3d0918(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x3d091c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x17d78420,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Caracteristicas del sistema\0A\00"
@.str.1 = [31 x i8] c"Numero de hilos disponibles: \0A\00"
@.str.2 = [49 x i8] c"Hilos usados para la inicializacion de vector: \0A\00"
@.str.3 = [30 x i8] c"Hilos usados para Calculos: \0A\00"
@.str.4 = [54 x i8] c" Tiempo de carga de vector procedural: %.2f segundos\0A\00"
@.str.5 = [55 x i8] c" Tiempo de total de calculo procedural: %.2f segundos\0A\00"
@.str.6 = [30 x i8] c" Speedups procedural: %.2f \0A\0A\00"
@.str.7 = [4 x i8] c"%s\0A\00"
@.str.8 = [28 x i8] c"Ultimos valores obtenidos: \00"
@.str.9 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100000000 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
store i32 0, i32* %1
store double 0.000000e+00, double* %7
store double 0.000000e+00, double* %8
store i32 0, i32* %6
%13 = call double (...) @omp_get_wtime()
store double %13, double* %10
%14 = getelementptr inbounds [100000000 x i32], [100000000 x i32]* %2, i64 0, i64 0
%15 = call i32 @inicializar_vector(i32* %14)
%16 = call double (...) @omp_get_wtime()
store double %16, double* %9
store i32 0, i32* %3
br label %17
17: ; preds = %31, %0
%18 = load i32, i32* %3
%19 = icmp slt i32 %18, 100000000
br i1 %19, label %20, label %34
20: ; preds = %17
%21 = load i32, i32* %6
%22 = load i32, i32* %3
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [100000000 x i32], [100000000 x i32]* %2, i64 0, i64 %23
%25 = load i32, i32* %24
%26 = add nsw i32 %21, %25
store i32 %26, i32* %6
%27 = load i32, i32* %6
%28 = load i32, i32* %3
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [100000000 x i32], [100000000 x i32]* %2, i64 0, i64 %29
store i32 %27, i32* %30
br label %31
31: ; preds = %20
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 1
store i32 %33, i32* %3
br label %17
34: ; preds = %17
%35 = call double (...) @omp_get_wtime()
store double %35, double* %11
%36 = load double, double* %9
%37 = load double, double* %10
%38 = fsub double %36, %37
store double %38, double* %8
%39 = load double, double* %11
%40 = load double, double* %9
%41 = fsub double %39, %40
store double %41, double* %7
%42 = load double, double* %7
%43 = load double, double* %7
%44 = fdiv double %42, %43
store double %44, double* %12
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0))
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
%49 = load double, double* %8
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0), double %49)
%51 = load double, double* %7
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.5, i64 0, i64 0), double %51)
%53 = load double, double* %12
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0), double %53)
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0))
%56 = getelementptr inbounds [100000000 x i32], [100000000 x i32]* %2, i64 0, i64 999995
%57 = load i32, i32* %56
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %57)
%59 = getelementptr inbounds [100000000 x i32], [100000000 x i32]* %2, i64 0, i64 999996
%60 = load i32, i32* %59
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %60)
%62 = getelementptr inbounds [100000000 x i32], [100000000 x i32]* %2, i64 0, i64 999997
%63 = load i32, i32* %62
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %63)
%65 = getelementptr inbounds [100000000 x i32], [100000000 x i32]* %2, i64 0, i64 999998
%66 = load i32, i32* %65
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %66)
%68 = getelementptr inbounds [100000000 x i32], [100000000 x i32]* %2, i64 0, i64 999999
%69 = load i32, i32* %68
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %69)
ret i32 0
}

LLVM IR (-O2):
@.str.4 = [54 x i8] c" Tiempo de carga de vector procedural: %.2f segundos\0A\00"
@.str.5 = [55 x i8] c" Tiempo de total de calculo procedural: %.2f segundos\0A\00"
@.str.6 = [30 x i8] c" Speedups procedural: %.2f \0A\0A\00"
@.str.8 = [28 x i8] c"Ultimos valores obtenidos: \00"
@.str.9 = [4 x i8] c"%d\0A\00"
@str = [28 x i8] c"Caracteristicas del sistema\00"
@str.10 = [30 x i8] c"Numero de hilos disponibles: \00"
@str.11 = [48 x i8] c"Hilos usados para la inicializacion de vector: \00"
@str.12 = [29 x i8] c"Hilos usados para Calculos: \00"
define i32 @main() {
%1 = alloca [100000000 x i32]
%2 = bitcast [100000000 x i32]* %1 to i8*
%3 = tail call double (...) @omp_get_wtime()
%4 = getelementptr inbounds [100000000 x i32], [100000000 x i32]* %1, i64 0, i64 0
%5 = call i32 @inicializar_vector(i32* %4)
%6 = call double (...) @omp_get_wtime()
br label %7
7: ; preds = %7, %0
%8 = phi i64 [ 0, %0 ], [ %29, %7 ]
%9 = phi i32 [ 0, %0 ], [ %28, %7 ]
%10 = getelementptr inbounds [100000000 x i32], [100000000 x i32]* %1, i64 0, i64 %8
%11 = load i32, i32* %10
%12 = add nsw i32 %11, %9
store i32 %12, i32* %10
%13 = add nuw nsw i64 %8, 1
%14 = getelementptr inbounds [100000000 x i32], [100000000 x i32]* %1, i64 0, i64 %13
%15 = load i32, i32* %14
%16 = add nsw i32 %15, %12
store i32 %16, i32* %14
%17 = add nuw nsw i64 %8, 2
%18 = getelementptr inbounds [100000000 x i32], [100000000 x i32]* %1, i64 0, i64 %17
%19 = load i32, i32* %18
%20 = add nsw i32 %19, %16
store i32 %20, i32* %18
%21 = add nuw nsw i64 %8, 3
%22 = getelementptr inbounds [100000000 x i32], [100000000 x i32]* %1, i64 0, i64 %21
%23 = load i32, i32* %22
%24 = add nsw i32 %23, %20
store i32 %24, i32* %22
%25 = add nuw nsw i64 %8, 4
%26 = getelementptr inbounds [100000000 x i32], [100000000 x i32]* %1, i64 0, i64 %25
%27 = load i32, i32* %26
%28 = add nsw i32 %27, %24
store i32 %28, i32* %26
%29 = add nuw nsw i64 %8, 5
%30 = icmp eq i64 %29, 100000000
br i1 %30, label %31, label %7
31: ; preds = %7
%32 = call double (...) @omp_get_wtime()
%33 = fsub double %6, %3
%34 = fsub double %32, %6
%35 = fdiv double %34, %34
%36 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%37 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.10, i64 0, i64 0))
%38 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.11, i64 0, i64 0))
%39 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.12, i64 0, i64 0))
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0), double %33)
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.5, i64 0, i64 0), double %34)
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0), double %35)
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0))
%44 = getelementptr inbounds [100000000 x i32], [100000000 x i32]* %1, i64 0, i64 999995
%45 = load i32, i32* %44
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %45)
%47 = getelementptr inbounds [100000000 x i32], [100000000 x i32]* %1, i64 0, i64 999996
%48 = load i32, i32* %47
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %48)
%50 = getelementptr inbounds [100000000 x i32], [100000000 x i32]* %1, i64 0, i64 999997
%51 = load i32, i32* %50
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %51)
%53 = getelementptr inbounds [100000000 x i32], [100000000 x i32]* %1, i64 0, i64 999998
%54 = load i32, i32* %53
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %54)
%56 = getelementptr inbounds [100000000 x i32], [100000000 x i32]* %1, i64 0, i64 999999
%57 = load i32, i32* %56
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i32 %57)
ret i32 0
}