// File: /workspace/github_c_makefile_star2_O0/nh13[P]ksw/src/parasail/src/nw_scan.c
// Function: parasail_nw_rowcol_scan
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 HB = NULL;
    int * restrict H  = NULL;
    int * restrict E  = NULL;
    int * restrict HtB= NULL;
    int * restrict Ht = NULL;
    int s1Len = 0;
    int i = 0;
    int j = 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;

    /* 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_NW | PARASAIL_FLAG_NOVEC_SCAN
        | 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);
    HB = parasail_memalign_int(16, s1Len+1);
    H  = HB+1;
    E  = parasail_memalign_int(16, s1Len);
    HtB= parasail_memalign_int(16, s1Len+1);
    Ht = HtB+1;

    /* validate heap variables */
    if (!s2) return NULL;
    if (!HB) return NULL;
    if (!E) return NULL;
    if (!HtB) 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]];
    }

    /* initialize H */
    H[-1] = 0;
    Ht[-1] = 0;
    for (i=0; i<s1Len; ++i) {
        H[i] = -open - i*gap;
    }

    /* initialize E */
    for (i=0; i<s1Len; ++i) {
        E[i] = NEG_INF_32;
    }

    /* iterate over database */
    for (j=0; j<s2Len; ++j) {
        int Ft = NEG_INF_32;
        /* calculate E */
        for (i=0; i<s1Len; ++i) {
            E[i] = MAX(E[i]-gap, H[i]-open);
        }
        /* calculate Ht */
        for (i=0; i<s1Len; ++i) {
            int matval = matrix->type == PARASAIL_MATRIX_TYPE_SQUARE ?
                         matrix->matrix[matrix->size*s1[i]+s2[j]] :
                         matrix->matrix[matrix->size*i+s2[j]];
            Ht[i] = MAX(H[i-1]+matval, E[i]);
        }
        Ht[-1] = -open -j*gap;
        /* calculate H */
        for (i=0; i<s1Len; ++i) {
            int Ft_opn;
            int Ht_pre = Ht[i-1];
            int Ft_ext = Ft-gap;
            if (Ht_pre >= Ft_ext) {
                Ft = Ht_pre;
            }
            else {
                Ft = Ft_ext;
            }
            Ft_opn = Ft-open;
            H[i] = MAX(Ht[i], Ft_opn);
#ifdef PARASAIL_TABLE
            result->tables->score_table[i*s2Len + j] = H[i];
#endif
        }
        H[-1] = -open - j*gap;
#ifdef PARASAIL_ROWCOL
        if (j == s2Len-1) {
            for (i=0; i<s1Len; ++i) {
                result->rowcols->score_col[i] = H[i];
            }
        }
        result->rowcols->score_row[j] = H[s1Len-1];
#endif
    }

    result->score = H[s1Len-1];
    result->end_query = s1Len-1;
    result->end_ref = s2Len-1;

    parasail_free(HtB);
    parasail_free(E);
    parasail_free(HB);
    parasail_free(s2);
    if (matrix->type == PARASAIL_MATRIX_TYPE_SQUARE) {
        parasail_free(s1);
    }

    return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %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)
movq $0x0, -0x60(%rbp)
movq $0x0, -0x68(%rbp)
movq $0x0, -0x70(%rbp)
movl $0x0, -0x74(%rbp)
movl $0x0, -0x78(%rbp)
movl $0x0, -0x7c(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x2ae414
movq 0xb78bf0(%rip), %rax    # 0xe26fd8
movq (%rax), %rdi
leaq 0xa3dbf9(%rip), %rsi    # 0xcebfeb
leaq 0x9fcaf1(%rip), %rdx    # 0xcaaeea
leaq 0xa3e2fd(%rip), %rcx    # 0xcec6fd
movb $0x0, %al
callq 0x19e180
movq $0x0, -0x8(%rbp)
jmp 0x2aeb21
jmp 0x2ae416
jmp 0x2ae418
cmpl $0x0, -0x24(%rbp)
jg 0x2ae451
movq 0xb78bb3(%rip), %rax    # 0xe26fd8
movq (%rax), %rdi
leaq 0xa3e2d2(%rip), %rsi    # 0xcec701
leaq 0x9fcab4(%rip), %rdx    # 0xcaaeea
leaq 0xa3e2d8(%rip), %rcx    # 0xcec715
movb $0x0, %al
callq 0x19e180
movq $0x0, -0x8(%rbp)
jmp 0x2aeb21
jmp 0x2ae453
jmp 0x2ae455
cmpl $0x0, -0x28(%rbp)
jge 0x2ae48e
movq 0xb78b76(%rip), %rax    # 0xe26fd8
movq (%rax), %rdi
leaq 0xa3e2af(%rip), %rsi    # 0xcec71b
leaq 0x9fca77(%rip), %rdx    # 0xcaaeea
leaq 0xa3e2b6(%rip), %rcx    # 0xcec730
movb $0x0, %al
callq 0x19e180
movq $0x0, -0x8(%rbp)
jmp 0x2aeb21
jmp 0x2ae490
jmp 0x2ae492
cmpl $0x0, -0x2c(%rbp)
jge 0x2ae4cb
movq 0xb78b39(%rip), %rax    # 0xe26fd8
movq (%rax), %rdi
leaq 0xa3e272(%rip), %rsi    # 0xcec71b
leaq 0x9fca3a(%rip), %rdx    # 0xcaaeea
leaq 0xa3e27e(%rip), %rcx    # 0xcec735
movb $0x0, %al
callq 0x19e180
movq $0x0, -0x8(%rbp)
jmp 0x2aeb21
jmp 0x2ae4cd
jmp 0x2ae4cf
cmpq $0x0, 0x10(%rbp)
jne 0x2ae509
movq 0xb78afb(%rip), %rax    # 0xe26fd8
movq (%rax), %rdi
leaq 0xa3db04(%rip), %rsi    # 0xcebfeb
leaq 0x9fc9fc(%rip), %rdx    # 0xcaaeea
leaq 0xa3e430(%rip), %rcx    # 0xcec925
movb $0x0, %al
callq 0x19e180
movq $0x0, -0x8(%rbp)
jmp 0x2aeb21
jmp 0x2ae50b
movq 0x10(%rbp), %rax
cmpl $0x0, 0x30(%rax)
jne 0x2ae592
jmp 0x2ae517
cmpq $0x0, -0x10(%rbp)
jne 0x2ae551
movq 0xb78ab3(%rip), %rax    # 0xe26fd8
movq (%rax), %rdi
leaq 0xa3dabc(%rip), %rsi    # 0xcebfeb
leaq 0x9fc9b4(%rip), %rdx    # 0xcaaeea
leaq 0xa3e1fc(%rip), %rcx    # 0xcec739
movb $0x0, %al
callq 0x19e180
movq $0x0, -0x8(%rbp)
jmp 0x2aeb21
jmp 0x2ae553
jmp 0x2ae555
cmpl $0x0, -0x14(%rbp)
jg 0x2ae58e
movq 0xb78a76(%rip), %rax    # 0xe26fd8
movq (%rax), %rdi
leaq 0xa3e195(%rip), %rsi    # 0xcec701
leaq 0x9fc977(%rip), %rdx    # 0xcaaeea
leaq 0xa3e1c3(%rip), %rcx    # 0xcec73d
movb $0x0, %al
callq 0x19e180
movq $0x0, -0x8(%rbp)
jmp 0x2aeb21
jmp 0x2ae590
jmp 0x2ae592
movq 0x10(%rbp), %rax
cmpl $0x0, 0x30(%rax)
jne 0x2ae5a7
movl -0x14(%rbp), %eax
movl %eax, -0x94(%rbp)
jmp 0x2ae5b4
movq 0x10(%rbp), %rax
movl 0x34(%rax), %eax
movl %eax, -0x94(%rbp)
movl -0x94(%rbp), %eax
movl %eax, -0x74(%rbp)
movl -0x74(%rbp), %edi
movl -0x24(%rbp), %esi
callq 0x1c3af0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x2ae5e0
movq $0x0, -0x8(%rbp)
jmp 0x2aeb21
movq -0x38(%rbp), %rax
movl 0xc(%rax), %ecx
orl $0x1400201, %ecx        # imm = 0x1400201
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 -0x74(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movl $0x10, %edi
callq 0x1c35d0
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x58(%rbp)
movslq -0x74(%rbp), %rsi
movl $0x10, %edi
callq 0x1c35d0
movq %rax, -0x60(%rbp)
movl -0x74(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
movl $0x10, %edi
callq 0x1c35d0
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x70(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x2ae67e
movq $0x0, -0x8(%rbp)
jmp 0x2aeb21
cmpq $0x0, -0x50(%rbp)
jne 0x2ae692
movq $0x0, -0x8(%rbp)
jmp 0x2aeb21
cmpq $0x0, -0x60(%rbp)
jne 0x2ae6a6
movq $0x0, -0x8(%rbp)
jmp 0x2aeb21
cmpq $0x0, -0x68(%rbp)
jne 0x2ae6ba
movq $0x0, -0x8(%rbp)
jmp 0x2aeb21
movq 0x10(%rbp), %rax
cmpl $0x0, 0x30(%rax)
jne 0x2ae728
movslq -0x74(%rbp), %rsi
movl $0x10, %edi
callq 0x1c35d0
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x2ae6ea
movq $0x0, -0x8(%rbp)
jmp 0x2aeb21
movl $0x0, -0x78(%rbp)
movl -0x78(%rbp), %eax
cmpl -0x74(%rbp), %eax
jge 0x2ae726
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rcx
movslq -0x78(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
movl (%rax,%rcx,4), %edx
movq -0x40(%rbp), %rax
movslq -0x78(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x78(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x78(%rbp)
jmp 0x2ae6f1
jmp 0x2ae728
movl $0x0, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x2ae764
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x20(%rbp), %rcx
movslq -0x7c(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
movl (%rax,%rcx,4), %edx
movq -0x48(%rbp), %rax
movslq -0x7c(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x2ae72f
movq -0x58(%rbp), %rax
movl $0x0, -0x4(%rax)
movq -0x70(%rbp), %rax
movl $0x0, -0x4(%rax)
movl $0x0, -0x78(%rbp)
movl -0x78(%rbp), %eax
cmpl -0x74(%rbp), %eax
jge 0x2ae7ad
xorl %edx, %edx
subl -0x28(%rbp), %edx
movl -0x78(%rbp), %eax
imull -0x2c(%rbp), %eax
subl %eax, %edx
movq -0x58(%rbp), %rax
movslq -0x78(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x78(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x78(%rbp)
jmp 0x2ae781
movl $0x0, -0x78(%rbp)
movl -0x78(%rbp), %eax
cmpl -0x74(%rbp), %eax
jge 0x2ae7d6
movq -0x60(%rbp), %rax
movslq -0x78(%rbp), %rcx
movl $0xc0000000, (%rax,%rcx,4) # imm = 0xC0000000
movl -0x78(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x78(%rbp)
jmp 0x2ae7b4
movl $0x0, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x2aeab2
movl $0xc0000000, -0x80(%rbp) # imm = 0xC0000000
movl $0x0, -0x78(%rbp)
movl -0x78(%rbp), %eax
cmpl -0x74(%rbp), %eax
jge 0x2ae865
movq -0x60(%rbp), %rax
movslq -0x78(%rbp), %rcx
movl (%rax,%rcx,4), %eax
subl -0x2c(%rbp), %eax
movq -0x58(%rbp), %rcx
movslq -0x78(%rbp), %rdx
movl (%rcx,%rdx,4), %ecx
subl -0x28(%rbp), %ecx
cmpl %ecx, %eax
jle 0x2ae835
movq -0x60(%rbp), %rax
movslq -0x78(%rbp), %rcx
movl (%rax,%rcx,4), %eax
subl -0x2c(%rbp), %eax
movl %eax, -0x98(%rbp)
jmp 0x2ae849
movq -0x58(%rbp), %rax
movslq -0x78(%rbp), %rcx
movl (%rax,%rcx,4), %eax
subl -0x28(%rbp), %eax
movl %eax, -0x98(%rbp)
movl -0x98(%rbp), %edx
movq -0x60(%rbp), %rax
movslq -0x78(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x78(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x78(%rbp)
jmp 0x2ae7f7
movl $0x0, -0x78(%rbp)
movl -0x78(%rbp), %eax
cmpl -0x74(%rbp), %eax
jge 0x2ae95d
movq 0x10(%rbp), %rax
cmpl $0x0, 0x30(%rax)
jne 0x2ae8b6
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rbp), %rcx
movl 0x18(%rcx), %ecx
movq -0x40(%rbp), %rdx
movslq -0x78(%rbp), %rsi
imull (%rdx,%rsi,4), %ecx
movq -0x48(%rbp), %rdx
movslq -0x7c(%rbp), %rsi
addl (%rdx,%rsi,4), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x9c(%rbp)
jmp 0x2ae8e0
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rbp), %rcx
movl 0x18(%rcx), %ecx
imull -0x78(%rbp), %ecx
movq -0x48(%rbp), %rdx
movslq -0x7c(%rbp), %rsi
addl (%rdx,%rsi,4), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x9c(%rbp)
movl -0x9c(%rbp), %eax
movl %eax, -0x84(%rbp)
movq -0x58(%rbp), %rax
movl -0x78(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
addl -0x84(%rbp), %eax
movq -0x60(%rbp), %rcx
movslq -0x78(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jle 0x2ae92d
movq -0x58(%rbp), %rax
movl -0x78(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
addl -0x84(%rbp), %eax
movl %eax, -0xa0(%rbp)
jmp 0x2ae93e
movq -0x60(%rbp), %rax
movslq -0x78(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0xa0(%rbp)
movl -0xa0(%rbp), %edx
movq -0x70(%rbp), %rax
movslq -0x78(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x78(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x78(%rbp)
jmp 0x2ae86c
xorl %ecx, %ecx
subl -0x28(%rbp), %ecx
movl -0x7c(%rbp), %eax
imull -0x2c(%rbp), %eax
subl %eax, %ecx
movq -0x70(%rbp), %rax
movl %ecx, -0x4(%rax)
movl $0x0, -0x78(%rbp)
movl -0x78(%rbp), %eax
cmpl -0x74(%rbp), %eax
jge 0x2aea26
movq -0x70(%rbp), %rax
movl -0x78(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x8c(%rbp)
movl -0x80(%rbp), %eax
subl -0x2c(%rbp), %eax
movl %eax, -0x90(%rbp)
movl -0x8c(%rbp), %eax
cmpl -0x90(%rbp), %eax
jl 0x2ae9c0
movl -0x8c(%rbp), %eax
movl %eax, -0x80(%rbp)
jmp 0x2ae9c9
movl -0x90(%rbp), %eax
movl %eax, -0x80(%rbp)
movl -0x80(%rbp), %eax
subl -0x28(%rbp), %eax
movl %eax, -0x88(%rbp)
movq -0x70(%rbp), %rax
movslq -0x78(%rbp), %rcx
movl (%rax,%rcx,4), %eax
cmpl -0x88(%rbp), %eax
jle 0x2ae9fb
movq -0x70(%rbp), %rax
movslq -0x78(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0xa4(%rbp)
jmp 0x2aea07
movl -0x88(%rbp), %eax
movl %eax, -0xa4(%rbp)
movl -0xa4(%rbp), %edx
movq -0x58(%rbp), %rax
movslq -0x78(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x78(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x78(%rbp)
jmp 0x2ae979
xorl %ecx, %ecx
subl -0x28(%rbp), %ecx
movl -0x7c(%rbp), %eax
imull -0x2c(%rbp), %eax
subl %eax, %ecx
movq -0x58(%rbp), %rax
movl %ecx, -0x4(%rax)
movl -0x7c(%rbp), %eax
movl -0x24(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x2aea82
movl $0x0, -0x78(%rbp)
movl -0x78(%rbp), %eax
cmpl -0x74(%rbp), %eax
jge 0x2aea80
movq -0x58(%rbp), %rax
movslq -0x78(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movslq -0x78(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x78(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x78(%rbp)
jmp 0x2aea4f
jmp 0x2aea82
movq -0x58(%rbp), %rax
movl -0x74(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rax
movslq -0x7c(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x2ae7dd
movq -0x58(%rbp), %rax
movl -0x74(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %ecx
movq -0x38(%rbp), %rax
movl %ecx, (%rax)
movl -0x74(%rbp), %ecx
subl $0x1, %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x4(%rax)
movl -0x24(%rbp), %ecx
subl $0x1, %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x68(%rbp), %rdi
callq 0x1c3590
movq -0x60(%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 0x2aeb19
movq -0x40(%rbp), %rdi
callq 0x1c3590
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xb0, %rsp
popq %rbp
retq
nop