void find_fitnesses_ccga(int dimensions, double (*fitnesses)[dimensions][100],
                         int (*fitnesses_min)[dimensions],
                         int (*fitnesses_max)[dimensions],
                         double *highest_store, double *total_fitness) {
  int max = 0;
  int min = 0;
  *highest_store = 0;
  *total_fitness = 0;
  for (int i = 0; i < dimensions; i++) {
    for (int j = 0; j < 100; j++) {
      min = (*fitnesses)[i][j] < (*fitnesses)[i][min] ? j : min;
      max = (*fitnesses)[i][j] > (*fitnesses)[i][max] ? j : max;
      *total_fitness += (*fitnesses)[i][j];
    }
    *highest_store = *highest_store > (*fitnesses)[i][max]
                         ? *highest_store
                         : (*fitnesses)[i][max];
    (*fitnesses_min)[i] = min;
    (*fitnesses_max)[i] = max;
    min = 0;
    max = 0;
  }
}


x86 assembly (clang, -O0):
<find_fitnesses_ccga>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x28(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x30(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    12e2 <find_fitnesses_ccga+0x1e2>
movl   $0x0,-0x40(%rbp)
cmpl   $0x64,-0x40(%rbp)
jge    1242 <find_fitnesses_ccga+0x142>
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
imul   $0x320,%rcx,%rcx
add    %rcx,%rax
movslq -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
imul   $0x320,%rcx,%rcx
add    %rcx,%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd %xmm1,%xmm0
jbe    11ae <find_fitnesses_ccga+0xae>
mov    -0x40(%rbp),%eax
mov    %eax,-0x44(%rbp)
jmp    11b4 <find_fitnesses_ccga+0xb4>
mov    -0x38(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
imul   $0x320,%rcx,%rcx
add    %rcx,%rax
movslq -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
imul   $0x320,%rcx,%rcx
add    %rcx,%rax
movslq -0x34(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    1201 <find_fitnesses_ccga+0x101>
mov    -0x40(%rbp),%eax
mov    %eax,-0x48(%rbp)
jmp    1207 <find_fitnesses_ccga+0x107>
mov    -0x34(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x48(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
imul   $0x320,%rcx,%rcx
add    %rcx,%rax
movslq -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    1159 <find_fitnesses_ccga+0x59>
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
imul   $0x320,%rcx,%rcx
add    %rcx,%rax
movslq -0x34(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    127d <find_fitnesses_ccga+0x17d>
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    129d <find_fitnesses_ccga+0x19d>
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
imul   $0x320,%rcx,%rcx
add    %rcx,%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x38(%rbp),%edx
mov    -0x18(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x34(%rbp),%edx
mov    -0x20(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1146 <find_fitnesses_ccga+0x46>
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_fitnesses_ccga>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
movq   $0x0,(%r8)
movq   $0x0,(%r9)
test   %edi,%edi
jle    11c4 <find_fitnesses_ccga+0xc4>
mov    %edi,%r10d
xorpd  %xmm0,%xmm0
xor    %r14d,%r14d
mov    %rsi,%r11
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
xor    %ebp,%ebp
xor    %edi,%edi
jmp    1159 <find_fitnesses_ccga+0x59>
nopl   0x0(%rax,%rax,1)
addsd  %xmm1,%xmm0
movsd  %xmm0,(%r9)
add    $0x1,%rax
mov    %r15d,%ebp
mov    %r12d,%edi
cmp    $0x64,%rax
je     1190 <find_fitnesses_ccga+0x90>
movsd  (%r11,%rax,8),%xmm1
movslq %ebp,%r15
imul   $0x320,%r14,%rbx
add    %rsi,%rbx
movsd  (%rbx,%r15,8),%xmm2
ucomisd %xmm1,%xmm2
mov    %eax,%r15d
ja     117e <find_fitnesses_ccga+0x7e>
mov    %ebp,%r15d
movslq %edi,%rbp
ucomisd (%rbx,%rbp,8),%xmm1
mov    %eax,%r12d
ja     1140 <find_fitnesses_ccga+0x40>
mov    %edi,%r12d
jmp    1140 <find_fitnesses_ccga+0x40>
movsd  (%r8),%xmm0
movslq %r12d,%rax
maxsd  (%rbx,%rax,8),%xmm0
movsd  %xmm0,(%r8)
mov    %r15d,(%rdx,%r14,4)
mov    %eax,(%rcx,%r14,4)
add    $0x1,%r14
cmp    %r10,%r14
je     11c4 <find_fitnesses_ccga+0xc4>
movsd  (%r9),%xmm0
add    $0x320,%r11
jmp    1130 <find_fitnesses_ccga+0x30>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @find_fitnesses_ccga(i32 %0, [100 x double]* %1, i32* %2, i32* %3, double* %4, double* %5) {
%7 = alloca i32
%8 = alloca [100 x double]*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca double*
%12 = alloca double*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i32 %0, i32* %7
store [100 x double]* %1, [100 x double]** %8
store i32* %2, i32** %9
store i32* %3, i32** %10
store double* %4, double** %11
store double* %5, double** %12
%17 = load i32, i32* %7
%18 = zext i32 %17 to i64
%19 = load i32, i32* %7
%20 = zext i32 %19 to i64
%21 = load i32, i32* %7
%22 = zext i32 %21 to i64
store i32 0, i32* %13
store i32 0, i32* %14
%23 = load double*, double** %11
store double 0.000000e+00, double* %23
%24 = load double*, double** %12
store double 0.000000e+00, double* %24
store i32 0, i32* %15
br label %25
25: ; preds = %131, %6
%26 = load i32, i32* %15
%27 = load i32, i32* %7
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %134
29: ; preds = %25
store i32 0, i32* %16
br label %30
30: ; preds = %91, %29
%31 = load i32, i32* %16
%32 = icmp slt i32 %31, 100
br i1 %32, label %33, label %94
33: ; preds = %30
%34 = load [100 x double]*, [100 x double]** %8
%35 = load i32, i32* %15
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [100 x double], [100 x double]* %34, i64 %36
%38 = load i32, i32* %16
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [100 x double], [100 x double]* %37, i64 0, i64 %39
%41 = load double, double* %40
%42 = load [100 x double]*, [100 x double]** %8
%43 = load i32, i32* %15
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [100 x double], [100 x double]* %42, i64 %44
%46 = load i32, i32* %14
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [100 x double], [100 x double]* %45, i64 0, i64 %47
%49 = load double, double* %48
%50 = fcmp olt double %41, %49
br i1 %50, label %51, label %53
51: ; preds = %33
%52 = load i32, i32* %16
br label %55
53: ; preds = %33
%54 = load i32, i32* %14
br label %55
55: ; preds = %53, %51
%56 = phi i32 [ %52, %51 ], [ %54, %53 ]
store i32 %56, i32* %14
%57 = load [100 x double]*, [100 x double]** %8
%58 = load i32, i32* %15
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [100 x double], [100 x double]* %57, i64 %59
%61 = load i32, i32* %16
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [100 x double], [100 x double]* %60, i64 0, i64 %62
%64 = load double, double* %63
%65 = load [100 x double]*, [100 x double]** %8
%66 = load i32, i32* %15
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [100 x double], [100 x double]* %65, i64 %67
%69 = load i32, i32* %13
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds [100 x double], [100 x double]* %68, i64 0, i64 %70
%72 = load double, double* %71
%73 = fcmp ogt double %64, %72
br i1 %73, label %74, label %76
74: ; preds = %55
%75 = load i32, i32* %16
br label %78
76: ; preds = %55
%77 = load i32, i32* %13
br label %78
78: ; preds = %76, %74
%79 = phi i32 [ %75, %74 ], [ %77, %76 ]
store i32 %79, i32* %13
%80 = load [100 x double]*, [100 x double]** %8
%81 = load i32, i32* %15
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds [100 x double], [100 x double]* %80, i64 %82
%84 = load i32, i32* %16
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds [100 x double], [100 x double]* %83, i64 0, i64 %85
%87 = load double, double* %86
%88 = load double*, double** %12
%89 = load double, double* %88
%90 = fadd double %89, %87
store double %90, double* %88
br label %91
91: ; preds = %78
%92 = load i32, i32* %16
%93 = add nsw i32 %92, 1
store i32 %93, i32* %16
br label %30
94: ; preds = %30
%95 = load double*, double** %11
%96 = load double, double* %95
%97 = load [100 x double]*, [100 x double]** %8
%98 = load i32, i32* %15
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds [100 x double], [100 x double]* %97, i64 %99
%101 = load i32, i32* %13
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds [100 x double], [100 x double]* %100, i64 0, i64 %102
%104 = load double, double* %103
%105 = fcmp ogt double %96, %104
br i1 %105, label %106, label %109
106: ; preds = %94
%107 = load double*, double** %11
%108 = load double, double* %107
br label %118
109: ; preds = %94
%110 = load [100 x double]*, [100 x double]** %8
%111 = load i32, i32* %15
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds [100 x double], [100 x double]* %110, i64 %112
%114 = load i32, i32* %13
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds [100 x double], [100 x double]* %113, i64 0, i64 %115
%117 = load double, double* %116
br label %118
118: ; preds = %109, %106
%119 = phi double [ %108, %106 ], [ %117, %109 ]
%120 = load double*, double** %11
store double %119, double* %120
%121 = load i32, i32* %14
%122 = load i32*, i32** %9
%123 = load i32, i32* %15
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds i32, i32* %122, i64 %124
store i32 %121, i32* %125
%126 = load i32, i32* %13
%127 = load i32*, i32** %10
%128 = load i32, i32* %15
%129 = sext i32 %128 to i64
%130 = getelementptr inbounds i32, i32* %127, i64 %129
store i32 %126, i32* %130
store i32 0, i32* %14
store i32 0, i32* %13
br label %131
131: ; preds = %118
%132 = load i32, i32* %15
%133 = add nsw i32 %132, 1
store i32 %133, i32* %15
br label %25
134: ; preds = %25
ret void
}

LLVM IR (-O2):
define void @find_fitnesses_ccga(i32 %0, [100 x double]* nocapture %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3, double* nocapture %4, double* nocapture %5) {
store double 0.000000e+00, double* %4
store double 0.000000e+00, double* %5
%7 = icmp sgt i32 %0, 0
br i1 %7, label %8, label %13
8: ; preds = %6
%9 = zext i32 %0 to i64
br label %10
10: ; preds = %25, %8
%11 = phi double [ 0.000000e+00, %8 ], [ %26, %25 ]
%12 = phi i64 [ 0, %8 ], [ %23, %25 ]
br label %27
13: ; preds = %14, %6
ret void
14: ; preds = %27
%15 = load double, double* %4
%16 = sext i32 %44 to i64
%17 = getelementptr inbounds [100 x double], [100 x double]* %1, i64 %12, i64 %16
%18 = load double, double* %17
%19 = fcmp ogt double %15, %18
%20 = select i1 %19, double %15, double %18
store double %20, double* %4
%21 = getelementptr inbounds i32, i32* %2, i64 %12
store i32 %39, i32* %21
%22 = getelementptr inbounds i32, i32* %3, i64 %12
store i32 %44, i32* %22
%23 = add nuw nsw i64 %12, 1
%24 = icmp eq i64 %23, %9
br i1 %24, label %13, label %25
25: ; preds = %14
%26 = load double, double* %5
br label %10
27: ; preds = %10, %27
%28 = phi double [ %11, %10 ], [ %45, %27 ]
%29 = phi i64 [ 0, %10 ], [ %46, %27 ]
%30 = phi i32 [ 0, %10 ], [ %39, %27 ]
%31 = phi i32 [ 0, %10 ], [ %44, %27 ]
%32 = getelementptr inbounds [100 x double], [100 x double]* %1, i64 %12, i64 %29
%33 = load double, double* %32
%34 = sext i32 %30 to i64
%35 = getelementptr inbounds [100 x double], [100 x double]* %1, i64 %12, i64 %34
%36 = load double, double* %35
%37 = fcmp olt double %33, %36
%38 = trunc i64 %29 to i32
%39 = select i1 %37, i32 %38, i32 %30
%40 = sext i32 %31 to i64
%41 = getelementptr inbounds [100 x double], [100 x double]* %1, i64 %12, i64 %40
%42 = load double, double* %41
%43 = fcmp ogt double %33, %42
%44 = select i1 %43, i32 %38, i32 %31
%45 = fadd double %33, %28
store double %45, double* %5
%46 = add nuw nsw i64 %29, 1
%47 = icmp eq i64 %46, 100
br i1 %47, label %14, label %27
}