// File: /workspace/github_c_makefile_star2_O3/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 0x95dd
movq 0x135a3(%rip), %rcx     # 0x1e170
movq 0x13554(%rip), %rax     # 0x1e128
movq (%rcx,%rax,8), %rax
cmpq $-0x1, %rax
je 0xae98
movl -0x38(%rbp), %r14d
movl -0x34(%rbp), %esi
movq 0x139d0(%rip), %rdx     # 0x1e5c0
leaq -0x3c(%rbp), %r15
xorl $0x2, %esi
movl %esi, -0x30(%rbp)
movq (%rcx,%rax,8), %rax
movq (%rdx,%rax,8), %rdi
shlq $0x3, %rdi
addq 0x139db(%rip), %rdi     # 0x1e5e8
leaq -0x2c(%rbp), %rsi
movq %r15, %rdx
callq 0x95dd
testl %ebx, %ebx
jne 0xac3c
movl -0x2c(%rbp), %ecx
movl %r14d, %eax
xorl %ecx, %eax
orl -0x30(%rbp), %eax
sete %al
cmpl %ecx, %r14d
jg 0xae98
testb %al, %al
jne 0xae98
movq 0x1352d(%rip), %rax     # 0x1e170
movq 0x13976(%rip), %rcx     # 0x1e5c0
movq 0x134d7(%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 0x1397c(%rip), %rsi     # 0x1e5e8
movq (%rax,%rdx,8), %rdx
movq (%rax,%rdx,8), %rdx
movq (%rcx,%rdx,8), %rdi
cmpb $0x3a, (%rsi,%rdi,8)
jne 0xac9d
cmpq 0x13a0b(%rip), %rdx     # 0x1e690
jne 0xad73
movq (%rax,%r12,8), %rdi
movq (%rax,%r13,8), %rsi
movl $0x8, %edx
jmp 0xadb5
movq (%rcx,%r13,8), %rdi
cmpq $-0x1, %rdi
jne 0xacab
movq (%rax,%r13,8), %rdi
movq $-0x1, %rsi
xorl %edx, %edx
callq 0x36e8
movq 0x13900(%rip), %rcx     # 0x1e5c0
movq (%rcx,%r12,8), %rdi
cmpq $-0x1, %rdi
jne 0xacd5
movq 0x1349f(%rip), %rcx     # 0x1e170
movq (%rcx,%r12,8), %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x36e8
movq 0x13a0a(%rip), %rdi     # 0x1e6f0
movq %rax, %rsi
xorl %edx, %edx
callq 0x36e8
movq %rax, %rdi
movq $-0x1, %rsi
xorl %edx, %edx
callq 0x36e8
movq 0x13468(%rip), %rcx     # 0x1e170
movq 0x13419(%rip), %rdx     # 0x1e128
movq (%rcx,%rdx,8), %rdx
movq (%rcx,%rdx,8), %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x36e8
movq 0x13448(%rip), %rcx     # 0x1e170
movq 0x13891(%rip), %rdx     # 0x1e5c0
movq 0x133f2(%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 0xad67
movq 0x13886(%rip), %rsi     # 0x1e5e0
testb $0x10, (%rsi,%rdi)
je 0xad67
cmpq $-0x22, (%rcx,%rdi,8)
je 0xad6b
movq (%rcx,%rdx,8), %rdi
movq %rax, %rsi
jmp 0xae31
movq (%rax,%r13,8), %rdi
movq $-0x1, %rsi
xorl %edx, %edx
callq 0x36e8
movq 0x133e4(%rip), %rcx     # 0x1e170
movq (%rcx,%r12,8), %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x36e8
movq 0x133cf(%rip), %rcx     # 0x1e170
movq 0x13380(%rip), %rdx     # 0x1e128
movq (%rcx,%rdx,8), %rdx
movq (%rcx,%rdx,8), %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x36e8
movq 0x13367(%rip), %rsi     # 0x1e128
movq %rax, %rdi
xorl %edx, %edx
callq 0x36e8
movq %rax, 0x13356(%rip)     # 0x1e128
movq 0x137e7(%rip), %rax     # 0x1e5c0
movq (%rax,%r13,8), %rdi
movq (%rax,%r12,8), %r13
cmpq $-0x1, %r13
je 0xae1e
cmpq $-0x1, %rdi
je 0xae21
movq $-0x1, %rsi
xorl %edx, %edx
callq 0x36e8
movq %r12, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x36e8
movq 0x138d9(%rip), %rdi     # 0x1e6e8
movq %rax, %rsi
xorl %edx, %edx
callq 0x36e8
movq %rax, %r13
jmp 0xae21
movq %rdi, %r13
movl $0x1, %edi
callq 0x384f
movq %rax, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x36e8
movq 0x13781(%rip), %rdx     # 0x1e5c0
movq 0x1332a(%rip), %rcx     # 0x1e170
movq 0x132db(%rip), %rsi     # 0x1e128
movq (%rcx,%rsi,8), %rdi
movq (%rdx,%rdi,8), %rdi
movq %rdi, (%rcx,%rsi,8)
movq 0x132c8(%rip), %rsi     # 0x1e128
movq (%rdx,%rsi,8), %rsi
movq (%rcx,%rsi,8), %rdi
movq (%rdx,%rdi,8), %rdi
movq %rdi, (%rcx,%rsi,8)
movq 0x132b1(%rip), %rsi     # 0x1e128
movq (%rdx,%rsi,8), %rsi
movq (%rcx,%rsi,8), %rsi
movq %rax, (%rcx,%rsi,8)
movq 0x1329e(%rip), %rax     # 0x1e128
movq (%rcx,%rax,8), %rax
cmpq $-0x1, %rax
jne 0xabfa
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq