// File: /workspace/github_c_makefile_star2_O3/BernardTatin[P]s7sh/s7.c
// Function: format_number
static void format_number(s7_scheme *sc, format_data *fdat, int32_t radix, s7_int width, s7_int precision, char float_choice, char pad, s7_pointer port)
    {
        char *tmp;
        block_t *b;
        s7_int nlen = 0;
        if (width < 0) width = 0;

        /* precision choice depends on float_choice if it's -1 */
        if (precision < 0)
        {
            if ((float_choice == 'e') ||
                    (float_choice == 'f') ||
                    (float_choice == 'g'))
                precision = 6;
            else
            {
                /* in the "int" cases, precision depends on the arg type */
                switch (type(car(fdat->args)))
                {
                    case T_INTEGER:
                    case T_RATIO:
                        precision = 0;
                        break;

                    default:
                        precision = 6;
                        break;
                }
            }
        }
        /* should (format #f "~F" 1/3) return "1/3"?? in CL it's "0.33333334" */

        if (pad != ' ')
        {
            char *padtmp;
#if (!WITH_GMP)
            if (radix == 10)
                tmp = number_to_string_base_10(sc, car(fdat->args), width, precision, float_choice, &nlen, P_WRITE);
            else
#endif
            {
                b = number_to_string_with_radix(sc, car(fdat->args), radix, width, precision, float_choice, &nlen);
                tmp = (char *)block_data(b);
            }
            padtmp = tmp;
            while (*padtmp == ' ') (*(padtmp++)) = pad;
            format_append_string(sc, fdat, tmp, nlen, port);
            if ((WITH_GMP) || (radix != 10)) liberate(sc, b);
        }
        else
        {
#if (!WITH_GMP)
            if (radix == 10)
                tmp = number_to_string_base_10(sc, car(fdat->args), width, precision, float_choice, &nlen, P_WRITE);
            else
#endif
            {
                b = number_to_string_with_radix(sc, car(fdat->args), radix, width, precision, float_choice, &nlen);
                tmp = (char *)block_data(b);
            }
            format_append_string(sc, fdat, tmp, nlen, port);
            if ((WITH_GMP) || (radix != 10)) liberate(sc, b);
        }
        fdat->args = cdr(fdat->args);
        fdat->ctr++;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %rax
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
movb 0x50(%rsp), %r13b
xorl %ecx, %ecx
movq %rcx, 0x10(%rsp)
testq %rax, %rax
cmovgq %rax, %rcx
testq %r8, %r8
jns 0x99354
leal -0x65(%r9), %eax
movl $0x6, %r8d
cmpb $0x3, %al
jb 0x99354
movq 0x20(%rbx), %rax
movq 0x8(%rax), %rax
movb (%rax), %al
addb $-0xb, %al
xorl %edx, %edx
cmpb $0x2, %al
cmovbq %rdx, %r8
movq 0x58(%rsp), %r15
movq 0x20(%rbx), %rax
movq 0x8(%rax), %rsi
cmpb $0x20, %r13b
jne 0x9938b
cmpl $0xa, %ebp
jne 0x993af
movsbl %r9b, %eax
leaq 0x10(%rsp), %r9
movq %r14, %rdi
movq %rcx, %rdx
movq %r8, %rcx
movl %eax, %r8d
callq 0x8f49e
movq %rax, %rsi
jmp 0x99401
cmpl $0xa, %ebp
jne 0x993ce
movsbl %r9b, %eax
leaq 0x10(%rsp), %r9
movq %r14, %rdi
movq %rcx, %rdx
movq %r8, %rcx
movl %eax, %r8d
callq 0x8f49e
movq %rax, %rsi
jmp 0x993eb
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
movsbl %r9b, %r9d
movq %r14, %rdi
movl %ebp, %edx
callq 0xd7ce
movq %rax, %r12
movq (%rax), %rsi
jmp 0x99401
leaq 0x10(%rsp), %rax
movq %rax, (%rsp)
movsbl %r9b, %r9d
movq %r14, %rdi
movl %ebp, %edx
callq 0xd7ce
movq %rax, %r12
movq (%rax), %rsi
cmpb $0x20, (%rsi)
jne 0x99401
leaq 0x1(%rsi), %rax
movb %r13b, -0x1(%rax)
cmpb $0x20, (%rax)
leaq 0x1(%rax), %rax
je 0x993f4
movq 0x10(%rsp), %r13
movq 0x8(%r15), %rax
movq 0x48(%rax), %rax
movq %r14, %rdi
movq %r13, %rdx
movq %r15, %rcx
callq *0x10(%rax)
addq %r13, (%rbx)
addl %r13d, 0x238(%r14)
cmpl $0xa, %ebp
je 0x99472
movslq 0x8(%r12), %rax
cmpq $0x11, %rax
jne 0x9945c
movq (%r12), %rdi
testq %rdi, %rdi
je 0x9944a
callq 0x8050
movq $0x0, (%r12)
movl $0x0, 0x8(%r12)
addq $0x838, %r14            # imm = 0x838
jmp 0x99467
leaq (%r14,%rax,8), %r14
addq $0x838, %r14            # imm = 0x838
movq (%r14), %rax
movq %rax, 0x18(%r12)
movq %r12, (%r14)
movq 0x20(%rbx), %rax
movq 0x10(%rax), %rax
movq %rax, 0x20(%rbx)
incq 0x10(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq