// File: /workspace/github_cpp_makefile_star2_O2/xocoder[P]m_kcptun/vendor/cm256/gf256.cpp
// Function: gf256_init_
int gf256_init_(int version)
{
    if (version != GF256_VERSION)
        return -1; // User's header does not match library version.

    // Avoid multiple initialization
    if (Initialized)
        return 0;
    Initialized = true;

    if (!IsLittleEndian())
        return -2; // Architecture is not supported (code won't work without mods).

    gf256_architecture_init();
    gf256_poly_init(kDefaultPolynomialIndex);
    gf256_explog_init();
    gf256_muldiv_init();
    gf256_inv_init();
    gf256_sqr_init();
    gf256_mul_mem_init();

    if (!gf256_self_test())
        return -3; // Self-test failed (perhaps untested configuration)

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
cmpl $0x2, %edi
jne 0x8c11
xorl %ebx, %ebx
cmpb $0x0, 0x28f13(%rip)     # 0x31b00
jne 0x8c14
movb $0x1, 0x28f0a(%rip)     # 0x31b00
xorl %eax, %eax
leaq 0x2581(%rip), %rcx      # 0xb180
cmpq $0x4, %rax
je 0x8c23
movb (%rax,%rcx), %dl
movb %dl, -0x24(%rbp,%rax)
incq %rax
jmp 0x8bff
pushq $-0x1
popq %rbx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x1020304, -0x24(%rbp) # imm = 0x1020304
jne 0x8ca1
pushq $0x1
popq %rax
xorl %esi, %esi
xorl %ecx, %ecx
xchgq %rbx, %rdi
cpuid
xchgq %rbx, %rdi
shrl $0x9, %ecx
andb $0x1, %cl
movb %cl, 0x28eba(%rip)      # 0x31b01
movl $0x14d, 0x28ea3(%rip)   # imm = 0x14D
movw $0x200, 0x28896(%rip)   # imm = 0x200
movb $0x1, 0x28a8f(%rip)     # 0x316f0
movb $0x1, %dl
movl $0x14d, %ecx            # imm = 0x14D
leaq 0x6681(%rip), %rax      # 0xf2f0
cmpq $0xfe, %rsi
je 0x8ca8
movzbl %dl, %edx
leal (%rdx,%rdx), %edi
testb %dl, %dl
movl $0x0, %edx
cmovsl %ecx, %edx
xorl %edi, %edx
movb %dl, 0x22401(%rsi,%rax)
incq %rsi
movzbl %dl, %edi
movw %si, 0x22200(%rax,%rdi,2)
jmp 0x8c6f
pushq $-0x2
jmp 0x8c13
movb $0x1, 0x28b40(%rip)     # 0x317ef
movw $0xff, 0x2883a(%rip)    # 0x314f2
movq $-0xfe, %rcx
testq %rcx, %rcx
je 0x8cd7
movb 0x224ff(%rcx,%rax), %dl
movb %dl, 0x225fe(%rcx,%rax)
incq %rcx
jmp 0x8cbf
movb $0x1, 0x28c10(%rip)     # 0x318ee
xorl %ecx, %ecx
cmpq $0x1fd, %rcx            # imm = 0x1FD
je 0x8cf6
movb $0x0, 0x225ff(%rcx,%rax)
incq %rcx
jmp 0x8ce0
xorl %ecx, %ecx
xorl %edx, %edx
cmpq $0x100, %rdx            # imm = 0x100
je 0x8d16
movb %cl, 0x12000(%rdx,%rax)
movb %cl, 0x2000(%rdx,%rax)
incq %rdx
jmp 0x8cfa
leaq 0x85d3(%rip), %rcx      # 0x112f0
leaq 0x185cc(%rip), %rdx     # 0x212f0
pushq $0x1
popq %rsi
leaq 0x186c3(%rip), %rdi     # 0x213f1
movl $0x100, %r8d            # imm = 0x100
xorl %r9d, %r9d
leaq 0x289b2(%rip), %r10     # 0x316f0
cmpq $0x100, %rsi            # imm = 0x100
je 0x8db0
movzbl 0x22200(%rax,%rsi,2), %r11d
movb %r9b, 0x100(%rcx)
addq %r8, %rcx
movb %r9b, 0x100(%rdx)
addq %r8, %rdx
movl %r11d, %ebx
xorl $0xff, %ebx
movl %ebx, %ebx
xorl %r14d, %r14d
cmpq $0xff, %r14
je 0x8da4
movzwl 0x22202(%rax,%r14,2), %r15d
leaq (%r15,%r11), %r12
movb (%r10,%r12), %r12b
movb %r12b, -0x10000(%rdi,%r14)
addq %rbx, %r15
movb (%r10,%r15), %r15b
movb %r15b, (%rdi,%r14)
incq %r14
jmp 0x8d72
incq %rsi
addq $0x100, %rdi            # imm = 0x100
jmp 0x8d3e
leaq 0x28539(%rip), %rcx     # 0x312f0
movq $-0x10000, %rdx         # imm = 0xFFFF0000
testq %rdx, %rdx
je 0x8dda
movb 0x22001(%rdx,%rax), %sil
movb %sil, (%rcx)
incq %rcx
addq $0x100, %rdx            # imm = 0x100
jmp 0x8dbe
leaq 0x2860f(%rip), %rcx     # 0x313f0
movq $-0x10100, %rdx         # imm = 0xFFFEFF00
testq %rdx, %rdx
je 0x8e04
movb 0x12100(%rdx,%rax), %sil
movb %sil, (%rcx)
incq %rcx
addq $0x101, %rdx            # imm = 0x101
jmp 0x8de8
leaq 0x84e5(%rip), %rcx      # 0x112f0
xorl %edx, %edx
leaq 0x28cfc(%rip), %r14     # 0x31b10
cmpq $0x100, %rdx            # imm = 0x100
je 0x8e6e
movq %rcx, %rsi
xorl %edi, %edi
cmpq $0x10, %rdi
je 0x8e41
movb (%rcx,%rdi), %r8b
movb %r8b, (%rdi,%r14)
movb (%rsi), %r8b
movb %r8b, 0x40(%rdi,%r14)
incq %rdi
addq $0x10, %rsi
jmp 0x8e22
movaps 0x28cc8(%rip), %xmm0    # 0x31b10
movaps 0x28d01(%rip), %xmm1    # 0x31b50
movq %rdx, %rsi
shlq $0x4, %rsi
movaps %xmm0, (%rsi,%rax)
movaps %xmm1, 0x1000(%rsi,%rax)
incq %rdx
addq $0x100, %rcx            # imm = 0x100
jmp 0x8e14
leaq 0x847b(%rip), %rcx      # 0x112f0
xorl %edx, %edx
pushq $-0x3
popq %rbx
movl $0x100, %esi            # imm = 0x100
cmpq $0x100, %rdx            # imm = 0x100
je 0x8f1c
movq %rdx, %rdi
shlq $0x8, %rdi
xorl %r9d, %r9d
xorl %r8d, %r8d
cmpq $0x10000, %r9           # imm = 0x10000
je 0x8f11
testq %rdx, %rdx
sete %r11b
movzbl (%rcx,%r9), %r10d
testq %r9, %r9
sete %r15b
orb %r11b, %r15b
jne 0x8ee9
movq %rdi, %r11
orq %r10, %r11
movzbl 0x12000(%rax,%r11), %r11d
cmpq %r11, %r8
jne 0x8c14
leaq (%rax,%r10), %r11
movzbl 0x12000(%r9,%r11), %r11d
cmpq %r11, %rdx
je 0x8ef5
jmp 0x8c14
testq %r10, %r10
jne 0x8c14
xorl %r10d, %r10d
incq %r8
leaq (%r9,%rsi), %r11
cmpq %rsi, %r9
movq %r11, %r9
jne 0x8e99
movq %r11, %r9
cmpq %r10, %rdx
je 0x8e99
jmp 0x8c14
incq %rdx
incq %rcx
jmp 0x8e7f
movb $0x5a, %al
movb %al, 0x28c2b(%rip)      # 0x31b4f
movb %al, 0x28c65(%rip)      # 0x31b8f
movb %al, 0x28c9f(%rip)      # 0x31bcf
pushq $-0x3f
popq %rax
testq %rax, %rax
je 0x8f49
movb $0x1f, 0x3f(%rax,%r14)
movb $-0x9, 0x7f(%rax,%r14)
incq %rax
jmp 0x8f33
leaq 0x28c00(%rip), %rsi     # 0x31b50
pushq $0x3f
popq %rdx
movq %r14, %rdi
callq 0x90ec
xorl %eax, %eax
cmpq $0x3f, %rax
je 0x8f73
cmpb $-0x18, (%rax,%r14)
leaq 0x1(%rax), %rax
je 0x8f5d
jmp 0x8c14
pushq $-0x3f
popq %rax
testq %rax, %rax
je 0x8f95
movb $0x1f, 0x3f(%rax,%r14)
movb $-0x9, 0x7f(%rax,%r14)
movb $0x71, 0xbf(%rax,%r14)
incq %rax
jmp 0x8f76
leaq 0x28bb4(%rip), %rsi     # 0x31b50
leaq 0x28bed(%rip), %rdx     # 0x31b90
pushq $0x3f
popq %rcx
movq %r14, %rdi
callq 0x91c3
xorl %eax, %eax
cmpq $0x3f, %rax
je 0x8fc6
cmpb $-0x67, (%rax,%r14)
leaq 0x1(%rax), %rax
je 0x8fb0
jmp 0x8c14
pushq $-0x3f
popq %rax
testq %rax, %rax
je 0x8fe8
movb $0x55, 0x3f(%rax,%r14)
movb $-0x56, 0x7f(%rax,%r14)
movb $0x6c, 0xbf(%rax,%r14)
incq %rax
jmp 0x8fc9
leaq 0x28b61(%rip), %rsi     # 0x31b50
leaq 0x28b9a(%rip), %rdx     # 0x31b90
pushq $0x3f
popq %rcx
movq %r14, %rdi
callq 0x9292
xorl %eax, %eax
cmpq $0x3f, %rax
je 0x9019
cmpb $-0x3a, (%rax,%r14)
leaq 0x1(%rax), %rax
je 0x9003
jmp 0x8c14
pushq $-0x3f
popq %rax
testq %rax, %rax
je 0x9032
movb $-0x1, 0x3f(%rax,%r14)
movb $-0x56, 0x7f(%rax,%r14)
incq %rax
jmp 0x901c
movb 0xef61(%rip), %r15b     # 0x17f9a
leaq 0x28b10(%rip), %rdx     # 0x31b50
pushq $0x6c
popq %rsi
pushq $0x3f
popq %rcx
movq %r14, %rdi
callq 0x958e
xorl %eax, %eax
cmpq $0x3f, %rax
je 0x906a
movb (%rax,%r14), %cl
xorb %r15b, %cl
incq %rax
cmpb $-0x1, %cl
je 0x9050
jmp 0x8c14
pushq $-0x3f
popq %rax
testq %rax, %rax
je 0x9083
movb $-0x1, 0x3f(%rax,%r14)
movb $0x55, 0x7f(%rax,%r14)
incq %rax
jmp 0x906d
movb 0xd808(%rip), %r15b     # 0x16892
leaq 0x28abf(%rip), %rsi     # 0x31b50
pushq $0x3f
popq %rcx
movq %r14, %rdi
movl $0xa2, %edx
callq 0x93b6
xorl %eax, %eax
cmpq $0x3f, %rax
je 0x90bb
leaq 0x1(%rax), %rcx
cmpb %r15b, (%rax,%r14)
movq %rcx, %rax
je 0x90a3
jmp 0x8c14
cmpb $0x5a, 0x28a8d(%rip)    # 0x31b4f
jne 0x8c14
cmpb $0x5a, 0x28ac0(%rip)    # 0x31b8f
jne 0x8c14
xorl %eax, %eax
cmpb $0x5a, 0x28af1(%rip)    # 0x31bcf
sete %al
leal (%rax,%rax,2), %ebx
addl $-0x3, %ebx
jmp 0x8c14