// File: /workspace/github_c_makefile_star2_O3/mirth-lang[P]mirth/bin/mirth1.c
// Function: int_to_str
static STR* int_to_str(INT a) {
    if (IS_I63(a) || (GET_BIG(a)->size == 2)) {
        return i64_to_str(int_to_i64(a));
    } else if ((GET_BIG(a)->size == 3) && (GET_BIG(a)->radix[2] == 0)) {
        return u64_to_str(int_to_u64(a));
    } else {
        STR *s = str_alloc(GET_BIG(a)->size * 10);
        if (SIGN_RADIX(GET_BIG(a))) {
            a = int_negate(a);
            ASSERT(IS_BIG(a));
            s = str_pushn(s, "-", 1);
        }
        s = str_pushn(s,"0x",2);
        BIG* b = GET_BIG(a);
        size_t i = b->radix[b->size-1] ? b->size : b->size-1;
        while (i --> 0) {
            uint32_t r = b->radix[i];
            char c[10] = "00000000_";
            int j = 8;
            while (j --> 0) {
                uint32_t h = r & 0xF;
                c[j] = (h > 9) ? h + 'A' - 10 : h + '0';
                r = r >> 4;
            }
            s = str_pushn(s,c,8+(i>0));
        }
        big_decref(b);
        return s;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %r14
testb $0x1, %r14b
jne 0xfeda
movq 0x10(%r14), %rax
cmpq $0x3, %rax
je 0xff89
cmpq $0x2, %rax
jne 0xff94
movq %r14, %rdi
callq 0xe445
movq %rax, %r14
movsbq %r14b, %rax
cmpq %r14, %rax
jne 0xff11
leaq 0x110351b(%rip), %rax   # 0x1113410
movq 0x400(%rax,%r14,8), %rbx
testq %rbx, %rbx
je 0xff11
movabsq $0xfffffffffffc, %rax   # imm = 0xFFFFFFFFFFFC
andq %rbx, %rax
jmp 0xff71
movq %r14, %r12
subq $-0x80, %r12
leaq -0x50(%rbp), %rsi
leaq -0x60(%rbp), %rbx
leaq -0x58(%rbp), %r15
movl $0x20, %edx
movq %r14, %rdi
movq %rbx, %rcx
movq %r15, %r8
callq 0x5402
movq (%rbx), %rdi
movq (%r15), %rsi
callq 0x9040
movq %rax, %rbx
cmpq $0xff, %r12
ja 0x10084
leaq 0x11034b7(%rip), %rax   # 0x1113410
movq %rbx, 0x400(%rax,%r14,8)
movabsq $0xfffffffffffc, %rcx   # imm = 0xFFFFFFFFFFFC
movq %rbx, %rax
andq %rcx, %rax
sete %cl
testb $0x3, %bl
setne %dl
orb %cl, %dl
jne 0x10084
incl (%rax)
jmp 0x10084
cmpl $0x0, 0x20(%r14)
je 0x10096
addq %rax, %rax
leaq (%rax,%rax,4), %rdi
callq 0xf5e4
movq %rax, %rbx
movq 0x10(%r14), %rax
cmpl $0x0, 0x14(%r14,%rax,4)
jns 0xffdb
movq %r14, %rdi
callq 0xee12
movq %rax, %r14
testb $0x1, %r14b
jne 0x1013d
leaq 0xd1432(%rip), %rsi     # 0xe13fd
movl $0x1, %edx
movq %rbx, %rdi
callq 0xf47c
movq %rax, %rbx
leaq 0xd141d(%rip), %rsi     # 0xe13ff
movl $0x2, %edx
movq %rbx, %rdi
callq 0xf47c
movq %rax, %rbx
movq 0x10(%r14), %rax
cmpl $0x0, 0x14(%r14,%rax,4)
leaq -0x1(%rax), %r12
cmovneq %rax, %r12
testq %r12, %r12
je 0x10077
movabsq $0x3030303030303030, %r13 # imm = 0x3030303030303030
leaq -0x50(%rbp), %r15
movl 0x14(%r14,%r12,4), %eax
decq %r12
movq %r13, -0x50(%rbp)
movw $0x5f, -0x48(%rbp)
movl $0x9, %ecx
movl %eax, %edx
andl $0xf, %edx
leal 0x30(%rdx), %esi
leal 0x37(%rdx), %edi
cmpl $0xa, %edx
movzbl %dil, %edx
movzbl %sil, %esi
cmovael %edx, %esi
movb %sil, -0x52(%rbp,%rcx)
shrl $0x4, %eax
decq %rcx
cmpq $0x1, %rcx
ja 0x1002e
xorl %edx, %edx
testq %r12, %r12
sete %dl
xorq $0x9, %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0xf47c
movq %rax, %rbx
testq %r12, %r12
jne 0x10017
decl (%r14)
jne 0x10084
movq %r14, %rdi
callq 0x5030
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
callq 0xe445
movq %rax, %r14
cmpq $0xff, %rax
ja 0x100bd
leaq 0x1103b60(%rip), %rax   # 0x1113c10
movq (%rax,%r14,8), %rbx
testq %rbx, %rbx
jne 0xff02
xorps %xmm0, %xmm0
leaq -0x32(%rbp), %rdi
movaps %xmm0, -0xe(%rdi)
movaps %xmm0, -0x1e(%rdi)
xorl %esi, %esi
movabsq $-0x3333333333333333, %r8 # imm = 0xCCCCCCCCCCCCCCCD
leaq -0x50(%rbp), %r9
movq %r14, %rdx
movq %rdx, %rcx
movq %rdx, %rax
mulq %r8
shrq $0x3, %rdx
leal (%rdx,%rdx), %eax
leal (%rax,%rax,4), %eax
movl %ecx, %r10d
subl %eax, %r10d
orb $0x30, %r10b
movb %r10b, (%rdi)
incq %rsi
cmpq %r9, %rdi
seta %al
decq %rdi
cmpq $0xa, %rcx
jb 0x10115
testb %al, %al
jne 0x100df
incq %rdi
callq 0x9040
movq %rax, %rbx
cmpq $0xff, %r14
ja 0x10084
leaq 0x1103adc(%rip), %rax   # 0x1113c10
movq %rbx, (%rax,%r14,8)
jmp 0xff61
leaq 0xd1281(%rip), %rsi     # 0xe13c5
movl $0x37, %edx
movl $0x2, %edi
callq 0x5060
callq 0x52b6
movl $0x1, %edi
callq 0x5130