// File: /workspace/github_c_makefile_star2_O0/dalnefre[P]kernel_abe/emit.c
// Function: depth_to_str
static void
depth_to_str(int depth, char* buf, CONS* cons)
{
	XDBUG_ENTER("depth_to_str");
	XDBUG_PRINT("", ("depth = %d", depth));
	strncpy(buf, "", CONS_BUFSZ);	/* zero buffer */
	if (nilp(cons)) {
		strcpy(buf, "NIL");
	} else if (boolp(cons)) {
		strcpy(buf, (cons ? "TRUE" : "FALSE"));
	} else if (atomp(cons)) {
		char *q = atom_str(cons);
		int n = 0;
		int qtd = q[strcspn(q, HUMUS_TOKEN_BRKS)]; /* look for special chars */

		buf[n++] = '#';
		if (qtd) {
			buf[n++] = '"';
		}
		if (strlen(q) > 249) {
			sprintf((buf + n), "%.249s...", q);
		} else {
			strcpy((buf + n), q);
		}
		if (qtd) {
			n = strlen(buf);
			buf[n++] = '"';
			buf[n] = '\0';
		}
	} else if (numberp(cons)) {
		sprintf(buf, "%d", MK_INT(cons));
#if NUMBER_IS_FUNC
#else
	} else if (funcp(cons)) {
		sprintf(buf, "^%lx", (ulint)MK_PTR(cons));
#endif
	} else if (depth < 0) {			/* depth limit */
		strcpy(buf, "...");
	} else if (actorp(cons)) {
		int n = 0;

		XDBUG_PRINT("", ("actor = @%lx[^%lx, 16#%08lx]", 
			(ulint)cons, (ulint)_THIS(cons), (ulint)_MINE(cons)));
		sprintf(buf, "@%lx[^%lx, ", (ulint)cons, (ulint)_THIS(cons));
		child_to_str((depth - 1), buf, _MINE(cons));
		n = strlen(buf);
		if (n < (CONS_BUFSZ - 2)) {
			buf[n++] = ']';
			buf[n] = '\0';
		}
	} else if (consp(cons)) {
		int n = 0;

		XDBUG_PRINT("", ("cons = (16#%08lx, 16#%08lx)", 
			(ulint)car(cons), (ulint)cdr(cons)));
		buf[n++] = '(';
		buf[n] = '\0';
		tail_to_str(depth, TAIL_LENGTH, buf, cons);
		n = strlen(buf);
		if (n < (CONS_BUFSZ - 2)) {
			buf[n++] = ')';
			buf[n] = '\0';
		}
	} else {
		sprintf(buf, "16#%08lx", (ulint)cons);
	}
	XDBUG_PRINT("", ("buf = %s", buf));
	XDBUG_RETURN;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rdi
leaq 0xc0d1(%rip), %rsi      # 0x2936f
movl $0x400, %edx            # imm = 0x400
callq 0x2070
leaq 0x11fe1(%rip), %rax     # 0x2f290
cmpq %rax, -0x18(%rbp)
sete %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x1d2d8
movq -0x10(%rbp), %rdi
leaq 0xe206(%rip), %rsi      # 0x2b4d4
callq 0x2090
jmp 0x1d5f8
cmpq $0x0, -0x18(%rbp)
je 0x1d2ea
movl $0x1, %eax
cmpq %rax, -0x18(%rbp)
jne 0x1d312
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rcx
leaq 0xdc18(%rip), %rsi      # 0x2af11
leaq 0xdbdb(%rip), %rax      # 0x2aedb
cmpq $0x0, %rcx
cmovneq %rax, %rsi
callq 0x2090
jmp 0x1d5f6
movq -0x18(%rbp), %rax
andq $0x3, %rax
cmpq $0x2, %rax
sete %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x1d41b
movq -0x18(%rbp), %rdi
callq 0x217a0
movq %rax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rdi
leaq 0xd5a9(%rip), %rsi      # 0x2a902
callq 0x2140
movq %rax, %rcx
movq -0x38(%rbp), %rax
movsbl (%rax,%rcx), %eax
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movl -0x24(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x24(%rbp)
movslq %ecx, %rcx
movb $0x23, (%rax,%rcx)
cmpl $0x0, -0x28(%rbp)
je 0x1d39e
movq -0x10(%rbp), %rax
movl -0x24(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x24(%rbp)
movslq %ecx, %rcx
movb $0x22, (%rax,%rcx)
movq -0x20(%rbp), %rdi
callq 0x20c0
cmpq $0xf9, %rax
jbe 0x1d3ce
movq -0x10(%rbp), %rdi
movslq -0x24(%rbp), %rax
addq %rax, %rdi
movq -0x20(%rbp), %rdx
leaq 0xd548(%rip), %rsi      # 0x2a90d
movb $0x0, %al
callq 0x2220
jmp 0x1d3e2
movq -0x10(%rbp), %rdi
movslq -0x24(%rbp), %rax
addq %rax, %rdi
movq -0x20(%rbp), %rsi
callq 0x2090
cmpl $0x0, -0x28(%rbp)
je 0x1d416
movq -0x10(%rbp), %rdi
callq 0x20c0
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rax
movl -0x24(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x24(%rbp)
movslq %ecx, %rcx
movb $0x22, (%rax,%rcx)
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
movb $0x0, (%rax,%rcx)
jmp 0x1d5f4
movq -0x18(%rbp), %rax
andq $0x3, %rax
cmpq $0x3, %rax
sete %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x1d458
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
sarq $0x2, %rax
movl %eax, %edx
leaq 0xd2b5(%rip), %rsi      # 0x2a701
movb $0x0, %al
callq 0x2220
jmp 0x1d5f2
cmpl $0x0, -0x4(%rbp)
jge 0x1d473
movq -0x10(%rbp), %rdi
leaq 0xcee1(%rip), %rsi      # 0x2a34a
callq 0x2090
jmp 0x1d5f0
movq -0x18(%rbp), %rax
andq $0x3, %rax
cmpq $0x1, %rax
sete %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x1d531
movl $0x0, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rdi
callq 0x1a590
movq -0x58(%rbp), %rdi
movq -0x50(%rbp), %rdx
movq %rax, %rcx
leaq 0xd452(%rip), %rsi      # 0x2a917
movb $0x0, %al
callq 0x2220
movl -0x4(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x44(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rdi
callq 0x1a600
movl -0x44(%rbp), %edi
movq -0x40(%rbp), %rsi
movq %rax, %rdx
callq 0x21270
movq -0x10(%rbp), %rdi
callq 0x20c0
movl %eax, -0x2c(%rbp)
cmpl $0x3fe, -0x2c(%rbp)     # imm = 0x3FE
jge 0x1d52c
movq -0x10(%rbp), %rax
movl -0x2c(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x2c(%rbp)
movslq %ecx, %rcx
movb $0x5d, (%rax,%rcx)
movq -0x10(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movb $0x0, (%rax,%rcx)
jmp 0x1d5ee
xorl %eax, %eax
cmpq $0x0, -0x18(%rbp)
movb %al, -0x59(%rbp)
je 0x1d54f
movq -0x18(%rbp), %rax
andq $0x3, %rax
cmpq $0x0, %rax
sete %al
movb %al, -0x59(%rbp)
movb -0x59(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x1d5d6
movl $0x0, -0x30(%rbp)
movq -0x10(%rbp), %rax
movl -0x30(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x30(%rbp)
movslq %ecx, %rcx
movb $0x28, (%rax,%rcx)
movq -0x10(%rbp), %rax
movslq -0x30(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movl -0x4(%rbp), %edi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movl $0x6, %esi
callq 0x21300
movq -0x10(%rbp), %rdi
callq 0x20c0
movl %eax, -0x30(%rbp)
cmpl $0x3fe, -0x30(%rbp)     # imm = 0x3FE
jge 0x1d5d4
movq -0x10(%rbp), %rax
movl -0x30(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x30(%rbp)
movslq %ecx, %rcx
movb $0x29, (%rax,%rcx)
movq -0x10(%rbp), %rax
movslq -0x30(%rbp), %rcx
movb $0x0, (%rax,%rcx)
jmp 0x1d5ec
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0xdaf9(%rip), %rsi      # 0x2b0de
movb $0x0, %al
callq 0x2220
jmp 0x1d5ee
jmp 0x1d5f0
jmp 0x1d5f2
jmp 0x1d5f4
jmp 0x1d5f6
jmp 0x1d5f8
addq $0x60, %rsp
popq %rbp
retq
nop