void freeArrays(int *POP_SIZE, double **pop, double *fo, double *best) {
  int i;
  free(fo);
  free(best);
  for (i = 0; i < *POP_SIZE; i++) {
    free(pop[i]);
  }
  free(pop);
}


x86 assembly (clang, -O0):
<freeArrays>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    -0x8(%rbp),%rcx
cmp    (%rcx),%eax
jge    116f <freeArrays+0x5f>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1141 <freeArrays+0x31>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<freeArrays>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r15
mov    %rsi,%r14
mov    %rdi,%r12
mov    %rdx,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
cmpl   $0x0,(%r12)
jle    1156 <freeArrays+0x46>
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
movslq (%r12),%rax
cmp    %rax,%rbx
jl     1140 <freeArrays+0x30>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @freeArrays(i32* %0, double** %1, double* %2, double* %3) {
%5 = alloca i32*
%6 = alloca double**
%7 = alloca double*
%8 = alloca double*
%9 = alloca i32
store i32* %0, i32** %5
store double** %1, double*** %6
store double* %2, double** %7
store double* %3, double** %8
%10 = load double*, double** %7
%11 = bitcast double* %10 to i8*
%12 = load double*, double** %8
%13 = bitcast double* %12 to i8*
store i32 0, i32* %9
br label %14
14: ; preds = %26, %4
%15 = load i32, i32* %9
%16 = load i32*, i32** %5
%17 = load i32, i32* %16
%18 = icmp slt i32 %15, %17
br i1 %18, label %19, label %29
19: ; preds = %14
%20 = load double**, double*** %6
%21 = load i32, i32* %9
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds double*, double** %20, i64 %22
%24 = load double*, double** %23
%25 = bitcast double* %24 to i8*
br label %26
26: ; preds = %19
%27 = load i32, i32* %9
%28 = add nsw i32 %27, 1
store i32 %28, i32* %9
br label %14
29: ; preds = %14
%30 = load double**, double*** %6
%31 = bitcast double** %30 to i8*
ret void
}

LLVM IR (-O2):
define void @freeArrays(i32* nocapture %0, double** nocapture %1, double* nocapture %2, double* nocapture %3) {
%5 = bitcast double* %2 to i8*
tail call void @free(i8* %5)
%6 = bitcast double* %3 to i8*
tail call void @free(i8* %6)
%7 = load i32, i32* %0
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %18
9: ; preds = %4, %9
%10 = phi i64 [ %14, %9 ], [ 0, %4 ]
%11 = getelementptr inbounds double*, double** %1, i64 %10
%12 = bitcast double** %11 to i8**
%13 = load i8*, i8** %12
tail call void @free(i8* %13)
%14 = add nuw nsw i64 %10, 1
%15 = load i32, i32* %0
%16 = sext i32 %15 to i64
%17 = icmp slt i64 %14, %16
br i1 %17, label %9, label %18
18: ; preds = %9, %4
%19 = bitcast double** %1 to i8*
tail call void @free(i8* %19)
ret void
}