// File: /workspace/github_c_makefile_star2_O3/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 0x12ddf(%rip), %rsi     # 0x1e128
movq %rax, %rdi
xorl %edx, %edx
callq 0x36e8
movq %rax, 0x12dce(%rip)     # 0x1e128
movq $-0x1, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x36e8
movq %rax, 0x12db6(%rip)     # 0x1e128
testl %ebx, %ebx
setne %r13b
callq 0xb2cd
movq %rax, %r12
movl 0x1334a(%rip), %eax     # 0x1e6d0
cmpl $0xffffff1d, %eax       # imm = 0xFFFFFF1D
setne %cl
andb %r13b, %cl
cmpb $0x1, %cl
jne 0xb403
cmpl $0xfffffed1, %eax       # imm = 0xFFFFFED1
jne 0xb3b1
movq 0x12db4(%rip), %rcx     # 0x1e158
cmpq 0x1334d(%rip), %rcx     # 0x1e6f8
je 0xb4b0
cmpl $0x0, 0x131fc(%rip)     # 0x1e5b4
jne 0xb4a5
movq 0x12dab(%rip), %rax     # 0x1e170
movq 0x12d5c(%rip), %rcx     # 0x1e128
movq (%rax,%rcx,8), %rsi
movq %r12, %rdi
xorl %edx, %edx
callq 0x36e8
movq 0x12d8f(%rip), %rcx     # 0x1e170
movq 0x12d40(%rip), %rdx     # 0x1e128
movq %rax, (%rcx,%rdx,8)
callq 0xb2cd
movq %rax, %r12
movl 0x132d6(%rip), %eax     # 0x1e6d0
cmpl $0xffffff1d, %eax       # imm = 0xFFFFFF1D
jne 0xb396
jmp 0xb40e
cmpl $0xffffff1d, %eax       # imm = 0xFFFFFF1D
jne 0xb4a5
movq 0x12d13(%rip), %rsi     # 0x1e128
movq %r12, %rdi
xorl %edx, %edx
callq 0x36e8
movq %rax, 0x12d02(%rip)     # 0x1e128
callq 0x9ac4
movl %eax, 0x1329f(%rip)     # 0x1e6d0
movl $0xffffff23, %edi       # imm = 0xFFFFFF23
xorl %esi, %esi
callq 0xb668
movq %rax, %r13
testq %r12, %r12
js 0xb474
movq 0x13194(%rip), %rax     # 0x1e5e0
testb $0x19, (%rax,%r12)
jne 0xb474
movq 0x12d16(%rip), %rax     # 0x1e170
cmpq $-0x9, (%rax,%r12,8)
jne 0xb474
leaq 0xb33a(%rip), %rdi      # 0x167a2
movq $-0x8, %rsi
callq 0x33eb
movl $0x1, %edi
callq 0x384f
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
movl 0x1322b(%rip), %eax     # 0x1e6d0
cmpl $0xfffffed1, %eax       # imm = 0xFFFFFED1
jne 0xb561
movq 0x12ca1(%rip), %rax     # 0x1e158
cmpq 0x1323a(%rip), %rax     # 0x1e6f8
jne 0xb561
movq 0x12c5d(%rip), %rsi     # 0x1e128
movq %r12, %rdi
xorl %edx, %edx
callq 0x36e8
movq %rax, 0x12c4c(%rip)     # 0x1e128
callq 0x9ac4
movl %eax, 0x131e9(%rip)     # 0x1e6d0
callq 0xa3ad
movq %rax, %rdi
movq $-0x1, %rsi
xorl %edx, %edx
callq 0x36e8
movq %rax, %r12
movl $0x1, %edi
callq 0x384f
movq %rax, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x36e8
movq 0x12c52(%rip), %rcx     # 0x1e170
movq %rax, (%rcx,%r14,8)
cmpl $-0x66, 0x131a7(%rip)   # 0x1e6d0
jne 0xb574
incq %r15
callq 0x9ac4
movl %eax, 0x13197(%rip)     # 0x1e6d0
movq $-0x1, %rdi
movq $-0x1, %rsi
xorl %edx, %edx
callq 0x36e8
movq 0x1306b(%rip), %rcx     # 0x1e5c0
movq %rax, (%rcx,%r14,8)
movq %rax, %r14
jmp 0xb372
movl $0x2, %edi
callq 0x384f
leaq 0xb256(%rip), %rdi      # 0x167c8
jmp 0xb5a9
movl $0x1, %edi
callq 0x384f
movq %rax, %rbx
cmpq $-0x1, %rax
setne %al
testq %r15, %r15
setne %r15b
andb %al, %r15b
movl $0x1, %edi
callq 0x384f
cmpb $0x1, %r15b
jne 0xb5ce
leaq 0xb234(%rip), %rdi      # 0x167dd
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
movq %rax, %r14
movq %rax, 0x12b38(%rip)     # 0x1e110
movq 0x12b49(%rip), %rsi     # 0x1e128
movq %rbx, %rdi
xorl %edx, %edx
callq 0x36e8
movq %rax, 0x12b38(%rip)     # 0x1e128
movq $-0x1, 0x12b15(%rip) # 0x1e110
cmpq $-0x1, %rbx
je 0xb659
movq 0x13100(%rip), %rdi     # 0x1e708
movq %r14, %rsi
xorl %edx, %edx
callq 0x36e8
movq %rax, %rdi
movq $-0x1, %rsi
xorl %edx, %edx
callq 0x36e8
movq 0x12b46(%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 0x12f6d(%rip), %rax     # 0x1e5c0
movq (%rax,%rbx,8), %rbx
jmp 0xb5fb
movl $0x1, %edi
callq 0x384f
jmp 0xb5bc