// File: /workspace/github_cpp_makefile_star2_O2/syzcch[P]FEC_C_version/./fec_rs.h
// Function: rscode::encoding()
void encoding()
    {
        int cols,rows;
        int factor=0,*factors;
        int *vdm,tmp;
        int z=rsNum,n=0;
        unsigned int fl=(num-1);
        int i=0,j=0;
        char *block;
        char **buffer;
        int l=0;
        int numx=num;

        if(allNum != num + rsNum)
        {
            printf("the addition of data disk num and checksum disk num should equal to allNum \n");
            exit(1);
        }

        n=num;
        cols=n;
        rows=z+n;
        factors = (int *) malloc(sizeof(int)*n);
        block=(char *) malloc(sizeof(char)*stripe_unit_size);
        buffer = (char **) malloc(sizeof(char *)*n);
        for (int i = 0; i < n; i++)
        {
            buffer[i] = (char *) malloc(stripe_unit_size);
            memset(buffer[i], 0, stripe_unit_size);
        }

        for(int i=0; i<n; i++)
        {
            for(int l=0; l<stripe_unit_size; l++)
            {
                buffer[i][l]=rs[i][l];
            }
        }

        for (int i = 0; i < n; i++)
        {
            factors[i] = 1;
        }

        vdm = gf_make_dispersal_matrix(rows, cols);

        for (int i = cols ; i< rows; i++)
        {
            memset(block, 0, stripe_unit_size);
            for (int j = 0; j < cols; j++)
            {
                tmp = vdm[i*cols+j];
                if (0 != tmp)
                {
                    factor = gf_single_divide(tmp, factors[j]);
                    factors[j] = tmp;
                    gf_mult_region(buffer[j], stripe_unit_size, factor);
                    gf_add_parity(buffer[j], block, stripe_unit_size);// do parity check
                }
            }

            memcpy(rs[numx],block,stripe_unit_size);
            numx++;
        }

        for(int i=0; i<num; i++)
        {
            if(buffer[i] == NULL)
            {
                printf(" already free ** \n ");
                continue;
            }
            free(buffer[i]);
        }
        if(buffer!=NULL)
        {
            free(buffer);
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movslq 0x8(%rdi), %r13
movslq 0x1c(%rdi), %rcx
movl 0x24(%rdi), %eax
addl %r13d, %eax
movq %rcx, -0x48(%rbp)
cmpl %eax, %ecx
jne 0x164a
movq %rdi, %rbx
leaq (,%r13,4), %rdi
movq %rdi, -0x58(%rbp)
callq 0x10f0
movq %rax, -0x50(%rbp)
movl 0x20(%rbx), %r15d
movslq %r15d, %rdi
movq %rdi, -0x30(%rbp)
callq 0x10f0
movq %rax, -0x40(%rbp)
leaq (,%r13,8), %rdi
callq 0x10f0
movq %rax, %r14
xorl %r12d, %r12d
testl %r13d, %r13d
movl $0x0, %eax
cmovgl %r13d, %eax
movq %rax, -0x38(%rbp)
cmpq %r12, -0x38(%rbp)
je 0x14f7
pushq $0x1
popq %rdi
movq -0x30(%rbp), %rsi
callq 0x1070
movq %rax, (%r14,%r12,8)
incq %r12
jmp 0x14dc
xorl %eax, %eax
cmpq -0x38(%rbp), %rax
je 0x1529
xorl %ecx, %ecx
movslq %r15d, %rdx
cmpq %rdx, %rcx
jge 0x1524
movq 0x10(%rbx), %rdx
movq (%rdx,%rax,8), %rdx
movb (%rdx,%rcx), %dl
movq (%r14,%rax,8), %rsi
movb %dl, (%rsi,%rcx)
incq %rcx
movl 0x20(%rbx), %r15d
jmp 0x1501
incq %rax
jmp 0x14f9
xorl %eax, %eax
movq -0x50(%rbp), %rcx
cmpq %rax, -0x38(%rbp)
je 0x1541
movl $0x1, (%rcx,%rax,4)
incq %rax
jmp 0x152f
movq %rbx, %rdi
movq -0x48(%rbp), %rsi
movl %r13d, %edx
callq 0x1ba4
movq %r13, %rcx
imulq %r13, %rcx
leaq (%rax,%rcx,4), %rax
movq %rax, -0x30(%rbp)
cmpq -0x48(%rbp), %r13
jge 0x1603
movq %r13, -0x60(%rbp)
movslq 0x20(%rbx), %rdx
movq -0x40(%rbp), %rdi
xorl %esi, %esi
callq 0x1060
xorl %r13d, %r13d
cmpq %r13, -0x38(%rbp)
je 0x15da
movq -0x30(%rbp), %rax
movl (%rax,%r13,4), %r15d
testl %r15d, %r15d
je 0x15d5
movq %r14, %r12
movq -0x50(%rbp), %r14
movl (%r14,%r13,4), %edx
movq %rbx, %rdi
movl %r15d, %esi
callq 0x1dc0
movl %r15d, (%r14,%r13,4)
movq %r12, %r14
movq (%r12,%r13,8), %r15
movl 0x20(%rbx), %edx
movq %rbx, %rdi
movq %r15, %rsi
movl %eax, %ecx
callq 0x1e0a
movl 0x20(%rbx), %ecx
movq %rbx, %rdi
movq %r15, %rsi
movq -0x40(%rbp), %rdx
callq 0x1e8c
incq %r13
jmp 0x157f
movq 0x10(%rbx), %rax
movq -0x60(%rbp), %r13
movq (%rax,%r13,8), %rdi
movslq 0x20(%rbx), %rdx
movq -0x40(%rbp), %rsi
callq 0x1090
incq %r13
movq -0x30(%rbp), %rax
addq -0x58(%rbp), %rax
jmp 0x155b
leaq 0x1a30(%rip), %r15      # 0x303a
xorl %r12d, %r12d
movl 0x8(%rbx), %eax
cmpq %rax, %r12
jae 0x1634
movq (%r14,%r12,8), %rdi
testq %rdi, %rdi
je 0x1625
callq 0x10d0
jmp 0x162f
movq %r15, %rdi
xorl %eax, %eax
callq 0x1040
incq %r12
jmp 0x160d
movq %r14, %rdi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x10d0
leaq 0x1bc8(%rip), %rdi      # 0x3219
callq 0x1120
pushq $0x1
popq %rdi
callq 0x10e0