// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x370, %rsp            # imm = 0x370
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x8(%rbp), %rax
testb $0x1, 0x60(%rax)
je 0x3a538
movq -0x28(%rbp), %rdi
movl $0xf, %esi
leaq 0x708ef(%rip), %rdx     # 0xaae18
movl $0x6d1, %ecx            # imm = 0x6D1
callq 0x158e0
jmp 0x3a71d
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x30(%rcx), %rax
jae 0x3a71d
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x360(%rbp)
movq -0x360(%rbp), %rax
cmpl $0x0, (%rax)
jne 0x3a590
movq -0x360(%rbp), %rax
cmpl $0x54, 0x8(%rax)
jne 0x3a590
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x3a540
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0x3a6f2
movq $0x0, -0x58(%rbp)
movq $0x0, -0x50(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rcx
movq -0x10(%rbp), %rdx
imulq $0x150, -0x38(%rbp), %rax # imm = 0x150
addq %rax, %rdx
xorl %eax, %eax
cmpq 0x140(%rdx), %rcx
movb %al, -0x361(%rbp)
jae 0x3a603
movq -0x30(%rbp), %rax
addq -0x40(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x30(%rcx), %rax
setb %al
movb %al, -0x361(%rbp)
movb -0x361(%rbp), %al
testb $0x1, %al
jne 0x3a60f
jmp 0x3a674
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movq -0x30(%rbp), %rcx
addq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x360(%rbp)
movq -0x360(%rbp), %rdi
movq -0x10(%rbp), %rsi
imulq $0x150, -0x38(%rbp), %rax # imm = 0x150
addq %rax, %rsi
movq -0x40(%rbp), %rax
shlq $0x6, %rax
addq %rax, %rsi
movq -0x28(%rbp), %rcx
leaq -0x358(%rbp), %rdx
callq 0x3a730
testb $0x1, %al
jne 0x3a661
jmp 0x3a674
jmp 0x3a663
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x3a5c6
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x3a682
jmp 0x3a71d
movq -0x40(%rbp), %rax
movq -0x10(%rbp), %rcx
imulq $0x150, -0x38(%rbp), %rdx # imm = 0x150
addq %rdx, %rcx
cmpq 0x140(%rcx), %rax
jne 0x3a6df
movq -0x10(%rbp), %rax
imulq $0x150, -0x38(%rbp), %rcx # imm = 0x150
addq %rcx, %rax
movq 0x148(%rax), %rax
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq *%rax
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x3a6d1
jmp 0x3a71d
movq -0x40(%rbp), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
jmp 0x3a6f2
jmp 0x3a6e1
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x3a598
movq -0x38(%rbp), %rax
cmpq -0x18(%rbp), %rax
jne 0x3a718
movq -0x28(%rbp), %rdi
movl $0xf, %esi
leaq 0x7070c(%rip), %rdx     # 0xaae18
movl $0x6f3, %ecx            # imm = 0x6F3
callq 0x158e0
jmp 0x3a71d
jmp 0x3a540
addq $0x370, %rsp            # imm = 0x370
popq %rbp
retq
nopw %cs:(%rax,%rax)