// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/common/ir.c
// Function: prv_parse_match
static const char *prv_parse_match(const char *rule,
				   subtilis_ir_op_match_t *match,
				   subtilis_error_t *err)
{
	const int max_instr = 32;
	char instr[max_instr];
	size_t i;

	while (prv_is_white_space(rule))
		rule++;
	if (!rule[0])
		return NULL;

	for (i = 0; *rule && i < max_instr && !prv_is_white_space(rule); i++)
		instr[i] = *rule++;
	instr[i] = 0;

	if (!strncmp(instr, "label_", LABEL_STR_SIZE)) {
		match->type = SUBTILIS_OP_LABEL;
		prv_parse_label(instr + LABEL_STR_SIZE, &match->op.label, err);
		return rule;
	}

	if (!strcmp(instr, "call")) {
		match->type = SUBTILIS_OP_CALL;
		return rule;
	}

	if (!strcmp(instr, "calli32")) {
		match->type = SUBTILIS_OP_CALLI32;
		return rule;
	}

	if (!strcmp(instr, "callr")) {
		match->type = SUBTILIS_OP_CALLREAL;
		return rule;
	}

	if (!strcmp(instr, "callptr")) {
		match->type = SUBTILIS_OP_CALL_PTR;
		return rule;
	}

	if (!strcmp(instr, "calli32ptr")) {
		match->type = SUBTILIS_OP_CALLI32_PTR;
		return rule;
	}

	if (!strcmp(instr, "callrptr")) {
		match->type = SUBTILIS_OP_CALLREAL_PTR;
		return rule;
	}

	if (!strcmp(instr, "syscall")) {
		match->type = SUBTILIS_OP_SYS_CALL;
		return rule;
	}

	for (i = 0; i < sizeof(op_desc) / sizeof(subtilis_ir_op_desc_t); i++)
		if (!strcmp(instr, op_desc[i].name))
			break;

	if (i == sizeof(op_desc) / sizeof(subtilis_ir_op_desc_t)) {
		subtilis_error_set_assertion_failed(err);
		return NULL;
	}

	match->type = SUBTILIS_OP_INSTR;
	match->op.instr.type = (subtilis_op_instr_type_t)i;
	return prv_parse_operands(rule, match, err);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl $0x20, -0x24(%rbp)
movq %rsp, %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
callq 0x3af20
testb $0x1, %al
jne 0x3a1e1
jmp 0x3a1ef
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x3a1d2
movq -0x10(%rbp), %rax
cmpb $0x0, (%rax)
jne 0x3a20c
movq $0x0, -0x8(%rbp)
movl $0x1, -0x3c(%rbp)
jmp 0x3a4dd
movq $0x0, -0x38(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x61(%rbp)
je 0x3a23f
xorl %eax, %eax
cmpq $0x20, -0x38(%rbp)
movb %al, -0x61(%rbp)
jae 0x3a23f
movq -0x10(%rbp), %rdi
callq 0x3af20
xorb $-0x1, %al
movb %al, -0x61(%rbp)
movb -0x61(%rbp), %al
testb $0x1, %al
jne 0x3a248
jmp 0x3a26f
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
movb (%rax), %cl
movq -0x38(%rbp), %rax
movb %cl, -0x60(%rbp,%rax)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x3a214
movq -0x38(%rbp), %rax
movb $0x0, -0x60(%rbp,%rax)
leaq -0x60(%rbp), %rdi
leaq 0x71044(%rip), %rsi     # 0xab2c7
movl $0x6, %edx
callq 0x12050
cmpl $0x0, %eax
jne 0x3a2c9
movq -0x18(%rbp), %rax
movl $0x1, (%rax)
leaq -0x60(%rbp), %rdi
addq $0x6, %rdi
movq -0x18(%rbp), %rsi
addq $0x8, %rsi
movq -0x20(%rbp), %rdx
callq 0x3af80
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
movl $0x1, -0x3c(%rbp)
jmp 0x3a4dd
leaq 0x7102b(%rip), %rsi     # 0xab2fb
leaq -0x60(%rbp), %rdi
callq 0x12140
cmpl $0x0, %eax
jne 0x3a2fc
movq -0x18(%rbp), %rax
movl $0x2, (%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
movl $0x1, -0x3c(%rbp)
jmp 0x3a4dd
leaq 0x70fcb(%rip), %rsi     # 0xab2ce
leaq -0x60(%rbp), %rdi
callq 0x12140
cmpl $0x0, %eax
jne 0x3a32f
movq -0x18(%rbp), %rax
movl $0x3, (%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
movl $0x1, -0x3c(%rbp)
jmp 0x3a4dd
leaq 0x70fa0(%rip), %rsi     # 0xab2d6
leaq -0x60(%rbp), %rdi
callq 0x12140
cmpl $0x0, %eax
jne 0x3a362
movq -0x18(%rbp), %rax
movl $0x4, (%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
movl $0x1, -0x3c(%rbp)
jmp 0x3a4dd
leaq 0x70f73(%rip), %rsi     # 0xab2dc
leaq -0x60(%rbp), %rdi
callq 0x12140
cmpl $0x0, %eax
jne 0x3a395
movq -0x18(%rbp), %rax
movl $0x5, (%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
movl $0x1, -0x3c(%rbp)
jmp 0x3a4dd
leaq 0x70f48(%rip), %rsi     # 0xab2e4
leaq -0x60(%rbp), %rdi
callq 0x12140
cmpl $0x0, %eax
jne 0x3a3c8
movq -0x18(%rbp), %rax
movl $0x6, (%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
movl $0x1, -0x3c(%rbp)
jmp 0x3a4dd
leaq 0x70f20(%rip), %rsi     # 0xab2ef
leaq -0x60(%rbp), %rdi
callq 0x12140
cmpl $0x0, %eax
jne 0x3a3fb
movq -0x18(%rbp), %rax
movl $0x7, (%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
movl $0x1, -0x3c(%rbp)
jmp 0x3a4dd
leaq 0x70ef6(%rip), %rsi     # 0xab2f8
leaq -0x60(%rbp), %rdi
callq 0x12140
cmpl $0x0, %eax
jne 0x3a42e
movq -0x18(%rbp), %rax
movl $0x8, (%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
movl $0x1, -0x3c(%rbp)
jmp 0x3a4dd
movq $0x0, -0x38(%rbp)
cmpq $0x9d, -0x38(%rbp)
jae 0x3a475
movq -0x38(%rbp), %rcx
leaq 0x90845(%rip), %rax     # 0xcac90
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rsi
leaq -0x60(%rbp), %rdi
callq 0x12140
cmpl $0x0, %eax
jne 0x3a465
jmp 0x3a475
jmp 0x3a467
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x3a436
cmpq $0x9d, -0x38(%rbp)
jne 0x3a4aa
movq -0x20(%rbp), %rdi
movl $0xf, %esi
leaq 0x70989(%rip), %rdx     # 0xaae18
movl $0x5f1, %ecx            # imm = 0x5F1
callq 0x158e0
movq $0x0, -0x8(%rbp)
movl $0x1, -0x3c(%rbp)
jmp 0x3a4dd
movq -0x18(%rbp), %rax
movl $0x0, (%rax)
movq -0x38(%rbp), %rax
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x3b050
movq %rax, -0x8(%rbp)
movl $0x1, -0x3c(%rbp)
movq -0x30(%rbp), %rax
movq %rax, %rsp
movq -0x8(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nop