// File: 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
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movl %r8d, -0x28(%rbp)
movl $0x10, %edi
callq 0x2190
movq %rax, -0x30(%rbp)
xorl %eax, %eax
cmpq -0x30(%rbp), %rax
jne 0x3f7f
leaq 0x12b5(%rip), %rdi      # 0x522d
movb $0x0, %al
callq 0x2040
movslq -0x28(%rbp), %rdi
shlq $0x2, %rdi
movslq -0x28(%rbp), %rax
imulq %rax, %rdi
callq 0x2190
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rcx
xorl %eax, %eax
cmpq (%rcx), %rax
jne 0x3fb7
leaq 0x12ad(%rip), %rdi      # 0x525d
movb $0x0, %al
callq 0x2040
movslq -0x28(%rbp), %rdi
shlq $0x2, %rdi
callq 0x2190
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x30(%rbp), %rcx
xorl %eax, %eax
cmpq 0x8(%rcx), %rax
jne 0x3fe9
leaq 0x12af(%rip), %rdi      # 0x5291
movb $0x0, %al
callq 0x2040
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x4029
movq -0x40(%rbp), %rax
movslq -0x44(%rbp), %rcx
movl $0xffffffff, (%rax,%rcx,4) # imm = 0xFFFFFFFF
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x4007
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x40a7
movq -0x20(%rbp), %rax
movslq -0x44(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
je 0x409a
movl -0x44(%rbp), %edx
movq -0x40(%rbp), %rax
movslq -0x44(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x28(%rbp), %eax
imull -0x44(%rbp), %eax
movl %eax, -0x50(%rbp)
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x4098
movq -0x18(%rbp), %rax
movl -0x50(%rbp), %ecx
addl -0x48(%rbp), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq -0x38(%rbp), %rax
movl -0x50(%rbp), %ecx
addl -0x48(%rbp), %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x4065
jmp 0x409a
jmp 0x409c
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x4030
movl $0x0, -0x4c(%rbp)
movl -0x28(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x417e
movq -0x20(%rbp), %rax
movslq -0x44(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
je 0x416e
jmp 0x40d4
movl -0x4c(%rbp), %ecx
xorl %eax, %eax
cmpl -0x28(%rbp), %ecx
movb %al, -0x51(%rbp)
jge 0x40f3
movq -0x40(%rbp), %rax
movslq -0x4c(%rbp), %rcx
cmpl $-0x1, (%rax,%rcx,4)
setne %al
movb %al, -0x51(%rbp)
movb -0x51(%rbp), %al
testb $0x1, %al
jne 0x40fc
jmp 0x4107
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x40d4
movl -0x4c(%rbp), %eax
cmpl -0x28(%rbp), %eax
jne 0x411c
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x41e8
movl -0x44(%rbp), %edx
movq -0x40(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x416c
movq -0x18(%rbp), %rax
movl -0x28(%rbp), %ecx
imull -0x44(%rbp), %ecx
addl -0x48(%rbp), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq -0x38(%rbp), %rax
movl -0x28(%rbp), %ecx
imull -0x4c(%rbp), %ecx
addl -0x48(%rbp), %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x4131
jmp 0x416e
jmp 0x4170
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x40b4
jmp 0x4180
movl -0x4c(%rbp), %ecx
xorl %eax, %eax
cmpl -0x28(%rbp), %ecx
movb %al, -0x52(%rbp)
jge 0x419f
movq -0x40(%rbp), %rax
movslq -0x4c(%rbp), %rcx
cmpl $-0x1, (%rax,%rcx,4)
setne %al
movb %al, -0x52(%rbp)
movb -0x52(%rbp), %al
testb $0x1, %al
jne 0x41a8
jmp 0x41b3
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x4180
movl -0x4c(%rbp), %eax
cmpl -0x28(%rbp), %eax
jne 0x41c5
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x41e8
movq -0x40(%rbp), %rdi
callq 0x2160
movq -0x38(%rbp), %rdi
callq 0x2160
movq -0x30(%rbp), %rdi
callq 0x2160
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)