LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/Carben-dev[P]ext2fs-simple-utilities/ext2_utils.c
// Function: restore_block_bitmap
int restore_block_bitmap(int block_num) {
    block_num++;
    
    unsigned char *ptr;
    int in_which_byte;
    int off;
    
    in_which_byte = block_num/8;
    if (block_num%8) {
        in_which_byte++;
        off = block_num%8;
    } else {
        off = 8;
    }
    
    
    ptr = block_bitmap + (in_which_byte - 1);
    
    // check if in use
    if ((*ptr)>>(off - 1) & 1) {
        return -1;
    }
    
    // mark it back to used
    
    *ptr = *ptr | (1<<(off - 1));
    
    //update superblock and gdt
    gdt->bg_free_blocks_count--;
    sb->s_free_blocks_count--;
    
    return 0;
    
}

// Assembly:
leal 0x1(%rdi), %eax
pushq $0x8
popq %rcx
cltd
idivl %ecx
movl %edx, %ecx
subl $0x1, %ecx
sbbl $0x0, %eax
pushq $0x1
popq %rdi
shll %cl, %edi
cmpl $0x1, %edx
leaq 0x3325(%rip), %rcx      # 0x50d0
movq (%rcx), %rcx
cltq
movzbl (%rcx,%rax), %esi
movl $0x80, %edx
cmovael %edi, %edx
testl %esi, %edx
je 0x1dc4
pushq $-0x1
popq %rax
retq
orb %sil, %dl
movb %dl, (%rcx,%rax)
leaq 0x32f7(%rip), %rax      # 0x50c8
movq (%rax), %rax
decw 0xc(%rax)
leaq 0x32e1(%rip), %rax      # 0x50c0
movq (%rax), %rax
decl 0xc(%rax)
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/Carben-dev[P]ext2fs-simple-utilities/ext2_utils.c
// Function: write_array_into_i_block
void write_array_into_i_block(struct ext2_inode *inode,
                              int *array,
                              int array_size)
{
    int num_block_written = 0;
    int i;
    
    for (i = 0; i < 12; i++) {
        inode->i_block[i] = array[i];
        num_block_written++;
        if (num_block_written == array_size) {
            return;
        }
    }
    
    // If reach here, write into indirect_block
    // allocate a space for indirect_block
    int indirect_block_num = dalloc();
    if (indirect_block_num < 0) {
        exit(ENOSPC);
    }
    inode->i_block[12] = indirect_block_num;
    inode->i_blocks += 2;
    
    // Since disk size is 128kb, only consider the cases that
    //      there is only one indirect block.
    unsigned int *indirect_block = (unsigned int *)(disk + EXT2_BLOCK_SIZE * inode->i_block[12]);
    for (i = 0; i < EXT2_BLOCK_SIZE/4; i++) {
        indirect_block[i] = array[12 + i];
        num_block_written++;
        if (num_block_written == array_size) {
            return;
        }
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
movl %edx, %eax
xorl %ecx, %ecx
cmpq $0xc, %rcx
je 0x1e12
movl (%r14,%rcx,4), %edx
movl %edx, 0x28(%r15,%rcx,4)
incq %rcx
cmpq %rcx, %rax
jne 0x1df9
jmp 0x1e4e
callq 0x1754
testl %eax, %eax
js 0x1e54
movl %eax, 0x58(%r15)
addl $0x2, 0x1c(%r15)
leaq 0x3285(%rip), %rcx      # 0x50b0
shll $0xa, %eax
addq (%rcx), %rax
addl $-0xc, %ebx
xorl %ecx, %ecx
cmpq $0x100, %rcx            # imm = 0x100
je 0x1e4e
movl 0x30(%r14,%rcx,4), %edx
movl %edx, (%rax,%rcx,4)
incq %rcx
cmpl %ecx, %ebx
jne 0x1e36
popq %rbx
popq %r14
popq %r15
retq
pushq $0x1c
popq %rdi
callq 0x1110
// File: /workspace/github_c_makefile_star2_O2/Carben-dev[P]ext2fs-simple-utilities/ext2_utils.c
// Function: ifree
void ifree(int inode_num) {
    unsigned char *ptr;
    int in_which_byte;
    int off;
    
    in_which_byte = inode_num/8;
    if (inode_num%8) {
        in_which_byte++;
        off = inode_num%8;
    } else {
        off = 8;
    }
    
    
    ptr = inode_bitmap + (in_which_byte - 1);
    *ptr = *ptr & ~(1<<(off - 1));
    
    //update superblock and gdt
    gdt->bg_free_inodes_count++;
    sb->s_free_inodes_count++;
}

// Assembly:
movl %edi, %eax
pushq $0x8
popq %rcx
cltd
idivl %ecx
movl %edx, %ecx
subl $0x1, %ecx
sbbl $0x0, %eax
pushq $0x1
popq %rsi
shll %cl, %esi
cmpl $0x1, %edx
leaq 0x325d(%rip), %rcx      # 0x50d8
movq (%rcx), %rcx
notb %sil
movzbl %sil, %edx
pushq $0x7f
popq %rsi
cmovael %edx, %esi
cltq
andb %sil, (%rcx,%rax)
leaq 0x3230(%rip), %rax      # 0x50c8
movq (%rax), %rax
incw 0xe(%rax)
leaq 0x321a(%rip), %rax      # 0x50c0
movq (%rax), %rax
incl 0x10(%rax)
retq
// File: /workspace/github_c_makefile_star2_O2/Carben-dev[P]ext2fs-simple-utilities/ext2_utils.c
// Function: dfree
void dfree(int block_num) {
    block_num++;
    
    unsigned char *ptr;
    int in_which_byte;
    int off;
    
    in_which_byte = block_num/8;
    if (block_num%8) {
        in_which_byte++;
        off = block_num%8;
    } else {
        off = 8;
    }
    
    
    ptr = block_bitmap + in_which_byte - 1;
    *ptr = *ptr & ~(1<<(off - 1));
    
    //update superblock and gdt
    gdt->bg_free_blocks_count++;
    sb->s_free_blocks_count++;
}

// Assembly:
leal 0x1(%rdi), %eax
pushq $0x8
popq %rcx
cltd
idivl %ecx
movl %edx, %ecx
addl $-0x1, %ecx
adcl $0x0, %eax
pushq $0x1
popq %rsi
shll %cl, %esi
addl $-0x1, %edx
leaq 0x3203(%rip), %rcx      # 0x50d0
movq (%rcx), %rcx
notb %sil
movzbl %sil, %edx
pushq $0x7f
popq %rsi
cmovbl %edx, %esi
cltq
andb %sil, -0x1(%rcx,%rax)
leaq 0x31dd(%rip), %rax      # 0x50c8
movq (%rax), %rax
incw 0xc(%rax)
leaq 0x31c7(%rip), %rax      # 0x50c0
movq (%rax), %rax
incl 0xc(%rax)
retq
// File: /workspace/github_c_makefile_star2_O2/Carben-dev[P]ext2fs-simple-utilities/ext2_utils.c
// Function: count_inode_bitmap
int count_inode_bitmap() {
    unsigned char *inode_bitmap_ptr;
    int curr_byte = 0;
    int vaild_byte_count = sb->s_inodes_count/8;
    int result = 0;
    int i;
    
    while (curr_byte < vaild_byte_count) {
        inode_bitmap_ptr = inode_bitmap + curr_byte;
        for (i = 0; i < 8; i++) {
            if (!(*inode_bitmap_ptr>>i & 1)) {
                result++;
            }
            
        }
        curr_byte++;
    }
    
    return result;
}

// Assembly:
leaq 0x31b9(%rip), %rax      # 0x50c0
movq (%rax), %rax
movl (%rax), %ecx
shrl $0x3, %ecx
leaq 0x31c2(%rip), %rax      # 0x50d8
movq (%rax), %rdx
xorl %esi, %esi
xorl %eax, %eax
cmpq %rcx, %rsi
je 0x1f42
movzbl (%rdx,%rsi), %edi
notl %edi
xorl %r8d, %r8d
cmpl $0x8, %r8d
je 0x1f3d
btl %r8d, %edi
adcl $0x0, %eax
incl %r8d
jmp 0x1f2b
incq %rsi
jmp 0x1f1d
retq
// File: /workspace/github_c_makefile_star2_O2/Carben-dev[P]ext2fs-simple-utilities/ext2_utils.c
// Function: count_block_bitmap
int count_block_bitmap() {
    unsigned char *block_bitmap_ptr;
    int curr_byte = 0;
    int vaild_byte_count = sb->s_blocks_count/8;
    int result = 0;
    int i;
    
    while (curr_byte < vaild_byte_count) {
        block_bitmap_ptr = block_bitmap + curr_byte;
        for (i = 0; i < 8; i++) {
            if (!(*block_bitmap_ptr>>i & 1)){
                result++;
            }
            
        }
        curr_byte++;
    }
    
    return result;
}

// Assembly:
leaq 0x3176(%rip), %rax      # 0x50c0
movq (%rax), %rax
movl 0x4(%rax), %ecx
shrl $0x3, %ecx
leaq 0x3176(%rip), %rax      # 0x50d0
movq (%rax), %rdx
xorl %esi, %esi
xorl %eax, %eax
cmpq %rcx, %rsi
je 0x1f86
movzbl (%rdx,%rsi), %edi
notl %edi
xorl %r8d, %r8d
cmpl $0x8, %r8d
je 0x1f81
btl %r8d, %edi
adcl $0x0, %eax
incl %r8d
jmp 0x1f6f
incq %rsi
jmp 0x1f61
retq
// File: /workspace/github_c_makefile_star2_O2/Carben-dev[P]ext2fs-simple-utilities/ext2_utils.c
// Function: cut_path
void cut_path(char *path,
              char *parent,
              char *name)
{
    int i;
    // Find out the index of the last '/' in path;
    int last_slash_index = 0;
    for (i = 0; i < strlen(path); i++) {
        if (path[i] == '/') {
            last_slash_index = i;
        }
    }
    // Set parent path
    if (last_slash_index == 0) {
        parent[0] = '/';
        parent[1] = '\0';
    } else {
        memcpy(parent, path, last_slash_index);
        parent[last_slash_index] = '\0';
    }
    // Set name
    strncpy(name, path + last_slash_index + 1, EXT2_NAME_LEN);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
callq 0x1070
xorl %edx, %edx
xorl %ecx, %ecx
cmpq %rdx, %rax
je 0x1fca
cmpb $0x2f, (%r14,%rdx)
cmovel %edx, %ecx
incq %rdx
jmp 0x1fb8
testl %ecx, %ecx
je 0x1fe4
movslq %ecx, %r12
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x10c0
movq %r12, %rax
jmp 0x1fee
movb $0x2f, (%r15)
pushq $0x1
popq %r12
xorl %eax, %eax
movb $0x0, (%r15,%r12)
leaq (%r14,%rax), %rsi
incq %rsi
movl $0xff, %edx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x1040
// File: /workspace/github_c_makefile_star2_O2/Carben-dev[P]ext2fs-simple-utilities/ext2_utils.c
// Function: copy_to_inode_datablock
int copy_to_inode_datablock(struct ext2_inode *dst_file_inode,
                            unsigned char *src_file,
                            int src_size)
{
    // allocate datablock space for cpy_file
    int dst_file_i_block_array_size = src_size/EXT2_BLOCK_SIZE;
    if (src_size%EXT2_BLOCK_SIZE) {
        dst_file_i_block_array_size++;
    }
    dst_file_inode->i_blocks = dst_file_i_block_array_size * 2; // set inode->blocks
    int *dst_file_i_block_array = malloc(sizeof(int) * dst_file_i_block_array_size);
    int i;
    for (i = 0; i < dst_file_i_block_array_size; i++) {
        dst_file_i_block_array[i] = dalloc();
        if (dst_file_i_block_array[i] < 0) {
            return ENOSPC;
        }
    }
    write_array_into_i_block(dst_file_inode, dst_file_i_block_array, dst_file_i_block_array_size);
    // do copy
    i = 0;
    while (i < dst_file_i_block_array_size) {
        unsigned char *src = src_file + EXT2_BLOCK_SIZE * i;
        unsigned char *dst = disk + EXT2_BLOCK_SIZE * dst_file_i_block_array[i];
        memcpy(dst, src, EXT2_BLOCK_SIZE);
        i++;
    }
    
    free(dst_file_i_block_array);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ecx
movq %rsi, %rbx
movl $0x400, %esi            # imm = 0x400
movl %edx, %eax
cltd
idivl %esi
movl %eax, %r12d
andl $0x3ff, %ecx            # imm = 0x3FF
cmpl $0x1, %ecx
sbbl $-0x1, %r12d
leal (%r12,%r12), %eax
movq %rdi, (%rsp)
movl %eax, 0x1c(%rdi)
movslq %r12d, %r13
leaq (,%r13,4), %rdi
callq 0x10e0
movq %rax, %r14
xorl %r15d, %r15d
testl %r13d, %r13d
movl $0x0, %r13d
cmovgl %r12d, %r13d
pushq $0x1c
popq %rbp
cmpq %r15, %r13
je 0x2084
callq 0x1754
movl %eax, (%r14,%r15,4)
incq %r15
testl %eax, %eax
jns 0x206d
jmp 0x20d1
movq (%rsp), %rdi
movq %r14, %rsi
movl %r12d, %edx
callq 0x1de8
xorl %r15d, %r15d
leaq 0x3013(%rip), %r12      # 0x50b0
cmpq %r15, %r13
je 0x20c7
movslq (%r14,%r15,4), %rdi
shlq $0xa, %rdi
addq (%r12), %rdi
movl $0x400, %edx            # imm = 0x400
movq %rbx, %rsi
callq 0x10c0
incq %r15
addq $0x400, %rbx            # imm = 0x400
jmp 0x209d
movq %r14, %rdi
callq 0x1030
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/Carben-dev[P]ext2fs-simple-utilities/ext2_utils.c
// Function: new_inode
int new_inode(unsigned short type,
              unsigned int size){
    // allocate space in inode table
    int new_inode_num = ialloc();
    if (new_inode_num < 0) {
        return ENOSPC;
    }
    struct ext2_inode *new_inode = inode_table + (new_inode_num - 1);
    
    // build dst file inode
    new_inode->i_mode           = 0x0000 | type;
    new_inode->i_uid            = 0;
    new_inode->i_size           = size;
    new_inode->i_ctime          = 0;
    new_inode->i_mtime          = 0;
    new_inode->i_dtime          = 0;
    new_inode->i_gid            = 0;
    new_inode->i_links_count    = 0;
    new_inode->i_blocks         = 0;
    new_inode->i_flags          = 0;
    // block[15]
    new_inode->osd1             = 0;
    new_inode->i_generation     = 0;
    new_inode->i_file_acl       = 0;
    new_inode->i_dir_acl        = 0;
    // padding
    memset(new_inode->extra, 0, 3);
    
    return new_inode_num;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %ebx
movl %edi, %ebp
callq 0x16cc
testl %eax, %eax
js 0x2136
leaq 0x2fbf(%rip), %rcx      # 0x50b8
movq (%rcx), %rcx
movl %eax, %edx
shlq $0x7, %rdx
movw %bp, -0x80(%rcx,%rdx)
andw $0x0, -0x7e(%rcx,%rdx)
movl %ebx, -0x7c(%rcx,%rdx)
andq $0x0, -0x1c(%rcx,%rdx)
andl $0x0, -0x14(%rcx,%rdx)
andw $0x0, -0xc(%rcx,%rdx)
movb $0x0, -0xa(%rcx,%rdx)
xorps %xmm0, %xmm0
movups %xmm0, -0x74(%rcx,%rdx)
movups %xmm0, -0x68(%rcx,%rdx)
jmp 0x2139
pushq $0x1c
popq %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/waynebhayes[P]SAHap/src/Genome.cpp
// Function: SAHap::Genome::Genome(SAHap::InputFile)
Genome::Genome(InputFile file)
{
	long int seed = GetFancySeed(true);
	cout << "Genome seed " << seed << endl;
	this->randomEngine = mt19937(seed);
	this->file = file;
	this->haplotypes = vector<Haplotype>(this->file.ploidy, Haplotype(this->file.index.size(), file.ploidy));
	this->range.start = 0;
	this->range.end = this->file.index.size();
	this->numberOfSites = this->file.index.size();
	this->increments = file.averageReadLength;
	this->shuffle();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x13a8, %rsp           # imm = 0x13A8
movq %rdi, %r15
xorps %xmm0, %xmm0
andl $0x0, 0x3f8(%rdi)
movups %xmm0, 0x3e8(%rdi)
andl $0x0, 0x400(%rdi)
movq %rsi, %r12
leaq 0x2368(%rdi), %rbx
leaq 0x2380(%rdi), %r14
leaq 0x23b8(%rdi), %rax
movups %xmm0, 0x2348(%rdi)
movups %xmm0, 0x2358(%rdi)
movups %xmm0, 0x2368(%rdi)
andq $0x0, 0x2378(%rdi)
movq %rax, 0x2388(%rdi)
movq $0x1, 0x2390(%rdi)
movups %xmm0, 0x2398(%rdi)
movl $0x3f800000, 0x23a8(%rdi) # imm = 0x3F800000
addq $0x23b0, %rdi           # imm = 0x23B0
movl $0x82, %edx
xorl %esi, %esi
callq 0x2140
leaq 0x2438(%r15), %r13
movq %r13, %rdi
callq 0x465e
movb $0x0, 0x37c0(%r15)
xorps %xmm1, %xmm1
movups %xmm1, 0x3bb0(%r15)
movaps 0x78f8(%rip), %xmm0     # 0xa010
movups %xmm0, 0x3bc0(%r15)
movabsq $0x3eb0c6f7a0b5ed8d, %rax # imm = 0x3EB0C6F7A0B5ED8D
movq %rax, 0x3bd0(%r15)
movups %xmm1, 0x3bd8(%r15)
movq $0x7fffffff, 0x3be8(%r15) # imm = 0x7FFFFFFF
andq $0x0, 0x3c00(%r15)
movups %xmm1, 0x3bf0(%r15)
movsd 0x7954(%rip), %xmm0     # 0xa0b0
movups %xmm0, 0x3c08(%r15)
movups %xmm1, 0x3c30(%r15)
andq $0x0, 0x3c40(%r15)
pushq $0x1
popq %rdi
callq 0x9a76
movq %rax, %rbp
movq 0xd842(%rip), %rdi      # 0xffc8
leaq 0x7a0c(%rip), %rsi      # 0xa199
callq 0x2230
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2220
movq %rax, %rdi
callq 0x20f0
leaq 0x20(%rsp), %rdi
movq %rbp, %rsi
callq 0x5a98
leaq 0x20(%rsp), %rsi
movl $0x1388, %edx           # imm = 0x1388
movq %r13, %rdi
callq 0x21f0
movq %r14, %rdi
movq %r12, %rsi
callq 0x4668
movq 0x2380(%r15), %r13
movq 0x23a0(%r15), %rsi
movl (%r12), %edx
leaq 0x20(%rsp), %rdi
callq 0x62c4
leaq 0x8(%rsp), %rdi
leaq 0x20(%rsp), %rdx
leaq 0x7(%rsp), %rcx
movq %r13, %rsi
callq 0x46e6
leaq 0x8(%rsp), %r13
movq %rbx, %rdi
movq %r13, %rsi
callq 0x5c82
movq %r13, %rdi
callq 0x473c
leaq 0x20(%rsp), %rdi
callq 0x6594
andq $0x0, 0x3be8(%r15)
movq 0x23a0(%r15), %rax
movq %rax, 0x3bf0(%r15)
movq %rax, 0x3bf8(%r15)
movq 0xa8(%r12), %rax
movq %rax, 0x3c00(%r15)
movq %r15, %rdi
callq 0x28ac
addq $0x13a8, %rsp           # imm = 0x13A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r12
leaq 0x20(%rsp), %rdi
callq 0x6594
jmp 0x2885
jmp 0x2882
jmp 0x2882
movq %rax, %r12
jmp 0x2894
movq %rax, %r12
addq $0x3c30, %r15           # imm = 0x3C30
movq %r15, %rdi
callq 0x5b38
movq %r14, %rdi
callq 0x475e
movq %rbx, %rdi
callq 0x473c
movq %r12, %rdi
callq 0x2400
// File: /workspace/github_c_makefile_star2_O2/waynebhayes[P]SAHap/src/Genome.cpp
// Function: SAHap::Genome::shuffle()
void Genome::shuffle() {
	uniform_int_distribution<size_t> distribution(0, this->haplotypes.size() - 1);

	this->maxIterations = this->haplotypes[0].size() * 100;

	if (this->initialized) {
		auto ploidy = this->haplotypes.size();
		auto length = this->haplotypes[0].size();
		this->haplotypes.clear();
		this->haplotypes = vector<Haplotype>(ploidy, Haplotype(length, ploidy));
	}

	for (auto& r : this->file.reads) {
		this->haplotypes[distribution(this->randomEngine)].add(&r);
	}

	this->initialized = true;

	// for (auto& ch : this->haplotypes) {
	// 	cout << ch << endl;
	// }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movq %rdi, %rbx
leaq 0x2368(%rdi), %r14
movq 0x2368(%rdi), %rdi
movq 0x2370(%rbx), %rax
subq %rdi, %rax
movl $0xf8, %r15d
cqto
idivq %r15
decq %rax
andq $0x0, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x6632
imulq $0x64, %rax, %rax
movq %rax, 0x3bd8(%rbx)
cmpb $0x1, 0x37c0(%rbx)
jne 0x297d
movq 0x2368(%rbx), %rdi
movq 0x2370(%rbx), %rax
subq %rdi, %rax
cqto
idivq %r15
movq %rax, %r15
callq 0x6632
movq %rax, %r12
movq %r14, %rdi
callq 0x4796
leaq 0x30(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
movl %r15d, %edx
callq 0x62c4
leaq 0x18(%rsp), %rdi
leaq 0x7(%rsp), %rcx
movq %r15, %rsi
movq %r13, %rdx
callq 0x46e6
leaq 0x18(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x5c82
movq %r15, %rdi
callq 0x473c
leaq 0x30(%rsp), %rdi
callq 0x6594
movq 0x23d8(%rbx), %r15
movq 0x23e0(%rbx), %rbp
leaq 0x2438(%rbx), %r12
leaq 0x8(%rsp), %r13
cmpq %rbp, %r15
je 0x29bf
movq %r13, %rdi
movq %r12, %rsi
callq 0x479e
imulq $0xf8, %rax, %rdi
addq (%r14), %rdi
movq %r15, %rsi
callq 0x6986
addq $0x30, %r15
jmp 0x2997
movb $0x1, 0x37c0(%rbx)
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x6594
movq %rbx, %rdi
callq 0x2400
nop
// File: /workspace/github_c_makefile_star2_O2/waynebhayes[P]SAHap/src/Genome.cpp
// Function: SAHap::Genome::mec()
dnaweight_t Genome::mec() {
	dnaweight_t out = 0;
	for (size_t i = 0; i < haplotypes.size(); i++) {
		out = out + haplotypes[i].mec();
	}

	return out;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorpd %xmm0, %xmm0
xorl %r14d, %r14d
movl $0xf8, %r15d
xorl %r12d, %r12d
movq 0x2368(%rbx), %rdi
movq 0x2370(%rbx), %rax
subq %rdi, %rax
cqto
idivq %r15
cmpq %rax, %r12
jae 0x2a7c
addq %r14, %rdi
movsd %xmm0, (%rsp)
callq 0x6640
movsd (%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
movsd (%rsp), %xmm0
incq %r12
addq $0xf8, %r14
jmp 0x2a35
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/waynebhayes[P]SAHap/src/Genome.cpp
// Function: SAHap::Genome::windowMEC()
dnaweight_t Genome::windowMEC() { 
	dnaweight_t out = 0;
	for (size_t i = 0; i < haplotypes.size(); i++) {
		assert(haplotypes[i].windowMec()>=0);
		out += haplotypes[i].windowMec();
		assert(out>=0);
	}
	return out;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
pushq $-0x1
popq %r15
xorl %r14d, %r14d
movl $0xf8, %r12d
xorpd %xmm0, %xmm0
movq 0x2368(%rbx), %rdi
movq 0x2370(%rbx), %rax
subq %rdi, %rax
cqto
idivq %r12
incq %r15
cmpq %rax, %r15
jae 0x2b26
movsd %xmm0, 0x8(%rsp)
addq %r14, %rdi
callq 0x66fe
ucomisd 0x75db(%rip), %xmm0     # 0xa0b8
jb 0x2b34
leaq (%r14,%r12), %r13
addq 0x2368(%rbx), %r14
movq %r14, %rdi
callq 0x66fe
movsd 0x8(%rsp), %xmm1
addsd %xmm0, %xmm1
movapd %xmm1, %xmm0
ucomisd 0x75b0(%rip), %xmm1     # 0xa0b8
movq %r13, %r14
jae 0x2aa9
leaq 0x76e5(%rip), %rdi      # 0xa1f9
leaq 0x76a8(%rip), %rsi      # 0xa1c3
leaq 0x76b0(%rip), %rcx      # 0xa1d2
pushq $0x4e
jmp 0x2b4b
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x766b(%rip), %rdi      # 0xa1a6
leaq 0x7681(%rip), %rsi      # 0xa1c3
leaq 0x7689(%rip), %rcx      # 0xa1d2
pushq $0x4c
popq %rdx
callq 0x2180
nop
// File: /workspace/github_c_makefile_star2_O2/waynebhayes[P]SAHap/src/Genome.cpp
// Function: SAHap::Genome::meanCoverage()
double Genome::meanCoverage() {
    double coverage = 0;
    for (size_t i = 0; i < haplotypes.size(); i++)
		coverage += this->haplotypes[i].meanCoverage();
    return coverage;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorpd %xmm0, %xmm0
xorl %r14d, %r14d
movl $0xf8, %r15d
xorl %r12d, %r12d
movq 0x2368(%rbx), %rdi
movq 0x2370(%rbx), %rax
subq %rdi, %rax
cqto
idivq %r15
cmpq %rax, %r12
jae 0x2c34
addq %r14, %rdi
movsd %xmm0, (%rsp)
callq 0x65c8
movsd (%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
movsd (%rsp), %xmm0
incq %r12
addq $0xf8, %r14
jmp 0x2bed
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/waynebhayes[P]SAHap/src/Genome.cpp
// Function: SAHap::Genome::windowTotalCoverage()
double Genome::windowTotalCoverage() {
	double coverage = 0;
	for (size_t i = 0; i < this->haplotypes.size(); i++)
		coverage += this->haplotypes[i].windowTotalCoverage();
	return coverage;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorpd %xmm0, %xmm0
xorl %r14d, %r14d
movl $0xf8, %r15d
xorl %r12d, %r12d
movq 0x2368(%rbx), %rdi
movq 0x2370(%rbx), %rax
subq %rdi, %rax
cqto
idivq %r15
cmpq %rax, %r12
jae 0x2ca2
addq %r14, %rdi
movsd %xmm0, (%rsp)
callq 0x68dc
movsd (%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
movsd (%rsp), %xmm0
incq %r12
addq $0xf8, %r14
jmp 0x2c5b
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/waynebhayes[P]SAHap/src/Genome.cpp
// Function: SAHap::Genome::windowMec()
double Genome::windowMec() {
	double out = 0;

	for (size_t i = 0; i < haplotypes.size(); i++) {
		// -logT_p(lambda_i, k_i)
#if OBJECTIVE == OBJ_MEC
		out = out + haplotypes[i].windowMec();
#elif OBJECTIVE == OBJ_Poisson
		out = out + haplotypes[i].siteCost(); // siteCost() should probably be renamed to PoissonWindowMec
#else
#error "No objective chosen"
#endif

	}

	// cout << "siteCost: " << out << endl;

	// double maxCost = this->haplotypes.size() * this->haplotypes[0].size();
	return out;// / maxCost;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorpd %xmm0, %xmm0
xorl %r14d, %r14d
movl $0xf8, %r15d
xorl %r12d, %r12d
movq 0x2368(%rbx), %rdi
movq 0x2370(%rbx), %rax
subq %rdi, %rax
cqto
idivq %r15
cmpq %rax, %r12
jae 0x2d10
addq %r14, %rdi
movsd %xmm0, (%rsp)
callq 0x66fe
movsd (%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
movsd (%rsp), %xmm0
incq %r12
addq $0xf8, %r14
jmp 0x2cc9
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/waynebhayes[P]SAHap/src/Genome.cpp
// Function: SAHap::Genome::acceptance(double, double)
double Genome::acceptance(double newScore, double curScore) {
	if (newScore < curScore) return 1;
	if (this->t == 0) return 0;
	double energyDiff = curScore - newScore;
	// cout << "Acceptance(" << energyDiff << ") = " << exp(energyDiff / this->t) << endl;

	// cout << "newScore: " << newScore << ", energyDiff: " << energyDiff << ", acceptance: " << exp(energyDiff / this->t) << endl;
	return exp(energyDiff / this->t);
}

// Assembly:
ucomisd %xmm0, %xmm1
jbe 0x2da4
movsd 0x730e(%rip), %xmm2     # 0xa0b0
jmp 0x2db8
movsd 0x3bc0(%rdi), %xmm3
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm3
jne 0x2dbd
jp 0x2dbd
movapd %xmm2, %xmm0
retq
subsd %xmm0, %xmm1
divsd %xmm3, %xmm1
movapd %xmm1, %xmm0
jmp 0x2410
// File: /workspace/github_c_makefile_star2_O2/waynebhayes[P]SAHap/src/Genome.cpp
// Function: SAHap::Genome::setParameters(double, double, unsigned long long)
void Genome::setParameters(double tInitial, double tEnd, iteration_t maxIterations) {
	if (this->curIteration) {
		// Probably warn the user in some way that the simulation is in process
	}

	this->tInitial = tInitial;
	// this->tEnd = tEnd;
	this->tDecay = -log(tEnd / this->tInitial);
	this->maxIterations = maxIterations;

	cout << "decay is " << this->tDecay << endl;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movsd %xmm0, 0x3bc8(%rdi)
divsd %xmm0, %xmm1
movapd %xmm1, %xmm0
callq 0x21e0
xorpd 0x7239(%rip), %xmm0     # 0xa040
movlpd %xmm0, 0x3bd0(%r14)
movq %rbx, 0x3bd8(%r14)
movq 0xd1aa(%rip), %rdi      # 0xffc8
leaq 0x73db(%rip), %rsi      # 0xa200
callq 0x2230
movsd 0x3bd0(%r14), %xmm0
movq %rax, %rdi
callq 0x23a0
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x20f0
// File: /workspace/github_c_makefile_star2_O2/waynebhayes[P]SAHap/src/Genome.cpp
// Function: SAHap::Genome::iteration()
void Genome::iteration() {
	auto oldScore = this->windowMec();
	// FIXME: these lines recomputes ALL the sites?? It should only incrementally compute the old and new scores at the sites touched by this read! Inefficient!
	this->move();
	auto newScore = this->windowMec();

	uniform_real_distribution<double> distribution(0, 1);
	double chanceToKeep = this->acceptance(newScore, oldScore);
	double randomIndex = distribution(this->randomEngine);

	bool isGood = newScore < oldScore;
	bool accept = randomIndex <= chanceToKeep;
	assert(!isGood || accept);

	if (isGood) {
		// always accept
	} else if (!accept) {
		// reject
		this->revertMove();
	}

	this->fAccept.record(isGood);

	if (!(isGood || oldScore == newScore)) {
		this->totalBad++;
		if (accept) {
			this->totalBadAccepted++;
		}
		this->pBad.record(chanceToKeep);
	}

#if 0
	uniform_real_distribution<double> d(0, 3);
	if (d(this->randomEngine) <= 1) {
		this->pBad.record(false);
	} else {
		this->pBad.record(true);
	}
#endif
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x30, %rsp
movq %rdi, %rbx
callq 0x2cae
movsd %xmm0, 0x8(%rsp)
movq %rbx, %rdi
callq 0x2e54
movq %rbx, %rdi
callq 0x2cae
movsd %xmm0, 0x10(%rsp)
xorps %xmm1, %xmm1
movhps 0x7072(%rip), %xmm1     # xmm1 = xmm1[0,1],mem[0,1]
leaq 0x20(%rsp), %r14
movaps %xmm1, (%r14)
movq %rbx, %rdi
movsd 0x8(%rsp), %xmm1
callq 0x2d94
movsd %xmm0, (%rsp)
leaq 0x2438(%rbx), %rsi
movq %r14, %rdi
callq 0x47a6
movapd %xmm0, %xmm1
xorl %ebp, %ebp
movsd 0x8(%rsp), %xmm0
ucomisd 0x10(%rsp), %xmm0
seta %r14b
jbe 0x308c
movsd (%rsp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x3104
movsd 0x8(%rsp), %xmm0
ucomisd 0x10(%rsp), %xmm0
movsd %xmm1, 0x18(%rsp)
ja 0x30b3
movsd (%rsp), %xmm0
ucomisd %xmm1, %xmm0
jae 0x30b3
movq %rbx, %rdi
callq 0x2fc6
movb %r14b, %bpl
movq %rbx, %rdi
movl %ebp, %esi
callq 0x3124
movsd 0x8(%rsp), %xmm0
ucomisd 0x10(%rsp), %xmm0
jae 0x30fb
incl 0x2360(%rbx)
movsd (%rsp), %xmm0
ucomisd 0x18(%rsp), %xmm0
jb 0x30e7
incl 0x2364(%rbx)
addq $0x408, %rbx            # imm = 0x408
movq %rbx, %rdi
movsd (%rsp), %xmm0
callq 0x319e
addq $0x30, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x7144(%rip), %rdi      # 0xa24f
leaq 0x70b1(%rip), %rsi      # 0xa1c3
leaq 0x7148(%rip), %rcx      # 0xa261
movl $0x119, %edx            # imm = 0x119
callq 0x2180
nop
// File: /workspace/github_c_makefile_star2_O2/waynebhayes[P]SAHap/src/Genome.cpp
// Function: SAHap::Genome::AcceptBuffer::record(char)
void Genome::AcceptBuffer::record(char good) {
	size_t next = this->pos == LENGTH - 1 ? 0 : this->pos + 1;
	assert(good == 0 || good == 1);
	if (this->len == LENGTH) {
		this->sum -= this->buffer[next]; // the next one is the first one
	} else {
		this->len++;
	}
	this->pos = next;
	this->buffer[next] = good;
	this->sum += good;
}

// Assembly:
movq 0x3f0(%rdi), %rcx
leaq 0x1(%rcx), %rdx
xorl %eax, %eax
cmpq $0x3e7, %rcx            # imm = 0x3E7
cmovneq %rdx, %rax
cmpb $0x2, %sil
jae 0x317e
movq 0x3e8(%rdi), %rcx
cmpq $0x3e8, %rcx            # imm = 0x3E8
jne 0x315e
movsbl (%rdi,%rax), %ecx
subl %ecx, 0x3f8(%rdi)
jmp 0x3168
incq %rcx
movq %rcx, 0x3e8(%rdi)
movzbl %sil, %ecx
movq %rax, 0x3f0(%rdi)
movb %sil, (%rdi,%rax)
addl %ecx, 0x3f8(%rdi)
retq
pushq %rax
leaq 0x73d4(%rip), %rdi      # 0xa55a
leaq 0x7036(%rip), %rsi      # 0xa1c3
leaq 0x73dd(%rip), %rcx      # 0xa571
movl $0x201, %edx            # imm = 0x201
callq 0x2180
// File: /workspace/github_c_makefile_star2_O2/waynebhayes[P]SAHap/src/Genome.cpp
// Function: SAHap::Genome::PbadBuffer::record(double)
void Genome::PbadBuffer::record(double acceptance) {
	size_t next = this->pos == LENGTH - 1 ? 0 : this->pos + 1;
	assert(acceptance >= 0.0 && acceptance <= 1.0);
	if (this->len == LENGTH) {
		this->sum -= this->buffer[next]; // the next one is the first one
	} else {
		this->len++;
	}
	this->pos = next;
	this->buffer[next] = acceptance;
	this->sum += acceptance;
	if(this->sum < 0) this->sum = 0;
}

// Assembly:
movq 0x1f48(%rdi), %rcx
leaq 0x1(%rcx), %rdx
xorl %eax, %eax
cmpq $0x3e7, %rcx            # imm = 0x3E7
cmovneq %rdx, %rax
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x3224
movsd 0x6ee8(%rip), %xmm1     # 0xa0b0
ucomisd %xmm0, %xmm1
jb 0x3224
movq 0x1f40(%rdi), %rcx
cmpq $0x3e8, %rcx            # imm = 0x3E8
jne 0x31f5
movsd 0x1f50(%rdi), %xmm1
subsd (%rdi,%rax,8), %xmm1
movsd %xmm1, 0x1f50(%rdi)
jmp 0x31ff
incq %rcx
movq %rcx, 0x1f40(%rdi)
movq %rax, 0x1f48(%rdi)
movsd %xmm0, (%rdi,%rax,8)
addsd 0x1f50(%rdi), %xmm0
xorpd %xmm1, %xmm1
maxsd %xmm0, %xmm1
movsd %xmm1, 0x1f50(%rdi)
retq
pushq %rax
leaq 0x72d8(%rip), %rdi      # 0xa504
leaq 0x6f90(%rip), %rsi      # 0xa1c3
leaq 0x72f1(%rip), %rcx      # 0xa52b
movl $0x1ee, %edx            # imm = 0x1EE
callq 0x2180
// File: /workspace/github_c_makefile_star2_O2/waynebhayes[P]SAHap/src/Genome.cpp
// Function: SAHap::Genome::getTemperature(unsigned long long)
double Genome::getTemperature(iteration_t iteration) {
	double s = iteration / (double)this->maxIterations;
	double temp = (double)this->tInitial * exp(-this->tDecay * s);

	// cout << iteration << ": " << temp << endl;
	return temp;
}

// Assembly:
pushq %rax
movq %rsi, %xmm0
movq 0x6dce(%rip), %xmm1     # 0xa020
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x6dd2(%rip), %xmm2     # 0xa030
subpd %xmm2, %xmm0
movapd %xmm0, %xmm3
unpckhpd %xmm0, %xmm3            # xmm3 = xmm3[1],xmm0[1]
addsd %xmm0, %xmm3
movq 0x3bd8(%rdi), %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
subpd %xmm2, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
divsd %xmm1, %xmm3
movsd 0x3bc8(%rdi), %xmm0
movsd %xmm0, (%rsp)
movsd 0x3bd0(%rdi), %xmm0
xorpd 0x6d95(%rip), %xmm0     # 0xa040
mulsd %xmm3, %xmm0
callq 0x2410
mulsd (%rsp), %xmm0
popq %rax
retq
nop
// File: /workspace/github_c_makefile_star2_O2/waynebhayes[P]SAHap/src/Genome.cpp
// Function: SAHap::Genome::ResetBuffers()
void Genome::ResetBuffers() {
    for (iteration_t i = 0; i < this->fAccept.LENGTH; ++i) this->fAccept.buffer[i]=0;
    for (iteration_t i = 0; i < this->pBad.LENGTH; ++i) this->pBad.buffer[i]=0;
    this->pBad.len = this->fAccept.len = 0;
    this->pBad.pos = this->fAccept.pos = 0;
    this->pBad.sum = this->fAccept.sum = 0;
    this->totalBad = 0;
    this->totalBadAccepted = this->totalGood = 0;
}

// Assembly:
xorl %eax, %eax
cmpq $0x3e8, %rax            # imm = 0x3E8
je 0x3311
movb $0x0, (%rdi,%rax)
incq %rax
jmp 0x3300
xorl %eax, %eax
cmpq $0x3e8, %rax            # imm = 0x3E8
je 0x3329
andq $0x0, 0x408(%rdi,%rax,8)
incq %rax
jmp 0x3313
andl $0x0, 0x400(%rdi)
andl $0x0, 0x3f8(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x3e8(%rdi)
movups %xmm0, 0x2348(%rdi)
movups %xmm0, 0x2358(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O2/waynebhayes[P]SAHap/src/Genome.cpp
// Function: SAHap::Genome::createBlocks()
void Genome::createBlocks() {
	for (Read r : file.reads) {
		if (blocks.empty() || !intersects(blocks.back(), r.range))
			blocks.push_back(r.range);
		else
			blocks.back() = combineBlocks(blocks.back(), r.range);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
movq 0x23d8(%rdi), %r14
movq 0x23e0(%rdi), %rbp
leaq 0x3c30(%rdi), %r15
leaq 0x28(%rsp), %r12
leaq 0x8(%rsp), %r13
cmpq %rbp, %r14
je 0x3f60
movq %r13, %rdi
movq %r14, %rsi
callq 0x47ae
movq 0x3c38(%rbx), %rax
cmpq %rax, 0x3c30(%rbx)
je 0x3f2f
movq -0x10(%rax), %rcx
movq -0x8(%rax), %rdx
movq 0x28(%rsp), %rdi
movq 0x30(%rsp), %rsi
cmpq %rdx, %rsi
movq %rdx, %r8
cmovbq %rsi, %r8
cmpq %rdi, %rcx
movq %rdi, %r9
cmovaq %rcx, %r9
cmpq %r9, %r8
jae 0x3f3c
movq %r15, %rdi
movq %r12, %rsi
callq 0x47d6
jmp 0x3f52
cmpq %rcx, %rdi
cmovbq %rdi, %rcx
cmpq %rsi, %rdx
cmovaq %rdx, %rsi
movq %rcx, -0x10(%rax)
movq %rsi, -0x8(%rax)
movq %r13, %rdi
callq 0x5a48
addq $0x30, %r14
jmp 0x3ee4
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x5a48
movq %rbx, %rdi
callq 0x2400
// File: /workspace/github_c_makefile_star2_O2/waynebhayes[P]SAHap/src/Genome.cpp
// Function: SAHap::Genome::autoSchedule(unsigned long long)
void Genome::autoSchedule(iteration_t iterations) {
	cout << "Finding optimal temperature schedule..." << endl;

	double tInitial = 1;
	while (this->findPbad(tInitial) < TARGET_PBAD_START) tInitial *= 2;
	while (this->findPbad(tInitial) > TARGET_PBAD_START) tInitial /= 2;
	while (this->findPbad(tInitial) < TARGET_PBAD_START) tInitial *= 1.2;
	cout << "tInitial found: " << tInitial << endl;
	double tEnd = tInitial;
	while (this->findPbad(tEnd) > TARGET_PBAD_END) tEnd /= 2;
	while (this->findPbad(tEnd) < TARGET_PBAD_END) tEnd *= 1.2;

	cout << "tInitial = " << tInitial << ", tEnd = " << tEnd << endl;

	this->setParameters(tInitial, tEnd, iterations);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq 0xbc68(%rip), %rdi      # 0xffc8
leaq 0x614e(%rip), %rsi      # 0xa4b5
callq 0x2230
movq %rax, %rdi
callq 0x20f0
movsd 0x5d34(%rip), %xmm0     # 0xa0b0
movq %r14, %rdi
movsd %xmm0, 0x8(%rsp)
callq 0x417e
movsd 0x5dbe(%rip), %xmm1     # 0xa150
ucomisd %xmm0, %xmm1
jbe 0x43a4
movsd 0x8(%rsp), %xmm0
addsd %xmm0, %xmm0
jmp 0x437c
movsd 0x8(%rsp), %xmm0
movq %r14, %rdi
movsd %xmm0, 0x8(%rsp)
callq 0x417e
ucomisd 0x5d90(%rip), %xmm0     # 0xa150
jbe 0x43d2
movsd 0x8(%rsp), %xmm0
mulsd 0x5d00(%rip), %xmm0     # 0xa0d0
jmp 0x43aa
movsd 0x8(%rsp), %xmm0
movq %r14, %rdi
movsd %xmm0, 0x8(%rsp)
callq 0x417e
movsd 0x5d62(%rip), %xmm1     # 0xa150
ucomisd %xmm0, %xmm1
jbe 0x4404
movsd 0x8(%rsp), %xmm0
mulsd 0x5d56(%rip), %xmm0     # 0xa158
jmp 0x43d8
movq 0xbbbd(%rip), %rdi      # 0xffc8
leaq 0x60cb(%rip), %rsi      # 0xa4dd
callq 0x2230
movq %rax, %rdi
movsd 0x8(%rsp), %xmm0
callq 0x23a0
movq %rax, %rdi
callq 0x20f0
movsd 0x8(%rsp), %xmm0
movq %r14, %rdi
movsd %xmm0, 0x10(%rsp)
callq 0x417e
ucomisd 0x5cff(%rip), %xmm0     # 0xa148
jbe 0x445b
movsd 0x10(%rsp), %xmm0
mulsd 0x5c77(%rip), %xmm0     # 0xa0d0
jmp 0x4433
movsd 0x10(%rsp), %xmm0
movq %r14, %rdi
movsd %xmm0, 0x10(%rsp)
callq 0x417e
movsd 0x5cd1(%rip), %xmm1     # 0xa148
ucomisd %xmm0, %xmm1
jbe 0x448d
movsd 0x10(%rsp), %xmm0
mulsd 0x5ccd(%rip), %xmm0     # 0xa158
jmp 0x4461
movq 0xbb34(%rip), %rdi      # 0xffc8
leaq 0x6053(%rip), %rsi      # 0xa4ee
callq 0x2230
movq %rax, %rdi
movsd 0x8(%rsp), %xmm0
callq 0x23a0
leaq 0x6045(%rip), %rsi      # 0xa4fa
movq %rax, %rdi
callq 0x2230
movq %rax, %rdi
movsd 0x10(%rsp), %xmm0
callq 0x23a0
movq %rax, %rdi
callq 0x20f0
movq %r14, %rdi
movsd 0x8(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movq %rbx, %rsi
addq $0x18, %rsp
popq %rbx
popq %r14
jmp 0x2de0
nop
// File: /workspace/github_c_makefile_star2_O2/waynebhayes[P]SAHap/src/Genome.cpp
// Function: SAHap::Genome::compareGroundTruth(SAHap::Haplotype const&, std::vector<int, std::allocator<int>> const&)
dnacnt_t Genome::compareGroundTruth(const Haplotype& ch, const vector<int>& truth) {
	dnacnt_t loss = 0;
	for (size_t i = 0; i < ch.size(); ++i) {
		if (ch.solution[i] != truth[i]) {
			loss++;
		}
	}
	return loss;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r15
xorl %r14d, %r14d
xorl %r12d, %r12d
movq %r15, %rdi
callq 0x6632
cmpq %rax, %r12
jae 0x452e
movq (%r15), %rax
movl (%rax,%r12,4), %eax
movq (%rbx), %rcx
xorl %edx, %edx
cmpl (%rcx,%r12,4), %eax
setne %dl
addq %rdx, %r14
incq %r12
jmp 0x4506
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/waynebhayes[P]SAHap/src/Genome.cpp
// Function: SAHap::operator<<(std::ostream&, SAHap::Genome const&)
ostream& operator << (ostream& stream, const Genome& ge) {
	int blockNum = 1;
	for (Range r : ge.blocks) {
		stream << "BLOCK " << blockNum++ << endl;
		for (size_t i = 0; i < ge.haplotypes.size(); ++i) {
			for (size_t j = 0; j < ge.haplotypes[i].size(); ++j) {
				if (j >= r.start && j <= r.end) {
					if (ge.haplotypes[i].solution[j] < 0)
						stream << 'X';
					else
						stream << ge.haplotypes[i].solution[j];
				}
				else
					stream << '-';
			}
			stream << endl;
		}
	}
	return stream;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq 0x3c30(%rsi), %rax
movq 0x3c38(%rsi), %rcx
movq %rcx, 0x10(%rsp)
pushq $0x1
popq %rcx
movl %ecx, 0xc(%rsp)
cmpq 0x10(%rsp), %rax
je 0x464c
movq (%rax), %r15
movq %rax, 0x18(%rsp)
movq 0x8(%rax), %rbp
movq %rbx, %rdi
leaq 0x6014(%rip), %rsi      # 0xa5a0
callq 0x2230
movq %rax, %rdi
movl 0xc(%rsp), %esi
callq 0x23f0
movq %rax, %rdi
callq 0x20f0
xorl %esi, %esi
movq 0x2368(%r14), %rdi
movq 0x2370(%r14), %rax
subq %rdi, %rax
cqto
movl $0xf8, %ecx
idivq %rcx
cmpq %rax, %rsi
jae 0x463a
movq %rsi, 0x20(%rsp)
imulq $0xf8, %rsi, %r13
xorl %r12d, %r12d
addq %r13, %rdi
callq 0x6632
cmpq %rax, %r12
jae 0x4625
cmpq %r15, %r12
jb 0x460a
cmpq %rbp, %r12
ja 0x460a
movq 0x2368(%r14), %rax
movq (%rax,%r13), %rax
movl (%rax,%r12,4), %esi
movq %rbx, %rdi
testl %esi, %esi
js 0x4611
callq 0x23f0
jmp 0x4619
movq %rbx, %rdi
pushq $0x2d
jmp 0x4613
pushq $0x58
popq %rsi
callq 0x2280
incq %r12
movq 0x2368(%r14), %rdi
jmp 0x45d6
movq %rbx, %rdi
callq 0x20f0
movq 0x20(%rsp), %rsi
incq %rsi
jmp 0x45a7
incl 0xc(%rsp)
movq 0x18(%rsp), %rax
addq $0x10, %rax
jmp 0x456b
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/waynebhayes[P]SAHap/src/Haplotype.cpp
// Function: SAHap::Haplotype::Haplotype(unsigned long, unsigned int)
Haplotype::Haplotype(dnapos_t length, unsigned ploidyCount)
	: length(length), total_mec(0), window_mec(0), isitecost(0)
{
	this->ploidyCount = ploidyCount;
	this->solution = vector<int>(this->length, -1);
	this->weights = vector<vector<int>>(this->length);
	this->siteCoverages = vector<dnacnt_t>(this->length);
	this->window.start = 0;
	this->window.end = this->length;

	for (dnapos_t i = 0; i < this->length; ++i) {
		this->solution[i] = -1;
		this->weights[i] = vector<int>(this->ploidyCount, 0);
		this->siteCoverages[i] = 0;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
movq %rsi, 0x18(%rdi)
leaq 0x20(%rdi), %r14
leaq 0x38(%rdi), %r15
leaq 0xa0(%rdi), %rax
movups %xmm0, 0x20(%rdi)
movups %xmm0, 0x30(%rdi)
andq $0x0, 0x60(%rdi)
movups %xmm0, 0x40(%rdi)
movups %xmm0, 0x50(%rdi)
movq %rax, 0x70(%rdi)
pushq $0x1
popq %rax
movq %rax, 0x78(%rdi)
movups %xmm0, 0x80(%rdi)
movl $0x3f800000, %ecx       # imm = 0x3F800000
movl %ecx, 0x90(%rdi)
movups %xmm0, 0x98(%rdi)
addq $0xd8, %rdi
movq %rdi, 0xa8(%rbx)
movq %rax, 0xb0(%rbx)
movups %xmm0, 0xb8(%rbx)
movl %ecx, 0xc8(%rbx)
movups %xmm0, 0xd0(%rbx)
movq $0x7fffffff, 0xe0(%rbx) # imm = 0x7FFFFFFF
andq $0x0, 0xe8(%rbx)
movl %edx, 0x68(%rbx)
leaq 0xc(%rsp), %rdx
orl $-0x1, (%rdx)
leaq 0x20(%rsp), %rdi
leaq 0xb(%rsp), %rcx
movq %r14, 0x18(%rsp)
movq %r15, 0x10(%rsp)
callq 0x6fe8
leaq 0x20(%rsp), %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x7674
movq %r12, %rdi
callq 0x5628
movq 0x18(%rbx), %rsi
leaq 0x20(%rsp), %rdi
leaq 0xc(%rsp), %rdx
callq 0x703e
leaq 0x20(%rsp), %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x773e
movq %r12, %rdi
callq 0x5900
movq 0x18(%rbx), %rsi
leaq 0x20(%rsp), %rdi
leaq 0xc(%rsp), %rdx
callq 0x7090
leaq 0x20(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x7826
movq %r12, %rdi
callq 0x59ae
andq $0x0, 0xe0(%rbx)
movq 0x18(%rbx), %rax
movq %rax, 0xe8(%rbx)
xorl %r14d, %r14d
leaq 0xc(%rsp), %r13
leaq 0xb(%rsp), %rbp
xorl %r15d, %r15d
cmpq %rax, %r15
jae 0x646d
movq (%rbx), %rax
orl $-0x1, (%rax,%r15,4)
movl 0x68(%rbx), %esi
andl $0x0, 0xc(%rsp)
movq %r12, %rdi
movq %r13, %rdx
movq %rbp, %rcx
callq 0x6fe8
movq 0x20(%rbx), %rdi
addq %r14, %rdi
movq %r12, %rsi
callq 0x7674
movq %r12, %rdi
callq 0x5628
movq 0x38(%rbx), %rax
andq $0x0, (%rax,%r15,8)
incq %r15
movq 0x18(%rbx), %rax
addq $0x18, %r14
jmp 0x641d
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x6482
jmp 0x6482
jmp 0x6482
movq %rax, %r12
leaq 0x70(%rbx), %r13
leaq 0xa8(%rbx), %rdi
callq 0x71a8
movq %r13, %rdi
callq 0x71a8
movq 0x10(%rsp), %rdi
callq 0x59ae
movq 0x18(%rsp), %rdi
callq 0x5900
movq %rbx, %rdi
callq 0x5628
movq %r12, %rdi
callq 0x2400
nop
// File: /workspace/github_c_makefile_star2_O2/waynebhayes[P]SAHap/src/Haplotype.cpp
// Function: SAHap::Haplotype::meanCoverage()
double Haplotype::meanCoverage() {
    double result = 0.0;
    for (dnapos_t i = 0; i < this->length; ++i) {
		result += this->siteCoverages[i];
    }
    return result/this->length;
}

// Assembly:
movq 0x18(%rdi), %rax
movq 0x38(%rdi), %rcx
xorpd %xmm0, %xmm0
xorl %edx, %edx
movsd 0x3a42(%rip), %xmm1     # 0xa020
movapd 0x3a4a(%rip), %xmm2     # 0xa030
cmpq %rdx, %rax
je 0x660c
movsd (%rcx,%rdx,8), %xmm3
unpcklps %xmm1, %xmm3            # xmm3 = xmm3[0],xmm1[0],xmm3[1],xmm1[1]
subpd %xmm2, %xmm3
movapd %xmm3, %xmm4
unpckhpd %xmm3, %xmm4            # xmm4 = xmm4[1],xmm3[1]
addsd %xmm3, %xmm4
addsd %xmm4, %xmm0
incq %rdx
jmp 0x65e6
movq %rax, %xmm1
punpckldq 0x3a07(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x3a0f(%rip), %xmm1     # 0xa030
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
divsd %xmm2, %xmm0
retq
// File: /workspace/github_c_makefile_star2_O2/waynebhayes[P]SAHap/src/Haplotype.cpp
// Function: SAHap::Haplotype::mec(unsigned long, unsigned long)
double Haplotype::mec(dnapos_t s, dnapos_t e) {
    double out = 0;
    assert(e>=s);

    for (unsigned j = 0; j < ploidyCount; j++) {
	for (dnapos_t i = s; i <= e && i < this->length; i++) {
	    if (solution[i] == (int)j) // solution is signed since (-1) is used to mean "undefined"
		continue;
	    if(weights[i][j] < 0 && weights[i][j] > -SMALL_ENOUGH_TO_IGNORE) weights[i][j] = 0;
	    assert(weights[i][j]>=0);
	    out += weights[i][j];
	}
    }
    assert(out>=0);
    return out;
}

// Assembly:
pushq %rbx
cmpq %rsi, %rdx
jb 0x66cb
movl 0x68(%rdi), %eax
movq (%rdi), %rcx
movq 0x18(%rdi), %r8
imulq $0x18, %rsi, %r9
addq 0x20(%rdi), %r9
xorpd %xmm0, %xmm0
xorl %edi, %edi
cmpq %rax, %rdi
je 0x66a2
movq %r9, %r10
movq %rsi, %r11
cmpq %rdx, %r11
ja 0x669d
cmpq %r8, %r11
jae 0x669d
movl (%rcx,%r11,4), %ebx
cmpq %rbx, %rdi
je 0x6694
movq (%r10), %rbx
movl (%rbx,%rdi,4), %ebx
testl %ebx, %ebx
js 0x66ae
cvtsi2sd %ebx, %xmm1
addsd %xmm1, %xmm0
incq %r11
addq $0x18, %r10
jmp 0x666f
incq %rdi
jmp 0x6664
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x66e4
popq %rbx
retq
leaq 0x3fdb(%rip), %rdi      # 0xa690
leaq 0x3f91(%rip), %rsi      # 0xa64d
leaq 0x3f9c(%rip), %rcx      # 0xa65f
pushq $0x62
popq %rdx
callq 0x2180
leaq 0x3f76(%rip), %rdi      # 0xa648
leaq 0x3f74(%rip), %rsi      # 0xa64d
leaq 0x3f7f(%rip), %rcx      # 0xa65f
pushq $0x5b
jmp 0x66c5
leaq 0x3b0e(%rip), %rdi      # 0xa1f9
leaq 0x3f5b(%rip), %rsi      # 0xa64d
leaq 0x3f66(%rip), %rcx      # 0xa65f
pushq $0x66
jmp 0x66c5
nop
// File: /workspace/github_c_makefile_star2_O2/waynebhayes[P]SAHap/src/Haplotype.cpp
// Function: SAHap::Haplotype::pickReads(unsigned int)
void Haplotype::pickReads(unsigned overlap) {
	this->reads.clear();
	
	for (auto r : this->saved_reads) {
		if (r->range.end > this->window.start + overlap && r->range.start <= this->window.end) {
			this->reads.insert(r);
		}
	}
	//cout << "MIN START: " << mx << endl;
	for (auto r : this->reads)
		this->saved_reads.erase(r);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x70(%rdi), %r14
movq %r14, %rdi
callq 0x71c4
leaq 0xb8(%rbx), %r12
movl %ebp, %r13d
movq %rsp, %r15
movq (%r12), %r12
testq %r12, %r12
je 0x67e5
movq 0x8(%r12), %rax
movq %rax, (%rsp)
movq 0xe0(%rbx), %rcx
addq %r13, %rcx
cmpq %rcx, 0x28(%rax)
jbe 0x67a9
movq 0x20(%rax), %rax
cmpq 0xe8(%rbx), %rax
ja 0x67a9
movq %r14, %rdi
movq %r15, %rsi
callq 0x7878
jmp 0x67a9
leaq 0xa8(%rbx), %r14
subq $-0x80, %rbx
movq %rsp, %r15
movq (%rbx), %rbx
testq %rbx, %rbx
je 0x6810
movq 0x8(%rbx), %rax
movq %rax, (%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x7b24
jmp 0x67f3
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O2/waynebhayes[P]SAHap/src/Haplotype.cpp
// Function: SAHap::Haplotype::initializeWindow(unsigned int, unsigned int)
void Haplotype::initializeWindow(unsigned windowSize, unsigned incrementBy) {
	this->window.start = 0;
	this->window.end = windowSize;
	this->increment_window_by = incrementBy;
	this->saved_reads = this->reads;

	this->pickReads(0);

	this->window_mec = mec(this->window.start, this->window.end);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
andq $0x0, 0xe0(%rdi)
movl %esi, %eax
movq %rax, 0xe8(%rdi)
movl %edx, 0xf0(%rdi)
leaq 0x70(%rdi), %rsi
addq $0xa8, %rdi
callq 0x741c
movq %rbx, %rdi
xorl %esi, %esi
callq 0x6780
movq 0xe0(%rbx), %rsi
movq 0xe8(%rbx), %rdx
movq %rbx, %rdi
callq 0x6646
movsd %xmm0, 0x58(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/waynebhayes[P]SAHap/src/Haplotype.cpp
// Function: SAHap::Haplotype::windowTotalCoverage()
double Haplotype::windowTotalCoverage() {
    double result = 0.0;
    for (dnapos_t i = this->window.start; i < this->window.end; ++i) {
		result += this->siteCoverages[i];
    }
    return result;//(this->window.end - this->window.start);
}

// Assembly:
movq 0x38(%rdi), %rax
movq 0xe0(%rdi), %rcx
movq 0xe8(%rdi), %rdx
xorpd %xmm0, %xmm0
movsd 0x3726(%rip), %xmm1     # 0xa020
movapd 0x372e(%rip), %xmm2     # 0xa030
cmpq %rdx, %rcx
jae 0x6928
movsd (%rax,%rcx,8), %xmm3
unpcklps %xmm1, %xmm3            # xmm3 = xmm3[0],xmm1[0],xmm3[1],xmm1[1]
subpd %xmm2, %xmm3
movapd %xmm3, %xmm4
unpckhpd %xmm3, %xmm4            # xmm4 = xmm4[1],xmm3[1]
addsd %xmm3, %xmm4
addsd %xmm4, %xmm0
incq %rcx
jmp 0x6902
retq
nop
// File: /workspace/github_c_makefile_star2_O2/waynebhayes[P]SAHap/src/Haplotype.cpp
// Function: SAHap::Haplotype::add(SAHap::Read*)
void Haplotype::add(Read * r) {
	if (this->reads.find(r) != this->reads.end()) {
		throw "Haplotype already contains read";
	}
	// std::cout << "adding\n";
	this->reads.insert(r);
	this->vote(*r);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0x8(%rsp), %rax
movq %rsi, (%rax)
leaq 0x70(%rdi), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x7c26
testq %rax, %rax
jne 0x69d5
leaq 0x8(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x7878
movq (%r15), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x69f8
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
pushq $0x8
popq %rdi
callq 0x2100
leaq 0x3cf6(%rip), %rcx      # 0xa6da
movq %rcx, (%rax)
movq 0x95ca(%rip), %rsi      # 0xffb8
movq %rax, %rdi
xorl %edx, %edx
callq 0x23e0
// File: /workspace/github_c_makefile_star2_O2/waynebhayes[P]SAHap/src/Haplotype.cpp
// Function: SAHap::Haplotype::vote(SAHap::Read&, bool)
void Haplotype::vote(Read& read, bool retract) {
#if SAHAP_CHROMOSOME_ALT_MEC
	// TODO: Alternative MEC
#else
	for (const Site& site : read.sites) {
		dnapos_t i = site.pos;

		subtractMECValuesAt(i);

		if (!retract) // enter
			addSite(site);
		else // leave
			removeSite(site);

		addMECValuesAt(i);
	}
#endif
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %edx, %ebx
movq %rdi, %r14
movq (%rsi), %r15
movq 0x8(%rsi), %r13
cmpq %r13, %r15
je 0x6a48
movq 0x8(%r15), %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x6bac
movq %r14, %rdi
movq %r15, %rsi
testb %bl, %bl
je 0x6a32
callq 0x6e3e
jmp 0x6a37
callq 0x6dfe
movq %r14, %rdi
movq %r12, %rsi
callq 0x6ce8
addq $0x18, %r15
jmp 0x6a0d
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq