// File: /workspace/github_c_makefile_star2_O0/nh13[P]ksw/src/parasail/src/sw.c
// Function: parasail_sw_rowcol
parasail_result_t* ENAME(
        const char * const restrict _s1, const int _s1Len,
        const char * const restrict _s2, const int s2Len,
        const int open, const int gap, const parasail_matrix_t *matrix)
{
    /* declare local variables */
    parasail_result_t *result = NULL;
    int * restrict s1 = NULL;
    int * restrict s2 = NULL;
    int * restrict H = NULL;
    int * restrict F = NULL;
    int s1Len = 0;
    int i = 0;
    int j = 0;
    int score = 0;
    int end_query = 0;
    int end_ref = 0;

    /* validate inputs */
    PARASAIL_CHECK_NULL(_s2);
    PARASAIL_CHECK_GT0(s2Len);
    PARASAIL_CHECK_GE0(open);
    PARASAIL_CHECK_GE0(gap);
    PARASAIL_CHECK_NULL(matrix);
    if (matrix->type == PARASAIL_MATRIX_TYPE_SQUARE) {
        PARASAIL_CHECK_NULL(_s1);
        PARASAIL_CHECK_GT0(_s1Len);
    }

    /* initialize stack variables */
    s1Len = matrix->type == PARASAIL_MATRIX_TYPE_SQUARE ? _s1Len : matrix->length;
    i = 0;
    j = 0;
    score = NEG_INF_32;
    end_query = s1Len;
    end_ref = s2Len;

    /* initialize result */
#ifdef PARASAIL_TABLE
    result = parasail_result_new_table1(s1Len, s2Len);
#else
#ifdef PARASAIL_ROWCOL
    result = parasail_result_new_rowcol1(s1Len, s2Len);
#else
    result = parasail_result_new();
#endif
#endif
    if (!result) return NULL;

    /* set known flags */
    result->flag |= PARASAIL_FLAG_SW | PARASAIL_FLAG_NOVEC
        | PARASAIL_FLAG_BITS_INT | PARASAIL_FLAG_LANES_1;
#ifdef PARASAIL_TABLE
    result->flag |= PARASAIL_FLAG_TABLE;
#endif
#ifdef PARASAIL_ROWCOL
    result->flag |= PARASAIL_FLAG_ROWCOL;
#endif

    /* initialize heap variables */
    s2 = parasail_memalign_int(16, s2Len);
    H = parasail_memalign_int(16, s2Len+1);
    F = parasail_memalign_int(16, s2Len+1);

    /* validate heap variables */
    if (!s2) return NULL;
    if (!H) return NULL;
    if (!F) return NULL;

    if (matrix->type == PARASAIL_MATRIX_TYPE_SQUARE) {
        s1 = parasail_memalign_int(16, s1Len);
        if (!s1) return NULL;
        for (i=0; i<s1Len; ++i) {
            s1[i] = matrix->mapper[(unsigned char)_s1[i]];
        }
    }

    for (j=0; j<s2Len; ++j) {
        s2[j] = matrix->mapper[(unsigned char)_s2[j]];
    }

    /* upper left corner */
    H[0] = 0;
    F[0] = NEG_INF_32;
    
    /* first row */
    for (j=1; j<=s2Len; ++j) {
        H[j] = 0;
        F[j] = NEG_INF_32;
    }

    /* iter over first sequence */
    for (i=1; i<=s1Len; ++i) {
        const int * const restrict matrow =
            matrix->type == PARASAIL_MATRIX_TYPE_SQUARE ?
            &matrix->matrix[matrix->size*s1[i-1]] :
            &matrix->matrix[matrix->size*(i-1)];
        /* init first column */
        int NH = H[0];
        int WH = 0;
        int E = NEG_INF_32;
        H[0] = WH;
        for (j=1; j<=s2Len; ++j) {
            int H_dag;
            int E_opn;
            int E_ext;
            int F_opn;
            int F_ext;
            int NWH = NH;
            NH = H[j];
            F_opn = NH - open;
            F_ext = F[j] - gap;
            F[j] = MAX(F_opn, F_ext);
            E_opn = WH - open;
            E_ext = E    - gap;
            E    = MAX(E_opn, E_ext);
            H_dag = NWH + matrow[s2[j-1]];
            WH = MAX(H_dag, 0);
            WH = MAX(WH, E);
            WH = MAX(WH, F[j]);
            H[j] = WH;
            if (WH > score) {
                end_query = i-1;
                end_ref = j-1;
            }
            else if (score == WH && j-1 < end_ref) {
                end_query = i-1;
                end_ref = j-1;
            }
            score = MAX(score,WH);
#ifdef PARASAIL_TABLE
            result->tables->score_table[1LL*(i-1)*s2Len + (j-1)] = WH;
#endif
        }
#ifdef PARASAIL_ROWCOL
        result->rowcols->score_col[i-1] = WH;
#endif
    }
#ifdef PARASAIL_ROWCOL
    for (j=1; j<=s2Len; ++j) {
        result->rowcols->score_row[j-1] = H[j];
    }
#endif

    result->score = score;
    result->end_query = end_query;
    result->end_ref = end_ref;

    parasail_free(F);
    parasail_free(H);
    parasail_free(s2);
    if (matrix->type == PARASAIL_MATRIX_TYPE_SQUARE) {
        parasail_free(s1);
    }

    return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movl %r8d, -0x28(%rbp)
movl %r9d, -0x2c(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
movq $0x0, -0x58(%rbp)
movl $0x0, -0x5c(%rbp)
movl $0x0, -0x60(%rbp)
movl $0x0, -0x64(%rbp)
movl $0x0, -0x68(%rbp)
movl $0x0, -0x6c(%rbp)
movl $0x0, -0x70(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x2adc71
movq 0xb79393(%rip), %rax    # 0xe26fd8
movq (%rax), %rdi
leaq 0xa3e39c(%rip), %rsi    # 0xcebfeb
leaq 0x9fe33f(%rip), %rdx    # 0xcabf95
leaq 0xa3eaa0(%rip), %rcx    # 0xcec6fd
movb $0x0, %al
callq 0x19e180
movq $0x0, -0x8(%rbp)
jmp 0x2ae353
jmp 0x2adc73
jmp 0x2adc75
cmpl $0x0, -0x24(%rbp)
jg 0x2adcae
movq 0xb79356(%rip), %rax    # 0xe26fd8
movq (%rax), %rdi
leaq 0xa3ea75(%rip), %rsi    # 0xcec701
leaq 0x9fe302(%rip), %rdx    # 0xcabf95
leaq 0xa3ea7b(%rip), %rcx    # 0xcec715
movb $0x0, %al
callq 0x19e180
movq $0x0, -0x8(%rbp)
jmp 0x2ae353
jmp 0x2adcb0
jmp 0x2adcb2
cmpl $0x0, -0x28(%rbp)
jge 0x2adceb
movq 0xb79319(%rip), %rax    # 0xe26fd8
movq (%rax), %rdi
leaq 0xa3ea52(%rip), %rsi    # 0xcec71b
leaq 0x9fe2c5(%rip), %rdx    # 0xcabf95
leaq 0xa3ea59(%rip), %rcx    # 0xcec730
movb $0x0, %al
callq 0x19e180
movq $0x0, -0x8(%rbp)
jmp 0x2ae353
jmp 0x2adced
jmp 0x2adcef
cmpl $0x0, -0x2c(%rbp)
jge 0x2add28
movq 0xb792dc(%rip), %rax    # 0xe26fd8
movq (%rax), %rdi
leaq 0xa3ea15(%rip), %rsi    # 0xcec71b
leaq 0x9fe288(%rip), %rdx    # 0xcabf95
leaq 0xa3ea21(%rip), %rcx    # 0xcec735
movb $0x0, %al
callq 0x19e180
movq $0x0, -0x8(%rbp)
jmp 0x2ae353
jmp 0x2add2a
jmp 0x2add2c
cmpq $0x0, 0x10(%rbp)
jne 0x2add66
movq 0xb7929e(%rip), %rax    # 0xe26fd8
movq (%rax), %rdi
leaq 0xa3e2a7(%rip), %rsi    # 0xcebfeb
leaq 0x9fe24a(%rip), %rdx    # 0xcabf95
leaq 0xa3ebd3(%rip), %rcx    # 0xcec925
movb $0x0, %al
callq 0x19e180
movq $0x0, -0x8(%rbp)
jmp 0x2ae353
jmp 0x2add68
movq 0x10(%rbp), %rax
cmpl $0x0, 0x30(%rax)
jne 0x2addef
jmp 0x2add74
cmpq $0x0, -0x10(%rbp)
jne 0x2addae
movq 0xb79256(%rip), %rax    # 0xe26fd8
movq (%rax), %rdi
leaq 0xa3e25f(%rip), %rsi    # 0xcebfeb
leaq 0x9fe202(%rip), %rdx    # 0xcabf95
leaq 0xa3e99f(%rip), %rcx    # 0xcec739
movb $0x0, %al
callq 0x19e180
movq $0x0, -0x8(%rbp)
jmp 0x2ae353
jmp 0x2addb0
jmp 0x2addb2
cmpl $0x0, -0x14(%rbp)
jg 0x2addeb
movq 0xb79219(%rip), %rax    # 0xe26fd8
movq (%rax), %rdi
leaq 0xa3e938(%rip), %rsi    # 0xcec701
leaq 0x9fe1c5(%rip), %rdx    # 0xcabf95
leaq 0xa3e966(%rip), %rcx    # 0xcec73d
movb $0x0, %al
callq 0x19e180
movq $0x0, -0x8(%rbp)
jmp 0x2ae353
jmp 0x2added
jmp 0x2addef
movq 0x10(%rbp), %rax
cmpl $0x0, 0x30(%rax)
jne 0x2ade04
movl -0x14(%rbp), %eax
movl %eax, -0xa0(%rbp)
jmp 0x2ade11
movq 0x10(%rbp), %rax
movl 0x34(%rax), %eax
movl %eax, -0xa0(%rbp)
movl -0xa0(%rbp), %eax
movl %eax, -0x5c(%rbp)
movl $0x0, -0x60(%rbp)
movl $0x0, -0x64(%rbp)
movl $0xc0000000, -0x68(%rbp) # imm = 0xC0000000
movl -0x5c(%rbp), %eax
movl %eax, -0x6c(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x70(%rbp)
movl -0x5c(%rbp), %edi
movl -0x24(%rbp), %esi
callq 0x1c3af0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x2ade5e
movq $0x0, -0x8(%rbp)
jmp 0x2ae353
movq -0x38(%rbp), %rax
movl 0xc(%rax), %ecx
orl $0x1400104, %ecx        # imm = 0x1400104
movl %ecx, 0xc(%rax)
movq -0x38(%rbp), %rax
movl 0xc(%rax), %ecx
orl $0x40000, %ecx          # imm = 0x40000
movl %ecx, 0xc(%rax)
movslq -0x24(%rbp), %rsi
movl $0x10, %edi
callq 0x1c35d0
movq %rax, -0x48(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movl $0x10, %edi
callq 0x1c35d0
movq %rax, -0x50(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movl $0x10, %edi
callq 0x1c35d0
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x2aded2
movq $0x0, -0x8(%rbp)
jmp 0x2ae353
cmpq $0x0, -0x50(%rbp)
jne 0x2adee6
movq $0x0, -0x8(%rbp)
jmp 0x2ae353
cmpq $0x0, -0x58(%rbp)
jne 0x2adefa
movq $0x0, -0x8(%rbp)
jmp 0x2ae353
movq 0x10(%rbp), %rax
cmpl $0x0, 0x30(%rax)
jne 0x2adf68
movslq -0x5c(%rbp), %rsi
movl $0x10, %edi
callq 0x1c35d0
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x2adf2a
movq $0x0, -0x8(%rbp)
jmp 0x2ae353
movl $0x0, -0x60(%rbp)
movl -0x60(%rbp), %eax
cmpl -0x5c(%rbp), %eax
jge 0x2adf66
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rcx
movslq -0x60(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
movl (%rax,%rcx,4), %edx
movq -0x40(%rbp), %rax
movslq -0x60(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x2adf31
jmp 0x2adf68
movl $0x0, -0x64(%rbp)
movl -0x64(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x2adfa4
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x20(%rbp), %rcx
movslq -0x64(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
movl (%rax,%rcx,4), %edx
movq -0x48(%rbp), %rax
movslq -0x64(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x2adf6f
movq -0x50(%rbp), %rax
movl $0x0, (%rax)
movq -0x58(%rbp), %rax
movl $0xc0000000, (%rax)     # imm = 0xC0000000
movl $0x1, -0x64(%rbp)
movl -0x64(%rbp), %eax
cmpl -0x24(%rbp), %eax
jg 0x2adff0
movq -0x50(%rbp), %rax
movslq -0x64(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
movq -0x58(%rbp), %rax
movslq -0x64(%rbp), %rcx
movl $0xc0000000, (%rax,%rcx,4) # imm = 0xC0000000
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x2adfbf
movl $0x1, -0x60(%rbp)
movl -0x60(%rbp), %eax
cmpl -0x5c(%rbp), %eax
jg 0x2ae2c4
movq 0x10(%rbp), %rax
cmpl $0x0, 0x30(%rax)
jne 0x2ae040
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rbp), %rcx
movl 0x18(%rcx), %ecx
movq -0x40(%rbp), %rdx
movl -0x60(%rbp), %esi
subl $0x1, %esi
movslq %esi, %rsi
imull (%rdx,%rsi,4), %ecx
movslq %ecx, %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0xa8(%rbp)
jmp 0x2ae069
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rbp), %rcx
movl 0x18(%rcx), %ecx
movl -0x60(%rbp), %edx
subl $0x1, %edx
imull %edx, %ecx
movslq %ecx, %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x50(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x7c(%rbp)
movl $0x0, -0x80(%rbp)
movl $0xc0000000, -0x84(%rbp) # imm = 0xC0000000
movl -0x80(%rbp), %ecx
movq -0x50(%rbp), %rax
movl %ecx, (%rax)
movl $0x1, -0x64(%rbp)
movl -0x64(%rbp), %eax
cmpl -0x24(%rbp), %eax
jg 0x2ae29b
movl -0x7c(%rbp), %eax
movl %eax, -0x9c(%rbp)
movq -0x50(%rbp), %rax
movslq -0x64(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
subl -0x28(%rbp), %eax
movl %eax, -0x94(%rbp)
movq -0x58(%rbp), %rax
movslq -0x64(%rbp), %rcx
movl (%rax,%rcx,4), %eax
subl -0x2c(%rbp), %eax
movl %eax, -0x98(%rbp)
movl -0x94(%rbp), %eax
cmpl -0x98(%rbp), %eax
jle 0x2ae0fd
movl -0x94(%rbp), %eax
movl %eax, -0xac(%rbp)
jmp 0x2ae109
movl -0x98(%rbp), %eax
movl %eax, -0xac(%rbp)
movl -0xac(%rbp), %edx
movq -0x58(%rbp), %rax
movslq -0x64(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x80(%rbp), %eax
subl -0x28(%rbp), %eax
movl %eax, -0x8c(%rbp)
movl -0x84(%rbp), %eax
subl -0x2c(%rbp), %eax
movl %eax, -0x90(%rbp)
movl -0x8c(%rbp), %eax
cmpl -0x90(%rbp), %eax
jle 0x2ae151
movl -0x8c(%rbp), %eax
movl %eax, -0xb0(%rbp)
jmp 0x2ae15d
movl -0x90(%rbp), %eax
movl %eax, -0xb0(%rbp)
movl -0xb0(%rbp), %eax
movl %eax, -0x84(%rbp)
movl -0x9c(%rbp), %eax
movq -0x78(%rbp), %rcx
movq -0x48(%rbp), %rdx
movl -0x64(%rbp), %esi
subl $0x1, %esi
movslq %esi, %rsi
movslq (%rdx,%rsi,4), %rdx
addl (%rcx,%rdx,4), %eax
movl %eax, -0x88(%rbp)
cmpl $0x0, -0x88(%rbp)
jle 0x2ae1a4
movl -0x88(%rbp), %eax
movl %eax, -0xb4(%rbp)
jmp 0x2ae1ae
xorl %eax, %eax
movl %eax, -0xb4(%rbp)
jmp 0x2ae1ae
movl -0xb4(%rbp), %eax
movl %eax, -0x80(%rbp)
movl -0x80(%rbp), %eax
cmpl -0x84(%rbp), %eax
jle 0x2ae1cd
movl -0x80(%rbp), %eax
movl %eax, -0xb8(%rbp)
jmp 0x2ae1d9
movl -0x84(%rbp), %eax
movl %eax, -0xb8(%rbp)
movl -0xb8(%rbp), %eax
movl %eax, -0x80(%rbp)
movl -0x80(%rbp), %eax
movq -0x58(%rbp), %rcx
movslq -0x64(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jle 0x2ae1fd
movl -0x80(%rbp), %eax
movl %eax, -0xbc(%rbp)
jmp 0x2ae20e
movq -0x58(%rbp), %rax
movslq -0x64(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0xbc(%rbp)
movl -0xbc(%rbp), %eax
movl %eax, -0x80(%rbp)
movl -0x80(%rbp), %edx
movq -0x50(%rbp), %rax
movslq -0x64(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x80(%rbp), %eax
cmpl -0x68(%rbp), %eax
jle 0x2ae241
movl -0x60(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x6c(%rbp)
movl -0x64(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x70(%rbp)
jmp 0x2ae268
movl -0x68(%rbp), %eax
cmpl -0x80(%rbp), %eax
jne 0x2ae266
movl -0x64(%rbp), %eax
subl $0x1, %eax
cmpl -0x70(%rbp), %eax
jge 0x2ae266
movl -0x60(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x6c(%rbp)
movl -0x64(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x70(%rbp)
jmp 0x2ae268
movl -0x68(%rbp), %eax
cmpl -0x80(%rbp), %eax
jle 0x2ae27b
movl -0x68(%rbp), %eax
movl %eax, -0xc0(%rbp)
jmp 0x2ae284
movl -0x80(%rbp), %eax
movl %eax, -0xc0(%rbp)
movl -0xc0(%rbp), %eax
movl %eax, -0x68(%rbp)
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x2ae09e
movl -0x80(%rbp), %edx
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movl -0x60(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x2adff7
movl $0x1, -0x64(%rbp)
movl -0x64(%rbp), %eax
cmpl -0x24(%rbp), %eax
jg 0x2ae300
movq -0x50(%rbp), %rax
movslq -0x64(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rax
movl -0x64(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x2ae2cb
movl -0x68(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, (%rax)
movl -0x6c(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x4(%rax)
movl -0x70(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x58(%rbp), %rdi
callq 0x1c3590
movq -0x50(%rbp), %rdi
callq 0x1c3590
movq -0x48(%rbp), %rdi
callq 0x1c3590
movq 0x10(%rbp), %rax
cmpl $0x0, 0x30(%rax)
jne 0x2ae34b
movq -0x40(%rbp), %rdi
callq 0x1c3590
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xc0, %rsp
popq %rbp
retq