#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 */
int /*<<< orphan*/ copy_child(int *, int *, int);
int /*<<< orphan*/ copy_vet(int *, int *, int);
scalar_t__ is_inside(int *, int, int);
int partition_size(int);
double path_cost(double **, int *, int);
int /*<<< orphan*/ printf(char *, int, ...);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ swap(int *, int, int);
int /*<<< orphan*/ time(void *);
void _genetic_algorithm(int *father_1, int *father_2, double **input, int n) {
  unsigned int iterations = 0;
  double pathp1 = path_cost(input, father_1, n);
  double pathp2 = path_cost(input, father_2, n);
  double best_cost = 0;
  int best_path[n];
  int child_1[n];
  int child_2[n];
  double cost_c1, cost_c2;
  int swp1, swp2, i;
  int z;
  srand(time(((void *)0)));
  if (pathp1 < pathp2) {
    copy_vet(father_1, best_path, n);
    best_cost = pathp1;
  } else {
    copy_vet(father_2, best_path, n);
    best_cost = pathp2;
  }
  int s = partition_size(n);
  do {
    for (z = 0; z < n; z++) {
      child_1[z] = child_2[z] = -1;
    }
    int i, j, k, l;
    i = rand() % (n - s);
    j = i;
    for (; i < j + s; i++) {
      child_1[i] = father_1[i];
      child_2[i] = father_2[i];
    }
    for (l = 0; l < n;) {
      if (l >= j && l < (j + s)) {
        l++;
        continue;
      }
      for (k = 0; k < n; k++) {
        if (is_inside(child_1, father_2[k], n)) {
          child_1[l] = father_2[k];
          l++;
          break;
        }
      }
    }
    for (l = 0; l < n;) {
      if (l >= j && l < (j + s)) {
        l++;
        continue;
      }
      for (k = 0; k < n; k++) {
        if (is_inside(child_2, father_1[k], n)) {
          child_2[l] = father_1[k];
          l++;
          break;
        }
      }
    }
    swp1 = rand() % n;
    swp2 = rand() % n;
    swap(child_1, swp1, swp2);
    double c = path_cost(input, child_1, n);
    if (c < best_cost) {
      copy_vet(child_1, best_path, n);
      best_cost = c;
    }
    swp1 = rand() % n;
    swp2 = rand() % n;
    swap(child_2, swp1, swp2);
    c = path_cost(input, child_2, n);
    if (c < best_cost) {
      copy_vet(child_2, best_path, n);
      best_cost = c;
    }
    copy_child(child_1, father_1, n);
    copy_child(child_2, father_2, n);
    iterations++;
  } while (iterations < 10000000);
  for (i = 0; i < n; i++) {
    printf("%d\n\n", best_path[i]);
  }
  printf("%d\n\n%.f\n\n*\n\n", best_path[0], best_cost);
}


x86 assembly (clang, -O0):
<_genetic_algorithm>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   10a0 <path_cost@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   10a0 <path_cost@plt>
movsd  %xmm0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x1c(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x40(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xb0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x48(%rbp)
mov    -0x1c(%rbp),%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xa8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x50(%rbp)
mov    -0x1c(%rbp),%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xa0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x58(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
movsd  -0x28(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    12a9 <_genetic_algorithm+0x109>
mov    -0xb0(%rbp),%rsi
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%edx
call   1080 <copy_vet@plt>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    12c6 <_genetic_algorithm+0x126>
mov    -0xb0(%rbp),%rsi
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%edx
call   1080 <copy_vet@plt>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x1c(%rbp),%edi
call   1090 <partition_size@plt>
mov    %eax,-0x7c(%rbp)
movl   $0x0,-0x78(%rbp)
mov    -0x78(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1316 <_genetic_algorithm+0x176>
mov    -0xa8(%rbp),%rax
mov    -0xa0(%rbp),%rcx
movslq -0x78(%rbp),%rdx
movl   $0xffffffff,(%rcx,%rdx,4)
movslq -0x78(%rbp),%rcx
movl   $0xffffffff,(%rax,%rcx,4)
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    12d8 <_genetic_algorithm+0x138>
mov    $0x0,%al
call   10c0 <rand@plt>
mov    -0x1c(%rbp),%ecx
sub    -0x7c(%rbp),%ecx
cltd
idiv   %ecx
mov    %edx,-0x80(%rbp)
mov    -0x80(%rbp),%eax
mov    %eax,-0x84(%rbp)
mov    -0x80(%rbp),%eax
mov    -0x84(%rbp),%ecx
add    -0x7c(%rbp),%ecx
cmp    %ecx,%eax
jge    1386 <_genetic_algorithm+0x1e6>
mov    -0xa0(%rbp),%rax
mov    -0xa8(%rbp),%rcx
mov    -0x8(%rbp),%rdx
movslq -0x80(%rbp),%rsi
mov    (%rdx,%rsi,4),%esi
movslq -0x80(%rbp),%rdx
mov    %esi,(%rcx,%rdx,4)
mov    -0x10(%rbp),%rcx
movslq -0x80(%rbp),%rdx
mov    (%rcx,%rdx,4),%edx
movslq -0x80(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x80(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x80(%rbp)
jmp    1332 <_genetic_algorithm+0x192>
movl   $0x0,-0x8c(%rbp)
mov    -0x8c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    146d <_genetic_algorithm+0x2cd>
mov    -0x8c(%rbp),%eax
cmp    -0x84(%rbp),%eax
jl     13dc <_genetic_algorithm+0x23c>
mov    -0x8c(%rbp),%eax
mov    -0x84(%rbp),%ecx
add    -0x7c(%rbp),%ecx
cmp    %ecx,%eax
jge    13dc <_genetic_algorithm+0x23c>
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    1390 <_genetic_algorithm+0x1f0>
movl   $0x0,-0x88(%rbp)
mov    -0x88(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1468 <_genetic_algorithm+0x2c8>
mov    -0xa8(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x88(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
mov    -0x1c(%rbp),%edx
call   1040 <is_inside@plt>
cmp    $0x0,%rax
je     144f <_genetic_algorithm+0x2af>
mov    -0xa8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq -0x88(%rbp),%rdx
mov    (%rcx,%rdx,4),%edx
movslq -0x8c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    1468 <_genetic_algorithm+0x2c8>
jmp    1454 <_genetic_algorithm+0x2b4>
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
jmp    13e6 <_genetic_algorithm+0x246>
jmp    1390 <_genetic_algorithm+0x1f0>
movl   $0x0,-0x8c(%rbp)
mov    -0x8c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1554 <_genetic_algorithm+0x3b4>
mov    -0x8c(%rbp),%eax
cmp    -0x84(%rbp),%eax
jl     14c3 <_genetic_algorithm+0x323>
mov    -0x8c(%rbp),%eax
mov    -0x84(%rbp),%ecx
add    -0x7c(%rbp),%ecx
cmp    %ecx,%eax
jge    14c3 <_genetic_algorithm+0x323>
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    1477 <_genetic_algorithm+0x2d7>
movl   $0x0,-0x88(%rbp)
mov    -0x88(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    154f <_genetic_algorithm+0x3af>
mov    -0xa0(%rbp),%rdi
mov    -0x8(%rbp),%rax
movslq -0x88(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
mov    -0x1c(%rbp),%edx
call   1040 <is_inside@plt>
cmp    $0x0,%rax
je     1536 <_genetic_algorithm+0x396>
mov    -0xa0(%rbp),%rax
mov    -0x8(%rbp),%rcx
movslq -0x88(%rbp),%rdx
mov    (%rcx,%rdx,4),%edx
movslq -0x8c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    154f <_genetic_algorithm+0x3af>
jmp    153b <_genetic_algorithm+0x39b>
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
jmp    14cd <_genetic_algorithm+0x32d>
jmp    1477 <_genetic_algorithm+0x2d7>
mov    $0x0,%al
call   10c0 <rand@plt>
cltd
idivl  -0x1c(%rbp)
mov    %edx,-0x6c(%rbp)
mov    $0x0,%al
call   10c0 <rand@plt>
mov    -0xa8(%rbp),%rdi
cltd
idivl  -0x1c(%rbp)
mov    %edx,-0x70(%rbp)
mov    -0x6c(%rbp),%esi
mov    -0x70(%rbp),%edx
call   10b0 <swap@plt>
mov    -0xa8(%rbp),%rsi
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%edx
call   10a0 <path_cost@plt>
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x98(%rbp),%xmm1
ff
movsd  -0x38(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    15d7 <_genetic_algorithm+0x437>
mov    -0xb0(%rbp),%rsi
mov    -0xa8(%rbp),%rdi
mov    -0x1c(%rbp),%edx
call   1080 <copy_vet@plt>
movsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x38(%rbp)
mov    $0x0,%al
call   10c0 <rand@plt>
cltd
idivl  -0x1c(%rbp)
mov    %edx,-0x6c(%rbp)
mov    $0x0,%al
call   10c0 <rand@plt>
mov    -0xa0(%rbp),%rdi
cltd
idivl  -0x1c(%rbp)
mov    %edx,-0x70(%rbp)
mov    -0x6c(%rbp),%esi
mov    -0x70(%rbp),%edx
call   10b0 <swap@plt>
mov    -0xa0(%rbp),%rsi
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%edx
call   10a0 <path_cost@plt>
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x98(%rbp),%xmm1
ff
movsd  -0x38(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    165a <_genetic_algorithm+0x4ba>
mov    -0xb0(%rbp),%rsi
mov    -0xa0(%rbp),%rdi
mov    -0x1c(%rbp),%edx
call   1080 <copy_vet@plt>
movsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x38(%rbp)
mov    -0xa8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <copy_child@plt>
mov    -0xa0(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <copy_child@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x989680,-0x20(%rbp)
jb     12d1 <_genetic_algorithm+0x131>
movl   $0x0,-0x74(%rbp)
mov    -0x74(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    16d3 <_genetic_algorithm+0x533>
mov    -0xb0(%rbp),%rax
movslq -0x74(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0x942(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    169d <_genetic_algorithm+0x4fd>
mov    -0xb0(%rbp),%rax
mov    (%rax),%esi
movsd  -0x38(%rbp),%xmm0
lea    0x91d(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x40(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_genetic_algorithm>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %ecx,%r14d
mov    %rdx,%rbx
mov    %rsi,%r12
mov    %rdi,%rsi
mov    %rdi,-0x78(%rbp)
mov    %rdx,%rdi
mov    %ecx,%edx
call   10c0 <path_cost@plt>
movsd  %xmm0,-0x48(%rbp)
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r14d,%edx
call   10c0 <path_cost@plt>
movsd  %xmm0,-0x30(%rbp)
mov    %r14d,%r13d
mov    %rsp,%r15
lea    0xf(,%r13,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
mov    %rsp,%rcx
sub    %rax,%rcx
mov    %rcx,-0x50(%rbp)
mov    %rcx,%rsp
mov    %rsp,%rcx
sub    %rax,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rcx,%rsp
xor    %edi,%edi
call   1090 <time@plt>
mov    %eax,%edi
call   1070 <srand@plt>
movsd  -0x48(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
ucomisd %xmm0,%xmm1
mov    %r12,-0x60(%rbp)
mov    %r12,%rdi
mov    -0x78(%rbp),%r12
cmova  %r12,%rdi
minsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    %r15,-0x68(%rbp)
mov    %r15,%rsi
mov    %r14d,%edx
call   10a0 <copy_vet@plt>
mov    %r14d,%edi
call   10b0 <partition_size@plt>
mov    %r14d,%ecx
mov    %rax,-0x88(%rbp)
sub    %eax,%ecx
mov    %ecx,-0x6c(%rbp)
lea    0x0(,%r13,4),%rax
mov    %rax,-0x80(%rbp)
xor    %eax,%eax
mov    %rbx,-0x58(%rbp)
jmp    12e8 <_genetic_algorithm+0x128>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  %xmm1,-0x48(%rbp)
mov    -0x50(%rbp),%rdi
mov    %r12,%rsi
mov    %r14d,%edx
call   1030 <copy_child@plt>
mov    %rbx,%rdi
mov    -0x60(%rbp),%rsi
mov    %r14d,%edx
call   1030 <copy_child@plt>
mov    -0x70(%rbp),%eax
add    $0x1,%eax
cmp    $0x989680,%eax
mov    -0x58(%rbp),%rbx
je     1566 <_genetic_algorithm+0x3a6>
mov    %eax,-0x70(%rbp)
test   %r14d,%r14d
jle    1316 <_genetic_algorithm+0x156>
mov    -0x40(%rbp),%rdi
mov    $0xff,%esi
mov    -0x80(%rbp),%r15
mov    %r15,%rdx
call   1060 <memset@plt>
mov    -0x50(%rbp),%rdi
mov    $0xff,%esi
mov    %r15,%rdx
call   1060 <memset@plt>
xor    %eax,%eax
call   10e0 <rand@plt>
cltd
idivl  -0x6c(%rbp)
mov    -0x88(%rbp),%rax
lea    (%rdx,%rax,1),%ecx
test   %eax,%eax
mov    %rdx,-0x30(%rbp)
mov    %ecx,-0x34(%rbp)
jle    1386 <_genetic_algorithm+0x1c6>
movslq %edx,%rbx
mov    -0x50(%rbp),%rax
lea    (%rax,%rbx,4),%rdi
lea    0x1(%rdx),%eax
cmp    %eax,%ecx
cmovg  %ecx,%eax
lea    (%r12,%rbx,4),%rsi
mov    %edx,%ecx
not    %ecx
add    %eax,%ecx
lea    0x4(,%rcx,4),%r15
mov    %r15,%rdx
call   1080 <memcpy@plt>
mov    -0x40(%rbp),%rax
lea    (%rax,%rbx,4),%rdi
mov    -0x60(%rbp),%rax
lea    (%rax,%rbx,4),%rsi
mov    -0x58(%rbp),%rbx
mov    %r15,%rdx
call   1080 <memcpy@plt>
mov    -0x34(%rbp),%ecx
mov    -0x30(%rbp),%rdx
test   %r14d,%r14d
mov    -0x40(%rbp),%rdi
jle    14a0 <_genetic_algorithm+0x2e0>
xor    %r15d,%r15d
jmp    13a9 <_genetic_algorithm+0x1e9>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r15d
cmp    %r14d,%r15d
jge    1420 <_genetic_algorithm+0x260>
cmp    %edx,%r15d
jl     13b3 <_genetic_algorithm+0x1f3>
cmp    %ecx,%r15d
jl     13a0 <_genetic_algorithm+0x1e0>
mov    %r12,%rbx
xor    %r12d,%r12d
nopl   0x0(%rax)
mov    -0x60(%rbp),%rax
mov    (%rax,%r12,4),%esi
mov    -0x50(%rbp),%rdi
mov    %r14d,%edx
call   1040 <is_inside@plt>
test   %rax,%rax
jne    13f0 <_genetic_algorithm+0x230>
add    $0x1,%r12
cmp    %r12,%r13
jne    13c0 <_genetic_algorithm+0x200>
jmp    1406 <_genetic_algorithm+0x246>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    -0x60(%rbp),%rax
mov    (%rax,%r12,4),%eax
movslq %r15d,%rcx
mov    -0x50(%rbp),%rdx
mov    %eax,(%rdx,%rcx,4)
add    $0x1,%r15d
mov    %rbx,%r12
mov    -0x40(%rbp),%rdi
mov    -0x58(%rbp),%rbx
mov    -0x30(%rbp),%rdx
mov    -0x34(%rbp),%ecx
jmp    13a4 <_genetic_algorithm+0x1e4>
nopw   0x0(%rax,%rax,1)
test   %r14d,%r14d
jle    14a0 <_genetic_algorithm+0x2e0>
xor    %r15d,%r15d
jmp    1439 <_genetic_algorithm+0x279>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r15d
cmp    %r14d,%r15d
jge    14a0 <_genetic_algorithm+0x2e0>
cmp    %edx,%r15d
jl     1443 <_genetic_algorithm+0x283>
cmp    %ecx,%r15d
jl     1430 <_genetic_algorithm+0x270>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r12,%rbx,4),%esi
mov    %r14d,%edx
call   1040 <is_inside@plt>
test   %rax,%rax
jne    1470 <_genetic_algorithm+0x2b0>
add    $0x1,%rbx
cmp    %rbx,%r13
mov    -0x40(%rbp),%rdi
jne    1450 <_genetic_algorithm+0x290>
jmp    1482 <_genetic_algorithm+0x2c2>
mov    (%r12,%rbx,4),%eax
movslq %r15d,%rcx
mov    -0x40(%rbp),%rdi
mov    %eax,(%rdi,%rcx,4)
add    $0x1,%r15d
mov    -0x58(%rbp),%rbx
mov    -0x30(%rbp),%rdx
mov    -0x34(%rbp),%ecx
cmp    %r14d,%r15d
jl     1439 <_genetic_algorithm+0x279>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   10e0 <rand@plt>
cltd
idiv   %r14d
mov    %edx,-0x30(%rbp)
xor    %eax,%eax
call   10e0 <rand@plt>
cltd
idiv   %r14d
mov    %rbx,%r15
mov    -0x50(%rbp),%rbx
mov    %rbx,%rdi
mov    -0x30(%rbp),%esi
call   10d0 <swap@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
call   10c0 <path_cost@plt>
movsd  -0x48(%rbp),%xmm1
ucomisd %xmm0,%xmm1
jbe    14fe <_genetic_algorithm+0x33e>
mov    -0x50(%rbp),%rdi
mov    -0x68(%rbp),%rsi
mov    %r14d,%edx
movsd  %xmm0,-0x30(%rbp)
call   10a0 <copy_vet@plt>
movsd  -0x30(%rbp),%xmm1
movsd  %xmm1,-0x48(%rbp)
xor    %eax,%eax
call   10e0 <rand@plt>
cltd
idiv   %r14d
mov    %edx,-0x30(%rbp)
xor    %eax,%eax
call   10e0 <rand@plt>
cltd
idiv   %r14d
mov    -0x40(%rbp),%rbx
mov    %rbx,%rdi
mov    -0x30(%rbp),%esi
call   10d0 <swap@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
call   10c0 <path_cost@plt>
movsd  -0x48(%rbp),%xmm1
ucomisd %xmm0,%xmm1
jbe    12b0 <_genetic_algorithm+0xf0>
mov    %rbx,%rdi
mov    -0x68(%rbp),%rsi
mov    %r14d,%edx
movsd  %xmm0,-0x30(%rbp)
call   10a0 <copy_vet@plt>
movsd  -0x30(%rbp),%xmm1
jmp    12b0 <_genetic_algorithm+0xf0>
test   %r14d,%r14d
mov    -0x68(%rbp),%r15
jle    1597 <_genetic_algorithm+0x3d7>
lea    0xa8a(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1580 <_genetic_algorithm+0x3c0>
mov    (%r15),%esi
lea    0xa64(%rip),%rdi
movsd  -0x48(%rbp),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%d\0A\0A\00"
@.str.1 = [13 x i8] c"%d\0A\0A%.f\0A\0A*\0A\0A\00"
define void @_genetic_algorithm(i32* %0, i32* %1, double** %2, i32 %3) {
%5 = tail call double @path_cost(double** %2, i32* %0, i32 %3)
%6 = tail call double @path_cost(double** %2, i32* %1, i32 %3)
%7 = zext i32 %3 to i64
%8 = alloca i32, i64 %7
%9 = alloca i32, i64 %7
%10 = bitcast i32* %9 to i8*
%11 = alloca i32, i64 %7
%12 = bitcast i32* %11 to i8*
%13 = tail call i32 @time(i8* null)
%14 = tail call i32 @srand(i32 %13)
%15 = fcmp olt double %5, %6
%16 = select i1 %15, i32* %0, i32* %1
%17 = select i1 %15, double %5, double %6
%18 = call i32 @copy_vet(i32* %16, i32* %8, i32 %3)
%19 = call i32 @partition_size(i32 %3)
%20 = icmp sgt i32 %3, 0
%21 = sub nsw i32 %3, %19
%22 = shl nuw nsw i64 %7, 2
%23 = icmp sgt i32 %19, 0
br label %24
24: ; preds = %124, %4
%25 = phi double [ %17, %4 ], [ %125, %124 ]
%26 = phi i32 [ 0, %4 ], [ %128, %124 ]
br i1 %20, label %27, label %28
27: ; preds = %24
br label %28
28: ; preds = %27, %24
%29 = call i32 (...) @rand()
%30 = srem i32 %29, %21
%31 = add i32 %30, %19
br i1 %23, label %32, label %49
32: ; preds = %28
%33 = sext i32 %30 to i64
%34 = getelementptr i32, i32* %9, i64 %33
%35 = bitcast i32* %34 to i8*
%36 = getelementptr i32, i32* %0, i64 %33
%37 = bitcast i32* %36 to i8*
%38 = add i32 %30, 1
%39 = call i32 @llvm.smax.i32(i32 %31, i32 %38)
%40 = xor i32 %30, -1
%41 = add i32 %39, %40
%42 = zext i32 %41 to i64
%43 = shl nuw nsw i64 %42, 2
%44 = add nuw nsw i64 %43, 4
%45 = getelementptr i32, i32* %11, i64 %33
%46 = bitcast i32* %45 to i8*
%47 = getelementptr i32, i32* %1, i64 %33
%48 = bitcast i32* %47 to i8*
br label %49
49: ; preds = %32, %28
br i1 %20, label %51, label %103
50: ; preds = %58
br i1 %20, label %77, label %103
51: ; preds = %49, %58
%52 = phi i32 [ %59, %58 ], [ 0, %49 ]
%53 = icmp sge i32 %52, %30
%54 = icmp slt i32 %52, %31
%55 = select i1 %53, i1 %54, i1 false
br i1 %55, label %56, label %61
56: ; preds = %51
%57 = add nsw i32 %52, 1
br label %58
58: ; preds = %74, %67, %56
%59 = phi i32 [ %57, %56 ], [ %73, %67 ], [ %52, %74 ]
%60 = icmp slt i32 %59, %3
br i1 %60, label %51, label %50
61: ; preds = %51, %74
%62 = phi i64 [ %75, %74 ], [ 0, %51 ]
%63 = getelementptr inbounds i32, i32* %1, i64 %62
%64 = load i32, i32* %63
%65 = call i64 @is_inside(i32* %9, i32 %64, i32 %3)
%66 = icmp eq i64 %65, 0
br i1 %66, label %74, label %67
67: ; preds = %61
%68 = and i64 %62, 4294967295
%69 = getelementptr inbounds i32, i32* %1, i64 %68
%70 = load i32, i32* %69
%71 = sext i32 %52 to i64
%72 = getelementptr inbounds i32, i32* %9, i64 %71
store i32 %70, i32* %72
%73 = add nsw i32 %52, 1
br label %58
74: ; preds = %61
%75 = add nuw nsw i64 %62, 1
%76 = icmp eq i64 %75, %7
br i1 %76, label %58, label %61
77: ; preds = %50, %84
%78 = phi i32 [ %85, %84 ], [ 0, %50 ]
%79 = icmp sge i32 %78, %30
%80 = icmp slt i32 %78, %31
%81 = select i1 %79, i1 %80, i1 false
br i1 %81, label %82, label %87
82: ; preds = %77
%83 = add nsw i32 %78, 1
br label %84
84: ; preds = %100, %93, %82
%85 = phi i32 [ %83, %82 ], [ %99, %93 ], [ %78, %100 ]
%86 = icmp slt i32 %85, %3
br i1 %86, label %77, label %103
87: ; preds = %77, %100
%88 = phi i64 [ %101, %100 ], [ 0, %77 ]
%89 = getelementptr inbounds i32, i32* %0, i64 %88
%90 = load i32, i32* %89
%91 = call i64 @is_inside(i32* %11, i32 %90, i32 %3)
%92 = icmp eq i64 %91, 0
br i1 %92, label %100, label %93
93: ; preds = %87
%94 = and i64 %88, 4294967295
%95 = getelementptr inbounds i32, i32* %0, i64 %94
%96 = load i32, i32* %95
%97 = sext i32 %78 to i64
%98 = getelementptr inbounds i32, i32* %11, i64 %97
store i32 %96, i32* %98
%99 = add nsw i32 %78, 1
br label %84
100: ; preds = %87
%101 = add nuw nsw i64 %88, 1
%102 = icmp eq i64 %101, %7
br i1 %102, label %84, label %87
103: ; preds = %84, %49, %50
%104 = call i32 (...) @rand()
%105 = srem i32 %104, %3
%106 = call i32 (...) @rand()
%107 = srem i32 %106, %3
%108 = call i32 @swap(i32* %9, i32 %105, i32 %107)
%109 = call double @path_cost(double** %2, i32* %9, i32 %3)
%110 = fcmp olt double %109, %25
br i1 %110, label %111, label %113
111: ; preds = %103
%112 = call i32 @copy_vet(i32* %9, i32* %8, i32 %3)
br label %113
113: ; preds = %111, %103
%114 = phi double [ %109, %111 ], [ %25, %103 ]
%115 = call i32 (...) @rand()
%116 = srem i32 %115, %3
%117 = call i32 (...) @rand()
%118 = srem i32 %117, %3
%119 = call i32 @swap(i32* %11, i32 %116, i32 %118)
%120 = call double @path_cost(double** %2, i32* %11, i32 %3)
%121 = fcmp olt double %120, %114
br i1 %121, label %122, label %124
122: ; preds = %113
%123 = call i32 @copy_vet(i32* %11, i32* %8, i32 %3)
br label %124
124: ; preds = %122, %113
%125 = phi double [ %120, %122 ], [ %114, %113 ]
%126 = call i32 @copy_child(i32* %9, i32* %0, i32 %3)
%127 = call i32 @copy_child(i32* %11, i32* %1, i32 %3)
%128 = add nuw nsw i32 %26, 1
%129 = icmp eq i32 %128, 10000000
br i1 %129, label %130, label %24
130: ; preds = %124
br i1 %20, label %131, label %138
131: ; preds = %130, %131
%132 = phi i64 [ %136, %131 ], [ 0, %130 ]
%133 = getelementptr inbounds i32, i32* %8, i64 %132
%134 = load i32, i32* %133
%135 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %134)
%136 = add nuw nsw i64 %132, 1
%137 = icmp eq i64 %136, %7
br i1 %137, label %138, label %131
138: ; preds = %131, %130
%139 = load i32, i32* %8
%140 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %139, double %125)
ret void
}