// File: /workspace/github_c_makefile_star2_O0/mirth-lang[P]mirth/bin/mirth1.c
// Function: big_pos_imperfect_udivmod
static void big_pos_imperfect_udivmod(BIG* a, INT b, uint32_t bhead, size_t bshift, INT* q, INT* r) {
    ASSERT(bhead >= 1);
    ASSERT(a && (a->size > bshift));
    BIG* accum = big_alloc(a->size - bshift + 2); // quotient in accum
    accum->size = a->size - bshift;
    a = big_reserve(a, a->size); // remainder in a;
    for (size_t i = a->size - bshift; i --> 0;) {
        while (1) {
            uint64_t ar = big_get_u64_(a, i+bshift);
            uint64_t n = ar / (1 + (uint64_t)bhead);
            if (!n) break;
            big_u64_add_at_accum_(accum,n,i);
            big_pos_u32_mul_sub_shift_accum_(a,b,n,i);
        }
    }
    if (big_pos_ucmp_(a,b) >= 0) {
        big_pos_u32_mul_sub_shift_accum_(a,b,1,0);
        big_succ_at_accum_(accum,0);
        ASSERT(big_pos_ucmp_(a,b) < 0);
    }
    int_decref(b);
    *r = big_normalize(a);
    *q = big_normalize(accum);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rsi, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
cmpl $0x1, -0x14(%rbp)
jae 0x41d8f
movl $0x2, %edi
leaq 0x313d34(%rip), %rsi    # 0x355aa5
movl $0x38, %edx
callq 0x5060
callq 0x5310
callq 0x53b0
movl $0x1, %edi
callq 0x5130
jmp 0x41d91
jmp 0x41d93
cmpq $0x0, -0x10(%rbp)
je 0x41da8
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
cmpq -0x20(%rbp), %rax
ja 0x41dd2
movl $0x2, %edi
leaq 0x313d2a(%rip), %rsi    # 0x355ade
movl $0x45, %edx
callq 0x5060
callq 0x5310
callq 0x53b0
movl $0x1, %edi
callq 0x5130
jmp 0x41dd4
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
subq -0x20(%rbp), %rdi
addq $0x2, %rdi
callq 0x5250
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
subq -0x20(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x1c970
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
subq -0x20(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, %rcx
addq $-0x1, %rcx
movq %rcx, -0x40(%rbp)
cmpq $0x0, %rax
jbe 0x41e9b
jmp 0x41e3d
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rsi
addq -0x20(%rbp), %rsi
callq 0x41f70
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movl -0x14(%rbp), %ecx
addq $0x1, %rcx
xorl %edx, %edx
divq %rcx
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0x41e6f
jmp 0x41e99
movq -0x38(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq -0x40(%rbp), %rdx
callq 0x41fc0
movq -0x10(%rbp), %rdi
movq -0x50(%rbp), %rax
movl %eax, %edx
movq -0x40(%rbp), %rcx
movq -0x8(%rbp), %rsi
callq 0x42070
jmp 0x41e3d
jmp 0x41e26
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x42300
cmpl $0x0, %eax
jl 0x41f10
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
movl $0x1, %edx
xorl %eax, %eax
movl %eax, %ecx
callq 0x42070
movq -0x38(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x424e0
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x42300
cmpl $0x0, %eax
jl 0x41f0c
movl $0x2, %edi
leaq 0x313c36(%rip), %rsi    # 0x355b24
movl $0x44, %edx
callq 0x5060
callq 0x5310
callq 0x53b0
movl $0x1, %edi
callq 0x5130
jmp 0x41f0e
jmp 0x41f10
movq -0x8(%rbp), %rdi
callq 0x41860
movq -0x30(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1cad0
movq %rax, %rcx
movq -0x70(%rbp), %rax
movq %rcx, -0x58(%rbp)
movq -0x58(%rbp), %rcx
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x38(%rbp), %rdi
callq 0x1cad0
movq %rax, %rcx
movq -0x68(%rbp), %rax
movq %rcx, -0x60(%rbp)
movq -0x60(%rbp), %rcx
movq %rcx, (%rax)
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)