// File: /workspace/github_c_makefile_star2_O2/azhai[P]mlite/mlite.c
// Function: pat_commit
void pat_commit(char *s, int all) {
	int	tp = 0, ta = LEFT, sp = 0, sa;
	cell	n, a1, a2, p, op;

	find_binop(s, &tp, &ta);
	while (inf_ops() != NIL) {
		find_binop(symbol_name(inf_first_op()), &sp, &sa);
		if (!all && (tp > sp || (tp == sp && ta == RIGHT)))
			break;
		a2 = inf_first_arg();
		a1 = inf_second_arg();
		if (consname_p(inf_first_op())) {		/* x :id y */
			if (inf_first_op() == S_cons) {		/* [x :: y] */
				n = cons(pat(a1), pat(a2));
			}
			else {
				n = node(pat(a2), NIL);
				n = node(pat(a1), n);
				n = node(inf_first_op(), n);
			}
			save(n);
			op = opr(a2);
			if (opr(a1) != NIL) {
				if (op == NIL) {
					op = opr(a1);
				}
				else {
					op = node(op, NIL);
					op = node(a1, op);
					op = node(S_also, op);
				}
			}
			n = node(unsave(1), op);
		}
		else {
			a2 = opr(a2) == NIL? pat(a2): opr(a2);
			n = node(a2, NIL);	/* (op (tuple arg1 arg2)) */
			a1 = opr(a1) == NIL? pat(a1): opr(a1);
			n = node(a1, n);
			n = node(S_tuple, n);
			n = node(n, NIL);
			n = node(inf_first_op(), n);
			a1 = inf_second_arg();		/* add pattern */
			a2 = inf_first_arg();
			p = symbol_p(pat(a1))? pat(a1): pat(a2);
			n = node(p, n);
		}
		inf_ops() = inf_other_ops();	/* remove op */
		inf_args() = inf_other_args();	/* remove arg2 */
		inf_first_arg() = n;		/* replace arg1 */
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
leaq -0x3c(%rbp), %r15
andl $0x0, (%r15)
movl %esi, %ebx
leaq -0x38(%rbp), %r12
movl $0x1, (%r12)
leaq -0x2c(%rbp), %rax
andl $0x0, (%rax)
movq %r15, %rsi
movq %r12, %rdx
callq 0x88b3
movl (%r15), %r14d
movl (%r12), %eax
movq 0x12401(%rip), %rcx     # 0x1c170
xorl $0x2, %eax
movl %eax, -0x30(%rbp)
pushq $-0x1
popq %r12
movq 0x123a8(%rip), %rax     # 0x1c128
movq (%rcx,%rax,8), %rax
cmpq $-0x1, %rax
je 0xa010
movq 0x1282b(%rip), %rdx     # 0x1c5c0
movq (%rcx,%rax,8), %rax
movq (%rdx,%rax,8), %rdi
shlq $0x3, %rdi
addq 0x12840(%rip), %rdi     # 0x1c5e8
leaq -0x2c(%rbp), %rsi
leaq -0x34(%rbp), %rdx
callq 0x88b3
testl %ebx, %ebx
jne 0x9dd8
movl -0x2c(%rbp), %ecx
movl %r14d, %eax
xorl %ecx, %eax
orl -0x30(%rbp), %eax
sete %al
cmpl %ecx, %r14d
jg 0xa010
testb %al, %al
jne 0xa010
movq 0x12391(%rip), %rax     # 0x1c170
movq 0x127da(%rip), %rcx     # 0x1c5c0
movq 0x1233b(%rip), %rdx     # 0x1c128
movq (%rcx,%rdx,8), %rsi
movq (%rax,%rsi,8), %rsi
movq (%rax,%rsi,8), %r15
movq (%rcx,%rsi,8), %rsi
movq (%rax,%rsi,8), %r13
movq 0x127e0(%rip), %rsi     # 0x1c5e8
movq (%rax,%rdx,8), %rdx
movq (%rax,%rdx,8), %rdx
movq (%rcx,%rdx,8), %rdi
cmpb $0x3a, (%rsi,%rdi,8)
jne 0x9e37
cmpq 0x1286f(%rip), %rdx     # 0x1c690
jne 0x9f05
movq (%rax,%r13,8), %rdi
movq (%rax,%r15,8), %rsi
pushq $0x8
popq %rdx
jmp 0x9f43
movq (%rcx,%r15,8), %rdi
cmpq $-0x1, %rdi
jne 0x9e45
movq (%rax,%r15,8), %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x3613
movq 0x1276a(%rip), %rcx     # 0x1c5c0
movq (%rcx,%r13,8), %rdi
cmpq $-0x1, %rdi
jne 0x9e6b
movq 0x12309(%rip), %rcx     # 0x1c170
movq (%rcx,%r13,8), %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x3613
movq 0x12874(%rip), %rdi     # 0x1c6f0
movq %rax, %rsi
xorl %edx, %edx
callq 0x3613
movq %rax, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x3613
movq 0x122d6(%rip), %rcx     # 0x1c170
movq 0x12287(%rip), %rdx     # 0x1c128
movq (%rcx,%rdx,8), %rdx
movq (%rcx,%rdx,8), %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x3613
movq 0x122b6(%rip), %rcx     # 0x1c170
movq 0x126ff(%rip), %rdx     # 0x1c5c0
movq 0x12260(%rip), %rsi     # 0x1c128
movq (%rdx,%rsi,8), %rsi
movq (%rcx,%rsi,8), %rsi
movq (%rdx,%rsi,8), %rdx
movq (%rcx,%rdx,8), %rdi
movq (%rcx,%rsi,8), %rdx
movq (%rcx,%rdi,8), %rdi
testq %rdi, %rdi
js 0x9ef9
movq 0x126f4(%rip), %rsi     # 0x1c5e0
testb $0x10, (%rsi,%rdi)
je 0x9ef9
cmpq $-0x22, (%rcx,%rdi,8)
je 0x9efd
movq (%rcx,%rdx,8), %rdi
movq %rax, %rsi
jmp 0x9fb9
movq (%rax,%r15,8), %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x3613
movq 0x12256(%rip), %rcx     # 0x1c170
movq (%rcx,%r13,8), %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x3613
movq 0x12241(%rip), %rcx     # 0x1c170
movq 0x121f2(%rip), %rdx     # 0x1c128
movq (%rcx,%rdx,8), %rdx
movq (%rcx,%rdx,8), %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x3613
movq 0x121d9(%rip), %rsi     # 0x1c128
movq %rax, %rdi
xorl %edx, %edx
callq 0x3613
movq %rax, 0x121c8(%rip)     # 0x1c128
movq 0x12659(%rip), %rax     # 0x1c5c0
movq (%rax,%r15,8), %rdi
movq (%rax,%r13,8), %r15
cmpq $-0x1, %r15
je 0x9fa8
cmpq $-0x1, %rdi
je 0x9fab
movq %r12, %rsi
xorl %edx, %edx
callq 0x3613
movq %r13, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x3613
movq 0x1274f(%rip), %rdi     # 0x1c6e8
movq %rax, %rsi
xorl %edx, %edx
callq 0x3613
movq %rax, %r15
jmp 0x9fab
movq %rdi, %r15
pushq $0x1
popq %rdi
callq 0x3775
movq %rax, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x3613
movq 0x125f9(%rip), %rdx     # 0x1c5c0
movq 0x121a2(%rip), %rcx     # 0x1c170
movq 0x12153(%rip), %rsi     # 0x1c128
movq (%rcx,%rsi,8), %rdi
movq (%rdx,%rdi,8), %rdi
movq %rdi, (%rcx,%rsi,8)
movq 0x12140(%rip), %rsi     # 0x1c128
movq (%rdx,%rsi,8), %rsi
movq (%rcx,%rsi,8), %rdi
movq (%rdx,%rdi,8), %rdi
movq %rdi, (%rcx,%rsi,8)
movq 0x12129(%rip), %rsi     # 0x1c128
movq (%rdx,%rsi,8), %rdx
movq (%rcx,%rdx,8), %rdx
movq %rax, (%rcx,%rdx,8)
jmp 0x9d79
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq