// File: /workspace/github_c_makefile_star2_O0/JesseBuesking[P]omnomnum/grisu2/prettify.h
// Function: prettify_string
static void prettify_string(char* buffer, int from_pos, int end_pos, int k) {
    int nb_digits = end_pos - from_pos;
    int i, offset;
    /* v = buffer * 10^k
       kk is such that 10^(kk-1) <= v < 10^kk
       this way kk gives the position of the comma.
    */
    int kk = nb_digits + k;

    buffer[end_pos] = '\0';
    if (nb_digits <= kk && kk <= 21) {
	/* the first digits are already in. Add some 0s and call it a day. */
	/* the 21 is a personal choice. Only 16 digits could possibly be relevant.
	 * Basically we want to print 12340000000 rather than 1234.0e7 or 1.234e10 */
	for (i = nb_digits; i < kk; i++)
	    buffer[from_pos + i] = '0';
	buffer[kk] = '.';
	buffer[kk+1] = '0';
	buffer[kk+2] = '\0';
    } else if (0 < kk && kk <= 21) {
	/* comma number. Just insert a '.' at the correct location. */
	memmove(&buffer[from_pos + kk + 1], &buffer[from_pos + kk], nb_digits - kk);
	buffer[from_pos + kk] = '.';
	buffer[from_pos + nb_digits + 1] = '\0';
    } else if (-6 < kk && kk <= 0) {
	/* something like 0.000abcde.
	 * add '0.' and some '0's */
	offset = 2-kk;
	memmove(&buffer[from_pos + offset], &buffer[from_pos], nb_digits);
	buffer[from_pos] = '0';
	buffer[from_pos + 1] = '.';
	for (i = from_pos + 2; i < from_pos + offset; i++)
	    buffer[i] = '0';
	buffer[from_pos + nb_digits + offset] = '\0';
    } else if (nb_digits == 1) {
	/* just add 'e...' */
	buffer[from_pos + 1] = 'e';
	/* fill_positive_fixnum will terminate the string */
	fill_exponent(kk - 1, &buffer[from_pos + 2]);
    } else {
	/* leave the first digit. then add a '.' and at the end 'e...' */
	memmove(&buffer[from_pos + 2], &buffer[from_pos + 1], nb_digits-1);
	buffer[from_pos + 1] = '.';
	buffer[from_pos + nb_digits + 1] = 'e';
	/* fill_fixnum will terminate the string */
	fill_exponent(kk - 1, &buffer[from_pos + nb_digits + 2]);
    }
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movl %esi, 0x1c(%rsp)
movl %edx, 0x18(%rsp)
movl %ecx, 0x14(%rsp)
movl 0x18(%rsp), %eax
subl 0x1c(%rsp), %eax
movl %eax, 0x10(%rsp)
movl 0x10(%rsp), %eax
addl 0x14(%rsp), %eax
movl %eax, 0x4(%rsp)
movq 0x20(%rsp), %rax
movslq 0x18(%rsp), %rcx
movb $0x0, (%rax,%rcx)
movl 0x10(%rsp), %eax
cmpl 0x4(%rsp), %eax
jg 0x152a8
cmpl $0x15, 0x4(%rsp)
jg 0x152a8
movl 0x10(%rsp), %eax
movl %eax, 0xc(%rsp)
movl 0xc(%rsp), %eax
cmpl 0x4(%rsp), %eax
jge 0x1526f
movq 0x20(%rsp), %rax
movl 0x1c(%rsp), %ecx
addl 0xc(%rsp), %ecx
movslq %ecx, %rcx
movb $0x30, (%rax,%rcx)
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x15244
movq 0x20(%rsp), %rax
movslq 0x4(%rsp), %rcx
movb $0x2e, (%rax,%rcx)
movq 0x20(%rsp), %rax
movl 0x4(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb $0x30, (%rax,%rcx)
movq 0x20(%rsp), %rax
movl 0x4(%rsp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movb $0x0, (%rax,%rcx)
jmp 0x1549d
xorl %eax, %eax
cmpl 0x4(%rsp), %eax
jge 0x1531e
cmpl $0x15, 0x4(%rsp)
jg 0x1531e
movq 0x20(%rsp), %rdi
movl 0x1c(%rsp), %eax
addl 0x4(%rsp), %eax
addl $0x1, %eax
cltq
addq %rax, %rdi
movq 0x20(%rsp), %rsi
movl 0x1c(%rsp), %eax
addl 0x4(%rsp), %eax
cltq
addq %rax, %rsi
movl 0x10(%rsp), %eax
subl 0x4(%rsp), %eax
movslq %eax, %rdx
callq 0x1110
movq 0x20(%rsp), %rax
movl 0x1c(%rsp), %ecx
addl 0x4(%rsp), %ecx
movslq %ecx, %rcx
movb $0x2e, (%rax,%rcx)
movq 0x20(%rsp), %rax
movl 0x1c(%rsp), %ecx
addl 0x10(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb $0x0, (%rax,%rcx)
jmp 0x1549b
movl $0xfffffffa, %eax       # imm = 0xFFFFFFFA
cmpl 0x4(%rsp), %eax
jge 0x153e2
cmpl $0x0, 0x4(%rsp)
jg 0x153e2
movl $0x2, %eax
subl 0x4(%rsp), %eax
movl %eax, 0x8(%rsp)
movq 0x20(%rsp), %rdi
movl 0x1c(%rsp), %eax
addl 0x8(%rsp), %eax
cltq
addq %rax, %rdi
movq 0x20(%rsp), %rsi
movslq 0x1c(%rsp), %rax
addq %rax, %rsi
movslq 0x10(%rsp), %rdx
callq 0x1110
movq 0x20(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movb $0x30, (%rax,%rcx)
movq 0x20(%rsp), %rax
movl 0x1c(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb $0x2e, (%rax,%rcx)
movl 0x1c(%rsp), %eax
addl $0x2, %eax
movl %eax, 0xc(%rsp)
movl 0xc(%rsp), %eax
movl 0x1c(%rsp), %ecx
addl 0x8(%rsp), %ecx
cmpl %ecx, %eax
jge 0x153c5
movq 0x20(%rsp), %rax
movslq 0xc(%rsp), %rcx
movb $0x30, (%rax,%rcx)
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x1539a
movq 0x20(%rsp), %rax
movl 0x1c(%rsp), %ecx
addl 0x10(%rsp), %ecx
addl 0x8(%rsp), %ecx
movslq %ecx, %rcx
movb $0x0, (%rax,%rcx)
jmp 0x15499
cmpl $0x1, 0x10(%rsp)
jne 0x1541b
movq 0x20(%rsp), %rax
movl 0x1c(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb $0x65, (%rax,%rcx)
movl 0x4(%rsp), %edi
subl $0x1, %edi
movq 0x20(%rsp), %rsi
movl 0x1c(%rsp), %eax
addl $0x2, %eax
cltq
addq %rax, %rsi
callq 0x15c70
jmp 0x15497
movq 0x20(%rsp), %rdi
movl 0x1c(%rsp), %eax
addl $0x2, %eax
cltq
addq %rax, %rdi
movq 0x20(%rsp), %rsi
movl 0x1c(%rsp), %eax
addl $0x1, %eax
cltq
addq %rax, %rsi
movl 0x10(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rdx
callq 0x1110
movq 0x20(%rsp), %rax
movl 0x1c(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb $0x2e, (%rax,%rcx)
movq 0x20(%rsp), %rax
movl 0x1c(%rsp), %ecx
addl 0x10(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb $0x65, (%rax,%rcx)
movl 0x4(%rsp), %edi
subl $0x1, %edi
movq 0x20(%rsp), %rsi
movl 0x1c(%rsp), %eax
addl 0x10(%rsp), %eax
addl $0x2, %eax
cltq
addq %rax, %rsi
callq 0x15c70
jmp 0x15499
jmp 0x1549b
jmp 0x1549d
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)