// File: /workspace/github_c_makefile_star2_O1/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
movl %esi, %ebx
xorl %eax, %eax
leaq -0x38(%rbp), %rsi
movl %eax, (%rsi)
leaq -0x34(%rbp), %rdx
movl $0x1, (%rdx)
movl %eax, -0x2c(%rbp)
callq 0x96d4
movq 0x13447(%rip), %rax     # 0x1e170
movq 0x133f8(%rip), %rcx     # 0x1e128
movq (%rax,%rcx,8), %rcx
cmpq $-0x1, %rcx
je 0xaffb
movl -0x38(%rbp), %r14d
movl -0x34(%rbp), %edx
leaq -0x3c(%rbp), %r15
xorl $0x2, %edx
movl %edx, -0x30(%rbp)
movq 0x1386a(%rip), %rdx     # 0x1e5c0
movq (%rax,%rcx,8), %rax
movq (%rdx,%rax,8), %rdi
shlq $0x3, %rdi
addq 0x1387f(%rip), %rdi     # 0x1e5e8
leaq -0x2c(%rbp), %rsi
movq %r15, %rdx
callq 0x96d4
testl %ebx, %ebx
jne 0xad98
movl -0x2c(%rbp), %ecx
movl %r14d, %eax
xorl %ecx, %eax
orl -0x30(%rbp), %eax
sete %al
cmpl %ecx, %r14d
jg 0xaffb
testb %al, %al
jne 0xaffb
movq 0x133d1(%rip), %rax     # 0x1e170
movq 0x1381a(%rip), %rcx     # 0x1e5c0
movq 0x1337b(%rip), %rdx     # 0x1e128
movq (%rcx,%rdx,8), %rsi
movq (%rax,%rsi,8), %rsi
movq (%rax,%rsi,8), %r13
movq (%rcx,%rsi,8), %rsi
movq (%rax,%rsi,8), %r12
movq 0x13820(%rip), %rsi     # 0x1e5e8
movq (%rax,%rdx,8), %rdx
movq (%rax,%rdx,8), %rdx
movq (%rcx,%rdx,8), %rdi
cmpb $0x3a, (%rsi,%rdi,8)
jne 0xadf9
cmpq 0x138af(%rip), %rdx     # 0x1e690
jne 0xaecf
movq (%rax,%r12,8), %rdi
movq (%rax,%r13,8), %rsi
movl $0x8, %edx
jmp 0xaf11
movq (%rcx,%r13,8), %rdi
cmpq $-0x1, %rdi
jne 0xae07
movq (%rax,%r13,8), %rdi
movq $-0x1, %rsi
xorl %edx, %edx
callq 0x36e8
movq 0x137a4(%rip), %rcx     # 0x1e5c0
movq (%rcx,%r12,8), %rdi
cmpq $-0x1, %rdi
jne 0xae31
movq 0x13343(%rip), %rcx     # 0x1e170
movq (%rcx,%r12,8), %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x36e8
movq 0x138ae(%rip), %rdi     # 0x1e6f0
movq %rax, %rsi
xorl %edx, %edx
callq 0x36e8
movq %rax, %rdi
movq $-0x1, %rsi
xorl %edx, %edx
callq 0x36e8
movq 0x1330c(%rip), %rcx     # 0x1e170
movq 0x132bd(%rip), %rdx     # 0x1e128
movq (%rcx,%rdx,8), %rdx
movq (%rcx,%rdx,8), %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x36e8
movq 0x132ec(%rip), %rcx     # 0x1e170
movq 0x13735(%rip), %rdx     # 0x1e5c0
movq 0x13296(%rip), %rsi     # 0x1e128
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 0xaec3
movq 0x1372a(%rip), %rsi     # 0x1e5e0
testb $0x10, (%rsi,%rdi)
je 0xaec3
cmpq $-0x22, (%rcx,%rdi,8)
je 0xaec7
movq (%rcx,%rdx,8), %rdi
movq %rax, %rsi
jmp 0xaf8d
movq (%rax,%r13,8), %rdi
movq $-0x1, %rsi
xorl %edx, %edx
callq 0x36e8
movq 0x13288(%rip), %rcx     # 0x1e170
movq (%rcx,%r12,8), %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x36e8
movq 0x13273(%rip), %rcx     # 0x1e170
movq 0x13224(%rip), %rdx     # 0x1e128
movq (%rcx,%rdx,8), %rdx
movq (%rcx,%rdx,8), %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x36e8
movq 0x1320b(%rip), %rsi     # 0x1e128
movq %rax, %rdi
xorl %edx, %edx
callq 0x36e8
movq %rax, 0x131fa(%rip)     # 0x1e128
movq 0x1368b(%rip), %rax     # 0x1e5c0
movq (%rax,%r13,8), %rdi
movq (%rax,%r12,8), %r13
cmpq $-0x1, %r13
je 0xaf7a
cmpq $-0x1, %rdi
je 0xaf7d
movq $-0x1, %rsi
xorl %edx, %edx
callq 0x36e8
movq %r12, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x36e8
movq 0x1377d(%rip), %rdi     # 0x1e6e8
movq %rax, %rsi
xorl %edx, %edx
callq 0x36e8
movq %rax, %r13
jmp 0xaf7d
movq %rdi, %r13
movl $0x1, %edi
callq 0x3851
movq %rax, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x36e8
movq 0x13625(%rip), %rcx     # 0x1e5c0
movq 0x131ce(%rip), %rdx     # 0x1e170
movq 0x1317f(%rip), %rsi     # 0x1e128
movq (%rdx,%rsi,8), %rdi
movq (%rcx,%rdi,8), %rdi
movq %rdi, (%rdx,%rsi,8)
movq 0x1316c(%rip), %rsi     # 0x1e128
movq (%rcx,%rsi,8), %rsi
movq (%rdx,%rsi,8), %rdi
movq (%rcx,%rdi,8), %rdi
movq %rdi, (%rdx,%rsi,8)
movq 0x13155(%rip), %rsi     # 0x1e128
movq (%rcx,%rsi,8), %rcx
movq (%rdx,%rcx,8), %rcx
movq %rax, (%rdx,%rcx,8)
movq 0x1318a(%rip), %rax     # 0x1e170
movq 0x1313b(%rip), %rcx     # 0x1e128
movq (%rax,%rcx,8), %rcx
cmpq $-0x1, %rcx
jne 0xad4f
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq