// File: /workspace/github_c_makefile_star2_O2/azhai[P]mlite/mlite.c
// Function: sf_define_type
cell sf_define_type(cell x, int *pc) {
	cell	p, t, n, a, defs, type, new;

	if (!tuple_p(cdr(x)) || !tuple_p(cddr(x)))
		return error("define_type: syntax error", x);
	if (!symbol_p(cadr(x)))
		return error("define_type: expected id, got", cadr(x));
	a = node(NIL, NIL);
	save(a);
	for (p = cddr(x); p != NIL; p = cdr(p)) {
		t = car(p);
		if (symbol_p(t)) {		/* (name 'name) */
			n = node(t, NIL);
			n = node(S_quote, n);
			n = node(n, NIL);
			n = node(t, n);
		}
		else {				/* (name (fn (x y))) */
			n = make_constructor(t);
			n = node(n, NIL);
			n = node(car(t), n);
		}
		n = node(S_define, n);
		car(a) = n;
		if (cdr(p) != NIL) {
			set(cdr(a), node(NIL, NIL));
			a = cdr(a);
		}
	}
	type = cadr(x);			/* (define T '(T cons ...)) */
	type = node(type, cddr(x));
	type = node(type, NIL);
	type = node(S_quote, type);
	type = node(type, NIL);
	type = node(cadr(x), type);
	type = node(S_define, type);
	defs = unsave(1);		/* (begin type-def cons-def ...) */
	defs = node(type, defs);
	defs = node(S_begin, defs);
	*pc = 1;
	return defs;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0xed11(%rip), %rdx      # 0x1c5c0
movq (%rdx,%rdi,8), %rax
testq %rax, %rax
js 0xd8c5
movq 0xed21(%rip), %rcx      # 0x1c5e0
testb $0x19, (%rcx,%rax)
je 0xd8e6
leaq 0x72fd(%rip), %rdi      # 0x14bc9
movq %r14, %rsi
callq 0x33e4
pushq $-0x5
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rdx,%rax,8), %rdx
testq %rdx, %rdx
js 0xd8c5
testb $0x19, (%rcx,%rdx)
jne 0xd8c5
movq %rsi, %rbx
movq 0xe871(%rip), %rdx      # 0x1c170
movq (%rdx,%rax,8), %rsi
testq %rsi, %rsi
js 0xda32
testb $0x10, (%rcx,%rsi)
je 0xda32
cmpq $-0x22, (%rdx,%rsi,8)
jne 0xda32
pushq $-0x1
popq %rdi
movq %rdi, %rsi
xorl %edx, %edx
callq 0x3613
movq %rax, %r12
movq 0xe7f0(%rip), %rsi      # 0x1c128
movq %rax, %rdi
xorl %edx, %edx
callq 0x3613
movq %rax, 0xe7df(%rip)      # 0x1c128
movq 0xec70(%rip), %rcx      # 0x1c5c0
movq (%rcx,%r14,8), %rax
leaq (%rcx,%rax,8), %rax
movq (%rax), %r15
movq 0xe80e(%rip), %rax      # 0x1c170
cmpq $-0x1, %r15
je 0xda3e
movq (%rax,%r15,8), %r13
testq %r13, %r13
js 0xd9ba
movq 0xec64(%rip), %rcx      # 0x1c5e0
testb $0x10, (%rcx,%r13)
je 0xd9ba
cmpq $-0x22, (%rax,%r13,8)
jne 0xd9ba
movq %r13, %rdi
pushq $-0x1
popq %rsi
xorl %edx, %edx
callq 0x3613
movq 0xed0a(%rip), %rdi      # 0x1c6a8
movq %rax, %rsi
xorl %edx, %edx
callq 0x3613
movq %rax, %rdi
pushq $-0x1
popq %rsi
xorl %edx, %edx
callq 0x3613
movq %r13, %rdi
jmp 0xd9da
movq %r13, %rdi
callq 0xd4e9
movq %rax, %rdi
pushq $-0x1
popq %rsi
xorl %edx, %edx
callq 0x3613
movq 0xe79a(%rip), %rcx      # 0x1c170
movq (%rcx,%r13,8), %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x3613
movq 0xed75(%rip), %rdi      # 0x1c760
movq %rax, %rsi
xorl %edx, %edx
callq 0x3613
movq 0xe774(%rip), %rcx      # 0x1c170
movq %rax, (%rcx,%r12,8)
movq 0xebb9(%rip), %rcx      # 0x1c5c0
cmpq $-0x1, (%rcx,%r15,8)
je 0xda29
pushq $-0x1
popq %rdi
movq %rdi, %rsi
xorl %edx, %edx
callq 0x3613
movq 0xeb9e(%rip), %rcx      # 0x1c5c0
movq %rax, (%rcx,%r12,8)
movq %rax, %r12
leaq (%rcx,%r15,8), %rax
jmp 0xd958
leaq 0x71aa(%rip), %rdi      # 0x14be3
jmp 0xd8cf
movq (%rcx,%r14,8), %rdx
movq (%rax,%rdx,8), %rdi
movq (%rcx,%rdx,8), %rsi
xorl %edx, %edx
callq 0x3613
pushq $-0x1
popq %r15
movq %rax, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x3613
movq 0xec3f(%rip), %rdi      # 0x1c6a8
movq %rax, %rsi
xorl %edx, %edx
callq 0x3613
movq %rax, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x3613
movq 0xe6e9(%rip), %rcx      # 0x1c170
movq 0xeb32(%rip), %rdx      # 0x1c5c0
movq (%rdx,%r14,8), %rdx
movq (%rcx,%rdx,8), %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x3613
movq 0xecb9(%rip), %rdi      # 0x1c760
movq %rax, %rsi
xorl %edx, %edx
callq 0x3613
movq %rax, %r14
pushq $0x1
popq %rdi
callq 0x3775
movq %r14, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x3613
movq 0xec88(%rip), %rdi      # 0x1c758
movq %rax, %rsi
xorl %edx, %edx
callq 0x3613
movl $0x1, (%rbx)
jmp 0xd8d7