#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 */
double omp_get_wtime();
int /*<<< orphan*/ printf(char *, double);
main() {
  struct estructura {
    int a;
    int b;
  } s[5000];
  int R[40000];
  double start, end, elapsed;
  int ii, i;
  int X1, X2;
  for (i = 0; i < 5000; i++) {
    s[i].a = 2;
    s[i].b = 3;
  }
  start = omp_get_wtime();
  for (ii = 1; ii <= 40000; ii++) {
    X1 = 0;
    X2 = 0;
    for (i = 0; i < 5000; i += 5)
      X1 += 2 * s[i].a + ii;
    X1 += 2 * s[i + 1].a + ii;
    X1 += 2 * s[i + 2].a + ii;
    X1 += 2 * s[i + 3].a + ii;
    X1 += 2 * s[i + 4].a + ii;
    for (i = 0; i < 5000; i += 5)
      X2 += 3 * s[i].b - ii;
    X2 += 3 * s[i + 1].b - ii;
    X2 += 3 * s[i + 2].b - ii;
    X2 += 3 * s[i + 3].b - ii;
    X2 += 3 * s[i + 4].b - ii;
    if (X1 < X2)
      R[ii] = X1;
    else
      R[ii] = X2;
  }
  end = omp_get_wtime();
  elapsed = end - start;
  printf("Tiempo(seg.):%11.9f \n", elapsed);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30d80,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x30d70(%rbp)
cmpl   $0x1388,-0x30d70(%rbp)
jge    1184 <main+0x64>
movslq -0x30d70(%rbp),%rax
movl   $0x2,-0x9c50(%rbp,%rax,8)
movslq -0x30d70(%rbp),%rax
movl   $0x3,-0x9c4c(%rbp,%rax,8)
mov    -0x30d70(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30d70(%rbp)
jmp    113c <main+0x1c>
mov    $0x0,%al
call   1030 <omp_get_wtime@plt>
movsd  %xmm0,-0x30d58(%rbp)
ff
movl   $0x1,-0x30d6c(%rbp)
cmpl   $0x9c40,-0x30d6c(%rbp)
jg     13e9 <main+0x2c9>
movl   $0x0,-0x30d74(%rbp)
movl   $0x0,-0x30d78(%rbp)
movl   $0x0,-0x30d70(%rbp)
cmpl   $0x1388,-0x30d70(%rbp)
jge    1212 <main+0xf2>
movslq -0x30d70(%rbp),%rax
mov    -0x9c50(%rbp,%rax,8),%eax
shl    $0x1,%eax
add    -0x30d6c(%rbp),%eax
add    -0x30d74(%rbp),%eax
mov    %eax,-0x30d74(%rbp)
mov    -0x30d70(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0x30d70(%rbp)
jmp    11cb <main+0xab>
mov    -0x30d70(%rbp),%eax
add    $0x1,%eax
cltq
mov    -0x9c50(%rbp,%rax,8),%eax
shl    $0x1,%eax
add    -0x30d6c(%rbp),%eax
add    -0x30d74(%rbp),%eax
mov    %eax,-0x30d74(%rbp)
mov    -0x30d70(%rbp),%eax
add    $0x2,%eax
cltq
mov    -0x9c50(%rbp,%rax,8),%eax
shl    $0x1,%eax
add    -0x30d6c(%rbp),%eax
add    -0x30d74(%rbp),%eax
mov    %eax,-0x30d74(%rbp)
mov    -0x30d70(%rbp),%eax
add    $0x3,%eax
cltq
mov    -0x9c50(%rbp,%rax,8),%eax
shl    $0x1,%eax
add    -0x30d6c(%rbp),%eax
add    -0x30d74(%rbp),%eax
mov    %eax,-0x30d74(%rbp)
mov    -0x30d70(%rbp),%eax
add    $0x4,%eax
cltq
mov    -0x9c50(%rbp,%rax,8),%eax
shl    $0x1,%eax
add    -0x30d6c(%rbp),%eax
add    -0x30d74(%rbp),%eax
mov    %eax,-0x30d74(%rbp)
movl   $0x0,-0x30d70(%rbp)
cmpl   $0x1388,-0x30d70(%rbp)
jge    12fd <main+0x1dd>
movslq -0x30d70(%rbp),%rax
imul   $0x3,-0x9c4c(%rbp,%rax,8),%eax
03
sub    -0x30d6c(%rbp),%eax
add    -0x30d78(%rbp),%eax
mov    %eax,-0x30d78(%rbp)
mov    -0x30d70(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0x30d70(%rbp)
jmp    12b8 <main+0x198>
mov    -0x30d70(%rbp),%eax
add    $0x1,%eax
cltq
imul   $0x3,-0x9c4c(%rbp,%rax,8),%eax
03
sub    -0x30d6c(%rbp),%eax
add    -0x30d78(%rbp),%eax
mov    %eax,-0x30d78(%rbp)
mov    -0x30d70(%rbp),%eax
add    $0x2,%eax
cltq
imul   $0x3,-0x9c4c(%rbp,%rax,8),%eax
03
sub    -0x30d6c(%rbp),%eax
add    -0x30d78(%rbp),%eax
mov    %eax,-0x30d78(%rbp)
mov    -0x30d70(%rbp),%eax
add    $0x3,%eax
cltq
imul   $0x3,-0x9c4c(%rbp,%rax,8),%eax
03
sub    -0x30d6c(%rbp),%eax
add    -0x30d78(%rbp),%eax
mov    %eax,-0x30d78(%rbp)
mov    -0x30d70(%rbp),%eax
add    $0x4,%eax
cltq
imul   $0x3,-0x9c4c(%rbp,%rax,8),%eax
03
sub    -0x30d6c(%rbp),%eax
add    -0x30d78(%rbp),%eax
mov    %eax,-0x30d78(%rbp)
mov    -0x30d74(%rbp),%eax
cmp    -0x30d78(%rbp),%eax
jge    13bc <main+0x29c>
mov    -0x30d74(%rbp),%ecx
movslq -0x30d6c(%rbp),%rax
mov    %ecx,-0x30d50(%rbp,%rax,4)
jmp    13d0 <main+0x2b0>
mov    -0x30d78(%rbp),%ecx
movslq -0x30d6c(%rbp),%rax
mov    %ecx,-0x30d50(%rbp,%rax,4)
jmp    13d5 <main+0x2b5>
mov    -0x30d6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30d6c(%rbp)
jmp    119d <main+0x7d>
mov    $0x0,%al
call   1030 <omp_get_wtime@plt>
movsd  %xmm0,-0x30d60(%rbp)
ff
movsd  -0x30d60(%rbp),%xmm0
ff
subsd  -0x30d58(%rbp),%xmm0
ff
movsd  %xmm0,-0x30d68(%rbp)
ff
movsd  -0x30d68(%rbp),%xmm0
ff
lea    0xbe1(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30d80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <omp_get_wtime@plt>
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <omp_get_wtime@plt>
subsd  (%rsp),%xmm0
lea    0xec0(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.estructura = type { i32, i32 }
@.str = [22 x i8] c"Tiempo(seg.):%11.9f \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5000 x %struct.estructura]
%3 = alloca [40000 x i32]
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %8
br label %11
11: ; preds = %23, %0
%12 = load i32, i32* %8
%13 = icmp slt i32 %12, 5000
br i1 %13, label %14, label %26
14: ; preds = %11
%15 = load i32, i32* %8
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [5000 x %struct.estructura], [5000 x %struct.estructura]* %2, i64 0, i64 %16
%18 = getelementptr inbounds %struct.estructura, %struct.estructura* %17, i32 0, i32 0
store i32 2, i32* %18
%19 = load i32, i32* %8
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [5000 x %struct.estructura], [5000 x %struct.estructura]* %2, i64 0, i64 %20
%22 = getelementptr inbounds %struct.estructura, %struct.estructura* %21, i32 0, i32 1
store i32 3, i32* %22
br label %23
23: ; preds = %14
%24 = load i32, i32* %8
%25 = add nsw i32 %24, 1
store i32 %25, i32* %8
br label %11
26: ; preds = %11
%27 = call double (...) @omp_get_wtime()
store double %27, double* %4
store i32 1, i32* %7
br label %28
28: ; preds = %170, %26
%29 = load i32, i32* %7
%30 = icmp sle i32 %29, 40000
br i1 %30, label %31, label %173
31: ; preds = %28
store i32 0, i32* %9
store i32 0, i32* %10
store i32 0, i32* %8
br label %32
32: ; preds = %46, %31
%33 = load i32, i32* %8
%34 = icmp slt i32 %33, 5000
br i1 %34, label %35, label %49
35: ; preds = %32
%36 = load i32, i32* %8
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [5000 x %struct.estructura], [5000 x %struct.estructura]* %2, i64 0, i64 %37
%39 = getelementptr inbounds %struct.estructura, %struct.estructura* %38, i32 0, i32 0
%40 = load i32, i32* %39
%41 = mul nsw i32 2, %40
%42 = load i32, i32* %7
%43 = add nsw i32 %41, %42
%44 = load i32, i32* %9
%45 = add nsw i32 %44, %43
store i32 %45, i32* %9
br label %46
46: ; preds = %35
%47 = load i32, i32* %8
%48 = add nsw i32 %47, 5
store i32 %48, i32* %8
br label %32
49: ; preds = %32
%50 = load i32, i32* %8
%51 = add nsw i32 %50, 1
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [5000 x %struct.estructura], [5000 x %struct.estructura]* %2, i64 0, i64 %52
%54 = getelementptr inbounds %struct.estructura, %struct.estructura* %53, i32 0, i32 0
%55 = load i32, i32* %54
%56 = mul nsw i32 2, %55
%57 = load i32, i32* %7
%58 = add nsw i32 %56, %57
%59 = load i32, i32* %9
%60 = add nsw i32 %59, %58
store i32 %60, i32* %9
%61 = load i32, i32* %8
%62 = add nsw i32 %61, 2
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [5000 x %struct.estructura], [5000 x %struct.estructura]* %2, i64 0, i64 %63
%65 = getelementptr inbounds %struct.estructura, %struct.estructura* %64, i32 0, i32 0
%66 = load i32, i32* %65
%67 = mul nsw i32 2, %66
%68 = load i32, i32* %7
%69 = add nsw i32 %67, %68
%70 = load i32, i32* %9
%71 = add nsw i32 %70, %69
store i32 %71, i32* %9
%72 = load i32, i32* %8
%73 = add nsw i32 %72, 3
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds [5000 x %struct.estructura], [5000 x %struct.estructura]* %2, i64 0, i64 %74
%76 = getelementptr inbounds %struct.estructura, %struct.estructura* %75, i32 0, i32 0
%77 = load i32, i32* %76
%78 = mul nsw i32 2, %77
%79 = load i32, i32* %7
%80 = add nsw i32 %78, %79
%81 = load i32, i32* %9
%82 = add nsw i32 %81, %80
store i32 %82, i32* %9
%83 = load i32, i32* %8
%84 = add nsw i32 %83, 4
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds [5000 x %struct.estructura], [5000 x %struct.estructura]* %2, i64 0, i64 %85
%87 = getelementptr inbounds %struct.estructura, %struct.estructura* %86, i32 0, i32 0
%88 = load i32, i32* %87
%89 = mul nsw i32 2, %88
%90 = load i32, i32* %7
%91 = add nsw i32 %89, %90
%92 = load i32, i32* %9
%93 = add nsw i32 %92, %91
store i32 %93, i32* %9
store i32 0, i32* %8
br label %94
94: ; preds = %108, %49
%95 = load i32, i32* %8
%96 = icmp slt i32 %95, 5000
br i1 %96, label %97, label %111
97: ; preds = %94
%98 = load i32, i32* %8
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds [5000 x %struct.estructura], [5000 x %struct.estructura]* %2, i64 0, i64 %99
%101 = getelementptr inbounds %struct.estructura, %struct.estructura* %100, i32 0, i32 1
%102 = load i32, i32* %101
%103 = mul nsw i32 3, %102
%104 = load i32, i32* %7
%105 = sub nsw i32 %103, %104
%106 = load i32, i32* %10
%107 = add nsw i32 %106, %105
store i32 %107, i32* %10
br label %108
108: ; preds = %97
%109 = load i32, i32* %8
%110 = add nsw i32 %109, 5
store i32 %110, i32* %8
br label %94
111: ; preds = %94
%112 = load i32, i32* %8
%113 = add nsw i32 %112, 1
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds [5000 x %struct.estructura], [5000 x %struct.estructura]* %2, i64 0, i64 %114
%116 = getelementptr inbounds %struct.estructura, %struct.estructura* %115, i32 0, i32 1
%117 = load i32, i32* %116
%118 = mul nsw i32 3, %117
%119 = load i32, i32* %7
%120 = sub nsw i32 %118, %119
%121 = load i32, i32* %10
%122 = add nsw i32 %121, %120
store i32 %122, i32* %10
%123 = load i32, i32* %8
%124 = add nsw i32 %123, 2
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds [5000 x %struct.estructura], [5000 x %struct.estructura]* %2, i64 0, i64 %125
%127 = getelementptr inbounds %struct.estructura, %struct.estructura* %126, i32 0, i32 1
%128 = load i32, i32* %127
%129 = mul nsw i32 3, %128
%130 = load i32, i32* %7
%131 = sub nsw i32 %129, %130
%132 = load i32, i32* %10
%133 = add nsw i32 %132, %131
store i32 %133, i32* %10
%134 = load i32, i32* %8
%135 = add nsw i32 %134, 3
%136 = sext i32 %135 to i64
%137 = getelementptr inbounds [5000 x %struct.estructura], [5000 x %struct.estructura]* %2, i64 0, i64 %136
%138 = getelementptr inbounds %struct.estructura, %struct.estructura* %137, i32 0, i32 1
%139 = load i32, i32* %138
%140 = mul nsw i32 3, %139
%141 = load i32, i32* %7
%142 = sub nsw i32 %140, %141
%143 = load i32, i32* %10
%144 = add nsw i32 %143, %142
store i32 %144, i32* %10
%145 = load i32, i32* %8
%146 = add nsw i32 %145, 4
%147 = sext i32 %146 to i64
%148 = getelementptr inbounds [5000 x %struct.estructura], [5000 x %struct.estructura]* %2, i64 0, i64 %147
%149 = getelementptr inbounds %struct.estructura, %struct.estructura* %148, i32 0, i32 1
%150 = load i32, i32* %149
%151 = mul nsw i32 3, %150
%152 = load i32, i32* %7
%153 = sub nsw i32 %151, %152
%154 = load i32, i32* %10
%155 = add nsw i32 %154, %153
store i32 %155, i32* %10
%156 = load i32, i32* %9
%157 = load i32, i32* %10
%158 = icmp slt i32 %156, %157
br i1 %158, label %159, label %164
159: ; preds = %111
%160 = load i32, i32* %9
%161 = load i32, i32* %7
%162 = sext i32 %161 to i64
%163 = getelementptr inbounds [40000 x i32], [40000 x i32]* %3, i64 0, i64 %162
store i32 %160, i32* %163
br label %169
164: ; preds = %111
%165 = load i32, i32* %10
%166 = load i32, i32* %7
%167 = sext i32 %166 to i64
%168 = getelementptr inbounds [40000 x i32], [40000 x i32]* %3, i64 0, i64 %167
store i32 %165, i32* %168
br label %169
169: ; preds = %164, %159
br label %170
170: ; preds = %169
%171 = load i32, i32* %7
%172 = add nsw i32 %171, 1
store i32 %172, i32* %7
br label %28
173: ; preds = %28
%174 = call double (...) @omp_get_wtime()
store double %174, double* %5
%175 = load double, double* %5
%176 = load double, double* %4
%177 = fsub double %175, %176
store double %177, double* %6
%178 = load double, double* %6
%179 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), double %178)
%180 = load i32, i32* %1
ret i32 %180
}

LLVM IR (-O2):
@.str = [22 x i8] c"Tiempo(seg.):%11.9f \0A\00"
define i32 @main() {
%1 = tail call double (...) @omp_get_wtime()
%2 = tail call double (...) @omp_get_wtime()
%3 = fsub double %2, %1
%4 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), double %3)
ret i32 0
}