// File: /workspace/github_c_makefile_star2_O2/BernardTatin[P]s7sh/s7.c
// Function: g_number_to_string
static s7_pointer g_number_to_string(s7_scheme *sc, s7_pointer args)
    {
#define H_number_to_string "(number->string num (radix 10)) converts the number num into a string."
#define Q_number_to_string s7_make_signature(sc, 3, sc->is_string_symbol, sc->is_number_symbol, sc->is_integer_symbol)

        s7_int nlen = 0, radix; /* ignore cppcheck complaint about radix! */
        char *res;
        s7_pointer x;

        x = car(args);
        if (!s7_is_number(x))
            return(method_or_bust_with_type(sc, x, sc->number_to_string_symbol, args, a_number_string, 1));

        if (is_pair(cdr(args)))
        {
            s7_pointer y;
            y = cadr(args);
            if (s7_is_integer(y))
                radix = s7_integer(y);
            else return(method_or_bust(sc, y, sc->number_to_string_symbol, args, T_INTEGER, 2));
            if ((radix < 2) || (radix > 16))
                return(out_of_range(sc, sc->number_to_string_symbol, small_int(2), y, a_valid_radix_string));
#if (WITH_GMP)
            if (!s7_is_bignum(x))
#endif
            {
                block_t *b;
                b = number_to_string_with_radix(sc, x, radix, 0, sc->float_format_precision, 'g', &nlen);
                return(block_to_string(sc, b, nlen));
            }
        }
#if WITH_GMP
        else radix = 10;
        if (s7_is_bignum(x))
        {
            s7_pointer p;
            res = big_number_to_string_with_radix(x, radix, 0, &nlen, P_WRITE);
            p = make_string_with_length(sc, res, nlen);
            free(res);
            return(p);
        }
        res = number_to_string_base_10(sc, x, 0, sc->float_format_precision, 'g', &nlen, P_WRITE);
#else
        if (is_t_integer(x))
        {
            if (has_print_name(x))
            {
                nlen = print_name_length(x);
                res = (char *)print_name(x);
            }
            else res = integer_to_string(sc, integer(x), &nlen);
        }
        else res = number_to_string_base_10(sc, x, 0, sc->float_format_precision, 'g', &nlen, P_WRITE);
#endif
        return(make_string_with_length(sc, res, nlen));
    }

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rcx
movq %rdi, %rbx
andq $0x0, 0x10(%rsp)
movq 0x8(%rsi), %rsi
movzbl (%rsi), %eax
leaq 0xbf098(%rip), %rdx     # 0x119970
cmpb $0x0, (%rax,%rdx)
je 0x5a92d
movq 0x10(%rcx), %rdx
cmpb $0x1, (%rdx)
jne 0x5a94e
movq 0x8(%rdx), %rax
cmpb $0xb, (%rax)
jne 0x5a96f
movq 0x8(%rax), %rdx
leaq -0x11(%rdx), %rcx
cmpq $-0xf, %rcx
jae 0x5a9af
movq 0x1370(%rbx), %rcx
movq 0x8(%rcx), %rsi
movq 0xbb04c(%rip), %rdx     # 0x115960
movq 0xc9d15(%rip), %r8      # 0x124630
movq %rbx, %rdi
movq %rax, %rcx
addq $0x18, %rsp
popq %rbx
popq %r14
jmp 0xcb8f
movq 0x1370(%rbx), %rdx
movq 0xc9a65(%rip), %r8      # 0x1243a0
pushq $0x1
popq %r9
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r14
jmp 0xcf9a
cmpb $0xb, %al
jne 0x5a990
testb $0x8, 0x3(%rsi)
jne 0x5a9e2
movq 0x8(%rsi), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x73b88
jmp 0x5a9aa
movq 0x1370(%rbx), %rdx
pushq $0xb
popq %r8
pushq $0x2
popq %r9
movq %rbx, %rdi
movq %rax, %rsi
addq $0x18, %rsp
popq %rbx
popq %r14
jmp 0xcd70
movslq 0x468(%rbx), %rcx
pushq $0x67
popq %r8
leaq 0x10(%rsp), %r9
movq %rbx, %rdi
xorl %edx, %edx
callq 0x730a4
movq %rax, %rsi
jmp 0x5a9ef
movslq 0x468(%rbx), %r8
leaq 0x10(%rsp), %r14
movq %r14, (%rsp)
pushq $0x67
popq %r9
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0xc49c
movq (%r14), %rdx
movq %rbx, %rdi
movq %rax, %rsi
addq $0x18, %rsp
popq %rbx
popq %r14
jmp 0x2bf22
movzbl 0x18(%rsi), %eax
movq %rax, 0x10(%rsp)
addq $0x19, %rsi
movq 0x10(%rsp), %rdx
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r14
jmp 0xd11d