// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
movl %esi, 0x34(%rsp)
movq %rdx, 0x28(%rsp)
movl %ecx, 0x24(%rsp)
movl %r8d, 0x20(%rsp)
movslq 0x20(%rsp), %rax
shrq $0x5, %rax
movl %eax, 0x18(%rsp)
movslq 0x20(%rsp), %rax
andq $0x1f, %rax
movl %eax, 0x14(%rsp)
cmpl $0x0, 0x14(%rsp)
je 0x441a
movq 0x28(%rsp), %rax
movslq 0x18(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, 0xc(%rsp)
movl $0x0, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
movl 0x24(%rsp), %ecx
subl 0x18(%rsp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x438b
movq 0x28(%rsp), %rax
movl 0x1c(%rsp), %ecx
addl 0x18(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, 0x10(%rsp)
movl 0x1c(%rsp), %eax
cmpl 0x34(%rsp), %eax
jge 0x4326
jmp 0x4345
leaq 0x225f(%rip), %rdi      # 0x658c
leaq 0x1fef(%rip), %rsi      # 0x6323
movl $0x2c9, %edx            # imm = 0x2C9
leaq 0x2269(%rip), %rcx      # 0x65a9
callq 0x1070
movl 0x10(%rsp), %edx
movslq 0x14(%rsp), %rcx
movl $0x20, %eax
subq %rcx, %rax
movl %eax, %ecx
shll %cl, %edx
movl 0xc(%rsp), %eax
movl 0x14(%rsp), %ecx
shrl %cl, %eax
orl %eax, %edx
movq 0x38(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl 0x10(%rsp), %eax
movl %eax, 0xc(%rsp)
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x42e9
movl 0x1c(%rsp), %eax
cmpl 0x34(%rsp), %eax
jge 0x4397
jmp 0x43b6
leaq 0x21ee(%rip), %rdi      # 0x658c
leaq 0x1f7e(%rip), %rsi      # 0x6323
movl $0x2ce, %edx            # imm = 0x2CE
leaq 0x21f8(%rip), %rcx      # 0x65a9
callq 0x1070
movl 0xc(%rsp), %edx
movl 0x14(%rsp), %ecx
shrl %cl, %edx
movq 0x38(%rsp), %rax
movl 0x1c(%rsp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, 0x1c(%rsp)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl 0x1c(%rsp), %eax
cmpl 0x34(%rsp), %eax
jg 0x43e4
jmp 0x4403
leaq 0x21af(%rip), %rdi      # 0x659a
leaq 0x1f31(%rip), %rsi      # 0x6323
movl $0x2d1, %edx            # imm = 0x2D1
leaq 0x21ab(%rip), %rcx      # 0x65a9
callq 0x1070
movq 0x38(%rsp), %rdi
movl 0x1c(%rsp), %esi
callq 0x2640
movl %eax, 0x44(%rsp)
jmp 0x44c7
movl $0x0, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
movl 0x24(%rsp), %ecx
subl 0x18(%rsp), %ecx
cmpl %ecx, %eax
jge 0x448a
movl 0x1c(%rsp), %eax
cmpl 0x34(%rsp), %eax
jge 0x443e
jmp 0x445d
leaq 0x2147(%rip), %rdi      # 0x658c
leaq 0x1ed7(%rip), %rsi      # 0x6323
movl $0x2d7, %edx            # imm = 0x2D7
leaq 0x2151(%rip), %rcx      # 0x65a9
callq 0x1070
movq 0x28(%rsp), %rax
movl 0x1c(%rsp), %ecx
addl 0x18(%rsp), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq 0x38(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x4422
movl 0x1c(%rsp), %eax
cmpl 0x34(%rsp), %eax
jg 0x4496
jmp 0x44b5
leaq 0x20fd(%rip), %rdi      # 0x659a
leaq 0x1e7f(%rip), %rsi      # 0x6323
movl $0x2db, %edx            # imm = 0x2DB
leaq 0x20f9(%rip), %rcx      # 0x65a9
callq 0x1070
movq 0x38(%rsp), %rdi
movl 0x1c(%rsp), %esi
callq 0x2640
movl %eax, 0x44(%rsp)
movl 0x44(%rsp), %eax
addq $0x48, %rsp
retq