// File: /workspace/github_c_makefile_star2_O1/983[P]bigint/bigint.c
// Function: bigint_raw_shift_right
int bigint_raw_shift_right(
    bigint_word *dst, int n_dst,
    const bigint_word *src, int n_src,
    int shift
){
    int i;
    int word_shift = shift / BIGINT_WORD_BITS;
    int bits_shift = shift % BIGINT_WORD_BITS;

    if (bits_shift){
        bigint_word hi, lo = src[word_shift];

        for (i = 0; i < n_src - word_shift - 1; i++){
            hi = src[i + word_shift + 1];
            BIGINT_ASSERT(i, <, n_dst);
            dst[i] = (hi << (BIGINT_WORD_BITS - bits_shift)) | (lo >> bits_shift);
            lo = hi;
        }

        BIGINT_ASSERT(i, <, n_dst);
        dst[i++] = lo >> bits_shift;

        BIGINT_ASSERT(i, <=, n_dst);
        return bigint_raw_truncate(dst, i);
    }else{
        /* this case is not only separate because of performance */
        /* but (hi << (BIGINT_WORD_BITS - 0)) is also undefined behaviour */
        for (i = 0; i < n_src - word_shift; i++){
            BIGINT_ASSERT(i, <, n_dst);
            dst[i] = src[i + word_shift];
        }

        BIGINT_ASSERT(i, <=, n_dst);
        return bigint_raw_truncate(dst, i);
    }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %r8d, %eax
sarl $0x5, %eax
movl %r8d, %r9d
andl $0x1f, %r9d
je 0x2d54
movslq %eax, %r14
movl (%rdx,%r14,4), %r10d
movl %r14d, %ebx
notl %ebx
addl %ecx, %ebx
testl %ebx, %ebx
jle 0x2d8a
addq $0x4, %rdx
xorl %eax, %eax
testl %esi, %esi
movl $0x0, %r11d
cmovgl %esi, %r11d
movl %ebx, %ebx
leaq (%rdx,%r14,4), %rdx
cmpq %rax, %r11
je 0x2ddb
movl (%rdx,%rax,4), %ebp
movl %r8d, %ecx
shrdl %cl, %ebp, %r10d
movl %r10d, (%rdi,%rax,4)
incq %rax
movl %ebp, %r10d
cmpq %rax, %rbx
jne 0x2d2d
movl %ebp, %r10d
jmp 0x2d8c
subl %eax, %ecx
jle 0x2db7
movslq %eax, %r9
xorl %eax, %eax
testl %esi, %esi
movl $0x0, %r8d
cmovgl %esi, %r8d
movl %ecx, %ecx
leaq (%rdx,%r9,4), %rdx
cmpq %rax, %r8
je 0x2dfa
movl (%rdx,%rax,4), %r9d
movl %r9d, (%rdi,%rax,4)
incq %rax
cmpq %rax, %rcx
jne 0x2d6f
jmp 0x2db9
xorl %eax, %eax
cmpl %esi, %eax
jge 0x2e19
movl %r9d, %ecx
shrl %cl, %r10d
movl %eax, %ecx
movl %r10d, (%rdi,%rcx,4)
incl %eax
movl %eax, %ecx
cmpl $0x0, -0x4(%rdi,%rcx,4)
jne 0x2dd6
leal -0x1(%rax), %ecx
cmpl $0x1, %eax
movl %ecx, %eax
jg 0x2da2
jmp 0x2dd4
xorl %eax, %eax
cmpl %esi, %eax
jg 0x2e38
testl %eax, %eax
je 0x2dd6
movl %eax, %ecx
cmpl $0x0, -0x4(%rdi,%rcx,4)
jne 0x2dd6
leal -0x1(%rax), %ecx
cmpl $0x1, %eax
movl %ecx, %eax
jg 0x2dc1
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x268f(%rip), %rdi      # 0x5471
leaq 0x242a(%rip), %rsi      # 0x5213
leaq 0x269e(%rip), %rcx      # 0x548e
movl $0x2c9, %edx            # imm = 0x2C9
callq 0x1060
leaq 0x2670(%rip), %rdi      # 0x5471
leaq 0x240b(%rip), %rsi      # 0x5213
leaq 0x267f(%rip), %rcx      # 0x548e
movl $0x2d7, %edx            # imm = 0x2D7
callq 0x1060
leaq 0x2651(%rip), %rdi      # 0x5471
leaq 0x23ec(%rip), %rsi      # 0x5213
leaq 0x2660(%rip), %rcx      # 0x548e
movl $0x2ce, %edx            # imm = 0x2CE
callq 0x1060
leaq 0x2640(%rip), %rdi      # 0x547f
leaq 0x23cd(%rip), %rsi      # 0x5213
leaq 0x2641(%rip), %rcx      # 0x548e
movl $0x2db, %edx            # imm = 0x2DB
callq 0x1060