// File: /workspace/github_cpp_makefile_star2_O2/koraa[P]sbcrack/cube/crypto.cpp
// Function: void gfield::reduce<26>(bigint<26> const&)
void reduce(const bigint<RESULT_DIGITS> &result)
    {
#if GF_BITS==192
        len = min(result.len, GF_DIGITS);
        memcpy(digits, result.digits, len*sizeof(digit));
        shrink();

        if(result.len > 192/BI_DIGIT_BITS)
        {
            gfield s;
            memcpy(s.digits, &result.digits[192/BI_DIGIT_BITS], min(result.len-192/BI_DIGIT_BITS, 64/BI_DIGIT_BITS)*sizeof(digit));
            if(result.len < 256/BI_DIGIT_BITS) memset(&s.digits[result.len-192/BI_DIGIT_BITS], 0, (256/BI_DIGIT_BITS-result.len)*sizeof(digit));
            memcpy(&s.digits[64/BI_DIGIT_BITS], s.digits, 64/BI_DIGIT_BITS*sizeof(digit));
            s.len = 128/BI_DIGIT_BITS;
            s.shrink();
            add(s);

            if(result.len > 256/BI_DIGIT_BITS)
            {
                memset(s.digits, 0, 64/BI_DIGIT_BITS*sizeof(digit));
                memcpy(&s.digits[64/BI_DIGIT_BITS], &result.digits[256/BI_DIGIT_BITS], min(result.len-256/BI_DIGIT_BITS, 64/BI_DIGIT_BITS)*sizeof(digit));
                if(result.len < 320/BI_DIGIT_BITS) memset(&s.digits[result.len+(64-256)/BI_DIGIT_BITS], 0, (320/BI_DIGIT_BITS-result.len)*sizeof(digit));
                memcpy(&s.digits[128/BI_DIGIT_BITS], &s.digits[64/BI_DIGIT_BITS], 64/BI_DIGIT_BITS*sizeof(digit));
                s.len = GF_DIGITS;
                s.shrink();
                add(s);

                if(result.len > 320/BI_DIGIT_BITS)
                {
                    memcpy(s.digits, &result.digits[320/BI_DIGIT_BITS], min(result.len-320/BI_DIGIT_BITS, 64/BI_DIGIT_BITS)*sizeof(digit));
                    if(result.len < 384/BI_DIGIT_BITS) memset(&s.digits[result.len-320/BI_DIGIT_BITS], 0, (384/BI_DIGIT_BITS-result.len)*sizeof(digit));
                    memcpy(&s.digits[64/BI_DIGIT_BITS], s.digits, 64/BI_DIGIT_BITS*sizeof(digit));
                    memcpy(&s.digits[128/BI_DIGIT_BITS], s.digits, 64/BI_DIGIT_BITS*sizeof(digit));
                    s.len = GF_DIGITS;
                    s.shrink();
                    add(s);
                }
            }
        }
        else if(*this >= P) gfint::sub(*this, P);
#else
#error Unsupported GF
#endif
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movl (%rsi), %eax
cmpl $0xc, %eax
pushq $0xc
popq %rcx
cmovll %eax, %ecx
movl %ecx, (%rdi)
addq $0x4, %rdi
addq $0x4, %rsi
movslq %ecx, %rdx
addq %rdx, %rdx
callq 0x10a0
movq %rbx, %rdi
callq 0x238c
movl (%r14), %r13d
cmpl $0xd, %r13d
jl 0x2b46
leaq 0xc(%rsp), %r15
leaq 0x1c(%r14), %rsi
leal -0xc(%r13), %ebp
cmpl $0x4, %ebp
pushq $0x4
popq %r12
movl %r12d, %edx
cmovbl %ebp, %edx
addl %edx, %edx
movq %r15, %rdi
callq 0x10a0
cmpl $0xf, %r13d
ja 0x2a35
movl %ebp, %eax
leaq (%r15,%rax,2), %rdi
addq %r13, %r13
pushq $0x20
popq %rdx
subq %r13, %rdx
xorl %esi, %esi
callq 0x1060
leaq 0x8(%rsp), %r13
movq 0x4(%r13), %rax
movq %rax, 0xc(%r13)
movl $0x8, (%r13)
movq %r13, %rdi
callq 0x238c
movq %rbx, %rdi
movq %r13, %rsi
callq 0x2ba8
movl (%r14), %r13d
cmpl $0x11, %r13d
jl 0x2b79
leaq 0x14(%rsp), %rdi
andq $0x0, -0x8(%rdi)
leaq 0x24(%r14), %rsi
leal -0x10(%r13), %edx
cmpl $0x4, %edx
cmovael %r12d, %edx
addl %edx, %edx
callq 0x10a0
cmpl $0x13, %r13d
ja 0x2aa8
leal -0xc(%r13), %eax
leaq (%r15,%rax,2), %rdi
addq %r13, %r13
pushq $0x28
popq %rdx
subq %r13, %rdx
xorl %esi, %esi
callq 0x1060
leaq 0x8(%rsp), %r13
movq 0xc(%r13), %rax
movq %rax, 0x14(%r13)
movl $0xc, (%r13)
movq %r13, %rdi
callq 0x238c
movq %rbx, %rdi
movq %r13, %rsi
callq 0x2ba8
movl (%r14), %r13d
cmpl $0x15, %r13d
jl 0x2b79
addq $0x2c, %r14
leal -0x14(%r13), %ebp
cmpl $0x4, %ebp
cmovbl %ebp, %r12d
addl %r12d, %r12d
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x10a0
cmpl $0x17, %r13d
ja 0x2b19
movl %ebp, %eax
leaq (%r15,%rax,2), %rdi
addq %r13, %r13
pushq $0x30
popq %rdx
subq %r13, %rdx
xorl %esi, %esi
callq 0x1060
leaq 0x8(%rsp), %r14
movq 0x4(%r14), %rax
movq %rax, 0xc(%r14)
movq %rax, 0x14(%r14)
movl $0xc, (%r14)
movq %r14, %rdi
callq 0x238c
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2ba8
jmp 0x2b79
leaq 0x85d7(%rip), %rsi      # 0xb124
movq %rbx, %rdi
callq 0x265e
testb %al, %al
je 0x2b79
leaq 0x85c4(%rip), %rdx      # 0xb124
movq %rbx, %rdi
movq %rbx, %rsi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x26b4
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq