// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movq $0x0, 0x38(%rsp)
movq 0x40(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rdi
callq 0x11320
testb $0x1, %al
jne 0x89f6a
movq 0x48(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq 0x48(%rsp), %rax
movq 0x1370(%rax), %rdx
movq 0x40(%rsp), %rcx
movq 0x19af9b(%rip), %r8     # 0x224ef0
movl $0x1, %r9d
callq 0x14130
movq %rax, 0x50(%rsp)
jmp 0x8a13c
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movzbl (%rax), %eax
cmpl $0x1, %eax
jne 0x8a087
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rdi
callq 0x11340
testb $0x1, %al
jne 0x89fa1
jmp 0x89fb2
movq 0x18(%rsp), %rdi
callq 0x10790
movq %rax, 0x30(%rsp)
jmp 0x89fe8
movq 0x48(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq 0x48(%rsp), %rax
movq 0x1370(%rax), %rdx
movq 0x40(%rsp), %rcx
movl $0xb, %r8d
movl $0x2, %r9d
callq 0x13c50
movq %rax, 0x50(%rsp)
jmp 0x8a13c
cmpq $0x2, 0x30(%rsp)
jl 0x89ff8
cmpq $0x10, 0x30(%rsp)
jle 0x8a02f
movq 0x48(%rsp), %rdi
movq 0x48(%rsp), %rax
movq 0x1370(%rax), %rax
movq 0x8(%rax), %rsi
movq 0x18c47c(%rip), %rdx    # 0x216490
movq 0x18(%rsp), %rcx
movq 0x19b1c0(%rip), %r8     # 0x2251e0
callq 0x13880
movq %rax, 0x50(%rsp)
jmp 0x8a13c
movq 0x48(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq 0x30(%rsp), %rax
movl %eax, %edx
movq 0x48(%rsp), %rax
movslq 0x468(%rax), %r8
xorl %eax, %eax
movl %eax, %ecx
movl $0x67, %r9d
leaq 0x38(%rsp), %rax
movq %rax, (%rsp)
callq 0x129b0
movq %rax, 0x10(%rsp)
movq 0x48(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq 0x38(%rsp), %rdx
callq 0x2d220
movq %rax, 0x50(%rsp)
jmp 0x8a13c
movq 0x20(%rsp), %rax
movzbl (%rax), %eax
cmpl $0xb, %eax
jne 0x8a0ed
movq 0x20(%rsp), %rax
movq (%rax), %rax
andq $0x8000000, %rax        # imm = 0x8000000
cmpq $0x0, %rax
je 0x8a0ce
movq 0x20(%rsp), %rax
movzbl 0x18(%rax), %eax
movq %rax, 0x38(%rsp)
movq 0x20(%rsp), %rax
addq $0x8, %rax
addq $0x10, %rax
addq $0x1, %rax
movq %rax, 0x28(%rsp)
jmp 0x8a0eb
movq 0x48(%rsp), %rdi
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rsi
leaq 0x38(%rsp), %rdx
callq 0xc7240
movq %rax, 0x28(%rsp)
jmp 0x8a123
movq 0x48(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq 0x48(%rsp), %rax
movslq 0x468(%rax), %rcx
xorl %eax, %eax
movl %eax, %edx
movl $0x67, %r8d
leaq 0x38(%rsp), %r9
movl $0x1, (%rsp)
callq 0xc66e0
movq %rax, 0x28(%rsp)
movq 0x48(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq 0x38(%rsp), %rdx
callq 0x144d0
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rax
addq $0x58, %rsp
retq
nopw %cs:(%rax,%rax)