// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/common/ir.c
// Function: subtilis_ir_match
void subtilis_ir_match(subtilis_ir_section_t *s, subtilis_ir_rule_t *rules,
		       size_t rule_count, void *user_data,
		       subtilis_error_t *err)
{
	size_t pc;
	size_t i;
	size_t j;
	subtilis_ir_match_state_t state;
	subtilis_ir_op_t *op;

	if (s->in_error_handler) {
		subtilis_error_set_assertion_failed(err);
		return;
	}

	for (pc = 0; pc < s->len;) {
		op = s->ops[pc];
		if ((op->type == SUBTILIS_OP_INSTR) &&
		    (op->op.instr.type == SUBTILIS_OP_INSTR_NOP)) {
			pc++;
			continue;
		}
		for (i = 0; i < rule_count; i++) {
			state.regs_count = 0;
			state.fregs_count = 0;
			state.labels_count = 0;
			for (j = 0;
			     j < rules[i].matches_count && pc + j < s->len;
			     j++) {
				op = s->ops[pc + j];
				if (!prv_match_op(op, &rules[i].matches[j],
						  &state, err))
					break;
			}
			if (err->type != SUBTILIS_ERROR_OK)
				return;
			if (j == rules[i].matches_count) {
				rules[i].action(s, pc, user_data, err);
				if (err->type != SUBTILIS_ERROR_OK)
					return;
				pc += j;
				break;
			}
		}
		if (i == rule_count) {
			subtilis_error_set_assertion_failed(err);
			return;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x358, %rsp            # imm = 0x358
movq %r8, (%rsp)
movq %rcx, 0x28(%rsp)
movq %rdx, 0x18(%rsp)
movq %rsi, 0x30(%rsp)
movl $0x6d1, %ecx            # imm = 0x6D1
cmpb $0x0, 0x60(%rdi)
je 0x2c195
leaq 0x41c28(%rip), %rdx     # 0x6dda0
pushq $0xf
popq %rsi
movq (%rsp), %rdi
addq $0x358, %rsp            # imm = 0x358
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1429e
xorl %r10d, %r10d
movq %rdi, 0x8(%rsp)
cmpq 0x30(%rdi), %r10
jae 0x2c4ec
movq 0x48(%rdi), %rax
movq (%rax,%r10,8), %rax
cmpl $0x0, (%rax)
jne 0x2c1bf
cmpl $0x54, 0x8(%rax)
jne 0x2c1bf
incq %r10
jmp 0x2c19d
xorl %eax, %eax
movq %r10, 0x10(%rsp)
movl $0x6f3, %ecx            # imm = 0x6F3
cmpq 0x18(%rsp), %rax
je 0x2c171
movq %rax, 0x20(%rsp)
imulq $0x150, %rax, %r12      # imm = 0x150
addq 0x30(%rsp), %r12
leaq 0x340(%rsp), %rax
xorpd %xmm0, %xmm0
movupd %xmm0, (%rax)
andq $0x0, 0x10(%rax)
xorl %r14d, %r14d
cmpq 0x140(%r12), %r14
jae 0x2c489
leaq (%r14,%r10), %rax
cmpq 0x30(%rdi), %rax
jae 0x2c489
movq 0x48(%rdi), %rcx
movq (%rcx,%rax,8), %rbx
movq %r14, %r15
shlq $0x6, %r15
movl (%rbx), %eax
cmpl (%r12,%r15), %eax
jne 0x2c489
leal -0x2(%rax), %ecx
cmpl $0x6, %ecx
jb 0x2c44a
addq %r12, %r15
cmpl $0x1, %eax
je 0x2c426
cmpl $0x8, %eax
je 0x2c44a
movl 0x8(%rbx), %eax
cmpl 0x8(%r15), %eax
jne 0x2c489
shlq $0x4, %rax
leaq 0x709a5(%rip), %rcx     # 0x9cc10
movl 0x8(%rax,%rcx), %eax
imulq $0x18, %rax, %rax
leaq 0x418d6(%rip), %rcx     # 0x6db50
leaq (%rcx,%rax), %r11
movq (%rax,%rcx), %r13
xorl %ebp, %ebp
movq %r14, 0x38(%rsp)
cmpq %r13, %rbp
je 0x2c44a
movl 0x30(%r15,%rbp,4), %eax
testl %eax, %eax
je 0x2c41e
cmpl $0x1, %eax
jne 0x2c2db
movl 0x8(%r11,%rbp,4), %eax
cmpl $0x2, %eax
jb 0x2c32a
je 0x2c3ba
cmpl $0x3, %eax
jne 0x2c459
movsd 0x10(%r15,%rbp,8), %xmm0
ucomisd 0x10(%rbx,%rbp,8), %xmm0
jne 0x2c489
jnp 0x2c41e
jmp 0x2c489
movl 0x8(%r11,%rbp,4), %eax
cmpl $0x4, %eax
je 0x2c36e
cmpl $0x1, %eax
je 0x2c33f
testl %eax, %eax
jne 0x2c452
movq 0x10(%rbx,%rbp,8), %rax
movq 0x10(%r15,%rbp,8), %rdx
movq 0x340(%rsp), %rcx
movq %rcx, %r8
leaq 0x48(%rsp), %rsi
subq $0x1, %r8
jb 0x2c3f5
cmpq %rdx, -0x8(%rsi)
je 0x2c3b0
addq $0x10, %rsi
jmp 0x2c310
movq 0x10(%r15,%rbp,8), %rax
cmpq 0x10(%rbx,%rbp,8), %rax
je 0x2c41e
jmp 0x2c489
movq 0x10(%rbx,%rbp,8), %rax
movq 0x10(%r15,%rbp,8), %rdx
movq 0x348(%rsp), %rcx
movq %rcx, %r8
leaq 0x148(%rsp), %rsi
subq $0x1, %r8
jb 0x2c3ca
cmpq %rdx, -0x8(%rsi)
je 0x2c3b0
addq $0x10, %rsi
jmp 0x2c35c
movq 0x10(%rbx,%rbp,8), %rsi
movq 0x10(%r15,%rbp,8), %rdx
leaq 0x40(%rsp), %rdi
movq (%rsp), %rcx
movq %r13, %r14
movq %r12, %r13
movq %r11, %r12
callq 0x2c5ad
movq %r12, %r11
movq %r13, %r12
movq %r14, %r13
movq 0x38(%rsp), %r14
movq 0x10(%rsp), %r10
movq 0x8(%rsp), %rdi
testb %al, %al
jne 0x2c41e
jmp 0x2c489
cmpq %rax, (%rsi)
je 0x2c41e
jmp 0x2c489
movl 0x10(%r15,%rbp,8), %eax
cmpl 0x10(%rbx,%rbp,8), %eax
je 0x2c41e
jmp 0x2c489
cmpq $0x10, %rcx
je 0x2c460
movq %rcx, %r8
shlq $0x4, %r8
leaq 0x140(%rsp), %r9
leaq (%r9,%r8), %rsi
movq %rdx, (%r9,%r8)
leaq 0x348(%rsp), %rdx
jmp 0x2c414
cmpq $0x10, %rcx
je 0x2c467
movq %rcx, %rsi
shlq $0x4, %rsi
addq %rsp, %rsi
addq $0x40, %rsi
movq %rdx, (%rsi)
leaq 0x340(%rsp), %rdx
movq %rax, 0x8(%rsi)
incq %rcx
movq %rcx, (%rdx)
incq %rbp
jmp 0x2c289
movq 0x8(%rbx), %rsi
movq 0x8(%r15), %rdx
leaq 0x40(%rsp), %rdi
movq (%rsp), %rcx
callq 0x2c5ad
movq 0x10(%rsp), %r10
movq 0x8(%rsp), %rdi
testb %al, %al
je 0x2c489
incq %r14
jmp 0x2c1fb
movl $0x6bd, %ecx            # imm = 0x6BD
jmp 0x2c46c
movl $0x6a4, %ecx            # imm = 0x6A4
jmp 0x2c46c
movl $0x667, %ecx            # imm = 0x667
jmp 0x2c46c
movl $0x64e, %ecx            # imm = 0x64E
movq (%rsp), %rdi
pushq $0xf
popq %rsi
leaq 0x41926(%rip), %rdx     # 0x6dda0
callq 0x1429e
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %r10
movq (%rsp), %rax
cmpl $0x0, (%rax)
jne 0x2c4ec
cmpq 0x140(%r12), %r14
je 0x2c4a9
movq 0x20(%rsp), %rax
incq %rax
jmp 0x2c1c6
movq %r10, %rsi
movq 0x28(%rsp), %rdx
movq (%rsp), %rbx
movq %rbx, %rcx
callq *0x148(%r12)
movq 0x10(%rsp), %r10
movq 0x8(%rsp), %rdi
cmpl $0x0, (%rbx)
jne 0x2c4ec
addq %r14, %r10
movq 0x20(%rsp), %rax
cmpq 0x18(%rsp), %rax
movl $0x6f3, %ecx            # imm = 0x6F3
jne 0x2c19d
jmp 0x2c171
addq $0x358, %rsp            # imm = 0x358
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq