#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 */
void evaluate_fitnesses(
    int dimensions, double (*eval_function)(unsigned short (*pop)[dimensions]),
    double (*fitnesses)[100], unsigned short (*pop)[100][dimensions], int *max,
    int *min) {
  *max = 0;
  *min = 0;
  for (int i = 0; i < 100; i++) {
    (*fitnesses)[i] = eval_function((*pop)[i]);
    if ((*fitnesses)[i] < (*fitnesses)[*min]) {
      *min = i;
    } else if ((*fitnesses)[i] > (*fitnesses)[*max]) {
      *max = i;
    }
  }
}


x86 assembly (clang, -O0):
<evaluate_fitnesses>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x40(%rbp)
mov    -0x28(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x30(%rbp),%rax
movl   $0x0,(%rax)
movl   $0x0,-0x34(%rbp)
cmpl   $0x64,-0x34(%rbp)
jge    11ee <evaluate_fitnesses+0xee>
mov    -0x40(%rbp),%rdx
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rdi
movslq -0x34(%rbp),%rcx
imul   %rdx,%rcx
shl    $0x1,%rcx
add    %rcx,%rdi
call   *%rax
mov    -0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x18(%rbp),%rax
mov    -0x30(%rbp),%rcx
movslq (%rcx),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd %xmm1,%xmm0
jbe    11aa <evaluate_fitnesses+0xaa>
mov    -0x34(%rbp),%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,(%rax)
jmp    11db <evaluate_fitnesses+0xdb>
mov    -0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
movslq (%rcx),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    11d6 <evaluate_fitnesses+0xd6>
mov    -0x34(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
jmp    11db <evaluate_fitnesses+0xdb>
jmp    11e0 <evaluate_fitnesses+0xe0>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1141 <evaluate_fitnesses+0x41>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<evaluate_fitnesses>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r15
mov    %rcx,%rbx
mov    %rdx,%r12
mov    %rsi,%r13
mov    %edi,%ebp
mov    %r8,(%rsp)
movl   $0x0,(%r8)
movl   $0x0,(%r9)
add    %rbp,%rbp
xor    %r14d,%r14d
jmp    1150 <evaluate_fitnesses+0x50>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14d,(%rax)
add    $0x1,%r14
add    %rbp,%rbx
cmp    $0x64,%r14
je     1182 <evaluate_fitnesses+0x82>
mov    %rbx,%rdi
call   *%r13
movsd  %xmm0,(%r12,%r14,8)
movslq (%r15),%rax
movsd  (%r12,%rax,8),%xmm1
ucomisd %xmm0,%xmm1
mov    %r15,%rax
ja     1140 <evaluate_fitnesses+0x40>
mov    (%rsp),%rcx
movslq (%rcx),%rax
ucomisd (%r12,%rax,8),%xmm0
mov    %rcx,%rax
ja     1140 <evaluate_fitnesses+0x40>
jmp    1143 <evaluate_fitnesses+0x43>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @evaluate_fitnesses(i32 %0, double (i16*)* %1, [100 x double]* %2, i16* %3, i32* %4, i32* %5) {
%7 = alloca i32
%8 = alloca double (i16*)*
%9 = alloca [100 x double]*
%10 = alloca i16*
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i32
store i32 %0, i32* %7
store double (i16*)* %1, double (i16*)** %8
store [100 x double]* %2, [100 x double]** %9
store i16* %3, i16** %10
store i32* %4, i32** %11
store i32* %5, i32** %12
%14 = load i32, i32* %7
%15 = zext i32 %14 to i64
%16 = load i32*, i32** %11
store i32 0, i32* %16
%17 = load i32*, i32** %12
store i32 0, i32* %17
store i32 0, i32* %13
br label %18
18: ; preds = %66, %6
%19 = load i32, i32* %13
%20 = icmp slt i32 %19, 100
br i1 %20, label %21, label %69
21: ; preds = %18
%22 = load double (i16*)*, double (i16*)** %8
%23 = load i16*, i16** %10
%24 = load i32, i32* %13
%25 = sext i32 %24 to i64
%26 = mul nsw i64 %25, %15
%27 = getelementptr inbounds i16, i16* %23, i64 %26
%28 = call double %22(i16* %27)
%29 = load [100 x double]*, [100 x double]** %9
%30 = load i32, i32* %13
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [100 x double], [100 x double]* %29, i64 0, i64 %31
store double %28, double* %32
%33 = load [100 x double]*, [100 x double]** %9
%34 = load i32, i32* %13
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [100 x double], [100 x double]* %33, i64 0, i64 %35
%37 = load double, double* %36
%38 = load [100 x double]*, [100 x double]** %9
%39 = load i32*, i32** %12
%40 = load i32, i32* %39
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [100 x double], [100 x double]* %38, i64 0, i64 %41
%43 = load double, double* %42
%44 = fcmp olt double %37, %43
br i1 %44, label %45, label %48
45: ; preds = %21
%46 = load i32, i32* %13
%47 = load i32*, i32** %12
store i32 %46, i32* %47
br label %65
48: ; preds = %21
%49 = load [100 x double]*, [100 x double]** %9
%50 = load i32, i32* %13
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [100 x double], [100 x double]* %49, i64 0, i64 %51
%53 = load double, double* %52
%54 = load [100 x double]*, [100 x double]** %9
%55 = load i32*, i32** %11
%56 = load i32, i32* %55
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [100 x double], [100 x double]* %54, i64 0, i64 %57
%59 = load double, double* %58
%60 = fcmp ogt double %53, %59
br i1 %60, label %61, label %64
61: ; preds = %48
%62 = load i32, i32* %13
%63 = load i32*, i32** %11
store i32 %62, i32* %63
br label %64
64: ; preds = %61, %48
br label %65
65: ; preds = %64, %45
br label %66
66: ; preds = %65
%67 = load i32, i32* %13
%68 = add nsw i32 %67, 1
store i32 %68, i32* %13
br label %18
69: ; preds = %18
ret void
}

LLVM IR (-O2):
define void @evaluate_fitnesses(i32 %0, double (i16*)* nocapture %1, [100 x double]* nocapture %2, i16* %3, i32* nocapture %4, i32* nocapture %5) {
%7 = zext i32 %0 to i64
store i32 0, i32* %4
store i32 0, i32* %5
br label %9
8: ; preds = %29
ret void
9: ; preds = %6, %29
%10 = phi i64 [ 0, %6 ], [ %30, %29 ]
%11 = mul nuw nsw i64 %10, %7
%12 = getelementptr inbounds i16, i16* %3, i64 %11
%13 = tail call double %1(i16* %12)
%14 = getelementptr inbounds [100 x double], [100 x double]* %2, i64 0, i64 %10
store double %13, double* %14
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [100 x double], [100 x double]* %2, i64 0, i64 %16
%18 = load double, double* %17
%19 = fcmp olt double %13, %18
br i1 %19, label %26, label %20
20: ; preds = %9
%21 = load i32, i32* %4
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [100 x double], [100 x double]* %2, i64 0, i64 %22
%24 = load double, double* %23
%25 = fcmp ogt double %13, %24
br i1 %25, label %26, label %29
26: ; preds = %20, %9
%27 = phi i32* [ %5, %9 ], [ %4, %20 ]
%28 = trunc i64 %10 to i32
store i32 %28, i32* %27
br label %29
29: ; preds = %26, %20
%30 = add nuw nsw i64 %10, 1
%31 = icmp eq i64 %30, 100
br i1 %31, label %8, label %9
}