#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++)
      X1 += 2 * s[i].a + ii;
    for (i = 0; i < 5000; i++)
      X2 += 3 * s[i].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     12b9 <main+0x199>
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    $0x1,%eax
mov    %eax,-0x30d70(%rbp)
jmp    11cb <main+0xab>
movl   $0x0,-0x30d70(%rbp)
cmpl   $0x1388,-0x30d70(%rbp)
jge    1261 <main+0x141>
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    $0x1,%eax
mov    %eax,-0x30d70(%rbp)
jmp    121c <main+0xfc>
mov    -0x30d74(%rbp),%eax
cmp    -0x30d78(%rbp),%eax
jge    128c <main+0x16c>
mov    -0x30d74(%rbp),%ecx
movslq -0x30d6c(%rbp),%rax
mov    %ecx,-0x30d50(%rbp,%rax,4)
jmp    12a0 <main+0x180>
mov    -0x30d78(%rbp),%ecx
movslq -0x30d6c(%rbp),%rax
mov    %ecx,-0x30d50(%rbp,%rax,4)
jmp    12a5 <main+0x185>
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    0xd11(%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 = %82, %26
%29 = load i32, i32* %7
%30 = icmp sle i32 %29, 40000
br i1 %30, label %31, label %85
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, 1
store i32 %48, i32* %8
br label %32
49: ; preds = %32
store i32 0, i32* %8
br label %50
50: ; preds = %64, %49
%51 = load i32, i32* %8
%52 = icmp slt i32 %51, 5000
br i1 %52, label %53, label %67
53: ; preds = %50
%54 = load i32, i32* %8
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [5000 x %struct.estructura], [5000 x %struct.estructura]* %2, i64 0, i64 %55
%57 = getelementptr inbounds %struct.estructura, %struct.estructura* %56, i32 0, i32 1
%58 = load i32, i32* %57
%59 = mul nsw i32 3, %58
%60 = load i32, i32* %7
%61 = sub nsw i32 %59, %60
%62 = load i32, i32* %10
%63 = add nsw i32 %62, %61
store i32 %63, i32* %10
br label %64
64: ; preds = %53
%65 = load i32, i32* %8
%66 = add nsw i32 %65, 1
store i32 %66, i32* %8
br label %50
67: ; preds = %50
%68 = load i32, i32* %9
%69 = load i32, i32* %10
%70 = icmp slt i32 %68, %69
br i1 %70, label %71, label %76
71: ; preds = %67
%72 = load i32, i32* %9
%73 = load i32, i32* %7
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds [40000 x i32], [40000 x i32]* %3, i64 0, i64 %74
store i32 %72, i32* %75
br label %81
76: ; preds = %67
%77 = load i32, i32* %10
%78 = load i32, i32* %7
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds [40000 x i32], [40000 x i32]* %3, i64 0, i64 %79
store i32 %77, i32* %80
br label %81
81: ; preds = %76, %71
br label %82
82: ; preds = %81
%83 = load i32, i32* %7
%84 = add nsw i32 %83, 1
store i32 %84, i32* %7
br label %28
85: ; preds = %28
%86 = call double (...) @omp_get_wtime()
store double %86, double* %5
%87 = load double, double* %5
%88 = load double, double* %4
%89 = fsub double %87, %88
store double %89, double* %6
%90 = load double, double* %6
%91 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), double %90)
%92 = load i32, i32* %1
ret i32 %92
}

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
}