// File: /workspace/github_c_makefile_star2_O3/RodionGork[P]tinyscheme/scheme.c
// Function: atom2str
static void atom2str(scheme * sc, pointer l, int f, char **pp, int *plen) {
  char *p;

  *plen = -1;
  if (l == sc->NIL) {
    p = "()";
  } else if (l == sc->T) {
    p = "#t";
  } else if (l == sc->F) {
    p = "#f";
  } else if (l == sc->EOF_OBJ) {
    p = "#<EOF>";
  } else if (is_port(l)) {
    p = "#<PORT>";
  } else if (is_number(l)) {
    p = sc->strbuff;
    if (f <= 1 || f == 10) {    /* f is the base for numbers if > 1 */
      if (num_is_integer(l)) {
        sprintf(p, "%ld", ivalue_unchecked(l));
      } else {
        if (rvalue_unchecked(l) * 0.0 != 0.0) { // is +/-inf or nan
          if (rvalue_unchecked(l) > 0) {
            strcpy(p, "+inf");
          } else if (rvalue_unchecked(l) < 0) {
            strcpy(p, "-inf");
          } else {
            strcpy(p, "+nan");
          }
        } else {
          sprintf(p, "%.10g", rvalue_unchecked(l));
        }
        /* r5rs says there must be a '.' (unless 'e'?) */
        f = strcspn(p, ".e");
        if (p[f] == 0) {
          p[f] = '.';           /* not found, so add '.0' at the end */
          p[f + 1] = '0';
          p[f + 2] = 0;
        }
      }
    } else {
      long v = ivalue(l);
      if (f >= 2 && f <= 36) {
        long_to_str(v, p, f);
      } else {
        *p = '\0';
      }
    }
  } else if (is_string(l)) {
    if (!f) {
      p = strvalue(l);
      if (IS_ASCII(*p)) {
        *plen = strlength(l);
      } else {
        string_to_utf8(sc, strvalue(l), strlength(l));
        p = sc->strbuff;
      }
    } else {                    /* Hack, uses the fact that printing is needed */
      *pp = sc->strbuff;
      *plen = 0;
      printslashstring(sc, strvalue(l), strlength(l));
      return;
    }
  } else if (is_character(l)) {
    int c = charvalue(l);
    p = sc->strbuff;
    if (!f) {
      char_to_utf8(c, p, plen);
    } else {
      switch (c) {
      case ' ':
        p = "#\\space";
        break;
      case '\n':
        p = "#\\newline";
        break;
      case '\r':
        p = "#\\return";
        break;
      case '\t':
        p = "#\\tab";
        break;
      default:
        if (c < 32 || c >= 0x80) {
          sprintf(p, "#\\x%x", c);
          break;
        }
        sprintf(p, "#\\%c", c);
        break;
      }
    }
  } else if (is_symbol(l)) {
    p = symname(l);
  } else if (is_proc(l)) {
    p = sc->strbuff;
    snprintf(p, sc->strbuff_size, "#<%s PROCEDURE %ld>", procname(l), procnum(l));
  } else if (is_macro(l)) {
    p = "#<MACRO>";
  } else if (is_closure(l)) {
    p = "#<CLOSURE>";
  } else if (is_promise(l)) {
    p = "#<PROMISE>";
  } else if (is_foreign(l)) {
    p = sc->strbuff;
    snprintf(p, sc->strbuff_size, "#<FOREIGN PROCEDURE %ld>", procnum(l));
  } else if (is_continuation(l)) {
    p = "#<CONTINUATION>";
  } else if (is_bvector(l)) {
    p = sc->strbuff;
    sprintf(p, "#u8(len=%d)", strlength(l));
  } else {
    p = "#<ERROR>";
  }
  *pp = p;
  if (*plen < 0) {
    *plen = strlen(p);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %rbx
movq %rcx, %r14
movl $0xffffffff, (%r8)      # imm = 0xFFFFFFFF
cmpq %rsi, 0x90(%rdi)
je 0xbcd9
movq %rdi, %r12
cmpq %rsi, 0xb0(%rdi)
je 0xbce5
cmpq %rsi, 0xd0(%r12)
je 0xbcee
cmpq %rsi, 0xf0(%r12)
je 0xbcf7
movl (%rsi), %eax
andl $0x1f, %eax
decl %eax
cmpl $0xe, %eax
ja 0xbe3e
leaq 0x172e(%rip), %rcx      # 0xd3c8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
testl %edx, %edx
je 0xbe5b
movq 0xea0(%r12), %rax
movq %rax, (%r14)
movl $0x0, (%rbx)
movq 0x8(%rsi), %rax
movl 0x10(%rsi), %edx
movq %r12, %rdi
movq %rax, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xc13d
leaq 0x2674(%rip), %r15      # 0xe354
movq %r15, (%r14)
jmp 0xbd07
leaq 0x23a2(%rip), %r15      # 0xe08e
jmp 0xbcfe
leaq 0x239c(%rip), %r15      # 0xe091
jmp 0xbcfe
leaq 0x2396(%rip), %r15      # 0xe094
movl (%rbx), %edx
movq %r15, (%r14)
testl %edx, %edx
jns 0xbd11
movq %r15, %rdi
callq 0x40c0
movl %eax, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x23eb(%rip), %r15      # 0xe10f
jmp 0xbcfe
movq 0x8(%rsi), %rax
movq 0x8(%rax), %r15
jmp 0xbcfe
leaq 0x23fc(%rip), %r15      # 0xe133
jmp 0xbcfe
movq 0xea0(%r12), %r15
movl 0x10(%rsi), %edx
leaq 0x23f8(%rip), %rsi      # 0xe143
movq %r15, %rdi
xorl %eax, %eax
callq 0x4290
jmp 0xbcfe
movq 0xea0(%r12), %r15
cmpl $0x2, %edx
setge %cl
cmpl $0xa, %edx
setne %dil
movb 0x8(%rsi), %al
testb %dil, %cl
jne 0xbe4a
testb %al, %al
je 0xbefe
movq 0x10(%rsi), %rdx
leaq 0x1714(%rip), %rsi      # 0xd49f
movq %r15, %rdi
xorl %eax, %eax
callq 0x4290
jmp 0xbcfe
movq 0xea0(%r12), %r15
movslq 0xea8(%r12), %rax
cmpb $0x0, 0x8(%rsi)
je 0xbe73
movq 0x10(%rsi), %rcx
jmp 0xbe79
movl 0x10(%rsi), %eax
movq 0xea0(%r12), %r15
testl %edx, %edx
je 0xbe92
cmpl $0xc, %eax
jg 0xbee4
cmpl $0x9, %eax
je 0xbf7c
cmpl $0xa, %eax
jne 0xbf6b
leaq 0x22d1(%rip), %r15      # 0xe0c3
jmp 0xbcfe
movq 0xea0(%r12), %r15
movslq 0xea8(%r12), %rax
cmpb $0x0, 0x8(%rsi)
je 0xbea4
movq 0x10(%rsi), %r8
jmp 0xbeaa
leaq 0x22e3(%rip), %r15      # 0xe104
jmp 0xbcfe
leaq 0x22ce(%rip), %r15      # 0xe0fb
jmp 0xbcfe
leaq 0x2262(%rip), %r15      # 0xe09b
jmp 0xbcfe
leaq 0x230a(%rip), %r15      # 0xe14f
jmp 0xbcfe
testb %al, %al
je 0xbf32
movq 0x10(%rsi), %rdi
jmp 0xbf38
movq 0x8(%rsi), %r15
cmpb $0x0, (%r15)
movl 0x10(%rsi), %edx
js 0xbf53
movl %edx, (%rbx)
jmp 0xbd00
cvttsd2si 0x10(%rsi), %rcx
leaq 0x229a(%rip), %rdx      # 0xe11a
movq %r15, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0x40e0
jmp 0xbcfe
movl %eax, %edi
movq %r15, %rsi
movq %rbx, %rdx
callq 0xc2a2
jmp 0xbcfe
cvttsd2si 0x10(%rsi), %r8
movslq %r8d, %rcx
shlq $0x5, %rcx
leaq 0x5668(%rip), %rdx      # 0x11520
movq 0x8(%rcx,%rdx), %rdx
testq %rdx, %rdx
leaq 0x2291(%rip), %rcx      # 0xe158
cmovneq %rdx, %rcx
leaq 0x2215(%rip), %rdx      # 0xe0e7
movq %r15, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0x40e0
jmp 0xbcfe
cmpl $0xd, %eax
je 0xbf88
cmpl $0x20, %eax
jne 0xbf6b
leaq 0x21c2(%rip), %r15      # 0xe0bb
jmp 0xbcfe
movsd 0x10(%rsi), %xmm0
xorpd %xmm1, %xmm1
movapd %xmm0, %xmm2
mulsd %xmm1, %xmm2
ucomisd %xmm1, %xmm2
jne 0xbf17
jnp 0xbf94
ucomisd %xmm1, %xmm0
jbe 0xbfb8
movb $0x0, 0x4(%r15)
movl $0x666e692b, (%r15)     # imm = 0x666E692B
jmp 0xbfd8
cvttsd2si 0x10(%rsi), %rdi
cmpl $0x24, %edx
ja 0xbf4a
movq %r15, %rsi
callq 0x4c9e
jmp 0xbcfe
movb $0x0, (%r15)
jmp 0xbcfe
movq %r12, %rdi
movq %r15, %rsi
callq 0xc091
movq 0xea0(%r12), %r15
jmp 0xbcfe
leal -0x80(%rax), %ecx
cmpl $-0x61, %ecx
ja 0xbfa7
leaq 0x2162(%rip), %rsi      # 0xe0dc
jmp 0xbfae
leaq 0x2153(%rip), %r15      # 0xe0d6
jmp 0xbcfe
leaq 0x213e(%rip), %r15      # 0xe0cd
jmp 0xbcfe
leaq 0x2117(%rip), %rsi      # 0xe0b2
movq %r15, %rdi
movb $0x1, %al
callq 0x4290
jmp 0xbfd8
leaq 0x2134(%rip), %rsi      # 0xe0e2
movq %r15, %rdi
movl %eax, %edx
jmp 0xbd4e
ucomisd %xmm0, %xmm1
jbe 0xbfcc
movb $0x0, 0x4(%r15)
movl $0x666e692d, (%r15)     # imm = 0x666E692D
jmp 0xbfd8
movb $0x0, 0x4(%r15)
movl $0x6e616e2b, (%r15)     # imm = 0x6E616E2B
leaq 0x20d9(%rip), %rsi      # 0xe0b8
movq %r15, %rdi
callq 0x4180
movslq %eax, %rcx
cmpb $0x0, (%r15,%rcx)
jne 0xbcfe
shlq $0x20, %rax
movb $0x2e, (%r15,%rcx)
movabsq $0x100000000, %rcx      # imm = 0x100000000
addq %rax, %rcx
sarq $0x20, %rcx
movb $0x30, (%r15,%rcx)
movabsq $0x200000000, %rcx      # imm = 0x200000000
addq %rax, %rcx
sarq $0x20, %rcx
movb $0x0, (%r15,%rcx)
jmp 0xbcfe