// File: /workspace/github_c_makefile_star2_O1/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 %rcx, %rax
movq %rdx, 0x8(%rsp)
movq %rsi, 0x30(%rsp)
movl $0x6d1, %ecx            # imm = 0x6D1
cmpb $0x0, 0x60(%rdi)
je 0x2db78
leaq 0x46276(%rip), %rdx     # 0x73dd0
movq %r8, %rdi
movl $0xf, %esi
addq $0x358, %rsp            # imm = 0x358
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x145f4
movq %rax, 0x28(%rsp)
movq %r8, (%rsp)
cmpq $0x0, 0x30(%rdi)
je 0x2df56
xorl %esi, %esi
movq %rdi, 0x10(%rsp)
movq 0x48(%rdi), %rax
movq (%rax,%rsi,8), %rax
cmpl $0x0, (%rax)
jne 0x2dbae
cmpl $0x54, 0x8(%rax)
jne 0x2dbae
incq %rsi
jmp 0x2df4c
cmpq $0x0, 0x8(%rsp)
je 0x2df10
xorl %eax, %eax
movq %rsi, 0x18(%rsp)
movq %rax, 0x20(%rsp)
imulq $0x150, %rax, %rax      # imm = 0x150
movq 0x30(%rsp), %rcx
leaq (%rcx,%rax), %r14
leaq 0x340(%rsp), %rdx
xorpd %xmm0, %xmm0
movupd %xmm0, (%rdx)
movq $0x0, 0x10(%rdx)
cmpq $0x0, 0x140(%rcx,%rax)
je 0x2dea8
xorl %ebp, %ebp
leaq (%rsi,%rbp), %rax
cmpq 0x30(%rdi), %rax
jae 0x2deaa
movq 0x48(%rdi), %rcx
movq (%rcx,%rax,8), %rbx
movq %rbp, %r12
shlq $0x6, %r12
movl (%rbx), %eax
cmpl (%r14,%r12), %eax
jne 0x2deaa
leal -0x2(%rax), %ecx
cmpl $0x6, %ecx
jb 0x2de96
cmpl $0x8, %eax
je 0x2de96
addq %r14, %r12
cmpl $0x1, %eax
jne 0x2dc73
movq 0x8(%rbx), %rsi
movq 0x8(%r12), %rdx
leaq 0x40(%rsp), %rdi
movq (%rsp), %rcx
callq 0x2e037
movq 0x18(%rsp), %rsi
movq 0x10(%rsp), %rdi
testb %al, %al
jne 0x2de96
jmp 0x2deaa
movl 0x8(%r12), %eax
cmpl %eax, 0x8(%rbx)
jne 0x2deaa
shlq $0x4, %rax
leaq 0x6ef84(%rip), %rcx     # 0x9cc10
movl 0x8(%rax,%rcx), %eax
leaq (%rax,%rax,2), %rax
leaq 0x45ee5(%rip), %rcx     # 0x73b80
movq (%rcx,%rax,8), %r15
testq %r15, %r15
je 0x2de96
leaq 0x45ed1(%rip), %rcx     # 0x73b80
leaq (%rcx,%rax,8), %r11
xorl %r13d, %r13d
movq %r15, 0x38(%rsp)
movl 0x30(%r12,%r13,4), %eax
testl %eax, %eax
je 0x2de8a
cmpl $0x1, %eax
jne 0x2dd09
movl 0x8(%r11,%r13,4), %eax
cmpl $0x2, %eax
jb 0x2dd5f
je 0x2dde7
cmpl $0x3, %eax
jne 0x2dedc
movsd 0x10(%r12,%r13,8), %xmm0
ucomisd 0x10(%rbx,%r13,8), %xmm0
jne 0x2deaa
jnp 0x2de8a
jmp 0x2deaa
movl 0x8(%r11,%r13,4), %eax
cmpl $0x4, %eax
je 0x2dda7
cmpl $0x1, %eax
je 0x2dd74
testl %eax, %eax
jne 0x2ded5
movq 0x10(%r12,%r13,8), %rdx
movq 0x340(%rsp), %rax
testq %rax, %rax
je 0x2de46
leaq 0x40(%rsp), %rcx
xorl %r8d, %r8d
cmpq %rdx, (%rcx)
je 0x2de49
incq %r8
addq $0x10, %rcx
cmpq %r8, %rax
jne 0x2dd42
movq %rax, %r8
jmp 0x2de49
movq 0x10(%r12,%r13,8), %rax
cmpq 0x10(%rbx,%r13,8), %rax
je 0x2de8a
jmp 0x2deaa
movq 0x10(%r12,%r13,8), %rdx
movq 0x348(%rsp), %rax
testq %rax, %rax
je 0x2ddfc
leaq 0x140(%rsp), %rcx
xorl %r10d, %r10d
cmpq %rdx, (%rcx)
je 0x2ddff
incq %r10
addq $0x10, %rcx
cmpq %r10, %rax
jne 0x2dd91
movq %rax, %r10
jmp 0x2ddff
movq 0x10(%rbx,%r13,8), %rsi
movq 0x10(%r12,%r13,8), %rdx
leaq 0x40(%rsp), %rdi
movq (%rsp), %rcx
movq %r14, %r15
movq %r11, %r14
callq 0x2e037
movq %r14, %r11
movq %r15, %r14
movq 0x38(%rsp), %r15
movq 0x18(%rsp), %rsi
movq 0x10(%rsp), %rdi
testb %al, %al
jne 0x2de8a
jmp 0x2deaa
movl 0x10(%r12,%r13,8), %eax
cmpl 0x10(%rbx,%r13,8), %eax
je 0x2de8a
jmp 0x2deaa
xorl %r10d, %r10d
movq 0x10(%rbx,%r13,8), %rcx
cmpq %rax, %r10
jne 0x2de31
cmpq $0x10, %r10
je 0x2deea
shlq $0x4, %r10
leaq 0x140(%rsp), %r9
leaq (%r9,%r10), %r8
movq %rdx, (%r9,%r10)
leaq 0x348(%rsp), %rdx
jmp 0x2de73
shlq $0x4, %r10
leaq 0x140(%rsp), %rax
cmpq %rcx, 0x8(%rax,%r10)
je 0x2de8a
jmp 0x2deaa
xorl %r8d, %r8d
movq 0x10(%rbx,%r13,8), %rcx
cmpq %rax, %r8
jne 0x2de7f
cmpq $0x10, %r8
je 0x2dee3
shlq $0x4, %r8
addq %rsp, %r8
addq $0x40, %r8
movq %rdx, (%r8)
leaq 0x340(%rsp), %rdx
movq %rcx, 0x8(%r8)
incq %rax
movq %rax, (%rdx)
jmp 0x2de8a
shlq $0x4, %r8
cmpq %rcx, 0x48(%rsp,%r8)
jne 0x2deaa
incq %r13
cmpq %r15, %r13
jne 0x2dcbb
incq %rbp
cmpq 0x140(%r14), %rbp
jb 0x2dbff
jmp 0x2deaa
xorl %ebp, %ebp
movq (%rsp), %rax
cmpl $0x0, (%rax)
jne 0x2df56
cmpq 0x140(%r14), %rbp
je 0x2df14
movq 0x20(%rsp), %rax
incq %rax
cmpq 0x8(%rsp), %rax
jne 0x2dbc1
jmp 0x2df40
movl $0x6bd, %ecx            # imm = 0x6BD
jmp 0x2deef
movl $0x6a4, %ecx            # imm = 0x6A4
jmp 0x2deef
movl $0x64e, %ecx            # imm = 0x64E
jmp 0x2deef
movl $0x667, %ecx            # imm = 0x667
movq (%rsp), %rdi
movl $0xf, %esi
leaq 0x45ed1(%rip), %rdx     # 0x73dd0
callq 0x145f4
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
jmp 0x2deaa
xorl %eax, %eax
jmp 0x2df45
movq 0x28(%rsp), %rdx
movq (%rsp), %rbx
movq %rbx, %rcx
callq *0x148(%r14)
movq 0x18(%rsp), %rsi
movq 0x10(%rsp), %rdi
cmpl $0x0, (%rbx)
jne 0x2df56
addq %rbp, %rsi
movq 0x20(%rsp), %rax
jmp 0x2df45
movq 0x8(%rsp), %rax
cmpq 0x8(%rsp), %rax
je 0x2df68
cmpq 0x30(%rdi), %rsi
jb 0x2db93
addq $0x358, %rsp            # imm = 0x358
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x6f3, %ecx            # imm = 0x6F3
movq (%rsp), %r8
jmp 0x2db53