// File: /workspace/github_c_makefile_star2_O0/dalnefre[P]kernel_abe/atom.c
// Function: lu_extend_atom
CONS*
lu_extend_atom(CONS* atom, int c)
/* return <atom> + <c> as a new atom, or atom of <c> if <atom> is NIL */
{
	CONS* root;
	CONS* node;
	CONS* ch = NUMBER(c);

	XDBUG_ENTER("lu_extend_atom");
	XDBUG_PRINT("", ("atom@%p = %s", atom, atom_str(atom)));
	XDBUG_PRINT("", ("c = %c(%d)", (isprint(c)?c:' '), c));
	if (lu_atom_root == NULL) {
		root = lu_cons(NIL, NIL);
		XDBUG_PRINT("", ("lu_atom_root = %p[%p;%p]", root, car(root), cdr(root)));
		lu_atom_root = MK_ATOM(root);
	}
	if ((atom == NULL) || nilp(atom)) {
		atom = lu_atom_root;
	}
	assert(atomp(atom));
	root = MK_CONS(atom);
	XDBUG_PRINT("", ("root = %p[%p;%p]", root, car(root), cdr(root)));
	node = cdr(root);
	for (;;) {
		XDBUG_PRINT("", ("node = %p[%p;%p]", node, car(node), cdr(node)));
		if (nilp(node)) {
			/* suffix not found, extend suffix list with new character */
			XDBUG_PRINT("", ("extending suffix list"));
			node = lu_cons(ch, car(root));
			node = lu_cons(node, NIL);
			rplacd(root, lu_cons(node, cdr(root)));
			break;
		}
		if (car(car(car(node))) == ch) {
			/* suffix found, return "atom" node */
			XDBUG_PRINT("", ("matched suffix list"));
			node = car(node);
			break;
		}
		node = cdr(node);
	}
	atom = MK_ATOM(node);
	assert(atomp(atom));
	XDBUG_RETURN atom;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movslq -0xc(%rbp), %rax
shlq $0x2, %rax
orq $0x3, %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, 0xe2f1(%rip)      # 0x2f808
jne 0x2153f
leaq 0xdd70(%rip), %rsi      # 0x2f290
movq %rsi, %rdi
callq 0x214a0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
andq $-0x4, %rax
orq $0x2, %rax
movq %rax, 0xe2c9(%rip)      # 0x2f808
cmpq $0x0, -0x8(%rbp)
je 0x21561
leaq 0xdd43(%rip), %rax      # 0x2f290
cmpq %rax, -0x8(%rbp)
sete %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x2156c
movq 0xe2a0(%rip), %rax      # 0x2f808
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
andq $0x3, %rax
cmpq $0x2, %rax
sete %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x2158a
jmp 0x215a9
leaq 0x9396(%rip), %rdi      # 0x2a927
leaq 0x939b(%rip), %rsi      # 0x2a933
movl $0x2e, %edx
leaq 0x9396(%rip), %rcx      # 0x2a93a
callq 0x2100
movq -0x8(%rbp), %rax
andq $-0x4, %rax
orq $0x0, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x25510
movq %rax, -0x20(%rbp)
leaq 0xdcc3(%rip), %rax      # 0x2f290
cmpq %rax, -0x20(%rbp)
sete %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x21649
movq -0x28(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rdi
callq 0x25380
movq -0x40(%rbp), %rdi
movq %rax, %rsi
callq 0x214a0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
leaq 0xdc83(%rip), %rsi      # 0x2f290
callq 0x214a0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rdi
callq 0x25510
movq -0x38(%rbp), %rdi
movq %rax, %rsi
callq 0x214a0
movq -0x30(%rbp), %rdi
movq %rax, %rsi
callq 0x256d0
jmp 0x21689
movq -0x20(%rbp), %rdi
callq 0x25380
movq %rax, %rdi
callq 0x25380
movq %rax, %rdi
callq 0x25380
cmpq -0x28(%rbp), %rax
jne 0x21677
movq -0x20(%rbp), %rdi
callq 0x25380
movq %rax, -0x20(%rbp)
jmp 0x21689
movq -0x20(%rbp), %rdi
callq 0x25510
movq %rax, -0x20(%rbp)
jmp 0x215c6
movq -0x20(%rbp), %rax
andq $-0x4, %rax
orq $0x2, %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
andq $0x3, %rax
cmpq $0x2, %rax
sete %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x216b7
jmp 0x216d6
leaq 0x9269(%rip), %rdi      # 0x2a927
leaq 0x926e(%rip), %rsi      # 0x2a933
movl $0x45, %edx
leaq 0x9269(%rip), %rcx      # 0x2a93a
callq 0x2100
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq