// File: /workspace/github_c_makefile_star2_O1/azhai[P]mlite/mlite.c
// Function: match
cell match(int curry) {
	cell	p, x, n, m, new, curried, npat;

	m = node(NIL, NIL);
	save(m);
	curried = NIL;
	npat = 0;
	save(curried);
	for (;;) {
		p = pattern();
		npat++;
		while (	curry &&
			Token != TOK_WHERE &&
			!(Token == TOK_ID && Attr == S_equal) &&
			!Error_flag
		) {
			set(car(Stack), node(p, car(Stack)));
			p = pattern();
		}
		if (Token == TOK_WHERE) {
			save(p);
			Token = scan();
			x = logop(TOK_OR, 0);
			if (tuple_p(p) && car(p) == GUARD)
				error("implicit guard conflicts with `where'",
					NOEXPR);
			p = node(unsave(1), x);
			p = node(GUARD, p);
		}
		if (Token != TOK_ID || Attr != S_equal) {
			unsave(2);
			return error("missing '=' in match", NOEXPR);
		}
		save(p);
		Token = scan();
		x = expr();
		n = node(x, NIL);
		set(car(m), node(unsave(1), n));
		if (Token != TOK_PIPE)
			break;
		Token = scan();
		set(cdr(m), node(NIL, NIL));
		m = cdr(m);
	}
	curried = unsave(1);
	if (curried != NIL && npat > 1) {
		unsave(1);
		return error("currying cannot be combined with `|'", NOEXPR);
	}
	Tmp = n = unsave(1);
	save(curried);
	Tmp = NIL;
	while (curried != NIL) {
		n = node(S_fn, n);
		n = node(n, NIL);
		n = node(car(curried), n);
		n = node(n, NIL);
		curried = cdr(curried);
	}
	unsave(1);
	return n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edi, %ebx
xorl %r15d, %r15d
movq $-0x1, %rdi
movq $-0x1, %rsi
xorl %edx, %edx
callq 0x36e8
movq %rax, %r14
movq 0x12c7e(%rip), %rsi     # 0x1e128
movq %rax, %rdi
xorl %edx, %edx
callq 0x36e8
movq %rax, 0x12c6d(%rip)     # 0x1e128
movq $-0x1, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x36e8
movq %rax, 0x12c55(%rip)     # 0x1e128
testl %ebx, %ebx
setne %r13b
callq 0xb42e
movq %rax, %r12
movl 0x131e9(%rip), %eax     # 0x1e6d0
cmpl $0xffffff1d, %eax       # imm = 0xFFFFFF1D
setne %cl
andb %r13b, %cl
cmpb $0x1, %cl
jne 0xb55e
cmpl $0xfffffed1, %eax       # imm = 0xFFFFFED1
jne 0xb50e
movq 0x12c53(%rip), %rcx     # 0x1e158
cmpq 0x131ec(%rip), %rcx     # 0x1e6f8
je 0xb55e
cmpl $0x0, 0x1309f(%rip)     # 0x1e5b4
jne 0xb55e
movq 0x12c52(%rip), %rax     # 0x1e170
movq 0x12c03(%rip), %rcx     # 0x1e128
movq (%rax,%rcx,8), %rsi
movq %r12, %rdi
xorl %edx, %edx
callq 0x36e8
movq 0x12c36(%rip), %rcx     # 0x1e170
movq 0x12be7(%rip), %rdx     # 0x1e128
movq %rax, (%rcx,%rdx,8)
callq 0xb42e
movq %rax, %r12
movl 0x1317d(%rip), %eax     # 0x1e6d0
testl %ebx, %ebx
je 0xb55e
cmpl $0xffffff1d, %eax       # imm = 0xFFFFFF1D
jne 0xb4f7
cmpl $0xffffff1d, %eax       # imm = 0xFFFFFF1D
jne 0xb5fa
movq 0x12bb8(%rip), %rsi     # 0x1e128
movq %r12, %rdi
xorl %edx, %edx
callq 0x36e8
movq %rax, 0x12ba7(%rip)     # 0x1e128
callq 0x9c07
movl %eax, 0x13144(%rip)     # 0x1e6d0
movl $0xffffff23, %edi       # imm = 0xFFFFFF23
xorl %esi, %esi
callq 0xb7c2
movq %rax, %r13
testq %r12, %r12
js 0xb5cf
movq 0x13039(%rip), %rax     # 0x1e5e0
testb $0x19, (%rax,%r12)
jne 0xb5cf
movq 0x12bbb(%rip), %rax     # 0x1e170
cmpq $-0x9, (%rax,%r12,8)
jne 0xb5cf
leaq 0xb1fa(%rip), %rdi      # 0x167bd
movq $-0x8, %rsi
callq 0x33eb
movl $0x1, %edi
callq 0x3851
movq %rax, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x36e8
movq $-0x9, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x36e8
movq %rax, %r12
cmpl $0xfffffed1, 0x130cc(%rip) # imm = 0xFFFFFED1
jne 0xb6bb
movq 0x12b47(%rip), %rax     # 0x1e158
cmpq 0x130e0(%rip), %rax     # 0x1e6f8
jne 0xb6bb
movq 0x12b03(%rip), %rsi     # 0x1e128
movq %r12, %rdi
xorl %edx, %edx
callq 0x36e8
movq %rax, 0x12af2(%rip)     # 0x1e128
callq 0x9c07
movl %eax, 0x1308f(%rip)     # 0x1e6d0
callq 0xa4fd
movq %rax, %rdi
movq $-0x1, %rsi
xorl %edx, %edx
callq 0x36e8
movq %rax, %r12
movl $0x1, %edi
callq 0x3851
movq %rax, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x36e8
movq 0x12af8(%rip), %rcx     # 0x1e170
movq %rax, (%rcx,%r14,8)
cmpl $-0x66, 0x1304d(%rip)   # 0x1e6d0
jne 0xb6f1
incq %r15
callq 0x9c07
movl %eax, 0x1303d(%rip)     # 0x1e6d0
movq $-0x1, %rdi
movq $-0x1, %rsi
xorl %edx, %edx
callq 0x36e8
movq 0x12f11(%rip), %rcx     # 0x1e5c0
movq %rax, (%rcx,%r14,8)
movq %rax, %r14
jmp 0xb4d3
movl $0x2, %edi
callq 0x3851
leaq 0xb117(%rip), %rdi      # 0x167e3
movq $-0x8, %rsi
callq 0x33eb
movq $-0x5, %r14
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, %edi
callq 0x3851
movq %rax, %rbx
cmpq $-0x1, %rax
setne %al
testq %r15, %r15
setne %r15b
andb %al, %r15b
movl $0x1, %edi
callq 0x3851
cmpb $0x1, %r15b
jne 0xb728
leaq 0xb0d2(%rip), %rdi      # 0x167f8
jmp 0xb6cc
movq %rax, %r14
movq %rax, 0x129de(%rip)     # 0x1e110
movq 0x129ef(%rip), %rsi     # 0x1e128
movq %rbx, %rdi
xorl %edx, %edx
callq 0x36e8
movq %rax, 0x129de(%rip)     # 0x1e128
movq $-0x1, 0x129bb(%rip) # 0x1e110
cmpq $-0x1, %rbx
je 0xb7b3
movq 0x12fa6(%rip), %rdi     # 0x1e708
movq %r14, %rsi
xorl %edx, %edx
callq 0x36e8
movq %rax, %rdi
movq $-0x1, %rsi
xorl %edx, %edx
callq 0x36e8
movq 0x129ec(%rip), %rcx     # 0x1e170
movq (%rcx,%rbx,8), %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x36e8
movq %rax, %rdi
movq $-0x1, %rsi
xorl %edx, %edx
callq 0x36e8
movq %rax, %r14
movq 0x12e13(%rip), %rax     # 0x1e5c0
movq (%rax,%rbx,8), %rbx
jmp 0xb755
movl $0x1, %edi
callq 0x3851
jmp 0xb6df