// File: syzcch[P]FEC_C_version/./fec_rs.h
// Function: rscode::gf_modar_setup()
void gf_modar_setup()
    {
        int j, b, t;
        if (gf_already_setup) return;
        B_TO_J = (int *) malloc(sizeof(int)*256);

        if (B_TO_J == NULL)
        {
            printf("gf_modar_setup, malloc B_TO_J");
        }
        /* When the word size is 8 bits, make three copies of the table so that
          you don't have to do the extra addition or subtraction in the
          multiplication/division routines */

        J_TO_B = (int *) malloc(sizeof(int)*256*3);
        if (J_TO_B == NULL)
        {
            printf("gf_modar_setup, malloc J_TO_B");
        }
        for (j = 0; j < 256; j++)
        {
            B_TO_J[j] = 255;
            J_TO_B[j] = 0;
        }

        b = 1;
        for (j = 0; j < 255; j++)
        {
            if (B_TO_J[b] != 255)
            {
                printf( "Error: j=%d, b=%d, B->J[b]=%d, J->B[j]=%d (0%o)\n");
            }
            B_TO_J[b] = j;
            J_TO_B[j] = b;
            b = b << 1;
            if (b & 256)
            {
                b = (b ^ prim_poly_8) & 255;
            }
        }

        for (j = 0; j < 255; j++)
        {
            J_TO_B[j+255] = J_TO_B[j];
            J_TO_B[j+2*255] = J_TO_B[j];
        }
        J_TO_B += 255;


        gf_already_setup = 1;

    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpl $0x0, 0x18(%rax)
je 0x3cef
jmp 0x3e90
movl $0x400, %edi            # imm = 0x400
callq 0x2190
movq %rax, 0x3430(%rip)      # 0x7130
cmpq $0x0, 0x3428(%rip)      # 0x7130
jne 0x3d18
leaq 0x145d(%rip), %rdi      # 0x516e
movb $0x0, %al
callq 0x2040
movl $0xc00, %edi            # imm = 0xC00
callq 0x2190
movq %rax, 0x340f(%rip)      # 0x7138
cmpq $0x0, 0x3407(%rip)      # 0x7138
jne 0x3d41
leaq 0x1452(%rip), %rdi      # 0x518c
movb $0x0, %al
callq 0x2040
movl $0x0, -0xc(%rbp)
cmpl $0x100, -0xc(%rbp)      # imm = 0x100
jge 0x3d80
movq 0x33d8(%rip), %rax      # 0x7130
movslq -0xc(%rbp), %rcx
movl $0xff, (%rax,%rcx,4)
movq 0x33ce(%rip), %rax      # 0x7138
movslq -0xc(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x3d48
movl $0x1, -0x10(%rbp)
movl $0x0, -0xc(%rbp)
cmpl $0xff, -0xc(%rbp)
jge 0x3e0d
movq 0x3392(%rip), %rax      # 0x7130
movslq -0x10(%rbp), %rcx
cmpl $0xff, (%rax,%rcx,4)
je 0x3db9
leaq 0x13f8(%rip), %rdi      # 0x51aa
movb $0x0, %al
callq 0x2040
movl -0xc(%rbp), %edx
movq 0x336d(%rip), %rax      # 0x7130
movslq -0x10(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x10(%rbp), %edx
movq 0x3364(%rip), %rax      # 0x7138
movslq -0xc(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x10(%rbp), %eax
shll %eax
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x3e00
movl -0x10(%rbp), %eax
xorl $0x11d, %eax            # imm = 0x11D
andl $0xff, %eax
movl %eax, -0x10(%rbp)
jmp 0x3e02
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x3d8e
movl $0x0, -0xc(%rbp)
cmpl $0xff, -0xc(%rbp)
jge 0x3e70
movq 0x3314(%rip), %rax      # 0x7138
movslq -0xc(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq 0x3306(%rip), %rax      # 0x7138
movl -0xc(%rbp), %ecx
addl $0xff, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movq 0x32f0(%rip), %rax      # 0x7138
movslq -0xc(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq 0x32e2(%rip), %rax      # 0x7138
movl -0xc(%rbp), %ecx
addl $0x1fe, %ecx            # imm = 0x1FE
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x3e14
movq -0x20(%rbp), %rax
movq 0x32bd(%rip), %rcx      # 0x7138
addq $0x3fc, %rcx            # imm = 0x3FC
movq %rcx, 0x32af(%rip)      # 0x7138
movl $0x1, 0x18(%rax)
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)