// File: /workspace/github_c_makefile_star2_O2/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
pushq $-0x1
popq %r14
movq %r14, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x3613
movq %rax, %r15
movq 0x11c79(%rip), %rsi     # 0x1c128
movq %rax, %rdi
xorl %edx, %edx
callq 0x3613
movq %rax, 0x11c68(%rip)     # 0x1c128
movq %r14, %rdi
xorl %r14d, %r14d
movq %rax, %rsi
xorl %edx, %edx
callq 0x3613
movq %rax, 0x11c51(%rip)     # 0x1c128
callq 0xa43e
movq %rax, %r13
movq %r14, -0x30(%rbp)
incq %r14
movl 0x121e4(%rip), %eax     # 0x1c6d0
testl %ebx, %ebx
je 0xa557
cmpl $0xffffff1d, %eax       # imm = 0xFFFFFF1D
je 0xa557
cmpl $0xfffffed1, %eax       # imm = 0xFFFFFED1
jne 0xa512
movq 0x11c53(%rip), %rcx     # 0x1c158
cmpq 0x121ec(%rip), %rcx     # 0x1c6f8
je 0xa5fa
cmpl $0x0, 0x1209b(%rip)     # 0x1c5b4
jne 0xa5ef
movq 0x11c4a(%rip), %rax     # 0x1c170
movq 0x11bfb(%rip), %rcx     # 0x1c128
movq (%rax,%rcx,8), %rsi
movq %r13, %rdi
xorl %edx, %edx
callq 0x3613
movq 0x11c2e(%rip), %rcx     # 0x1c170
movq 0x11bdf(%rip), %rdx     # 0x1c128
movq %rax, (%rcx,%rdx,8)
callq 0xa43e
movq %rax, %r13
jmp 0xa4e6
cmpl $0xffffff1d, %eax       # imm = 0xFFFFFF1D
jne 0xa5ef
movq 0x11bbf(%rip), %rsi     # 0x1c128
movq %r13, %rdi
xorl %edx, %edx
callq 0x3613
movq %rax, 0x11bae(%rip)     # 0x1c128
callq 0x8d74
movl %eax, 0x1214b(%rip)     # 0x1c6d0
movl $0xffffff23, %edi       # imm = 0xFFFFFF23
xorl %esi, %esi
callq 0xa795
movq %rax, %r12
testq %r13, %r13
js 0xa5c4
movq 0x12040(%rip), %rax     # 0x1c5e0
testb $0x19, (%rax,%r13)
jne 0xa5c4
movq 0x11bc2(%rip), %rax     # 0x1c170
cmpq $-0x9, (%rax,%r13,8)
jne 0xa5c4
leaq 0xa1e6(%rip), %rdi      # 0x147a2
pushq $-0x8
popq %rsi
callq 0x33e4
pushq $0x1
popq %rdi
callq 0x3775
movq %rax, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x3613
pushq $-0x9
popq %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x3613
movq %rax, %r13
movl 0x120e1(%rip), %eax     # 0x1c6d0
cmpl $0xfffffed1, %eax       # imm = 0xFFFFFED1
jne 0xa69e
movq 0x11b57(%rip), %rax     # 0x1c158
cmpq 0x120f0(%rip), %rax     # 0x1c6f8
jne 0xa69e
movq 0x11b13(%rip), %rsi     # 0x1c128
movq %r13, %rdi
xorl %edx, %edx
callq 0x3613
movq %rax, 0x11b02(%rip)     # 0x1c128
callq 0x8d74
movl %eax, 0x1209f(%rip)     # 0x1c6d0
callq 0x95f5
movq %rax, %rdi
pushq $-0x1
popq %r13
movq %r13, %rsi
xorl %edx, %edx
callq 0x3613
movq %rax, %r12
pushq $0x1
popq %rdi
callq 0x3775
movq %rax, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x3613
movq 0x11b0a(%rip), %rcx     # 0x1c170
movq %rax, (%rcx,%r15,8)
cmpl $-0x66, 0x1205f(%rip)   # 0x1c6d0
jne 0xa6af
callq 0x8d74
movl %eax, 0x12052(%rip)     # 0x1c6d0
movq %r13, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x3613
movq 0x11f2e(%rip), %rcx     # 0x1c5c0
movq %rax, (%rcx,%r15,8)
movq %rax, %r15
jmp 0xa4d7
pushq $0x2
popq %rdi
callq 0x3775
leaq 0xa11b(%rip), %rdi      # 0x147c8
jmp 0xa6e6
pushq $0x1
popq %r15
movl %r15d, %edi
callq 0x3775
movq %rax, %rbx
cmpq $-0x1, %rax
setne %al
cmpq $0x0, -0x30(%rbp)
setne %r12b
andb %al, %r12b
movl %r15d, %edi
callq 0x3775
cmpb $0x1, %r12b
jne 0xa704
leaq 0xa0f7(%rip), %rdi      # 0x147dd
pushq $-0x8
popq %rsi
callq 0x33e4
pushq $-0x5
popq %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, 0x11a02(%rip)     # 0x1c110
movq 0x11a13(%rip), %rsi     # 0x1c128
movq %rbx, %rdi
xorl %edx, %edx
callq 0x3613
movq %rax, 0x11a02(%rip)     # 0x1c128
orq $-0x1, 0x119e2(%rip)    # 0x1c110
pushq $-0x1
popq %r15
cmpq $-0x1, %rbx
je 0xa788
movq 0x11fc9(%rip), %rdi     # 0x1c708
movq %r14, %rsi
xorl %edx, %edx
callq 0x3613
movq %rax, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x3613
movq 0x11a13(%rip), %rcx     # 0x1c170
movq (%rcx,%rbx,8), %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x3613
movq %rax, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x3613
movq %rax, %r14
movq 0x11e3e(%rip), %rax     # 0x1c5c0
movq (%rax,%rbx,8), %rbx
jmp 0xa732
pushq $0x1
popq %rdi
callq 0x3775
jmp 0xa6f2