#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;
      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     128b <main+0x16b>
movl   $0x0,-0x30d74(%rbp)
movl   $0x0,-0x30d78(%rbp)
movl   $0x0,-0x30d70(%rbp)
cmpl   $0x1388,-0x30d70(%rbp)
jge    1233 <main+0x113>
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)
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    11cb <main+0xab>
mov    -0x30d74(%rbp),%eax
cmp    -0x30d78(%rbp),%eax
jge    125e <main+0x13e>
mov    -0x30d74(%rbp),%ecx
movslq -0x30d6c(%rbp),%rax
mov    %ecx,-0x30d50(%rbp,%rax,4)
jmp    1272 <main+0x152>
mov    -0x30d78(%rbp),%ecx
movslq -0x30d6c(%rbp),%rax
mov    %ecx,-0x30d50(%rbp,%rax,4)
jmp    1277 <main+0x157>
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    0xd3f(%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 = %74, %26
%29 = load i32, i32* %7
%30 = icmp sle i32 %29, 40000
br i1 %30, label %31, label %77
31: ; preds = %28
store i32 0, i32* %9
store i32 0, i32* %10
store i32 0, i32* %8
br label %32
32: ; preds = %56, %31
%33 = load i32, i32* %8
%34 = icmp slt i32 %33, 5000
br i1 %34, label %35, label %59
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
%46 = load i32, i32* %8
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [5000 x %struct.estructura], [5000 x %struct.estructura]* %2, i64 0, i64 %47
%49 = getelementptr inbounds %struct.estructura, %struct.estructura* %48, i32 0, i32 1
%50 = load i32, i32* %49
%51 = mul nsw i32 3, %50
%52 = load i32, i32* %7
%53 = sub nsw i32 %51, %52
%54 = load i32, i32* %10
%55 = add nsw i32 %54, %53
store i32 %55, i32* %10
br label %56
56: ; preds = %35
%57 = load i32, i32* %8
%58 = add nsw i32 %57, 1
store i32 %58, i32* %8
br label %32
59: ; preds = %32
%60 = load i32, i32* %9
%61 = load i32, i32* %10
%62 = icmp slt i32 %60, %61
br i1 %62, label %63, label %68
63: ; preds = %59
%64 = load i32, i32* %9
%65 = load i32, i32* %7
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [40000 x i32], [40000 x i32]* %3, i64 0, i64 %66
store i32 %64, i32* %67
br label %73
68: ; preds = %59
%69 = load i32, i32* %10
%70 = load i32, i32* %7
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [40000 x i32], [40000 x i32]* %3, i64 0, i64 %71
store i32 %69, i32* %72
br label %73
73: ; preds = %68, %63
br label %74
74: ; preds = %73
%75 = load i32, i32* %7
%76 = add nsw i32 %75, 1
store i32 %76, i32* %7
br label %28
77: ; preds = %28
%78 = call double (...) @omp_get_wtime()
store double %78, double* %5
%79 = load double, double* %5
%80 = load double, double* %4
%81 = fsub double %79, %80
store double %81, double* %6
%82 = load double, double* %6
%83 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), double %82)
%84 = load i32, i32* %1
ret i32 %84
}

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
}