// File: /workspace/github_cpp_makefile_star2_O1/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, -0x34(%rbp)
movq %rdx, -0x60(%rbp)
movq %rsi, -0x58(%rbp)
movl $0x10, %edi
callq 0x10d0
movq %rax, %r15
testq %rax, %rax
jne 0x2245
leaq 0xef2(%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 0x10d0
movq %rax, (%r15)
movq %rax, -0x48(%rbp)
testq %rax, %rax
jne 0x227a
leaq 0xeed(%rip), %rdi       # 0x3160
xorl %eax, %eax
callq 0x1040
movq %rbx, %rdi
callq 0x10d0
movq %rax, 0x8(%r15)
movq %rax, -0x30(%rbp)
testq %rax, %rax
jne 0x229d
leaq 0xefe(%rip), %rdi       # 0x3194
xorl %eax, %eax
callq 0x1040
movq %r15, -0x40(%rbp)
movl %r14d, %ebx
testl %r14d, %r14d
jle 0x22bf
leaq (,%rbx,4), %rdx
movq -0x30(%rbp), %rdi
movl $0xff, %esi
callq 0x1050
testl %r14d, %r14d
jle 0x230b
leaq (,%rbx,4), %r15
xorl %r12d, %r12d
xorl %r13d, %r13d
movq -0x60(%rbp), %rax
cmpl $0x0, (%rax,%r13,4)
je 0x2300
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 0x1070
incq %r13
addl %r14d, %r12d
cmpq %r13, %rbx
jne 0x22d2
xorl %r15d, %r15d
subl %r14d, -0x34(%rbp)
jle 0x23b0
shlq $0x2, %rbx
xorl %r12d, %r12d
movq -0x50(%rbp), %r13
xorl %r15d, %r15d
movq -0x60(%rbp), %rax
cmpl $0x0, (%rax,%r13,4)
je 0x23a0
cmpl %r14d, %r15d
jge 0x2360
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 0x235d
incq %rcx
cmpq %rcx, %rdx
jne 0x234a
movl %r14d, %r15d
jmp 0x2360
addl %ecx, %r15d
cmpl %r14d, %r15d
je 0x23d9
movslq %r15d, %rax
movq -0x30(%rbp), %rcx
movl %r13d, (%rcx,%rax,4)
testl %r14d, %r14d
jle 0x23a0
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 0x1070
incq %r13
incl %r12d
cmpl -0x34(%rbp), %r12d
jne 0x2326
cmpl %r14d, %r15d
jge 0x23d4
movslq %r15d, %rax
movq -0x30(%rbp), %rcx
leaq (%rcx,%rax,4), %rax
cmpl $-0x1, (%rax)
je 0x23d4
incl %r15d
addq $0x4, %rax
cmpl %r15d, %r14d
jne 0x23c0
movl %r14d, %r15d
cmpl %r14d, %r15d
jne 0x23df
movq -0x40(%rbp), %rax
jmp 0x23fc
movq -0x30(%rbp), %rdi
callq 0x10b0
movq -0x48(%rbp), %rdi
callq 0x10b0
movq -0x40(%rbp), %rdi
callq 0x10b0
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop