// File: /workspace/github_cpp_makefile_star2_O3/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), %r13d
cmpl $0xc, %r13d
movl $0xc, %ebp
cmovll %r13d, %ebp
movl %ebp, (%rdi)
leaq 0x4(%rdi), %r15
addq $0x4, %rsi
movslq %ebp, %r12
leaq (%r12,%r12), %rdx
movq %r15, %rdi
callq 0x10a0
testl %r13d, %r13d
je 0x2c61
cmpw $0x0, -0x2(%r15,%r12,2)
jne 0x2c61
jmp 0x2c52
leaq -0x1(%rax), %r12
decl %ebp
cmpw $0x0, (%rbx,%rax,2)
jne 0x2c5d
movq %r12, %rax
cmpq $0x1, %r12
jne 0x2c45
xorl %ebp, %ebp
decl %eax
movl %eax, (%rbx)
movl (%r14), %r12d
cmpl $0xd, %r12d
jl 0x2cdc
leaq 0xc(%rsp), %r15
leaq 0x1c(%r14), %rsi
leal -0xc(%r12), %ebp
cmpl $0x4, %ebp
movl $0x4, %edx
cmovbl %ebp, %edx
addl %edx, %edx
movq %r15, %rdi
callq 0x10a0
cmpl $0xf, %r12d
ja 0x2cab
movl %ebp, %eax
leaq (%r15,%rax,2), %rdi
addq %r12, %r12
movl $0x20, %edx
subq %r12, %rdx
xorl %esi, %esi
callq 0x1060
movq 0xc(%rsp), %rax
movq %rax, 0x14(%rsp)
shrq $0x30, %rax
movl $0x8, %eax
jne 0x2d34
movl $0x8, %ecx
cmpq $0x1, %rcx
je 0x2d32
leaq -0x1(%rcx), %rax
cmpw $0x0, 0x8(%rsp,%rcx,2)
movq %rax, %rcx
je 0x2cc5
jmp 0x2d34
cmpl 0x8442(%rip), %ebp      # 0xb124
jl 0x2e6b
jg 0x2d12
movl %ebp, %eax
leaq 0x8431(%rip), %rcx      # 0xb124
testl %eax, %eax
jle 0x2d12
movzwl 0x2(%rbx,%rax,2), %edx
movzwl 0x2(%rcx,%rax,2), %esi
cmpw %si, %dx
jb 0x2e6b
decq %rax
cmpw %si, %dx
jbe 0x2cf3
leaq 0x840b(%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 0x28a8
xorl %eax, %eax
leaq 0x8(%rsp), %rdx
movl %eax, (%rdx)
movq %rbx, %rdi
movq %rbx, %rsi
callq 0x2e7a
movl (%r14), %r12d
cmpl $0x11, %r12d
jl 0x2e6b
leaq 0x14(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x24(%r14), %rsi
leal -0x10(%r12), %eax
cmpl $0x4, %eax
movl $0x4, %edx
cmovbl %eax, %edx
addl %edx, %edx
callq 0x10a0
cmpl $0x13, %r12d
ja 0x2d9c
leal -0xc(%r12), %eax
leaq (%r15,%rax,2), %rdi
addq %r12, %r12
movl $0x28, %edx
subq %r12, %rdx
xorl %esi, %esi
callq 0x1060
movq 0x14(%rsp), %rax
movq %rax, 0x1c(%rsp)
movl $0xc, 0x8(%rsp)
movl $0xd, %eax
cmpw $0x0, 0x8(%rsp,%rax,2)
jne 0x2dcb
leal -0x2(%rax), %ecx
movl %ecx, 0x8(%rsp)
decq %rax
cmpq $0x1, %rax
jne 0x2db3
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
movq %rbx, %rsi
callq 0x2e7a
movl (%r14), %r12d
cmpl $0x15, %r12d
jl 0x2e6b
addq $0x2c, %r14
leal -0x14(%r12), %ebp
cmpl $0x4, %ebp
movl $0x4, %edx
cmovbl %ebp, %edx
addl %edx, %edx
movq %r15, %rdi
movq %r14, %rsi
callq 0x10a0
cmpl $0x17, %r12d
ja 0x2e27
movl %ebp, %eax
leaq (%r15,%rax,2), %rdi
addq %r12, %r12
movl $0x30, %edx
subq %r12, %rdx
xorl %esi, %esi
callq 0x1060
movq 0xc(%rsp), %rax
movq %rax, 0x14(%rsp)
movq %rax, 0x1c(%rsp)
movl $0xc, 0x8(%rsp)
movl $0xd, %eax
cmpw $0x0, 0x8(%rsp,%rax,2)
jne 0x2e5b
leal -0x2(%rax), %ecx
movl %ecx, 0x8(%rsp)
decq %rax
cmpq $0x1, %rax
jne 0x2e43
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
movq %rbx, %rsi
callq 0x2e7a
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq