// File: /workspace/github_cpp_makefile_star2_O3/syzcch[P]FEC_C_version/./fec_rs.h
// Function: rscode::gf_condense_dispersal_matrix(int*, int*, int, int)
Condensed_Matrix *gf_condense_dispersal_matrix(
        int *disp, int *existing_rows, int rows,    int  cols)
    {
        Condensed_Matrix *cm;
        int *m;
        int *id;
        int i, j, k, tmp;

        /* Allocate cm and initialize */
        cm = (Condensed_Matrix *) malloc(sizeof(Condensed_Matrix));
        if (NULL == cm)
        {
            printf("gf_condense_dispersal_matrix - Condensed_Matrix");
        }
        cm->condensed_matrix = (int *) malloc(sizeof(int)*cols*cols);
        if (NULL == cm->condensed_matrix)
        {
            printf("gf_condense_dispersal_matrix - cm->condensed_matrix");

        }
        cm->row_identities = (int *) malloc(sizeof(int)*cols);
        if (NULL == cm->row_identities)
        {
            printf("gf_condense_dispersal_matrix - cm->row_identities");
        }
        m = cm->condensed_matrix;
        id = cm->row_identities;
        for (i = 0; i < cols; i++)
        {
            id[i] = -1;
        }

        /* First put identity rows in their proper places */

        for (i = 0; i < cols; i++)
        {
            if (existing_rows[i] != 0)
            {
                id[i] = i;
                tmp = cols*i;
                for (j = 0; j < cols; j++)
                {
                    m[tmp+j] = disp[tmp+j];
                }
            }
        }

        /* Next, put coding rows in */
        k = 0;
        for (i = cols; i < rows; i++)
        {
            if (existing_rows[i] != 0)
            {
                while(k < cols && id[k] != -1)
                {
                    k++;
                }
                if (k == cols)
                {
                    return cm;
                }
                id[k] = i;
                for (j = 0; j < cols; j++)
                {
                    m[cols*k+j] = disp[cols*i+j];
                }
            }
        }

        /* If we're here, there are no more coding rows -- check to see that the
           condensed dispersal matrix is full -- otherwise, it's not -- return an
           error */

        while(k < cols && id[k] != -1)
        {
            k++;
        }
        if (k == cols)
        {
            return cm;
        }

        free(id);
        free(m);
        free(cm);
        return NULL;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %r8d, %r14d
movl %ecx, -0x3c(%rbp)
movq %rdx, -0x60(%rbp)
movq %rsi, -0x58(%rbp)
movl $0x10, %edi
callq 0x10e0
movq %rax, %r15
testq %rax, %rax
jne 0x228d
leaq 0xeaa(%rip), %rdi       # 0x3130
xorl %eax, %eax
callq 0x1040
movslq %r14d, %rax
leaq (,%rax,4), %rbx
movq %rbx, %rdi
movq %rax, -0x50(%rbp)
imulq %rax, %rdi
callq 0x10e0
movq %rax, (%r15)
movq %rax, -0x48(%rbp)
testq %rax, %rax
jne 0x22c2
leaq 0xea5(%rip), %rdi       # 0x3160
xorl %eax, %eax
callq 0x1040
movq %rbx, %rdi
callq 0x10e0
movq %r15, -0x38(%rbp)
movq %rax, 0x8(%r15)
movq %rax, -0x30(%rbp)
testq %rax, %rax
jne 0x22e9
leaq 0xeb2(%rip), %rdi       # 0x3194
xorl %eax, %eax
callq 0x1040
movl %r14d, %ebx
testl %r14d, %r14d
jle 0x2349
leaq (,%rbx,4), %r15
movq -0x30(%rbp), %rdi
movl $0xff, %esi
movq %r15, %rdx
callq 0x1050
xorl %r12d, %r12d
xorl %r13d, %r13d
movq -0x60(%rbp), %rax
cmpl $0x0, (%rax,%r13,4)
je 0x233e
movl %r12d, %eax
movq -0x58(%rbp), %rcx
leaq (%rcx,%rax,4), %rsi
movq -0x48(%rbp), %rcx
leaq (%rcx,%rax,4), %rdi
movq -0x30(%rbp), %rax
movl %r13d, (%rax,%r13,4)
movq %r15, %rdx
callq 0x1080
incq %r13
addl %r14d, %r12d
cmpq %r13, %rbx
jne 0x2310
xorl %r15d, %r15d
subl %r14d, -0x3c(%rbp)
jle 0x23eb
shlq $0x2, %rbx
xorl %r12d, %r12d
movq -0x50(%rbp), %r13
xorl %r15d, %r15d
movq -0x60(%rbp), %rax
cmpl $0x0, (%rax,%r13,4)
je 0x23db
cmpl %r14d, %r15d
jge 0x239b
movslq %r15d, %rcx
movq -0x30(%rbp), %rax
leaq (%rax,%rcx,4), %rax
movq -0x50(%rbp), %rdx
subq %rcx, %rdx
xorl %ecx, %ecx
cmpl $-0x1, (%rax,%rcx,4)
je 0x2398
incq %rcx
cmpq %rcx, %rdx
jne 0x2388
jmp 0x2413
addl %ecx, %r15d
cmpl %r14d, %r15d
je 0x2413
movslq %r15d, %rax
movq -0x30(%rbp), %rcx
movl %r13d, (%rcx,%rax,4)
testl %r14d, %r14d
jle 0x23db
leal (%r12,%r14), %eax
imull %r14d, %eax
cltq
movq -0x58(%rbp), %rcx
leaq (%rcx,%rax,4), %rsi
movl %r15d, %eax
imull %r14d, %eax
cltq
movq -0x48(%rbp), %rcx
leaq (%rcx,%rax,4), %rdi
movq %rbx, %rdx
callq 0x1080
incq %r13
incl %r12d
cmpl -0x3c(%rbp), %r12d
jne 0x2364
cmpl %r14d, %r15d
jge 0x240e
movslq %r15d, %rax
movq -0x30(%rbp), %rcx
leaq (%rcx,%rax,4), %rax
cmpl $-0x1, (%rax)
je 0x240e
incl %r15d
addq $0x4, %rax
cmpl %r15d, %r14d
jne 0x23fb
jmp 0x2413
cmpl %r14d, %r15d
jne 0x2419
movq -0x38(%rbp), %rax
jmp 0x2436
movq -0x30(%rbp), %rdi
callq 0x10c0
movq -0x48(%rbp), %rdi
callq 0x10c0
movq -0x38(%rbp), %rdi
callq 0x10c0
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop