#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 DBL_MIN;
int calculate_output(double aux_real[1000], double aux_img[1000],
                     double matrice_real[1000][1000],
                     double matrice_img[1000][1000], double snapshot_real[1000],
                     double snapshot_img[1000]) {
  int i, j, t;
  double val, t_val;
  {
    int lb, ub, lbp, ubp, lb2, ub2;
    (void)(lb);
    (void)(ub);
    (void)(lbp);
    (void)(ubp);
    (void)(lb2);
    (void)(ub2);
    register int lbv, ubv;
    (void)(lbv);
    (void)(ubv);
    int t1, t1t, newlb_t1, newub_t1;
    (void)(t1);
    (void)(t1t);
    (void)(newlb_t1);
    (void)(newub_t1);
    int t2, t2t, newlb_t2, newub_t2;
    (void)(t2);
    (void)(t2t);
    (void)(newlb_t2);
    (void)(newub_t2);
    int t3, t3t, newlb_t3, newub_t3;
    (void)(t3);
    (void)(t3t);
    (void)(newlb_t3);
    (void)(newub_t3);
    int t4, t4t, newlb_t4, newub_t4;
    (void)(t4);
    (void)(t4t);
    (void)(newlb_t4);
    (void)(newub_t4);
    int t5, t5t, newlb_t5, newub_t5;
    (void)(t5);
    (void)(t5t);
    (void)(newlb_t5);
    (void)(newub_t5);
    int t6, t6t, newlb_t6, newub_t6;
    (void)(t6);
    (void)(t6t);
    (void)(newlb_t6);
    (void)(newub_t6);
    int t7, t7t, newlb_t7, newub_t7;
    (void)(t7);
    (void)(t7t);
    (void)(newlb_t7);
    (void)(newub_t7);
    int t8, t8t, newlb_t8, newub_t8;
    (void)(t8);
    (void)(t8t);
    (void)(newlb_t8);
    (void)(newub_t8);
    int t9, t9t, newlb_t9, newub_t9;
    (void)(t9);
    (void)(t9t);
    (void)(newlb_t9);
    (void)(newub_t9);
    int t10, t10t, newlb_t10, newub_t10;
    (void)(t10);
    (void)(t10t);
    (void)(newlb_t10);
    (void)(newub_t10);
    lbp = 0;
    ubp = 1000 - 1;
#pragma omp parallel for private(lbv, ubv)
    for (t2 = lbp; t2 <= ubp; t2++) {
      aux_real[t2] = 0;
    }
    if (1000 >= 1) {
      lbp = 0;
      ubp = 1000 - 1;
#pragma omp parallel for private(lbv, ubv)
      for (t2 = lbp; t2 <= ubp; t2++) {
        for (t3 = 0; t3 <= 1000 - 1; t3++) {
          aux_real[t2] += snapshot_real[t3] * matrice_real[t2][t3] -
                          snapshot_img[t3] * matrice_img[t2][t3];
        }
      }
    }
    lbp = 0;
    ubp = 1000 - 1;
#pragma omp parallel for private(lbv, ubv)
    for (t2 = lbp; t2 <= ubp; t2++) {
      aux_img[t2] = 0;
    }
    if (1000 >= 1) {
      lbp = 0;
      ubp = 1000 - 1;
#pragma omp parallel for private(lbv, ubv)
      for (t2 = lbp; t2 <= ubp; t2++) {
        for (t3 = 0; t3 <= 1000 - 1; t3++) {
          aux_img[t2] += snapshot_img[t3] * matrice_real[t2][t3] +
                         snapshot_real[t3] * matrice_img[t2][t3];
        }
      }
    }
    t = 0;
    t_val = DBL_MIN;
    for (t2 = 0; t2 <= 1000 - 1; t2++) {
      val = aux_real[t2] * aux_real[t2] + aux_img[t2] * aux_img[t2];
      t = (val >= t_val) ? (t_val = val, t2) : t;
    }
  }
  return t;
}


x86 assembly (clang, -O0):
<calculate_output>:
push   %rbp
mov    %rsp,%rbp
sub    $0x98,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movl   $0x0,-0x5c(%rbp)
movl   $0x3e7,-0x60(%rbp)
mov    -0x5c(%rbp),%eax
mov    %eax,-0x84(%rbp)
mov    -0x84(%rbp),%eax
cmp    -0x60(%rbp),%eax
jg     1170 <calculate_output+0x70>
mov    -0x8(%rbp),%rax
movslq -0x84(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    113a <calculate_output+0x3a>
movl   $0x0,-0x5c(%rbp)
movl   $0x3e7,-0x60(%rbp)
mov    -0x5c(%rbp),%eax
mov    %eax,-0x84(%rbp)
mov    -0x84(%rbp),%eax
cmp    -0x60(%rbp),%eax
jg     1273 <calculate_output+0x173>
movl   $0x0,-0x94(%rbp)
cmpl   $0x3e7,-0x94(%rbp)
jg     125a <calculate_output+0x15a>
mov    -0x28(%rbp),%rax
movslq -0x94(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x84(%rbp),%rcx
imul   $0x1f40,%rcx,%rcx
add    %rcx,%rax
movslq -0x94(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x30(%rbp),%rax
movslq -0x94(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x20(%rbp),%rax
movslq -0x84(%rbp),%rcx
imul   $0x1f40,%rcx,%rcx
add    %rcx,%rax
movslq -0x94(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movslq -0x84(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    11a0 <calculate_output+0xa0>
jmp    125f <calculate_output+0x15f>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    1187 <calculate_output+0x87>
movl   $0x0,-0x5c(%rbp)
movl   $0x3e7,-0x60(%rbp)
mov    -0x5c(%rbp),%eax
mov    %eax,-0x84(%rbp)
mov    -0x84(%rbp),%eax
cmp    -0x60(%rbp),%eax
jg     12c0 <calculate_output+0x1c0>
mov    -0x10(%rbp),%rax
movslq -0x84(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    128a <calculate_output+0x18a>
movl   $0x0,-0x5c(%rbp)
movl   $0x3e7,-0x60(%rbp)
mov    -0x5c(%rbp),%eax
mov    %eax,-0x84(%rbp)
mov    -0x84(%rbp),%eax
cmp    -0x60(%rbp),%eax
jg     13ac <calculate_output+0x2ac>
movl   $0x0,-0x94(%rbp)
cmpl   $0x3e7,-0x94(%rbp)
jg     1393 <calculate_output+0x293>
mov    -0x30(%rbp),%rax
movslq -0x94(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x84(%rbp),%rcx
imul   $0x1f40,%rcx,%rcx
add    %rcx,%rax
movslq -0x94(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x28(%rbp),%rax
movslq -0x94(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x20(%rbp),%rax
movslq -0x84(%rbp),%rcx
imul   $0x1f40,%rcx,%rcx
add    %rcx,%rax
movslq -0x94(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x84(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    12f0 <calculate_output+0x1f0>
jmp    1398 <calculate_output+0x298>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    12d7 <calculate_output+0x1d7>
movl   $0x0,-0x3c(%rbp)
mov    0x2c26(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x0,-0x84(%rbp)
cmpl   $0x3e7,-0x84(%rbp)
jg     147b <calculate_output+0x37b>
mov    -0x8(%rbp),%rax
movslq -0x84(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x84(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x10(%rbp),%rax
movslq -0x84(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x10(%rbp),%rax
movslq -0x84(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
ucomisd -0x50(%rbp),%xmm0
jb     1455 <calculate_output+0x355>
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x84(%rbp),%eax
mov    %eax,-0x114(%rbp)
jmp    145e <calculate_output+0x35e>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x114(%rbp)
mov    -0x114(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    13cd <calculate_output+0x2cd>
mov    -0x3c(%rbp),%eax
add    $0x98,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculate_output>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,%r12
mov    %r8,%rbx
mov    %rcx,%r13
mov    %rdx,%r15
mov    %rsi,0x10(%rsp)
mov    %rdi,%r14
xor    %ebp,%ebp
mov    $0x1f40,%edx
xor    %esi,%esi
call   1030 <memset@plt>
xorpd  %xmm0,%xmm0
mov    %r15,%rax
mov    %r13,%rcx
nopw   0x0(%rax,%rax,1)
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%rcx,%rdx,8),%xmm1
mulsd  (%r12,%rdx,8),%xmm1
movsd  (%rbx,%rdx,8),%xmm2
mulsd  (%rax,%rdx,8),%xmm2
subsd  %xmm1,%xmm2
addsd  %xmm2,%xmm0
movsd  %xmm0,(%r14,%rbp,8)
add    $0x1,%rdx
cmp    $0x3e8,%rdx
jne    1160 <calculate_output+0x50>
add    $0x1,%rbp
cmp    $0x3e8,%rbp
je     11b2 <calculate_output+0xa2>
movsd  (%r14,%rbp,8),%xmm0
add    $0x1f40,%rcx
add    $0x1f40,%rax
jmp    1150 <calculate_output+0x40>
mov    %r14,0x8(%rsp)
xor    %r14d,%r14d
mov    $0x1f40,%edx
mov    0x10(%rsp),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
xorpd  %xmm0,%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x1,%eax
cs nopw 0x0(%rax,%rax,1)
nop
movsd  -0x8(%r12,%rax,8),%xmm1
movsd  -0x8(%rbx,%rax,8),%xmm2
mulsd  -0x8(%r13,%rax,8),%xmm2
mulsd  -0x8(%r15,%rax,8),%xmm1
addsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x0(%rbp,%r14,8)
movsd  (%rbx,%rax,8),%xmm2
mulsd  0x0(%r13,%rax,8),%xmm2
movsd  (%r12,%rax,8),%xmm0
mulsd  (%r15,%rax,8),%xmm0
addsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x0(%rbp,%r14,8)
add    $0x2,%rax
cmp    $0x3e9,%rax
jne    11f0 <calculate_output+0xe0>
add    $0x1,%r14
cmp    $0x3e8,%r14
je     1274 <calculate_output+0x164>
movsd  0x0(%rbp,%r14,8),%xmm0
add    $0x1f40,%r15
add    $0x1f40,%r13
jmp    11e0 <calculate_output+0xd0>
mov    0x2d65(%rip),%rax
movsd  (%rax),%xmm0
xor    %ecx,%ecx
xor    %eax,%eax
mov    0x8(%rsp),%rsi
nopl   0x0(%rax,%rax,1)
movsd  0x0(%rbp,%rcx,8),%xmm1
movsd  0x8(%rbp,%rcx,8),%xmm2
mulsd  %xmm1,%xmm1
movsd  (%rsi,%rcx,8),%xmm3
movsd  0x8(%rsi,%rcx,8),%xmm4
mulsd  %xmm3,%xmm3
addsd  %xmm1,%xmm3
ucomisd %xmm0,%xmm3
movapd %xmm0,%xmm1
cmpnlesd %xmm3,%xmm1
movapd %xmm1,%xmm5
andnpd %xmm3,%xmm5
andpd  %xmm0,%xmm1
orpd   %xmm5,%xmm1
mov    %eax,%edx
cmovae %ecx,%edx
mulsd  %xmm2,%xmm2
mulsd  %xmm4,%xmm4
addsd  %xmm2,%xmm4
lea    0x1(%rcx),%eax
ucomisd %xmm1,%xmm4
movapd %xmm1,%xmm0
cmpnlesd %xmm4,%xmm0
movapd %xmm0,%xmm2
andpd  %xmm1,%xmm2
andnpd %xmm4,%xmm0
orpd   %xmm2,%xmm0
cmovb  %edx,%eax
add    $0x2,%rcx
cmp    $0x3e8,%rcx
jne    1290 <calculate_output+0x180>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@DBL_MIN = global double 0.000000e+00
define i32 @calculate_output(double* %0, double* %1, [1000 x double]* %2, [1000 x double]* %3, double* %4, double* %5) {
%7 = alloca double*
%8 = alloca double*
%9 = alloca [1000 x double]*
%10 = alloca [1000 x double]*
%11 = alloca double*
%12 = alloca double*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca double
%17 = alloca double
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
%29 = alloca i32
%30 = alloca i32
%31 = alloca i32
%32 = alloca i32
%33 = alloca i32
%34 = alloca i32
%35 = alloca i32
%36 = alloca i32
%37 = alloca i32
%38 = alloca i32
%39 = alloca i32
%40 = alloca i32
%41 = alloca i32
%42 = alloca i32
%43 = alloca i32
%44 = alloca i32
%45 = alloca i32
%46 = alloca i32
%47 = alloca i32
%48 = alloca i32
%49 = alloca i32
%50 = alloca i32
%51 = alloca i32
%52 = alloca i32
%53 = alloca i32
%54 = alloca i32
%55 = alloca i32
%56 = alloca i32
%57 = alloca i32
%58 = alloca i32
%59 = alloca i32
%60 = alloca i32
%61 = alloca i32
%62 = alloca i32
%63 = alloca i32
%64 = alloca i32
%65 = alloca i32
store double* %0, double** %7
store double* %1, double** %8
store [1000 x double]* %2, [1000 x double]** %9
store [1000 x double]* %3, [1000 x double]** %10
store double* %4, double** %11
store double* %5, double** %12
%66 = load i32, i32* %18
%67 = load i32, i32* %19
%68 = load i32, i32* %20
%69 = load i32, i32* %21
%70 = load i32, i32* %22
%71 = load i32, i32* %23
%72 = load i32, i32* %24
%73 = load i32, i32* %25
%74 = load i32, i32* %26
%75 = load i32, i32* %27
%76 = load i32, i32* %28
%77 = load i32, i32* %29
%78 = load i32, i32* %30
%79 = load i32, i32* %31
%80 = load i32, i32* %32
%81 = load i32, i32* %33
%82 = load i32, i32* %34
%83 = load i32, i32* %35
%84 = load i32, i32* %36
%85 = load i32, i32* %37
%86 = load i32, i32* %38
%87 = load i32, i32* %39
%88 = load i32, i32* %40
%89 = load i32, i32* %41
%90 = load i32, i32* %42
%91 = load i32, i32* %43
%92 = load i32, i32* %44
%93 = load i32, i32* %45
%94 = load i32, i32* %46
%95 = load i32, i32* %47
%96 = load i32, i32* %48
%97 = load i32, i32* %49
%98 = load i32, i32* %50
%99 = load i32, i32* %51
%100 = load i32, i32* %52
%101 = load i32, i32* %53
%102 = load i32, i32* %54
%103 = load i32, i32* %55
%104 = load i32, i32* %56
%105 = load i32, i32* %57
%106 = load i32, i32* %58
%107 = load i32, i32* %59
%108 = load i32, i32* %60
%109 = load i32, i32* %61
%110 = load i32, i32* %62
%111 = load i32, i32* %63
%112 = load i32, i32* %64
%113 = load i32, i32* %65
store i32 0, i32* %20
store i32 999, i32* %21
%114 = load i32, i32* %20
store i32 %114, i32* %30
br label %115
115: ; preds = %124, %6
%116 = load i32, i32* %30
%117 = load i32, i32* %21
%118 = icmp sle i32 %116, %117
br i1 %118, label %119, label %127
119: ; preds = %115
%120 = load double*, double** %7
%121 = load i32, i32* %30
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds double, double* %120, i64 %122
store double 0.000000e+00, double* %123
br label %124
124: ; preds = %119
%125 = load i32, i32* %30
%126 = add nsw i32 %125, 1
store i32 %126, i32* %30
br label %115
127: ; preds = %115
store i32 0, i32* %20
store i32 999, i32* %21
%128 = load i32, i32* %20
store i32 %128, i32* %30
br label %129
129: ; preds = %177, %127
%130 = load i32, i32* %30
%131 = load i32, i32* %21
%132 = icmp sle i32 %130, %131
br i1 %132, label %133, label %180
133: ; preds = %129
store i32 0, i32* %34
br label %134
134: ; preds = %173, %133
%135 = load i32, i32* %34
%136 = icmp sle i32 %135, 999
br i1 %136, label %137, label %176
137: ; preds = %134
%138 = load double*, double** %11
%139 = load i32, i32* %34
%140 = sext i32 %139 to i64
%141 = getelementptr inbounds double, double* %138, i64 %140
%142 = load double, double* %141
%143 = load [1000 x double]*, [1000 x double]** %9
%144 = load i32, i32* %30
%145 = sext i32 %144 to i64
%146 = getelementptr inbounds [1000 x double], [1000 x double]* %143, i64 %145
%147 = load i32, i32* %34
%148 = sext i32 %147 to i64
%149 = getelementptr inbounds [1000 x double], [1000 x double]* %146, i64 0, i64 %148
%150 = load double, double* %149
%151 = load double*, double** %12
%152 = load i32, i32* %34
%153 = sext i32 %152 to i64
%154 = getelementptr inbounds double, double* %151, i64 %153
%155 = load double, double* %154
%156 = load [1000 x double]*, [1000 x double]** %10
%157 = load i32, i32* %30
%158 = sext i32 %157 to i64
%159 = getelementptr inbounds [1000 x double], [1000 x double]* %156, i64 %158
%160 = load i32, i32* %34
%161 = sext i32 %160 to i64
%162 = getelementptr inbounds [1000 x double], [1000 x double]* %159, i64 0, i64 %161
%163 = load double, double* %162
%164 = fmul double %155, %163
%165 = fneg double %164
%166 = call double @llvm.fmuladd.f64(double %142, double %150, double %165)
%167 = load double*, double** %7
%168 = load i32, i32* %30
%169 = sext i32 %168 to i64
%170 = getelementptr inbounds double, double* %167, i64 %169
%171 = load double, double* %170
%172 = fadd double %171, %166
store double %172, double* %170
br label %173
173: ; preds = %137
%174 = load i32, i32* %34
%175 = add nsw i32 %174, 1
store i32 %175, i32* %34
br label %134
176: ; preds = %134
br label %177
177: ; preds = %176
%178 = load i32, i32* %30
%179 = add nsw i32 %178, 1
store i32 %179, i32* %30
br label %129
180: ; preds = %129
store i32 0, i32* %20
store i32 999, i32* %21
%181 = load i32, i32* %20
store i32 %181, i32* %30
br label %182
182: ; preds = %191, %180
%183 = load i32, i32* %30
%184 = load i32, i32* %21
%185 = icmp sle i32 %183, %184
br i1 %185, label %186, label %194
186: ; preds = %182
%187 = load double*, double** %8
%188 = load i32, i32* %30
%189 = sext i32 %188 to i64
%190 = getelementptr inbounds double, double* %187, i64 %189
store double 0.000000e+00, double* %190
br label %191
191: ; preds = %186
%192 = load i32, i32* %30
%193 = add nsw i32 %192, 1
store i32 %193, i32* %30
br label %182
194: ; preds = %182
store i32 0, i32* %20
store i32 999, i32* %21
%195 = load i32, i32* %20
store i32 %195, i32* %30
br label %196
196: ; preds = %243, %194
%197 = load i32, i32* %30
%198 = load i32, i32* %21
%199 = icmp sle i32 %197, %198
br i1 %199, label %200, label %246
200: ; preds = %196
store i32 0, i32* %34
br label %201
201: ; preds = %239, %200
%202 = load i32, i32* %34
%203 = icmp sle i32 %202, 999
br i1 %203, label %204, label %242
204: ; preds = %201
%205 = load double*, double** %12
%206 = load i32, i32* %34
%207 = sext i32 %206 to i64
%208 = getelementptr inbounds double, double* %205, i64 %207
%209 = load double, double* %208
%210 = load [1000 x double]*, [1000 x double]** %9
%211 = load i32, i32* %30
%212 = sext i32 %211 to i64
%213 = getelementptr inbounds [1000 x double], [1000 x double]* %210, i64 %212
%214 = load i32, i32* %34
%215 = sext i32 %214 to i64
%216 = getelementptr inbounds [1000 x double], [1000 x double]* %213, i64 0, i64 %215
%217 = load double, double* %216
%218 = load double*, double** %11
%219 = load i32, i32* %34
%220 = sext i32 %219 to i64
%221 = getelementptr inbounds double, double* %218, i64 %220
%222 = load double, double* %221
%223 = load [1000 x double]*, [1000 x double]** %10
%224 = load i32, i32* %30
%225 = sext i32 %224 to i64
%226 = getelementptr inbounds [1000 x double], [1000 x double]* %223, i64 %225
%227 = load i32, i32* %34
%228 = sext i32 %227 to i64
%229 = getelementptr inbounds [1000 x double], [1000 x double]* %226, i64 0, i64 %228
%230 = load double, double* %229
%231 = fmul double %222, %230
%232 = call double @llvm.fmuladd.f64(double %209, double %217, double %231)
%233 = load double*, double** %8
%234 = load i32, i32* %30
%235 = sext i32 %234 to i64
%236 = getelementptr inbounds double, double* %233, i64 %235
%237 = load double, double* %236
%238 = fadd double %237, %232
store double %238, double* %236
br label %239
239: ; preds = %204
%240 = load i32, i32* %34
%241 = add nsw i32 %240, 1
store i32 %241, i32* %34
br label %201
242: ; preds = %201
br label %243
243: ; preds = %242
%244 = load i32, i32* %30
%245 = add nsw i32 %244, 1
store i32 %245, i32* %30
br label %196
246: ; preds = %196
store i32 0, i32* %15
%247 = load double, double* @DBL_MIN
store double %247, double* %17
store i32 0, i32* %30
br label %248
248: ; preds = %284, %246
%249 = load i32, i32* %30
%250 = icmp sle i32 %249, 999
br i1 %250, label %251, label %287
251: ; preds = %248
%252 = load double*, double** %7
%253 = load i32, i32* %30
%254 = sext i32 %253 to i64
%255 = getelementptr inbounds double, double* %252, i64 %254
%256 = load double, double* %255
%257 = load double*, double** %7
%258 = load i32, i32* %30
%259 = sext i32 %258 to i64
%260 = getelementptr inbounds double, double* %257, i64 %259
%261 = load double, double* %260
%262 = load double*, double** %8
%263 = load i32, i32* %30
%264 = sext i32 %263 to i64
%265 = getelementptr inbounds double, double* %262, i64 %264
%266 = load double, double* %265
%267 = load double*, double** %8
%268 = load i32, i32* %30
%269 = sext i32 %268 to i64
%270 = getelementptr inbounds double, double* %267, i64 %269
%271 = load double, double* %270
%272 = fmul double %266, %271
%273 = call double @llvm.fmuladd.f64(double %256, double %261, double %272)
store double %273, double* %16
%274 = load double, double* %16
%275 = load double, double* %17
%276 = fcmp oge double %274, %275
br i1 %276, label %277, label %280
277: ; preds = %251
%278 = load double, double* %16
store double %278, double* %17
%279 = load i32, i32* %30
br label %282
280: ; preds = %251
%281 = load i32, i32* %15
br label %282
282: ; preds = %280, %277
%283 = phi i32 [ %279, %277 ], [ %281, %280 ]
store i32 %283, i32* %15
br label %284
284: ; preds = %282
%285 = load i32, i32* %30
%286 = add nsw i32 %285, 1
store i32 %286, i32* %30
br label %248
287: ; preds = %248
%288 = load i32, i32* %15
ret i32 %288
}

LLVM IR (-O2):
@DBL_MIN = global double 0.000000e+00
define i32 @calculate_output(double* nocapture %0, double* nocapture %1, [1000 x double]* nocapture %2, [1000 x double]* nocapture %3, double* nocapture %4, double* nocapture %5) {
%7 = bitcast double* %0 to i8*
%8 = bitcast double* %1 to i8*
br label %9
9: ; preds = %33, %6
%10 = phi double [ 0.000000e+00, %6 ], [ %35, %33 ]
%11 = phi i64 [ 0, %6 ], [ %31, %33 ]
%12 = getelementptr inbounds double, double* %0, i64 %11
br label %13
13: ; preds = %9, %13
%14 = phi double [ %10, %9 ], [ %27, %13 ]
%15 = phi i64 [ 0, %9 ], [ %28, %13 ]
%16 = getelementptr inbounds double, double* %4, i64 %15
%17 = load double, double* %16
%18 = getelementptr inbounds [1000 x double], [1000 x double]* %2, i64 %11, i64 %15
%19 = load double, double* %18
%20 = getelementptr inbounds double, double* %5, i64 %15
%21 = load double, double* %20
%22 = getelementptr inbounds [1000 x double], [1000 x double]* %3, i64 %11, i64 %15
%23 = load double, double* %22
%24 = fneg double %21
%25 = fmul double %23, %24
%26 = tail call double @llvm.fmuladd.f64(double %17, double %19, double %25)
%27 = fadd double %14, %26
store double %27, double* %12
%28 = add nuw nsw i64 %15, 1
%29 = icmp eq i64 %28, 1000
br i1 %29, label %30, label %13
30: ; preds = %13
%31 = add nuw nsw i64 %11, 1
%32 = icmp eq i64 %31, 1000
br i1 %32, label %36, label %33
33: ; preds = %30
%34 = getelementptr inbounds double, double* %0, i64 %31
%35 = load double, double* %34
br label %9
36: ; preds = %30
br label %37
37: ; preds = %72, %36
%38 = phi double [ 0.000000e+00, %36 ], [ %74, %72 ]
%39 = phi i64 [ 0, %36 ], [ %70, %72 ]
%40 = getelementptr inbounds double, double* %1, i64 %39
br label %41
41: ; preds = %41, %37
%42 = phi double [ %38, %37 ], [ %66, %41 ]
%43 = phi i64 [ 0, %37 ], [ %67, %41 ]
%44 = getelementptr inbounds double, double* %5, i64 %43
%45 = load double, double* %44
%46 = getelementptr inbounds [1000 x double], [1000 x double]* %2, i64 %39, i64 %43
%47 = load double, double* %46
%48 = getelementptr inbounds double, double* %4, i64 %43
%49 = load double, double* %48
%50 = getelementptr inbounds [1000 x double], [1000 x double]* %3, i64 %39, i64 %43
%51 = load double, double* %50
%52 = fmul double %49, %51
%53 = tail call double @llvm.fmuladd.f64(double %45, double %47, double %52)
%54 = fadd double %42, %53
store double %54, double* %40
%55 = or i64 %43, 1
%56 = getelementptr inbounds double, double* %5, i64 %55
%57 = load double, double* %56
%58 = getelementptr inbounds [1000 x double], [1000 x double]* %2, i64 %39, i64 %55
%59 = load double, double* %58
%60 = getelementptr inbounds double, double* %4, i64 %55
%61 = load double, double* %60
%62 = getelementptr inbounds [1000 x double], [1000 x double]* %3, i64 %39, i64 %55
%63 = load double, double* %62
%64 = fmul double %61, %63
%65 = tail call double @llvm.fmuladd.f64(double %57, double %59, double %64)
%66 = fadd double %54, %65
store double %66, double* %40
%67 = add nuw nsw i64 %43, 2
%68 = icmp eq i64 %67, 1000
br i1 %68, label %69, label %41
69: ; preds = %41
%70 = add nuw nsw i64 %39, 1
%71 = icmp eq i64 %70, 1000
br i1 %71, label %75, label %72
72: ; preds = %69
%73 = getelementptr inbounds double, double* %1, i64 %70
%74 = load double, double* %73
br label %37
75: ; preds = %69
%76 = load double, double* @DBL_MIN
br label %77
77: ; preds = %77, %75
%78 = phi i64 [ 0, %75 ], [ %102, %77 ]
%79 = phi i32 [ 0, %75 ], [ %101, %77 ]
%80 = phi double [ %76, %75 ], [ %99, %77 ]
%81 = getelementptr inbounds double, double* %0, i64 %78
%82 = load double, double* %81
%83 = getelementptr inbounds double, double* %1, i64 %78
%84 = load double, double* %83
%85 = fmul double %84, %84
%86 = tail call double @llvm.fmuladd.f64(double %82, double %82, double %85)
%87 = fcmp ult double %86, %80
%88 = select i1 %87, double %80, double %86
%89 = trunc i64 %78 to i32
%90 = select i1 %87, i32 %79, i32 %89
%91 = or i64 %78, 1
%92 = getelementptr inbounds double, double* %0, i64 %91
%93 = load double, double* %92
%94 = getelementptr inbounds double, double* %1, i64 %91
%95 = load double, double* %94
%96 = fmul double %95, %95
%97 = tail call double @llvm.fmuladd.f64(double %93, double %93, double %96)
%98 = fcmp ult double %97, %88
%99 = select i1 %98, double %88, double %97
%100 = trunc i64 %91 to i32
%101 = select i1 %98, i32 %90, i32 %100
%102 = add nuw nsw i64 %78, 2
%103 = icmp eq i64 %102, 1000
br i1 %103, label %104, label %77
104: ; preds = %77
ret i32 %101
}