// File: /workspace/github_c_makefile_star2_O3/skeeto[P]hash-prospector/genetic.c
// Function: main
int
main(void)
{
    int verbose = 1;
    double best = 1000.0;
    time_t best_time = time(0);
    uint64_t rng[POOL][4];
    struct gene pool[POOL];

    rng_init(rng, sizeof(rng));
    for (int i = 0; i < POOL; i++)
        gene_gen(pool + i, rng[0]);

    for (;;) {
        #pragma omp parallel for schedule(dynamic)
        for (int i = 0; i < POOL; i++) {
            if (!(pool[i].flags & FLAG_SCORED)) {
                pool[i].score = estimate_bias32(pool + i, rng[i]);
                pool[i].flags |= FLAG_SCORED;
            }
        }
        for (int i = 0; i < POOL; i++) {
            if (!(pool[i].flags & FLAG_EXACT) && pool[i].score < THRESHOLD) {
                pool[i].score = exact_bias32(pool + i);
                pool[i].flags |= FLAG_EXACT;
            }
        }

        qsort(pool, POOL, sizeof(*pool), cmp);
        if (verbose) {
            for (int i = 0; i < POOL; i++) {
                if (!(pool[i].flags & FLAG_PRINTED) &&
                      pool[i].score < DONTCARE) {
                    gene_print(pool + i, stdout);
                    printf(" = %.17g\n", pool[i].score);
                    pool[i].flags |= FLAG_PRINTED;
                }
            }
        }

        time_t now = time(0);
        if (pool[0].score < best) {
            best = pool[0].score;
            best_time = now;
        } else if (now - best_time > RESETMINS * 60) {
            best = 1000.0;
            best_time = now;
            for (int i = 0; i < POOL; i++)
                gene_gen(pool + i, rng[0]);
        }

        int c = POOL / 4;
        for (int a = 0; c < POOL && a < POOL / 4; a++)
            for (int b = a + 1; c < POOL && b < POOL / 4; b++)
                gene_cross(pool + c++, pool + a, pool + b, rng[0]);
        undup(pool, rng[0]);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4a58, %rsp           # imm = 0x4A58
xorl %edi, %edi
callq 0x10a0
movq %rax, %rbx
leaq 0xe94(%rip), %rdi       # 0x2082
leaq 0xe9a(%rip), %rsi       # 0x208f
callq 0x10b0
testq %rax, %rax
je 0x1221
movq %rax, %r14
leaq 0x550(%rsp), %rdi
movl $0x1, %esi
movl $0x500, %edx            # imm = 0x500
movq %rax, %rcx
callq 0x1050
testq %rax, %rax
jne 0x1226
callq 0x1030
movq %r14, %rdi
callq 0x1060
xorl %r15d, %r15d
leaq 0x550(%rsp), %r14
leaq (%rsp,%r15), %rdi
addq $0x50, %rdi
movq %r14, %rsi
callq 0x1aa2
addq $0x20, %r15
cmpq $0x500, %r15            # imm = 0x500
jne 0x1239
movsd 0xdaa(%rip), %xmm0      # 0x2008
movsd %xmm0, 0x30(%rsp)
movq $0x0, 0x38(%rsp)
movq 0x38(%rsp), %rax
shlq $0x5, %rax
testb $0x1, 0x68(%rsp,%rax)
jne 0x145f
leaq (%rsp,%rax), %r14
addq $0x50, %r14
leaq (%rsp,%rax), %r12
addq $0x550, %r12            # imm = 0x550
movl $0x2000, %edx           # imm = 0x2000
leaq 0xa50(%rsp), %rdi
xorl %esi, %esi
callq 0x1080
movzwl 0x8(%r14), %eax
movl 0x10(%r14), %edi
movl 0x14(%r14), %r8d
movzwl 0xa(%r14), %edx
movq %r14, 0x48(%rsp)
movzwl 0xc(%r14), %esi
movq (%r12), %r9
movq 0x8(%r12), %r15
movq 0x10(%r12), %r10
movq %r12, 0x40(%rsp)
movq 0x18(%r12), %r11
movq $0x0, 0x10(%rsp)
leaq (%r15,%r15,4), %rcx
rolq $0x7, %rcx
movq %r9, 0x20(%rsp)
xorq %r9, %r10
movq %r10, 0x18(%rsp)
movq %r10, %r14
leal (%rcx,%rcx,8), %r10d
movl %r10d, %r9d
movl %eax, %ecx
shrl %cl, %r9d
xorq %r15, %r14
movq %r14, 0x28(%rsp)
xorl %r10d, %r9d
imull %edi, %r9d
movl %r9d, %r12d
movl %edx, %ecx
shrl %cl, %r12d
xorl %r9d, %r12d
imull %r8d, %r12d
leaq 0xa50(%rsp), %r13
xorl %r9d, %r9d
movl %r10d, %r14d
btcl %r9d, %r14d
movl %r14d, %ebp
movl %eax, %ecx
shrl %cl, %ebp
xorl %r14d, %ebp
imull %edi, %ebp
movl %ebp, %r14d
movl %edx, %ecx
shrl %cl, %r14d
xorl %ebp, %r14d
imull %r8d, %r14d
xorl %r12d, %r14d
movl %r14d, %ebp
movl %esi, %ecx
shrl %cl, %ebp
xorl %r14d, %ebp
xorl %ecx, %ecx
btl %ecx, %ebp
adcq $0x0, (%r13,%rcx,8)
incq %rcx
cmpq $0x20, %rcx
jne 0x1364
incq %r9
addq $0x100, %r13            # imm = 0x100
cmpq $0x20, %r9
jne 0x1332
xorq %r15, %r11
shlq $0x11, %r15
movq 0x20(%rsp), %r9
xorq %r11, %r9
rolq $0x2d, %r11
movq 0x18(%rsp), %r10
xorq %r15, %r10
movq 0x10(%rsp), %r14
incq %r14
movq 0x28(%rsp), %r12
movq %r12, %r15
movq %r14, 0x10(%rsp)
cmpq $0x40000, %r14          # imm = 0x40000
jne 0x12e5
movq 0x40(%rsp), %rax
movq %r12, 0x8(%rax)
movq %r9, (%rax)
movq %r10, 0x10(%rax)
movq %r11, 0x18(%rax)
xorpd %xmm0, %xmm0
leaq 0xa50(%rsp), %rax
xorl %ecx, %ecx
movq $-0x20000, %rdi         # imm = 0xFFFE0000
movsd 0xc1c(%rip), %xmm2      # 0x2010
movsd 0xc1c(%rip), %xmm3      # 0x2018
xorl %edx, %edx
movq (%rax,%rdx,8), %rsi
addq %rdi, %rsi
xorps %xmm1, %xmm1
cvtsi2sd %rsi, %xmm1
mulsd %xmm2, %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm3, %xmm1
addsd %xmm1, %xmm0
incq %rdx
cmpq $0x20, %rdx
jne 0x13fe
incq %rcx
addq $0x100, %rax            # imm = 0x100
cmpq $0x20, %rcx
jne 0x13fc
ucomisd 0xbfb(%rip), %xmm0      # 0x2038
jb 0x1445
sqrtsd %xmm0, %xmm0
jmp 0x144a
callq 0x10c0
mulsd 0xbb6(%rip), %xmm0      # 0x2008
movq 0x48(%rsp), %rax
movsd %xmm0, (%rax)
orb $0x1, 0x18(%rax)
movq 0x38(%rsp), %rcx
incq %rcx
movq %rcx, 0x38(%rsp)
cmpq $0x28, %rcx
jne 0x126d
movq $0x0, 0x18(%rsp)
movq 0x18(%rsp), %rax
shlq $0x5, %rax
testb $0x2, 0x68(%rsp,%rax)
jne 0x1683
addq %rsp, %rax
addq $0x50, %rax
movsd 0xb7e(%rip), %xmm0      # 0x2020
movq %rax, 0x28(%rsp)
ucomisd (%rax), %xmm0
jbe 0x1683
movl $0x2000, %edx           # imm = 0x2000
leaq 0xa50(%rsp), %rdi
xorl %esi, %esi
callq 0x1080
movq 0x28(%rsp), %rax
movzwl 0x8(%rax), %r12d
movl 0x10(%rax), %r14d
movl 0x14(%rax), %r15d
movzwl 0xa(%rax), %ebp
movzwl 0xc(%rax), %r13d
movl $0x8000000, %eax        # imm = 0x8000000
movq %rax, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
leaq 0x2a50(%rsp), %rdi
movl $0x2000, %edx           # imm = 0x2000
xorl %esi, %esi
callq 0x1080
leaq 0x2a50(%rsp), %rdi
movq 0x20(%rsp), %rax
shlq $0x1b, %rax
movl %eax, %esi
movl %r12d, %ecx
shrl %cl, %esi
xorl %eax, %esi
imull %r14d, %esi
movl %esi, %edx
movl %ebp, %ecx
shrl %cl, %edx
xorl %esi, %edx
imull %r15d, %edx
movq %rdi, %rsi
xorl %r11d, %r11d
movl %eax, %r8d
btcl %r11d, %r8d
movl %r8d, %r9d
movl %r12d, %ecx
shrl %cl, %r9d
xorl %r8d, %r9d
imull %r14d, %r9d
movl %r9d, %r10d
movl %ebp, %ecx
shrl %cl, %r10d
xorl %r9d, %r10d
imull %r15d, %r10d
xorl %edx, %r10d
movl %r10d, %r8d
movl %r13d, %ecx
shrl %cl, %r8d
xorl %r10d, %r8d
xorl %ecx, %ecx
btl %ecx, %r8d
adcq $0x0, (%rsi,%rcx,8)
incq %rcx
cmpq $0x20, %rcx
jne 0x156e
incq %r11
addq $0x100, %rsi            # imm = 0x100
cmpq $0x20, %r11
jne 0x1537
incq %rax
cmpq 0x10(%rsp), %rax
jne 0x1518
leaq 0xa50(%rsp), %rax
movq %rdi, %rcx
xorl %edx, %edx
movl $0x100, %r8d            # imm = 0x100
movq 0x20(%rsp), %r9
xorl %esi, %esi
movdqa (%rax,%rsi,8), %xmm0
paddq (%rcx,%rsi,8), %xmm0
movdqa %xmm0, (%rax,%rsi,8)
addq $0x2, %rsi
cmpq $0x20, %rsi
jne 0x15b8
incq %rdx
addq %r8, %rcx
addq %r8, %rax
cmpq $0x20, %rdx
jne 0x15b6
incq %r9
movq %r9, 0x20(%rsp)
addq $0x8000000, 0x10(%rsp)  # imm = 0x8000000
cmpq $0x20, %r9
jne 0x14fb
pxor %xmm0, %xmm0
leaq 0xa50(%rsp), %rax
xorl %ecx, %ecx
movsd 0xa07(%rip), %xmm2      # 0x2018
movq $-0x80000000, %rdi      # imm = 0x80000000
movsd 0xa08(%rip), %xmm3      # 0x2028
xorl %edx, %edx
movq (%rax,%rdx,8), %rsi
addq %rdi, %rsi
xorps %xmm1, %xmm1
cvtsi2sd %rsi, %xmm1
mulsd %xmm3, %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm2, %xmm1
addsd %xmm1, %xmm0
incq %rdx
cmpq $0x20, %rdx
jne 0x1622
incq %rcx
addq $0x100, %rax            # imm = 0x100
cmpq $0x20, %rcx
jne 0x1620
ucomisd 0x9d7(%rip), %xmm0      # 0x2038
jb 0x1669
sqrtsd %xmm0, %xmm0
jmp 0x166e
callq 0x10c0
mulsd 0x992(%rip), %xmm0      # 0x2008
movq 0x28(%rsp), %rax
movsd %xmm0, (%rax)
orb $0x2, 0x18(%rax)
movq 0x18(%rsp), %rcx
incq %rcx
movq %rcx, 0x18(%rsp)
cmpq $0x28, %rcx
jne 0x147f
movl $0x28, %esi
movl $0x20, %edx
leaq 0x50(%rsp), %rdi
leaq 0x4e0(%rip), %rcx       # 0x1b90
callq 0x1040
movl $0x18, %r14d
testb $0x4, 0x50(%rsp,%r14)
jne 0x1726
movsd 0x965(%rip), %xmm0      # 0x2030
ucomisd 0x38(%rsp,%r14), %xmm0
jbe 0x1726
movq 0x2905(%rip), %rax      # 0x3fe0
movq (%rax), %rdi
movswl 0x40(%rsp,%r14), %edx
movl 0x48(%rsp,%r14), %ecx
movl 0x4c(%rsp,%r14), %r9d
movswl 0x42(%rsp,%r14), %r8d
movswl 0x44(%rsp,%r14), %eax
movl %eax, (%rsp)
leaq 0x98e(%rip), %rsi       # 0x2092
xorl %eax, %eax
callq 0x1090
movsd 0x38(%rsp,%r14), %xmm0
leaq 0x95f(%rip), %rdi       # 0x2078
movb $0x1, %al
callq 0x1070
orb $0x4, 0x50(%rsp,%r14)
addq $0x20, %r14
cmpq $0x518, %r14            # imm = 0x518
jne 0x16bb
xorl %edi, %edi
callq 0x10a0
movq %rax, %r12
movsd 0x50(%rsp), %xmm0
movsd 0x30(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x1754
movq %r12, %rbx
jmp 0x1791
movq %r12, %rax
subq %rbx, %rax
cmpq $0x1519, %rax           # imm = 0x1519
jl 0x1797
xorl %ebx, %ebx
leaq (%rsp,%rbx), %rdi
addq $0x50, %rdi
leaq 0x550(%rsp), %rsi
callq 0x1aa2
addq $0x20, %rbx
cmpq $0x500, %rbx            # imm = 0x500
jne 0x1764
movq %r12, %rbx
movsd 0x877(%rip), %xmm0      # 0x2008
movsd %xmm0, 0x30(%rsp)
movq 0x550(%rsp), %rsi
movq 0x558(%rsp), %r8
movq 0x560(%rsp), %rdi
movl $0xa, %r14d
movl $0x1, %r10d
movl $0x34, %ecx
movq 0x568(%rsp), %r9
xorl %edx, %edx
cmpq $0x8, %rdx
ja 0x18b4
leaq 0x1(%rdx), %rax
movq %rax, 0x10(%rsp)
movq %rdx, %r11
shlq $0x5, %r11
addq %rsp, %r11
addq $0x50, %r11
movslq %r14d, %rbp
movq %rbp, %r15
shlq $0x5, %r15
orq $0x18, %r15
leaq 0x50(%rsp), %r12
movq %r10, %rax
leaq (%r8,%r8,4), %r14
movapd (%r11), %xmm0
movapd 0x10(%r11), %xmm1
movapd %xmm1, -0x8(%r12,%r15)
movapd %xmm0, -0x18(%r12,%r15)
btq $0x3a, %r14
jb 0x183b
movl -0x4(%r12,%rcx), %r14d
movl %r14d, -0x8(%r12,%r15)
movzwl -0xa(%r12,%rcx), %r14d
movw %r14w, -0xe(%r12,%r15)
movq %r8, %r14
shlq $0x11, %r14
xorq %rsi, %rdi
xorq %r8, %r9
xorq %rdi, %r8
xorq %r9, %rsi
rolq $0x2d, %r9
xorq %r14, %rdi
movl (%r12,%rcx), %r14d
movl %r14d, -0x4(%r12,%r15)
movzwl -0x8(%r12,%rcx), %r14d
movw %r14w, -0xc(%r12,%r15)
movl $0x0, (%r12,%r15)
leaq 0x1(%rbp), %r14
cmpq $0x26, %rbp
jg 0x1894
leaq 0x1(%rax), %r13
addq $0x20, %r12
movq %r14, %rbp
cmpq $0x9, %rax
movq %r13, %rax
jb 0x1801
leaq -0x1(%r14), %r11
cmpq $0x26, %r11
jg 0x18b4
incq %r10
addq $0x20, %rcx
cmpq $0x9, %rdx
movq 0x10(%rsp), %rdx
jb 0x17ca
movl $0x27, %eax
movq %rax, 0x20(%rsp)
leaq 0x78(%rsp), %rax
movq %rax, 0x18(%rsp)
movq $0x0, 0x10(%rsp)
cmpq $0x26, 0x10(%rsp)
ja 0x1a5b
movq 0x10(%rsp), %rax
shlq $0x5, %rax
leaq (%rsp,%rax), %r13
addq $0x50, %r13
movq 0x18(%rsp), %rbp
movq 0x20(%rsp), %r10
movzwl 0x8(%r13), %r14d
cmpw (%rbp), %r14w
jne 0x1a4e
movzwl 0xa(%r13), %r15d
cmpw 0x2(%rbp), %r15w
jne 0x1a4e
movzwl 0xc(%r13), %r11d
cmpw 0x4(%rbp), %r11w
jne 0x1a4e
movl 0x10(%r13), %r12d
cmpl 0x8(%rbp), %r12d
jne 0x1a4e
movl 0x14(%r13), %eax
movq %rax, 0x28(%rsp)
cmpl 0xc(%rbp), %eax
jne 0x1a4e
leaq (%r8,%r8,4), %rax
rolq $0x7, %rax
leaq (%rax,%rax,8), %rcx
movq %rcx, %rax
movabsq $-0x3333333333333333, %rdx # imm = 0xCCCCCCCCCCCCCCCD
mulq %rdx
shrq $0x2, %rdx
leaq (%rdx,%rdx,4), %rax
movq %rcx, %rdx
subq %rax, %rdx
shrq $0x3, %rcx
leaq 0x6c3(%rip), %rax       # 0x2040
movslq (%rax,%rdx,4), %rax
leaq 0x6b8(%rip), %rdx       # 0x2040
addq %rdx, %rax
jmpq *%rax
movq %rcx, %rax
movabsq $0x2aaaaaaaaaaaaaab, %rdx # imm = 0x2AAAAAAAAAAAAAAB
mulq %rdx
addl %edx, %edx
leal (%rdx,%rdx,2), %eax
subl %eax, %ecx
leaq 0x6b5(%rip), %rax       # 0x2060
addw (%rax,%rcx,4), %r14w
movw %r14w, (%rbp)
jmp 0x1a2d
movzwl %cx, %eax
movq 0x28(%rsp), %rcx
addl %ecx, %eax
addl $0xffff8000, %eax       # imm = 0xFFFF8000
movl %eax, 0xc(%rbp)
jmp 0x1a2d
movq %rcx, %rax
movabsq $0x2aaaaaaaaaaaaaab, %rdx # imm = 0x2AAAAAAAAAAAAAAB
mulq %rdx
addl %edx, %edx
leal (%rdx,%rdx,2), %eax
subl %eax, %ecx
leaq 0x677(%rip), %rax       # 0x2060
addw (%rax,%rcx,4), %r11w
movw %r11w, 0x4(%rbp)
jmp 0x1a2d
movzwl %cx, %eax
addl %r12d, %eax
addl $0xffff8000, %eax       # imm = 0xFFFF8000
movl %eax, 0x8(%rbp)
jmp 0x1a2d
movq %rcx, %rax
movabsq $0x2aaaaaaaaaaaaaab, %rdx # imm = 0x2AAAAAAAAAAAAAAB
mulq %rdx
addl %edx, %edx
leal (%rdx,%rdx,2), %eax
subl %eax, %ecx
leaq 0x63d(%rip), %rax       # 0x2060
addw (%rax,%rcx,4), %r15w
movw %r15w, 0x2(%rbp)
movq %r8, %rax
shlq $0x11, %rax
xorq %rsi, %rdi
xorq %r8, %r9
xorq %rdi, %r8
xorq %r9, %rsi
xorq %rax, %rdi
rolq $0x2d, %r9
movl $0x0, 0x10(%rbp)
addq $0x20, %rbp
decq %r10
jne 0x18f8
movq 0x10(%rsp), %rcx
incq %rcx
decq 0x20(%rsp)
addq $0x20, 0x18(%rsp)
movq %rcx, 0x10(%rsp)
cmpq $0x28, %rcx
jne 0x18d1
movq %r8, 0x558(%rsp)
movq %rsi, 0x550(%rsp)
movq %rdi, 0x560(%rsp)
movq %r9, 0x568(%rsp)
jmp 0x1264