// File: /workspace/github_cpp_makefile_star2_O1/syzcch[P]FEC_C_version/./fec_star.h
// Function: star::Evenodd_decoding(int*)
void Evenodd_decoding( int *restarts)
    {
        int i,j,stripe,k;
        int rs_disk1 = -1;
        int rs_disk2 = -1;
        int rs_nbr = 0;

        for(i = 0; i < data_disk_nbr + 2; i++)
        {
            if( restarts[i] == 1)
            {
                rs_disk1 = i;
                rs_nbr ++;
                break;
            }
        }
        if(rs_disk1 != -1)
        {
            for( i = rs_disk1 + 1; i < data_disk_nbr + 2; i++)
            {
                if(restarts[i] == 1)
                {
                    rs_disk2 = i;
                    rs_nbr ++;
                    break;
                }
            }
        }
        if(rs_disk1 != -1)memset(check_data[rs_disk1], 0,check_data_size * sizeof(int));
        if(rs_disk2 != -1)memset(check_data[rs_disk2], 0,check_data_size * sizeof(int));

        if(rs_disk1 >= data_disk_nbr)
        {
            if(restarts[data_disk_nbr] == 1)/*row checksum*/
            {
                STAR_encoding_row();
            }
            if(restarts[data_disk_nbr + 1] == 1)/*slope 1*/
            {
                STAR_encoding_diag1();
            }
        }

        if(rs_disk1 < data_disk_nbr && rs_nbr == 1)
        {
            for( i = 0; i < check_data_size; i++)
            {
                for( j = 0; j <= data_disk_nbr; j++)
                {
                    if( j !=  rs_disk1)
                    {
                        check_data[rs_disk1][i] ^= check_data[j][i];
                    }
                }
            }
        }

        //*one data error + one checksum error*/
        if(rs_nbr == 2 && rs_disk1 < data_disk_nbr && rs_disk2 >= data_disk_nbr)
        {
            if( rs_disk2 == data_disk_nbr + 1)/*slope -1*/
            {
                for(i = 0; i < check_data_size; i++)
                    for(j = 0; j <= data_disk_nbr; j++)
                        if( j != rs_disk1)
                            check_data[rs_disk1][i] ^= check_data[j][i];
                STAR_encoding_diag1();
            }

            if( rs_disk2 == data_disk_nbr)
            {
                /*int i,j,stripe,k;*/
                int *tmp;
                tmp = (int*)malloc(sizeof(int) * (p * block_size));
                memset(tmp, 0, p * block_size * sizeof(int));

                int *tmp_for_s;
                tmp_for_s = (int *)malloc(sizeof(int) * block_size);
                memset(tmp_for_s, 0, block_size *sizeof(int));

                for(stripe = 0; stripe < block_nbr+1; stripe++)
                {
                    for(i = 0; i < data_disk_nbr ; i++)
                    {
                        for(j = 0; j<block_size; j++)
                        {
                            k = (stripe - i + p) % p;
                            if( k < block_nbr)
                                tmp[stripe * block_size + j] ^= check_data[i][ k * block_size + j];
                        }
                    }
                }

                stripe = (rs_disk1 + p - 1) % p;
                for( i = 0; i < block_size; i++)
                {
                    if( stripe == p - 1)
                        tmp_for_s[i] = tmp[stripe * block_size + i];
                    else
                        tmp_for_s[i] = tmp[stripe * block_size + i] ^ check_data[data_disk_nbr + 1][stripe * block_size + i];
                }

                for( i = 0; i < block_nbr; i++)
                {
                    for( j = 0; j < block_size; j++)
                    {
                        tmp[i * block_size + j] ^= (tmp_for_s[j] ^ check_data[data_disk_nbr + 1][ i * block_size + j]);
                    }
                }
                for( j = 0; j < block_size; j++)
                    tmp[ block_nbr * block_size + j] ^= tmp_for_s[j];

                for( i = 0; i < p; i++)
                {
                    j = (i + p - rs_disk1) % p;
                    if( j < p - 1)
                    {
                        memmove( check_data[rs_disk1] + j * block_size, tmp + i * block_size, block_size * sizeof(int));

                    }
                }

                free(tmp);
                free(tmp_for_s);
                STAR_encoding_row();
            }
        }

        if(rs_nbr == 2 && rs_disk1 < data_disk_nbr && rs_disk2 < data_disk_nbr)/*2 data error */
        {

            int *tmp;
            tmp = (int*)malloc(sizeof(int) * (p * block_size));
            memset(tmp, 0, p*block_size*sizeof(int));

            /*computing s firstly*/
            int *tmp_for_s;
            tmp_for_s = (int *)malloc(sizeof(int) * block_size);
            memset(tmp_for_s, 0, block_size *sizeof(int));
            for( i = 0; i < block_nbr; i++)
            {
                for( j = 0; j < block_size; j++)
                {
                    tmp_for_s[j] ^= check_data[data_disk_nbr][i * block_size + j];
                    tmp_for_s[j] ^= check_data[data_disk_nbr + 1][i * block_size + j];
                }
            }


            for(stripe = 0; stripe < block_nbr+1; stripe++)
            {
                for(i = 0; i < data_disk_nbr; i++)
                {
                    k = (stripe - i + p) % p;
                    if( k < block_nbr)
                        for(j = 0; j<block_size; j++)
                        {
                            tmp[stripe * block_size + j] ^= check_data[i][ k * block_size + j];
                        }
                }
            }
            for( i = 0; i< block_nbr ; i++)
            {
                for( j = 0; j< block_size; j++)
                {
                    tmp[ i * block_size + j] ^= (check_data[data_disk_nbr + 1][i * block_size + j] ^ tmp_for_s[j]);
                }
            }
            for( j = 0; j < block_size; j++)
                tmp[ block_nbr * block_size + j] ^= tmp_for_s[j];

            /*store s~ in tmp*/
            stripe = (rs_disk1 + p - 1) % p;
            memmove( tmp_for_s, tmp + stripe * block_size, block_size * sizeof(int));

            while(1)
            {
                k = (stripe - rs_disk2 + p) % p;
                if( k == block_nbr)
                    break;
                memmove( check_data[rs_disk2] + k * block_size, tmp_for_s, block_size * sizeof(int));

                for( j = 0; j < block_size; j++)
                {
                    for( i = 0; i <= data_disk_nbr; i++)
                        if( i != rs_disk1)
                            check_data[rs_disk1][k * block_size + j] ^= check_data[i][k * block_size + j] ;
                }

                stripe = (k + rs_disk1 + p) % p;

                for( j = 0; j < block_size; j++)
                {
                    tmp_for_s[j] = check_data[rs_disk1][k * block_size + j] ^ tmp[stripe * block_size + j];
                }

            }

            free(tmp);
            free(tmp_for_s);
        }

    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movslq 0x28(%rdi), %rax
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
cmpq $-0x1, %rax
jl 0x2b00
leal 0x2(%rax), %ecx
xorl %r12d, %r12d
cmpl $0x1, (%r14,%r12,4)
je 0x2b0b
incq %r12
cmpq %r12, %rcx
jne 0x2af1
xorl %r15d, %r15d
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
jmp 0x2b11
movl $0x1, %r15d
cmpl $-0x1, %r12d
je 0x2b34
movslq %r12d, %rcx
cmpq %rax, %rcx
jg 0x2b34
leaq 0x1(%rcx), %rdx
cmpl $0x1, 0x4(%r14,%rcx,4)
movq %rdx, %rcx
jne 0x2b1a
incl %r15d
movl %edx, %r13d
cmpl $-0x1, %r12d
je 0x2b54
movq 0x18(%rbx), %rax
movslq %r12d, %rcx
movq (%rax,%rcx,8), %rdi
movslq 0x8(%rbx), %rdx
shlq $0x2, %rdx
xorl %esi, %esi
callq 0x1050
cmpl $-0x1, %r13d
je 0x2b74
movq 0x18(%rbx), %rax
movslq %r13d, %rcx
movq (%rax,%rcx,8), %rdi
movslq 0x8(%rbx), %rdx
shlq $0x2, %rdx
xorl %esi, %esi
callq 0x1050
movslq 0x28(%rbx), %rax
cmpl %eax, %r12d
jl 0x2ba0
cmpl $0x1, (%r14,%rax,4)
jne 0x2b8c
movq %rbx, %rdi
callq 0x27b2
movslq 0x28(%rbx), %rax
cmpl $0x1, 0x4(%r14,%rax,4)
jne 0x2ba0
movq %rbx, %rdi
callq 0x27f8
cmpl 0x28(%rbx), %r12d
setl %al
cmpl $0x1, %r15d
sete %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x2c0a
cmpl $0x0, 0x8(%rbx)
jle 0x2c0a
movslq %r12d, %rax
movl %r12d, %ecx
negq %rcx
xorl %edx, %edx
cmpl $0x0, 0x28(%rbx)
js 0x2bfe
movq 0x18(%rbx), %rsi
movq $-0x1, %rdi
leaq (%rcx,%rdi), %r8
cmpq $-0x1, %r8
je 0x2bf2
movq 0x8(%rsi,%rdi,8), %r8
movl (%r8,%rdx,4), %r8d
movq (%rsi,%rax,8), %r9
xorl %r8d, (%r9,%rdx,4)
movslq 0x28(%rbx), %r8
incq %rdi
cmpq %r8, %rdi
jl 0x2bd7
incq %rdx
movslq 0x8(%rbx), %rsi
cmpq %rsi, %rdx
jl 0x2bc6
cmpl $0x2, %r15d
jne 0x31e4
movl 0x28(%rbx), %eax
movq %r12, -0x50(%rbp)
cmpl %eax, %r12d
jge 0x2ed5
cmpl %eax, %r13d
jl 0x2ed5
incl %eax
cmpl %eax, %r13d
jne 0x2c94
cmpl $0x0, 0x8(%rbx)
movq -0x50(%rbp), %rcx
jle 0x2c8c
movslq %ecx, %rax
movl %ecx, %ecx
negq %rcx
xorl %edx, %edx
cmpl $0x0, 0x28(%rbx)
js 0x2c80
movq 0x18(%rbx), %rsi
movq $-0x1, %rdi
leaq (%rcx,%rdi), %r8
cmpq $-0x1, %r8
je 0x2c74
movq 0x8(%rsi,%rdi,8), %r8
movl (%r8,%rdx,4), %r8d
movq (%rsi,%rax,8), %r9
xorl %r8d, (%r9,%rdx,4)
movslq 0x28(%rbx), %r8
incq %rdi
cmpq %r8, %rdi
jl 0x2c59
incq %rdx
movslq 0x8(%rbx), %rsi
cmpq %rsi, %rdx
jl 0x2c48
movq %rbx, %rdi
callq 0x27f8
movslq 0x28(%rbx), %rcx
movq %rcx, -0x38(%rbp)
cmpl %ecx, %r13d
jne 0x2ed5
movl %r13d, -0x2c(%rbp)
movl 0x10(%rbx), %ecx
movslq 0xc(%rbx), %r15
movl %r15d, %r14d
movl %r15d, %eax
movq %rcx, %r13
imull %ecx, %eax
movslq %eax, %r12
shlq $0x2, %r12
movq %r12, %rdi
callq 0x10d0
movq %rax, -0x58(%rbp)
movq %rax, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x1050
movq %r15, %r12
leaq (,%r15,4), %r15
movq %r15, %rdi
callq 0x10d0
movq %rax, -0x48(%rbp)
movq %rax, %rdi
xorl %esi, %esi
movq %r15, -0x60(%rbp)
movq %r15, %rdx
callq 0x1050
movl 0x14(%rbx), %ecx
testl %ecx, %ecx
js 0x2d79
movq 0x18(%rbx), %rsi
leaq 0x1(%rcx), %rax
movq %rax, -0x40(%rbp)
xorl %r8d, %r8d
movq -0x58(%rbp), %r9
cmpl $0x0, -0x38(%rbp)
jle 0x2d6c
leal (%r8,%r13), %r10d
xorl %r11d, %r11d
testl %r12d, %r12d
jle 0x2d63
movl %r10d, %eax
subl %r11d, %eax
cltd
idivl %r13d
movl %edx, %eax
imull %r14d, %eax
cltq
shlq $0x2, %rax
xorl %edi, %edi
cmpl %ecx, %edx
jge 0x2d5b
movq (%rsi,%r11,8), %r15
addq %rax, %r15
movl (%r15,%rdi,4), %r15d
xorl %r15d, (%r9,%rdi,4)
incq %rdi
cmpq %rdi, %r14
jne 0x2d48
incq %r11
cmpq -0x38(%rbp), %r11
jne 0x2d2b
incq %r8
addq -0x60(%rbp), %r9
cmpq -0x40(%rbp), %r8
jne 0x2d1e
testl %r14d, %r14d
movq -0x48(%rbp), %r10
jle 0x2dd9
movq -0x50(%rbp), %rax
addl %r13d, %eax
decl %eax
cltd
idivl %r13d
decl %r13d
movq 0x18(%rbx), %rax
movl %edx, %esi
imull %r12d, %esi
movslq %esi, %rsi
movq -0x58(%rbp), %rdi
leaq (%rdi,%rsi,4), %rdi
shlq $0x2, %rsi
xorl %r8d, %r8d
cmpl %r13d, %edx
jne 0x2db9
movl (%rdi,%r8,4), %r9d
jmp 0x2dcd
movq -0x38(%rbp), %r9
movq 0x8(%rax,%r9,8), %r9
addq %rsi, %r9
movl (%r9,%r8,4), %r9d
xorl (%rdi,%r8,4), %r9d
movl %r9d, (%r10,%r8,4)
incq %r8
cmpq %r8, %r14
jne 0x2dae
testl %ecx, %ecx
jle 0x2e2c
movq 0x18(%rbx), %rax
leaq (,%r14,4), %rdx
xorl %esi, %esi
movq -0x58(%rbp), %rdi
xorl %r8d, %r8d
movq -0x48(%rbp), %r15
testl %r14d, %r14d
jle 0x2e1e
movq -0x38(%rbp), %r9
movq 0x8(%rax,%r9,8), %r9
addq %rsi, %r9
xorl %r10d, %r10d
movl (%r9,%r10,4), %r11d
xorl (%r15,%r10,4), %r11d
xorl %r11d, (%rdi,%r10,4)
incq %r10
cmpq %r10, %r14
jne 0x2e0a
incq %r8
addq %rdx, %rdi
addq %rdx, %rsi
cmpq %rcx, %r8
jne 0x2df6
testl %r12d, %r12d
movq -0x48(%rbp), %rsi
jle 0x2e55
movl %r14d, %eax
imull %ecx, %eax
cltq
movq -0x58(%rbp), %rcx
leaq (%rcx,%rax,4), %rax
xorl %ecx, %ecx
movl (%rsi,%rcx,4), %edx
xorl %edx, (%rax,%rcx,4)
incq %rcx
cmpq %rcx, %r14
jne 0x2e47
movl 0x10(%rbx), %ecx
testl %ecx, %ecx
movl -0x2c(%rbp), %r13d
jle 0x2ebb
movq -0x50(%rbp), %r15
movslq %r15d, %r14
negl %r15d
xorl %r12d, %r12d
leal (%r15,%rcx), %eax
addl %r12d, %eax
cltd
idivl %ecx
decl %ecx
cmpl %ecx, %edx
jge 0x2eb0
movq 0x18(%rbx), %rcx
movslq 0xc(%rbx), %rax
imull %eax, %edx
movslq %edx, %rdi
shlq $0x2, %rdi
addq (%rcx,%r14,8), %rdi
movl %eax, %ecx
imull %r12d, %ecx
movslq %ecx, %rcx
movq -0x58(%rbp), %rdx
leaq (%rdx,%rcx,4), %rsi
shlq $0x2, %rax
movq %rax, %rdx
callq 0x1070
incl %r12d
movl 0x10(%rbx), %ecx
cmpl %ecx, %r12d
jl 0x2e6d
movq -0x58(%rbp), %rdi
callq 0x10b0
movq -0x48(%rbp), %rdi
callq 0x10b0
movq %rbx, %rdi
callq 0x27b2
movl 0x28(%rbx), %eax
cmpl %eax, -0x50(%rbp)
jge 0x31e4
cmpl %eax, %r13d
jge 0x31e4
movl %r13d, -0x2c(%rbp)
movslq %eax, %r13
movl 0x10(%rbx), %ecx
movslq 0xc(%rbx), %r14
movl %r14d, %r12d
movl %r14d, %eax
movq %rcx, -0x38(%rbp)
imull %ecx, %eax
movslq %eax, %r15
shlq $0x2, %r15
movq %r15, %rdi
callq 0x10d0
movq %rax, -0x40(%rbp)
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x1050
leaq (,%r14,4), %rdi
movq %rdi, -0x48(%rbp)
callq 0x10d0
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
movq -0x48(%rbp), %rdx
callq 0x1050
movl 0x14(%rbx), %ecx
testl %ecx, %ecx
jle 0x2f9c
movq 0x18(%rbx), %rax
leaq (,%r12,4), %rdx
xorl %esi, %esi
xorl %edi, %edi
testl %r12d, %r12d
jle 0x2f91
movq 0x8(%rax,%r13,8), %r8
addq %rsi, %r8
movq (%rax,%r13,8), %r9
addq %rsi, %r9
xorl %r10d, %r10d
movl (%r15,%r10,4), %r11d
xorl (%r9,%r10,4), %r11d
movl %r11d, (%r15,%r10,4)
xorl (%r8,%r10,4), %r11d
movl %r11d, (%r15,%r10,4)
incq %r10
cmpq %r10, %r12
jne 0x2f75
incq %rdi
addq %rdx, %rsi
cmpq %rcx, %rdi
jne 0x2f5e
testl %ecx, %ecx
js 0x3013
movq 0x18(%rbx), %rsi
leaq 0x1(%rcx), %rax
movq %rax, -0x60(%rbp)
xorl %r8d, %r8d
movq -0x40(%rbp), %r9
testl %r13d, %r13d
jle 0x3006
movq -0x38(%rbp), %rax
leal (%rax,%r8), %r10d
xorl %r11d, %r11d
testl %r14d, %r14d
setle %dil
movl %r10d, %eax
subl %r11d, %eax
cltd
idivl -0x38(%rbp)
cmpl %ecx, %edx
setge %al
orb %dil, %al
jne 0x2ffe
imull %r14d, %edx
movslq %edx, %rax
shlq $0x2, %rax
addq (%rsi,%r11,8), %rax
xorl %edx, %edx
movl (%rax,%rdx,4), %edi
xorl %edi, (%r9,%rdx,4)
incq %rdx
cmpq %rdx, %r12
jne 0x2fef
incq %r11
cmpq %r13, %r11
jne 0x2fc3
incq %r8
addq -0x48(%rbp), %r9
cmpq -0x60(%rbp), %r8
jne 0x2fb3
testl %ecx, %ecx
jle 0x305e
movq 0x18(%rbx), %rax
leaq (,%r12,4), %rdx
xorl %esi, %esi
movq -0x40(%rbp), %rdi
xorl %r8d, %r8d
testl %r12d, %r12d
jle 0x3050
movq 0x8(%rax,%r13,8), %r9
addq %rsi, %r9
xorl %r10d, %r10d
movl (%r15,%r10,4), %r11d
xorl (%r9,%r10,4), %r11d
xorl %r11d, (%rdi,%r10,4)
incq %r10
cmpq %r10, %r12
jne 0x303c
incq %r8
addq %rdx, %rdi
addq %rdx, %rsi
cmpq %rcx, %r8
jne 0x302c
testl %r12d, %r12d
jle 0x3084
movl %r12d, %eax
imull %ecx, %eax
cltq
movq -0x40(%rbp), %rcx
leaq (%rcx,%rax,4), %rax
xorl %ecx, %ecx
movl (%r15,%rcx,4), %edx
xorl %edx, (%rax,%rcx,4)
incq %rcx
cmpq %rcx, %r12
jne 0x3075
movq -0x50(%rbp), %rax
movq -0x38(%rbp), %rcx
addl %ecx, %eax
decl %eax
cltd
idivl %ecx
movl %edx, %r14d
imull %edx, %r12d
movslq %r12d, %rax
movq -0x40(%rbp), %rcx
leaq (%rcx,%rax,4), %rsi
movq %r15, %rdi
movq -0x48(%rbp), %rdx
callq 0x1070
subl -0x2c(%rbp), %r14d
movl 0x10(%rbx), %ecx
addl %ecx, %r14d
movl %r14d, %eax
cltd
idivl %ecx
cmpl 0x14(%rbx), %edx
je 0x31c5
movl %edx, %r12d
movslq -0x2c(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x50(%rbp), %rax
movslq %eax, %r13
movl %eax, %r14d
negq %r14
movq 0x18(%rbx), %rax
movslq 0xc(%rbx), %rdx
movslq %r12d, %rdi
imulq %rdx, %rdi
shlq $0x2, %rdi
movq -0x38(%rbp), %rcx
addq (%rax,%rcx,8), %rdi
shlq $0x2, %rdx
movq %r15, %rsi
callq 0x1070
movl 0xc(%rbx), %ecx
testl %ecx, %ecx
jle 0x315e
xorl %eax, %eax
cmpl $0x0, 0x28(%rbx)
js 0x3155
movq 0x18(%rbx), %rcx
movq $-0x1, %rdx
leaq (%r14,%rdx), %rsi
cmpq $-0x1, %rsi
je 0x3149
movq 0x8(%rcx,%rdx,8), %rsi
movl 0xc(%rbx), %edi
imull %r12d, %edi
addl %eax, %edi
movslq %edi, %rdi
movl (%rsi,%rdi,4), %esi
movq (%rcx,%r13,8), %r8
xorl %esi, (%r8,%rdi,4)
movslq 0x28(%rbx), %rsi
incq %rdx
cmpq %rsi, %rdx
jl 0x3123
incl %eax
movl 0xc(%rbx), %ecx
cmpl %ecx, %eax
jl 0x3112
movq -0x50(%rbp), %rax
addl %r12d, %eax
movl 0x10(%rbx), %esi
addl %esi, %eax
cltd
idivl %esi
movl %edx, %eax
testl %ecx, %ecx
jle 0x31ae
movq 0x18(%rbx), %rsi
imull %ecx, %r12d
movl %eax, %edi
imull %ecx, %edi
movslq %r12d, %rdx
movslq %edi, %rdi
movl %ecx, %ecx
shlq $0x2, %rdx
addq (%rsi,%r13,8), %rdx
movq -0x40(%rbp), %rsi
leaq (%rsi,%rdi,4), %rsi
xorl %edi, %edi
movl (%rsi,%rdi,4), %r8d
xorl (%rdx,%rdi,4), %r8d
movl %r8d, (%r15,%rdi,4)
incq %rdi
cmpq %rdi, %rcx
jne 0x319a
subl -0x2c(%rbp), %eax
movl 0x10(%rbx), %ecx
addl %ecx, %eax
cltd
idivl %ecx
movl %edx, %r12d
cmpl 0x14(%rbx), %edx
jne 0x30e2
movq -0x40(%rbp), %rdi
callq 0x10b0
movq %r15, %rdi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x10b0
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop