// File: /workspace/github_c_makefile_star2_O3/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, 0x18(%rsp)
movq %rsi, 0x38(%rsp)
movl $0x6d1, %ecx            # imm = 0x6D1
cmpb $0x0, 0x60(%rdi)
jne 0x2dc58
movq %rax, 0x28(%rsp)
movq %r8, (%rsp)
movq 0x30(%rdi), %rax
testq %rax, %rax
je 0x2dc3d
xorl %r10d, %r10d
movq %rdi, 0x8(%rsp)
movq 0x48(%rdi), %rcx
movq (%rcx,%r10,8), %rcx
cmpl $0x0, (%rcx)
jne 0x2d89a
cmpl $0x54, 0x8(%rcx)
jne 0x2d89a
incq %r10
jmp 0x2dc34
cmpq $0x0, 0x18(%rsp)
je 0x2dbf8
xorl %eax, %eax
movq %r10, 0x10(%rsp)
movq %rax, 0x20(%rsp)
imulq $0x150, %rax, %rax      # imm = 0x150
movq 0x38(%rsp), %rcx
leaq (%rcx,%rax), %r15
leaq 0x340(%rsp), %rdx
xorpd %xmm0, %xmm0
movupd %xmm0, (%rdx)
movq $0x0, 0x10(%rdx)
cmpq $0x0, 0x140(%rcx,%rax)
je 0x2db8d
xorl %ebp, %ebp
leaq (%r10,%rbp), %rax
cmpq 0x30(%rdi), %rax
jae 0x2db8f
movq 0x48(%rdi), %rcx
movq (%rcx,%rax,8), %rbx
movq %rbp, %r12
shlq $0x6, %r12
movl (%rbx), %eax
cmpl (%r15,%r12), %eax
jne 0x2db8f
leal -0x2(%rax), %ecx
cmpl $0x6, %ecx
jb 0x2db7b
addq %r15, %r12
cmpl $0x1, %eax
je 0x2db56
cmpl $0x8, %eax
je 0x2db7b
movl 0x8(%rbx), %eax
cmpl 0x8(%r12), %eax
jne 0x2db8f
shlq $0x4, %rax
leaq 0x6f2c2(%rip), %rcx     # 0x9cc10
movl 0x8(%rax,%rcx), %eax
leaq (%rax,%rax,2), %rax
leaq 0x46243(%rip), %rcx     # 0x73ba0
movq (%rcx,%rax,8), %r14
testq %r14, %r14
je 0x2db7b
leaq 0x4622f(%rip), %rcx     # 0x73ba0
leaq (%rcx,%rax,8), %r11
xorl %r13d, %r13d
movq %r14, 0x30(%rsp)
movl 0x30(%r12,%r13,4), %eax
testl %eax, %eax
je 0x2db48
cmpl $0x1, %eax
jne 0x2d9cb
movl 0x8(%r11,%r13,4), %eax
cmpl $0x2, %eax
jb 0x2da22
je 0x2daab
cmpl $0x3, %eax
jne 0x2dbc4
movsd 0x10(%r12,%r13,8), %xmm0
ucomisd 0x10(%rbx,%r13,8), %xmm0
jne 0x2db8f
jnp 0x2db48
jmp 0x2db8f
movl 0x8(%r11,%r13,4), %eax
cmpl $0x4, %eax
je 0x2da6b
cmpl $0x1, %eax
je 0x2da37
testl %eax, %eax
jne 0x2dbbd
movq 0x10(%rbx,%r13,8), %rax
movq 0x10(%r12,%r13,8), %rdx
movq 0x340(%rsp), %rcx
testq %rcx, %rcx
je 0x2daf2
leaq 0x40(%rsp), %r8
xorl %esi, %esi
cmpq %rdx, (%r8)
je 0x2daf4
incq %rsi
addq $0x10, %r8
cmpq %rsi, %rcx
jne 0x2da08
jmp 0x2daf9
movq 0x10(%r12,%r13,8), %rax
cmpq 0x10(%rbx,%r13,8), %rax
je 0x2db48
jmp 0x2db8f
movq 0x10(%rbx,%r13,8), %rax
movq 0x10(%r12,%r13,8), %rdx
movq 0x348(%rsp), %rcx
testq %rcx, %rcx
je 0x2dac0
leaq 0x140(%rsp), %r8
xorl %esi, %esi
cmpq %rdx, (%r8)
je 0x2dac2
incq %rsi
addq $0x10, %r8
cmpq %rsi, %rcx
jne 0x2da58
jmp 0x2dac7
movq 0x10(%rbx,%r13,8), %rsi
movq 0x10(%r12,%r13,8), %rdx
leaq 0x40(%rsp), %rdi
movq (%rsp), %rcx
movq %r15, %r14
movq %r11, %r15
callq 0x2dd3a
movq %r15, %r11
movq %r14, %r15
movq 0x30(%rsp), %r14
movq 0x10(%rsp), %r10
movq 0x8(%rsp), %rdi
testb %al, %al
jne 0x2db48
jmp 0x2db8f
movl 0x10(%r12,%r13,8), %eax
cmpl 0x10(%rbx,%r13,8), %eax
je 0x2db48
jmp 0x2db8f
xorl %esi, %esi
cmpq %rcx, %rsi
jne 0x2db28
cmpq $0x10, %rcx
je 0x2dbcb
movq %rcx, %r8
shlq $0x4, %r8
leaq 0x140(%rsp), %r9
leaq (%r9,%r8), %rsi
movq %rdx, (%r9,%r8)
leaq 0x348(%rsp), %rdx
jmp 0x2db1c
xorl %esi, %esi
cmpq %rcx, %rsi
jne 0x2db3d
cmpq $0x10, %rcx
je 0x2dbd2
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)
jmp 0x2db48
shlq $0x4, %rsi
leaq 0x140(%rsp), %rcx
cmpq %rax, 0x8(%rcx,%rsi)
je 0x2db48
jmp 0x2db8f
shlq $0x4, %rsi
cmpq %rax, 0x48(%rsp,%rsi)
jne 0x2db8f
incq %r13
cmpq %r14, %r13
jne 0x2d97d
jmp 0x2db7b
movq 0x8(%rbx), %rsi
movq 0x8(%r12), %rdx
leaq 0x40(%rsp), %rdi
movq (%rsp), %rcx
callq 0x2dd3a
movq 0x10(%rsp), %r10
movq 0x8(%rsp), %rdi
testb %al, %al
je 0x2db8f
incq %rbp
cmpq 0x140(%r15), %rbp
jb 0x2d8eb
jmp 0x2db8f
xorl %ebp, %ebp
movq (%rsp), %rax
cmpl $0x0, (%rax)
jne 0x2dc3d
cmpq 0x140(%r15), %rbp
je 0x2dbfc
movq 0x20(%rsp), %rax
incq %rax
cmpq 0x18(%rsp), %rax
jne 0x2d8ad
jmp 0x2dc4f
movl $0x6bd, %ecx            # imm = 0x6BD
jmp 0x2dbd7
movl $0x6a4, %ecx            # imm = 0x6A4
jmp 0x2dbd7
movl $0x667, %ecx            # imm = 0x667
jmp 0x2dbd7
movl $0x64e, %ecx            # imm = 0x64E
movq (%rsp), %rdi
movl $0xf, %esi
leaq 0x46209(%rip), %rdx     # 0x73df0
callq 0x145a4
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %r10
jmp 0x2db8f
xorl %eax, %eax
jmp 0x2dc29
movq %r10, %rsi
movq 0x28(%rsp), %rdx
movq (%rsp), %rbx
movq %rbx, %rcx
callq *0x148(%r15)
movq 0x10(%rsp), %r10
movq 0x8(%rsp), %rdi
cmpl $0x0, (%rbx)
jne 0x2dc3d
addq %rbp, %r10
movq 0x20(%rsp), %rax
cmpq 0x18(%rsp), %rax
je 0x2dc4f
movq 0x30(%rdi), %rax
cmpq %rax, %r10
jb 0x2d87f
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
leaq 0x46191(%rip), %rdx     # 0x73df0
movq %r8, %rdi
movl $0xf, %esi
addq $0x358, %rsp            # imm = 0x358
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x145a4