// File: /workspace/github_c_makefile_star2_O0/mirth-lang[P]mirth/bin/mirth1.c
// Function: big_pos_udivmod
static void big_pos_udivmod(BIG* a, INT b, INT *q, INT *r) {
    size_t bshift;
    uint32_t bhead;
    bool bperfect = true;
    if (IS_BIG(b)) {
        BIG* bb = GET_BIG(b);
        bshift = bb->size-1;
        bhead = bb->radix[bshift];
        if (bhead == 0) {
            ASSERT(bshift > 0);
            bshift--;
            bhead = bb->radix[bshift];
        }
        for (size_t i = 0; i < bshift; i++) {
            if (bb->radix[i]) { bperfect=false; break; }
        }
    } else {
        int64_t ib = GET_I63(b);
        ASSERT(ib > 1);
        uint64_t ub = (uint64_t)ib;
        if (ub <= (uint64_t)UINT32_MAX) {
            bshift = 0;
            bhead = ub;
            bperfect = true;
        } else {
            bshift = 1;
            bhead = HI_RADIX(ub);
            bperfect = LO_RADIX(ub) == 0;
        }
    }
    if (bshift >= a->size) {
        *q = WRAP_I63(0);
        *r = WRAP_BIG(a);
        int_decref(b);
    } else if (bperfect) {
        int_decref(b);
        big_u32_shift_udivmod(a, bhead, bshift, q, r);
    } else {
        big_pos_imperfect_udivmod(a, b, bhead, bshift, q, r);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rsi, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movb $0x1, -0x2d(%rbp)
movq -0x8(%rbp), %rax
andq $0x1, %rax
cmpq $0x0, %rax
jne 0x41a27
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
subq $0x1, %rax
movq %rax, -0x28(%rbp)
movq -0x38(%rbp), %rax
movq -0x28(%rbp), %rcx
movl 0x18(%rax,%rcx,4), %eax
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
jne 0x419eb
jmp 0x4199d
cmpq $0x0, -0x28(%rbp)
ja 0x419ce
movl $0x2, %edi
leaq 0x314008(%rip), %rsi    # 0x3559b8
movl $0x38, %edx
callq 0x5060
callq 0x5310
callq 0x53b0
movl $0x1, %edi
callq 0x5130
jmp 0x419d0
movq -0x28(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x28(%rbp)
movq -0x38(%rbp), %rax
movq -0x28(%rbp), %rcx
movl 0x18(%rax,%rcx,4), %eax
movl %eax, -0x2c(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x28(%rbp), %rax
jae 0x41a22
movq -0x38(%rbp), %rax
movq -0x40(%rbp), %rcx
cmpl $0x0, 0x18(%rax,%rcx,4)
je 0x41a12
movb $0x0, -0x2d(%rbp)
jmp 0x41a22
jmp 0x41a14
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x419f3
jmp 0x41abc
movq -0x8(%rbp), %rax
subq $0x1, %rax
movl $0x2, %ecx
cqto
idivq %rcx
movq %rax, -0x48(%rbp)
cmpq $0x1, -0x48(%rbp)
jg 0x41a6e
movl $0x2, %edi
leaq 0x313fa1(%rip), %rsi    # 0x3559f1
movl $0x34, %edx
callq 0x5060
callq 0x5310
callq 0x53b0
movl $0x1, %edi
callq 0x5130
jmp 0x41a70
movq -0x48(%rbp), %rax
movq %rax, -0x50(%rbp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, -0x50(%rbp)
ja 0x41a98
movq $0x0, -0x28(%rbp)
movq -0x50(%rbp), %rax
movl %eax, -0x2c(%rbp)
movb $0x1, -0x2d(%rbp)
jmp 0x41aba
movq $0x1, -0x28(%rbp)
movq -0x50(%rbp), %rax
shrq $0x20, %rax
movl %eax, -0x2c(%rbp)
movq -0x50(%rbp), %rax
cmpl $0x0, %eax
sete %al
andb $0x1, %al
movb %al, -0x2d(%rbp)
jmp 0x41abc
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jb 0x41afb
movq -0x18(%rbp), %rax
movq $0x1, -0x58(%rbp)
movq -0x58(%rbp), %rcx
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
movq %rcx, -0x60(%rbp)
movq -0x60(%rbp), %rcx
movq %rcx, (%rax)
movq -0x8(%rbp), %rdi
callq 0x41860
jmp 0x41b42
testb $0x1, -0x2d(%rbp)
je 0x41b24
movq -0x8(%rbp), %rdi
callq 0x41860
movq -0x10(%rbp), %rdi
movl -0x2c(%rbp), %esi
movq -0x28(%rbp), %rdx
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
callq 0x41b70
jmp 0x41b40
movq -0x10(%rbp), %rdi
movl -0x2c(%rbp), %edx
movq -0x28(%rbp), %rcx
movq -0x18(%rbp), %r8
movq -0x20(%rbp), %r9
movq -0x8(%rbp), %rsi
callq 0x41d40
jmp 0x41b42
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax,%rax)