// File: /workspace/github_cpp_makefile_star2_O2/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 $0x28, %rsp
movl %r8d, %r14d
movl %ecx, -0x34(%rbp)
movq %rdx, %r12
movq %rsi, -0x40(%rbp)
pushq $0x10
popq %rdi
callq 0x10f0
movq %rax, %r13
testq %rax, %rax
jne 0x2202
leaq 0xf35(%rip), %rdi       # 0x3130
xorl %eax, %eax
callq 0x1040
movslq %r14d, %r15
leaq (,%r15,4), %rbx
movq %rbx, %rdi
imulq %r15, %rdi
callq 0x10f0
movq %rax, (%r13)
movq %rax, -0x48(%rbp)
testq %rax, %rax
movq %r13, -0x30(%rbp)
jne 0x2238
leaq 0xf2f(%rip), %rdi       # 0x3160
xorl %eax, %eax
callq 0x1040
movq %rbx, %rdi
callq 0x10f0
movq %rax, %r13
movq -0x30(%rbp), %rax
movq %r13, 0x8(%rax)
testq %r13, %r13
jne 0x225e
leaq 0xf3d(%rip), %rdi       # 0x3194
xorl %eax, %eax
callq 0x1040
xorl %ecx, %ecx
testl %r14d, %r14d
movl $0x0, %eax
cmovgl %r14d, %eax
movq -0x48(%rbp), %r11
movq -0x40(%rbp), %r10
cmpq %rcx, %rax
je 0x2284
orl $-0x1, (%r13,%rcx,4)
incq %rcx
jmp 0x2274
movl %r14d, %ecx
xorl %edx, %edx
movq %r11, %rsi
movq %r10, %rdi
cmpq %rax, %rdx
je 0x22c0
cmpl $0x0, (%r12,%rdx,4)
je 0x22b5
movl %edx, (%r13,%rdx,4)
xorl %r8d, %r8d
cmpq %r8, %rcx
je 0x22b5
movl (%rdi,%r8,4), %r9d
movl %r9d, (%rsi,%r8,4)
incq %r8
jmp 0x22a3
incq %rdx
addq %rbx, %rdi
addq %rbx, %rsi
jmp 0x228f
movslq -0x34(%rbp), %rdx
movq %r15, %rcx
imulq %r15, %rcx
leaq (%r10,%rcx,4), %rsi
xorl %ecx, %ecx
movq %r15, %rdi
cmpq %rdx, %rdi
jge 0x2337
cmpl $0x0, (%r12,%rdi,4)
je 0x232f
movslq %ecx, %r8
cmpl %r14d, %r8d
cmovlel %r14d, %ecx
cmpq %r15, %r8
jge 0x22ff
cmpl $-0x1, (%r13,%r8,4)
je 0x22fc
incq %r8
jmp 0x22ea
movl %r8d, %ecx
cmpl %r14d, %ecx
je 0x235a
movslq %ecx, %r8
movl %edi, (%r13,%r8,4)
movl %ecx, %r8d
imull %r14d, %r8d
movslq %r8d, %r8
leaq (%r11,%r8,4), %r8
xorl %r9d, %r9d
cmpq %r9, %rax
je 0x232f
movl (%rsi,%r9,4), %r10d
movl %r10d, (%r8,%r9,4)
incq %r9
jmp 0x231d
incq %rdi
addq %rbx, %rsi
jmp 0x22d4
movslq %ecx, %rax
cmpl %r14d, %eax
cmovlel %r14d, %ecx
cmpq %r15, %rax
jge 0x2355
cmpl $-0x1, (%r13,%rax,4)
je 0x2353
incq %rax
jmp 0x2341
movl %eax, %ecx
cmpl %r14d, %ecx
jne 0x2360
movq -0x30(%rbp), %rax
jmp 0x237e
movq %r13, %rdi
movq %r11, %rbx
callq 0x10d0
movq %rbx, %rdi
callq 0x10d0
movq -0x30(%rbp), %rdi
callq 0x10d0
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop