// File: c2-d2[P]disty/src/main.cpp
// Function: void compute_mask<std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>>>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>> const&, int)
void compute_mask(string &mask, const T &pileup, int n_thres) {
    assert(pileup.size()==mask.size());
    assert(pileup[0].size()==128);

    int column_sum=accumulate(pileup[0].begin(), pileup[0].end(), 0);

    int masked_columns=0;

    for(int i=0; i<static_cast<int>(pileup.size()); i++){
        int ns=pileup[i]['n']+pileup[i]['N'];
        if (ns >= n_thres){
            mask[i]='0';
            masked_columns++;
        }
        else{
            if(ns>0)
            {
                mask[i]='N';
            }
            else{
                mask[i]='1';
            }
        }
    }

    cerr << "Number of masked columns: " << masked_columns << " (out of " << pileup.size() << " positions, threshold: " << n_thres << " Ns, number of samples: " << column_sum << ")" << endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x10(%rbp), %rdi
callq 0x7b40
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
callq 0x2140
movq %rax, %rcx
movq -0x40(%rbp), %rax
cmpq %rcx, %rax
jne 0x4b17
jmp 0x4b36
leaq 0x3e5b(%rip), %rdi      # 0x8979
leaq 0x3aa9(%rip), %rsi      # 0x85ce
movl $0x163, %edx            # imm = 0x163
leaq 0x3e63(%rip), %rcx      # 0x8994
callq 0x2110
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x7c80
movq %rax, %rdi
callq 0x7610
cmpq $0x80, %rax
jne 0x4b55
jmp 0x4b74
leaq 0x3d97(%rip), %rdi      # 0x88f3
leaq 0x3a6b(%rip), %rsi      # 0x85ce
movl $0x164, %edx            # imm = 0x164
leaq 0x3e25(%rip), %rcx      # 0x8994
callq 0x2110
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x7c80
movq %rax, %rdi
callq 0x76b0
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x7c80
movq %rax, %rdi
callq 0x76e0
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
xorl %edx, %edx
callq 0x7cc0
movl %eax, -0x18(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x44(%rbp)
movq -0x10(%rbp), %rdi
callq 0x7b40
movq %rax, %rcx
movl -0x44(%rbp), %eax
cmpl %ecx, %eax
jge 0x4c84
movq -0x10(%rbp), %rdi
movslq -0x30(%rbp), %rsi
callq 0x7c80
movq %rax, %rdi
movl $0x6e, %esi
callq 0x7ca0
movl (%rax), %eax
movl %eax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
movslq -0x30(%rbp), %rsi
callq 0x7c80
movq %rax, %rdi
movl $0x4e, %esi
callq 0x7ca0
movq %rax, %rcx
movl -0x48(%rbp), %eax
addl (%rcx), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x14(%rbp), %eax
jl 0x4c4a
movq -0x8(%rbp), %rdi
movslq -0x30(%rbp), %rsi
callq 0x23d0
movb $0x30, (%rax)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x4c74
cmpl $0x0, -0x34(%rbp)
jle 0x4c62
movq -0x8(%rbp), %rdi
movslq -0x30(%rbp), %rsi
callq 0x23d0
movb $0x4e, (%rax)
jmp 0x4c72
movq -0x8(%rbp), %rdi
movslq -0x30(%rbp), %rsi
callq 0x23d0
movb $0x31, (%rax)
jmp 0x4c74
jmp 0x4c76
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x4bc6
movq 0x8365(%rip), %rdi      # 0xcff0
leaq 0x3d52(%rip), %rsi      # 0x89e4
callq 0x21d0
movq %rax, %rdi
movl -0x2c(%rbp), %esi
callq 0x2360
movq %rax, %rdi
leaq 0x3d53(%rip), %rsi      # 0x89ff
callq 0x21d0
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rdi
callq 0x7b40
movq -0x50(%rbp), %rdi
movq %rax, %rsi
callq 0x2060
movq %rax, %rdi
leaq 0x3d35(%rip), %rsi      # 0x8a09
callq 0x21d0
movq %rax, %rdi
movl -0x14(%rbp), %esi
callq 0x2360
movq %rax, %rdi
leaq 0x3d33(%rip), %rsi      # 0x8a21
callq 0x21d0
movq %rax, %rdi
movl -0x18(%rbp), %esi
callq 0x2360
movq %rax, %rdi
leaq 0x3906(%rip), %rsi      # 0x860e
callq 0x21d0
movq %rax, %rdi
movq 0x8291(%rip), %rsi      # 0xcfa8
callq 0x2210
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)