// File: /workspace/github_cpp_makefile_star2_O2/syzcch[P]FEC_C_version/./fec_rdp.h
// Function: rdp::rdp_decoding_d(char**, int, int, int, int)
void rdp_decoding_d(char *g_data[],  int disks, int stripe_unit_size, int w, int x)
    {
        int xcount, ccount, count, dcount;
        int packet_size = stripe_unit_size / w;
        int gr,g,gx;
        int row_disk, diag_disk;
        char *row_data, *diag_data, *rdata, *xdata;
        int coffset;
        int i,j,k,c;
        int diag_count;
        int row_count;


        dcount=stripe_unit_size;
        xcount=stripe_unit_size;
        gr = pnumRdp - 2;
        gx = (x >= 3 ? x - 3 : pnumRdp - 1);
        row_disk = pnumRdp + 1;
        diag_disk = x;
        rdata=g_data[0];
        xdata=g_data[x];
        row_data=rdata;
        diag_data=xdata;
        g = gr;
        diag_count = xcount;
        row_count = dcount;


        while(1)
        {
            if(g == pnumRdp - 1)
            {
                if(gr == (row_disk >= 3 ? row_disk - 3 : row_disk + pnumRdp -3))
                {
                    row_disk = x;
                    diag_disk = pnumRdp + 1;
                    row_data = xdata;
                    diag_data =rdata;
                    g = gx;
                    row_count = diag_count;
                    diag_count = dcount;

                    continue;
                }
                else
                    break;
            }
            else
            {
                int row_index;
                char* cdata;
                row_index = (g - diag_disk + pnumRdp + 2) % pnumRdp;
                coffset = (row_index + diag_disk - 2 + pnumRdp) % pnumRdp * packet_size;
                cdata=g_data[1];
                for(i = row_index * packet_size, j = coffset, k = 0; i < diag_count && k < packet_size; i++, j++, k++)
                {
                    diag_data[i] = cdata[j];

                }
                for(c = 2; c <(disks+2); c++)
                {
                    if((int)c == diag_disk)
                        continue;

                    ccount=stripe_unit_size;
                    cdata = g_data[c];
                    coffset = (row_index + diag_disk - c + pnumRdp)
                              % pnumRdp * packet_size;

                    for(i = row_index * packet_size, j = coffset, k = 0; i < diag_count && j < ccount && k < packet_size; i++, j++, k++)
                    {
                        diag_data[i] ^=  cdata[j];

                    }

                }
                if(pnumRdp + 1 != diag_disk)
                {
                    ccount=stripe_unit_size;
                    cdata = g_data[0];
                    coffset = (row_index + diag_disk - 1 + pnumRdp)
                              % pnumRdp * packet_size;

                    for(i = row_index * packet_size, j = coffset, k = 0; i < diag_count && j < ccount && k < packet_size; i++, j++, k++)
                    {
                        diag_data[i] ^=  cdata[j];

                    }
                }
                //row_parity calculate
                for(c = 2; c <(disks+2); c++)
                {
                    if((int)c == row_disk)
                        continue;

                    ccount=stripe_unit_size;
                    cdata = g_data[c];
                    coffset = row_index * packet_size;

                    for(i = coffset, k = 0; i < ccount && k < packet_size; i++, k++)
                    {
                        row_data[i] ^= cdata[i];

                    }


                }
                if(row_disk != pnumRdp + 1)
                {

                    //diag_disk must be DISK---VDEV_RAIDZ_R
                    count = row_count;
                    cdata = diag_data;
                    coffset = row_index * packet_size;

                    for(i = coffset, k = 0; i < count && k < packet_size; i++, k++)
                        row_data[i] ^= cdata[i];

                }
                //calculate the next g
                g = (row_index + row_disk - 2) % pnumRdp;

            }
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %ecx, %r10d
movl %edx, %r11d
movl %ecx, %eax
cltd
idivl %r8d
movl %eax, %ecx
movq %rdi, -0x30(%rbp)
movl 0x10(%rdi), %r15d
leal -0x2(%r15), %edx
leal -0x3(%r9), %eax
leal -0x1(%r15), %edi
cmpl $0x3, %r9d
cmovgel %eax, %edi
movl %edi, -0x34(%rbp)
leal 0x1(%r15), %ebx
movq (%rsi), %rdi
movslq %r9d, %rax
movq (%rsi,%rax,8), %r8
addl $0x2, %r11d
movslq %r10d, %r10
movslq %r11d, %r11
movq %r15, -0x60(%rbp)
movq %r9, -0x68(%rbp)
movl %r9d, %eax
movq %rdi, -0x58(%rbp)
movq %rdi, -0x48(%rbp)
movq %r8, -0x50(%rbp)
movq %r8, -0x40(%rbp)
movl %eax, %r9d
movl %ebx, %edi
addl $-0x2, %ebx
movl %ebx, -0x38(%rbp)
leal -0x1(%r15), %eax
cmpl %eax, %edx
je 0x1cda
subl %r9d, %edx
leal (%rdx,%r15), %eax
addl $0x2, %eax
cltd
idivl %r15d
movl %edx, %r8d
leal (%r8,%r9), %r14d
leal (%r15,%r14), %eax
addl $-0x2, %eax
cltd
idivl %r15d
imull %ecx, %edx
movq %r8, -0x70(%rbp)
movl %r8d, %eax
imull %ecx, %eax
movslq %eax, %r13
movslq %edx, %rax
addq 0x8(%rsi), %rax
movq -0x40(%rbp), %rdx
leaq (%rdx,%r13), %r12
xorl %edx, %edx
leaq (%rdx,%r13), %r8
cmpq %r10, %r8
jge 0x1ba2
cmpl %ecx, %edx
jge 0x1ba2
movb (%rax,%rdx), %r8b
movb %r8b, (%r12,%rdx)
incq %rdx
jmp 0x1b88
movabsq $0x2, %r15
cmpq %r11, %r15
jge 0x1bfb
cmpq %r9, %r15
jne 0x1bbb
incq %r15
jmp 0x1bac
movq (%rsi,%r15,8), %r8
movl %r14d, %eax
subl %r15d, %eax
movq -0x30(%rbp), %rdx
movl 0x10(%rdx), %ebx
addl %ebx, %eax
cltd
idivl %ebx
imull %ecx, %edx
movslq %edx, %rax
xorl %edx, %edx
leaq (%rdx,%r13), %rbx
cmpq %r10, %rbx
jge 0x1bb6
cmpq %r10, %rax
jge 0x1bb6
cmpl %ecx, %edx
jge 0x1bb6
movb (%r8,%rax), %bl
xorb %bl, (%r12,%rdx)
incq %rax
incq %rdx
jmp 0x1bd9
movq -0x30(%rbp), %rax
movl 0x10(%rax), %r15d
leal 0x1(%r15), %eax
cmpl %r9d, %eax
jne 0x1c80
movq -0x48(%rbp), %rax
addq %r13, %rax
movabsq $0x2, %rdx
cmpq %r11, %rdx
jge 0x1c51
cmpq %rdi, %rdx
jne 0x1c2c
incq %rdx
jmp 0x1c1d
movq (%rsi,%rdx,8), %r8
addq %r13, %r8
xorl %r14d, %r14d
leaq (%r14,%r13), %rbx
cmpq %r10, %rbx
jge 0x1c27
cmpl %ecx, %r14d
jge 0x1c27
movb (%r8,%r14), %bl
xorb %bl, (%rax,%r14)
incq %r14
jmp 0x1c36
movq -0x30(%rbp), %rdx
movl 0x10(%rdx), %r15d
leal 0x1(%r15), %edx
cmpl %edx, %edi
movl -0x38(%rbp), %ebx
je 0x1ccb
xorl %edx, %edx
leaq (%rdx,%r13), %r8
cmpq %r10, %r8
jge 0x1cc3
cmpl %ecx, %edx
jge 0x1cc3
movb (%r12,%rdx), %r8b
xorb %r8b, (%rax,%rdx)
incq %rdx
jmp 0x1c66
movq (%rsi), %r8
leal (%r14,%r15), %eax
decl %eax
cltd
idivl %r15d
imull %ecx, %edx
movslq %edx, %rax
xorl %edx, %edx
leaq (%rdx,%r13), %rbx
cmpq %r10, %rbx
jge 0x1c0c
cmpq %r10, %rax
jge 0x1c0c
cmpl %ecx, %edx
jge 0x1c0c
movb (%r8,%rax), %bl
xorb %bl, (%r12,%rdx)
incq %rax
incq %rdx
jmp 0x1c95
movq -0x30(%rbp), %rax
movl 0x10(%rax), %r15d
movq -0x70(%rbp), %rax
addl %ebx, %eax
cltd
idivl %r15d
jmp 0x1b3b
cmpl $0x3, %edi
movl %r15d, %eax
movl $0x0, %edx
cmovgel %edx, %eax
leal -0x1(%rdi,%rax), %r8d
leal 0x1(%r15), %eax
movq -0x50(%rbp), %rdx
movq %rdx, -0x48(%rbp)
movq -0x58(%rbp), %rdx
movq %rdx, -0x40(%rbp)
movq -0x68(%rbp), %rdx
movl %edx, %ebx
movl -0x34(%rbp), %edx
cmpl %r8d, -0x60(%rbp)
je 0x1b30
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop