// File: medvedevgroup[P]varmatch/src/wholegenome.cpp
// Function: WholeGenome::CalculateScore(DiploidVariant&, int, int, int, int)
int WholeGenome::CalculateScore(DiploidVariant & dv,
                                int choice,
                                int score_unit,
                                int match_mode,
                                int score_scheme){
    int score = 0;
    if(choice <= NOT_USE) return score;
    if(score_unit == 0){
        score = 1;
    }else if(score_unit == 1){
        if(match_mode == 0){
            if(choice == -1){
                score += ScoreEditDistance(dv, 0);
            }else if(choice == -2){
                score += ScoreEditDistance(dv, 1);
            }else if(choice == 0){
                score += ScoreEditDistance(dv, 0);
                if(dv.multi_alts && !dv.zero_one_var){
                    score += ScoreEditDistance(dv, 1);
                }
            }else{
                score += ScoreEditDistance(dv, 0);
                score += ScoreEditDistance(dv, 1);
            }
        }else{
            score += ScoreEditDistance(dv, choice);
        }
    }

    if(score_scheme == 0){
        return score;
    }else if(score_scheme == 1 || score_scheme == 2){
        if(dv.flag == false && score_scheme == 1){
            return score;
        }else if(dv.flag && score_scheme == 2){
            return score;
        }else{
            return 0;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl %ecx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movl %r9d, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movl $0x0, -0x2c(%rbp)
cmpl $-0x9, -0x1c(%rbp)
jg 0x2200e
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x22168
cmpl $0x0, -0x20(%rbp)
jne 0x22020
movl $0x1, -0x2c(%rbp)
jmp 0x2210a
cmpl $0x1, -0x20(%rbp)
jne 0x22108
cmpl $0x0, -0x24(%rbp)
jne 0x220f0
cmpl $-0x1, -0x1c(%rbp)
jne 0x22054
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rsi
xorl %edx, %edx
callq 0x1d690
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
jmp 0x220ee
cmpl $-0x2, -0x1c(%rbp)
jne 0x22074
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl $0x1, %edx
callq 0x1d690
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
jmp 0x220ec
cmpl $0x0, -0x1c(%rbp)
jne 0x220bd
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rsi
xorl %edx, %edx
callq 0x1d690
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x18(%rbp), %rax
testb $0x1, 0x41(%rax)
je 0x220bb
movq -0x18(%rbp), %rax
testb $0x1, 0x42(%rax)
jne 0x220bb
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl $0x1, %edx
callq 0x1d690
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
jmp 0x220ea
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rsi
xorl %edx, %edx
callq 0x1d690
movq -0x38(%rbp), %rdi
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x18(%rbp), %rsi
movl $0x1, %edx
callq 0x1d690
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
jmp 0x220ec
jmp 0x220ee
jmp 0x22106
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
callq 0x1d690
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
jmp 0x22108
jmp 0x2210a
cmpl $0x0, -0x28(%rbp)
jne 0x22118
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x22168
cmpl $0x1, -0x28(%rbp)
je 0x22124
cmpl $0x2, -0x28(%rbp)
jne 0x22164
movq -0x18(%rbp), %rax
movb 0x4c(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x22143
cmpl $0x1, -0x28(%rbp)
jne 0x22143
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x22168
movq -0x18(%rbp), %rax
testb $0x1, 0x4c(%rax)
je 0x2215b
cmpl $0x2, -0x28(%rbp)
jne 0x2215b
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x22168
movl $0x0, -0x4(%rbp)
jmp 0x22168
jmp 0x22166
ud2
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)