// File: /workspace/github_cpp_makefile_star2_O1/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), %ebp
cmpl $0xc, %ebp
movl $0xc, %eax
cmovll %ebp, %eax
movl %eax, (%rdi)
addq $0x4, %rdi
addq $0x4, %rsi
movslq %eax, %r15
leaq (%r15,%r15), %rdx
callq 0x10a0
testl %ebp, %ebp
je 0x2cc8
cmpw $0x0, 0x2(%rbx,%r15,2)
jne 0x2cc8
leaq -0x1(%r15), %rax
decl %r15d
movl %r15d, (%rbx)
movq %rax, %r15
testq %rax, %rax
jne 0x2cad
movslq (%r14), %r12
cmpq $0xd, %r12
jl 0x2d55
leaq 0xc(%rsp), %r15
leaq 0x1c(%r14), %rsi
leaq -0xc(%r12), %r13
cmpl $0x4, %r13d
movl $0x4, %eax
cmovll %r13d, %eax
movslq %eax, %rdx
addq %rdx, %rdx
movq %r15, %rdi
callq 0x10a0
cmpl $0xf, %r12d
jg 0x2d1a
leaq (%r15,%r13,2), %rdi
movl $0x10, %edx
subl %r12d, %edx
addq %rdx, %rdx
xorl %esi, %esi
callq 0x1060
movq 0xc(%rsp), %rax
movq %rax, 0x14(%rsp)
movl $0x8, 0x8(%rsp)
movl $0x8, %eax
cmpw $0x0, 0x1a(%rsp)
jne 0x2da3
movl $0x8, %ecx
cmpq $0x1, %rcx
je 0x2da1
leaq -0x1(%rcx), %rax
cmpw $0x0, 0x8(%rsp,%rcx,2)
movq %rax, %rcx
je 0x2d3e
jmp 0x2da3
movl (%rbx), %eax
movl 0x83c7(%rip), %ecx      # 0xb124
cmpl %ecx, %eax
jl 0x2f18
cmpl %ecx, %eax
jg 0x2ef8
leaq 0x83b0(%rip), %rdx      # 0xb124
movl %eax, %ecx
testl %eax, %eax
jle 0x2eea
movzwl 0x2(%rbx,%rax,2), %esi
movzwl 0x2(%rdx,%rax,2), %edi
cmpw %di, %si
jb 0x2ee8
decq %rax
cmpw %di, %si
jbe 0x2d74
movb $0x1, %sil
jmp 0x2eea
xorl %eax, %eax
leaq 0x8(%rsp), %rdx
movl %eax, (%rdx)
movq %rbx, %rdi
movq %rbx, %rsi
callq 0x2f28
movslq (%r14), %r13
cmpq $0x11, %r13
jl 0x2f18
leaq 0x14(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x24(%r14), %rsi
cmpl $0x14, %r13d
movl $0x14, %r12d
movl $0x14, %eax
cmovll %r13d, %eax
cltq
leaq -0x20(,%rax,2), %rdx
callq 0x10a0
cmpl $0x13, %r13d
jg 0x2e13
leaq (%r15,%r13,2), %rdi
addq $-0x18, %rdi
subl %r13d, %r12d
addq %r12, %r12
xorl %esi, %esi
movq %r12, %rdx
callq 0x1060
movq 0x14(%rsp), %rax
movq %rax, 0x1c(%rsp)
movl $0xc, 0x8(%rsp)
movl $0xd, %eax
cmpw $0x0, 0x8(%rsp,%rax,2)
jne 0x2e42
leal -0x2(%rax), %ecx
movl %ecx, 0x8(%rsp)
decq %rax
cmpq $0x1, %rax
jne 0x2e2a
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
movq %rbx, %rsi
callq 0x2f28
movslq (%r14), %r12
cmpq $0x15, %r12
jl 0x2f18
addq $0x2c, %r14
leaq -0x14(%r12), %r13
cmpl $0x4, %r13d
movl $0x4, %eax
cmovll %r13d, %eax
movslq %eax, %rdx
addq %rdx, %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x10a0
cmpl $0x17, %r12d
jg 0x2ea2
leaq (%r15,%r13,2), %rdi
movl $0x18, %edx
subl %r12d, %edx
addq %rdx, %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 0x2ed6
leal -0x2(%rax), %ecx
movl %ecx, 0x8(%rsp)
decq %rax
cmpq $0x1, %rax
jne 0x2ebe
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
movq %rbx, %rsi
callq 0x2f28
jmp 0x2f18
xorl %esi, %esi
testl %ecx, %ecx
setg %al
xorb $0x1, %sil
testb %sil, %al
jne 0x2f18
leaq 0x8225(%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 0x291e
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop