// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/arch/arm32/assembler.c
// Function: prv_parse_identifier
static void prv_parse_identifier(subtilis_arm_ass_context_t *c,
				 subtilis_error_t *err)
{
	const char *tbuf;
	size_t index;
	size_t i;
	size_t base_len;
	size_t token_end;
	bool status_valid;
	bool byte_valid;
	bool hword_valid;
	bool dword_valid;
	size_t ptr;
	size_t search_len;
	subtilis_arm_instr_type_t itype;
	subtilis_arm_iclass_t iclass;
	subtilis_arm_ass_modifiers_t modifiers = {false};
	subtilis_arm_mtran_type_t mtran_type = SUBTILIS_ARM_MTRAN_IA;
	subtilis_arm_ccode_type_t ccode = SUBTILIS_ARM_CCODE_AL;
	size_t max_length = 0;
	size_t max_index = SIZE_MAX;

	tbuf = subtilis_token_get_text(c->t);
	if (tbuf[0] < 'A' || tbuf[0] > 'Z') {
		prv_parse_label(c, tbuf, err);
		return;
	}

	index = tbuf[0] - 'A';
	if (!keyword_map[index].mnems) {
		prv_parse_label(c, tbuf, err);
		return;
	}

	for (i = 0; i < keyword_map[index].count; i++) {
		search_len = strlen(keyword_map[index].mnems[i].name);
		if (search_len > keyword_map[index].max_length)
			search_len = keyword_map[index].max_length;
		if (!strncmp(keyword_map[index].mnems[i].name, tbuf,
			     search_len)) {
			base_len = strlen(keyword_map[index].mnems[i].name);
			if (base_len > max_length) {
				max_length = base_len;
				max_index = i;
			}
		}
	}

	if (max_index == SIZE_MAX) {
		prv_parse_label(c, tbuf, err);
		return;
	}

	/*
	 * It might still be an identifier
	 */

	token_end = strlen(tbuf);
	itype = keyword_map[index].mnems[max_index].type;
	iclass = subtilis_arm_get_iclass(itype, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	if (iclass == SUBTILIS_ARM_ICLASS_FPA) {
		prv_parse_possible_fpa(c, itype, tbuf, &tbuf[max_length],
				       token_end - max_length, err);
		return;
	}

	if (iclass == SUBTILIS_ARM_ICLASS_VFP) {
		prv_parse_possible_vfp(c, itype, tbuf, &tbuf[max_length],
				       token_end - max_length, err);
		return;
	}

	/* Special case for BL */

	if ((itype == SUBTILIS_ARM_INSTR_B) && (token_end > 1) &&
	    (token_end != 3) && (tbuf[1] == 'L'))
		max_length++;

	status_valid = itype != SUBTILIS_ARM_INSTR_LDR &&
		       itype != SUBTILIS_ARM_INSTR_STR &&
		       itype != SUBTILIS_ARM_INSTR_CMP &&
		       itype != SUBTILIS_ARM_INSTR_CMN &&
		       itype != SUBTILIS_ARM_INSTR_LDM &&
		       itype != SUBTILIS_ARM_INSTR_LDM &&
		       itype != SUBTILIS_ARM_INSTR_TST &&
		       itype != SUBTILIS_ARM_INSTR_TEQ &&
		       itype != SUBTILIS_ARM_INSTR_B;
	byte_valid =
	    itype == SUBTILIS_ARM_INSTR_LDR || itype == SUBTILIS_ARM_INSTR_STR;
	hword_valid = byte_valid;
	dword_valid = hword_valid;

	ptr = max_length;
	if (ptr == token_end) {
		if ((itype == SUBTILIS_ARM_INSTR_LDM) ||
		    (itype == SUBTILIS_ARM_INSTR_STM))
			prv_parse_label(c, tbuf, err);
		else
			prv_parse_instruction(c, tbuf, itype, ccode, &modifiers,
					      mtran_type, err);
		return;
	}

	if (ptr + 2 <= token_end) {
		for (i = 0; i < sizeof(condition_codes) / sizeof(const char *);
		     i++)
			if ((tbuf[ptr] == condition_codes[i][0]) &&
			    (tbuf[ptr + 1] == condition_codes[i][1]))
				break;

		if (i < sizeof(condition_codes) / sizeof(const char *)) {
			ptr += 2;
			ccode = (subtilis_arm_ccode_type_t)i;
		}
	}

	if ((ptr + 2 == token_end) && ((itype == SUBTILIS_ARM_INSTR_LDM) ||
				       (itype == SUBTILIS_ARM_INSTR_STM))) {
		for (i = 0; i < sizeof(mtran_types) / sizeof(mtran_types[0]);
		     i++)
			if (!strcmp(&tbuf[ptr], mtran_types[i]))
				break;

		if (i < sizeof(mtran_types) / sizeof(mtran_types[0])) {
			mtran_type = (subtilis_arm_mtran_type_t)i;
			ptr += 2;
		}
	}

	if (ptr + 1 == token_end) {
		modifiers.status = tbuf[ptr] == 'S' && status_valid;
		modifiers.byte = tbuf[ptr] == 'B' && byte_valid;
		modifiers.hword = tbuf[ptr] == 'H' && hword_valid;
		modifiers.dword = tbuf[ptr] == 'D' && dword_valid;
		modifiers.teqp =
		    tbuf[ptr] == 'P' && itype == SUBTILIS_ARM_INSTR_TEQ;
		if (!modifiers.status && !modifiers.byte && !modifiers.teqp &&
		    !modifiers.hword && !modifiers.dword) {
			prv_parse_label(c, tbuf, err);
			return;
		}
	} else if ((ptr + 2 == token_end) &&
		   (status_valid || itype == SUBTILIS_ARM_INSTR_LDR) &&
		   (byte_valid || hword_valid)) {
		if (tbuf[ptr] != 'S') {
			prv_parse_label(c, tbuf, err);
			return;
		}
		modifiers.status = true;
		modifiers.byte = tbuf[ptr + 1] == 'B';
		modifiers.hword = tbuf[ptr + 1] == 'H';
		if (!modifiers.byte && !modifiers.hword) {
			prv_parse_label(c, tbuf, err);
			return;
		}
	} else if (ptr != token_end) {
		prv_parse_label(c, tbuf, err);
		return;
	}

	prv_parse_instruction(c, tbuf, itype, ccode, &modifiers, mtran_type,
			      err);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x5d(%rbp), %rdi
xorl %esi, %esi
movl $0x5, %edx
callq 0x12110
movl $0x0, -0x64(%rbp)
movl $0xe, -0x68(%rbp)
movq $0x0, -0x70(%rbp)
movq $-0x1, -0x78(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x12d70
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x41, %eax
jl 0x917aa
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5a, %eax
jle 0x917c0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x10(%rbp), %rdx
callq 0x93220
jmp 0x91de6
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
subl $0x41, %eax
cltq
movq %rax, -0x20(%rbp)
leaq 0x3ec29(%rip), %rax     # 0xd0400
imulq $0x18, -0x20(%rbp), %rcx
addq %rcx, %rax
cmpq $0x0, (%rax)
jne 0x917fb
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x10(%rbp), %rdx
callq 0x93220
jmp 0x91de6
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
leaq 0x3ebf2(%rip), %rcx     # 0xd0400
imulq $0x18, -0x20(%rbp), %rdx
addq %rdx, %rcx
cmpq 0x8(%rcx), %rax
jae 0x91903
leaq 0x3ebd9(%rip), %rax     # 0xd0400
imulq $0x18, -0x20(%rbp), %rcx
addq %rcx, %rax
movq (%rax), %rax
movq -0x28(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rdi
callq 0x120d0
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
leaq 0x3ebac(%rip), %rcx     # 0xd0400
imulq $0x18, -0x20(%rbp), %rdx
addq %rdx, %rcx
cmpq 0x10(%rcx), %rax
jbe 0x91879
leaq 0x3eb97(%rip), %rax     # 0xd0400
imulq $0x18, -0x20(%rbp), %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movq %rax, -0x50(%rbp)
leaq 0x3eb80(%rip), %rax     # 0xd0400
imulq $0x18, -0x20(%rbp), %rcx
addq %rcx, %rax
movq (%rax), %rax
movq -0x28(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
movq -0x50(%rbp), %rdx
callq 0x12050
cmpl $0x0, %eax
jne 0x918f0
leaq 0x3eb4e(%rip), %rax     # 0xd0400
imulq $0x18, -0x20(%rbp), %rcx
addq %rcx, %rax
movq (%rax), %rax
movq -0x28(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rdi
callq 0x120d0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x70(%rbp), %rax
jbe 0x918ee
movq -0x30(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x78(%rbp)
jmp 0x918f0
jmp 0x918f2
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x91803
cmpq $-0x1, -0x78(%rbp)
jne 0x91920
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x10(%rbp), %rdx
callq 0x93220
jmp 0x91de6
movq -0x18(%rbp), %rdi
callq 0x120d0
movq %rax, -0x38(%rbp)
leaq 0x3eacc(%rip), %rax     # 0xd0400
imulq $0x18, -0x20(%rbp), %rcx
addq %rcx, %rax
movq (%rax), %rax
movq -0x78(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x70780
movl %eax, -0x58(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x9196d
jmp 0x91de6
cmpl $0x1, -0x58(%rbp)
jne 0x9199c
movq -0x8(%rbp), %rdi
movl -0x54(%rbp), %esi
movq -0x18(%rbp), %rdx
movq -0x18(%rbp), %rcx
addq -0x70(%rbp), %rcx
movq -0x38(%rbp), %r8
subq -0x70(%rbp), %r8
movq -0x10(%rbp), %r9
callq 0x93430
jmp 0x91de6
cmpl $0x2, -0x58(%rbp)
jne 0x919cb
movq -0x8(%rbp), %rdi
movl -0x54(%rbp), %esi
movq -0x18(%rbp), %rdx
movq -0x18(%rbp), %rcx
addq -0x70(%rbp), %rcx
movq -0x38(%rbp), %r8
subq -0x70(%rbp), %r8
movq -0x10(%rbp), %r9
callq 0x936f0
jmp 0x91de6
cmpl $0x16, -0x54(%rbp)
jne 0x919f8
cmpq $0x1, -0x38(%rbp)
jbe 0x919f8
cmpq $0x3, -0x38(%rbp)
je 0x919f8
movq -0x18(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x4c, %eax
jne 0x919f8
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
xorl %eax, %eax
cmpl $0x12, -0x54(%rbp)
movb %al, -0x79(%rbp)
je 0x91a5a
xorl %eax, %eax
cmpl $0x13, -0x54(%rbp)
movb %al, -0x79(%rbp)
je 0x91a5a
xorl %eax, %eax
cmpl $0xa, -0x54(%rbp)
movb %al, -0x79(%rbp)
je 0x91a5a
xorl %eax, %eax
cmpl $0xb, -0x54(%rbp)
movb %al, -0x79(%rbp)
je 0x91a5a
xorl %eax, %eax
cmpl $0x14, -0x54(%rbp)
movb %al, -0x79(%rbp)
je 0x91a5a
xorl %eax, %eax
cmpl $0x14, -0x54(%rbp)
movb %al, -0x79(%rbp)
je 0x91a5a
xorl %eax, %eax
cmpl $0x8, -0x54(%rbp)
movb %al, -0x79(%rbp)
je 0x91a5a
xorl %eax, %eax
cmpl $0x9, -0x54(%rbp)
movb %al, -0x79(%rbp)
je 0x91a5a
cmpl $0x16, -0x54(%rbp)
setne %al
movb %al, -0x79(%rbp)
movb -0x79(%rbp), %al
andb $0x1, %al
movb %al, -0x39(%rbp)
movb $0x1, %al
cmpl $0x12, -0x54(%rbp)
movb %al, -0x7a(%rbp)
je 0x91a77
cmpl $0x13, -0x54(%rbp)
sete %al
movb %al, -0x7a(%rbp)
movb -0x7a(%rbp), %al
andb $0x1, %al
movb %al, -0x3a(%rbp)
movb -0x3a(%rbp), %al
andb $0x1, %al
movb %al, -0x3b(%rbp)
movb -0x3b(%rbp), %al
andb $0x1, %al
movb %al, -0x3c(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
cmpq -0x38(%rbp), %rax
jne 0x91ae8
cmpl $0x14, -0x54(%rbp)
je 0x91aad
cmpl $0x15, -0x54(%rbp)
jne 0x91ac0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x10(%rbp), %rdx
callq 0x93220
jmp 0x91ae3
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x54(%rbp), %edx
movl -0x68(%rbp), %ecx
movl -0x64(%rbp), %r9d
movq -0x10(%rbp), %rax
leaq -0x5d(%rbp), %r8
movq %rax, (%rsp)
callq 0x937f0
jmp 0x91de6
movq -0x48(%rbp), %rax
addq $0x2, %rax
cmpq -0x38(%rbp), %rax
ja 0x91b7d
movq $0x0, -0x28(%rbp)
cmpq $0x10, -0x28(%rbp)
jae 0x91b61
movq -0x18(%rbp), %rax
movq -0x48(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movq -0x28(%rbp), %rdx
leaq 0x3eb50(%rip), %rcx     # 0xd0670
movq (%rcx,%rdx,8), %rcx
movsbl (%rcx), %ecx
cmpl %ecx, %eax
jne 0x91b51
movq -0x18(%rbp), %rax
movq -0x48(%rbp), %rcx
movsbl 0x1(%rax,%rcx), %eax
movq -0x28(%rbp), %rdx
leaq 0x3eb2d(%rip), %rcx     # 0xd0670
movq (%rcx,%rdx,8), %rcx
movsbl 0x1(%rcx), %ecx
cmpl %ecx, %eax
jne 0x91b51
jmp 0x91b61
jmp 0x91b53
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x91b02
cmpq $0x10, -0x28(%rbp)
jae 0x91b7b
movq -0x48(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x48(%rbp)
movq -0x28(%rbp), %rax
movl %eax, -0x68(%rbp)
jmp 0x91b7d
movq -0x48(%rbp), %rax
addq $0x2, %rax
cmpq -0x38(%rbp), %rax
jne 0x91bf5
cmpl $0x14, -0x54(%rbp)
je 0x91b97
cmpl $0x15, -0x54(%rbp)
jne 0x91bf5
movq $0x0, -0x28(%rbp)
cmpq $0x8, -0x28(%rbp)
jae 0x91bd9
movq -0x18(%rbp), %rdi
addq -0x48(%rbp), %rdi
movq -0x28(%rbp), %rcx
leaq 0x3eb37(%rip), %rax     # 0xd06f0
movq (%rax,%rcx,8), %rsi
callq 0x12140
cmpl $0x0, %eax
jne 0x91bc9
jmp 0x91bd9
jmp 0x91bcb
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x91b9f
cmpq $0x8, -0x28(%rbp)
jae 0x91bf3
movq -0x28(%rbp), %rax
movl %eax, -0x64(%rbp)
movq -0x48(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x48(%rbp)
jmp 0x91bf5
movq -0x48(%rbp), %rax
addq $0x1, %rax
cmpq -0x38(%rbp), %rax
jne 0x91cf8
movq -0x18(%rbp), %rax
movq -0x48(%rbp), %rcx
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0x53, %ecx
movb %al, -0x7b(%rbp)
jne 0x91c23
movb -0x39(%rbp), %al
movb %al, -0x7b(%rbp)
movb -0x7b(%rbp), %al
andb $0x1, %al
movb %al, -0x5d(%rbp)
movq -0x18(%rbp), %rax
movq -0x48(%rbp), %rcx
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0x42, %ecx
movb %al, -0x7c(%rbp)
jne 0x91c47
movb -0x3a(%rbp), %al
movb %al, -0x7c(%rbp)
movb -0x7c(%rbp), %al
andb $0x1, %al
movb %al, -0x5c(%rbp)
movq -0x18(%rbp), %rax
movq -0x48(%rbp), %rcx
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0x48, %ecx
movb %al, -0x7d(%rbp)
jne 0x91c6b
movb -0x3b(%rbp), %al
movb %al, -0x7d(%rbp)
movb -0x7d(%rbp), %al
andb $0x1, %al
movb %al, -0x5a(%rbp)
movq -0x18(%rbp), %rax
movq -0x48(%rbp), %rcx
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0x44, %ecx
movb %al, -0x7e(%rbp)
jne 0x91c8f
movb -0x3c(%rbp), %al
movb %al, -0x7e(%rbp)
movb -0x7e(%rbp), %al
andb $0x1, %al
movb %al, -0x59(%rbp)
movq -0x18(%rbp), %rax
movq -0x48(%rbp), %rcx
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0x50, %ecx
movb %al, -0x7f(%rbp)
jne 0x91cb7
cmpl $0x9, -0x54(%rbp)
sete %al
movb %al, -0x7f(%rbp)
movb -0x7f(%rbp), %al
andb $0x1, %al
movb %al, -0x5b(%rbp)
testb $0x1, -0x5d(%rbp)
jne 0x91cf3
testb $0x1, -0x5c(%rbp)
jne 0x91cf3
testb $0x1, -0x5b(%rbp)
jne 0x91cf3
testb $0x1, -0x5a(%rbp)
jne 0x91cf3
testb $0x1, -0x59(%rbp)
jne 0x91cf3
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x10(%rbp), %rdx
callq 0x93220
jmp 0x91de6
jmp 0x91dc3
movq -0x48(%rbp), %rax
addq $0x2, %rax
cmpq -0x38(%rbp), %rax
jne 0x91da2
testb $0x1, -0x39(%rbp)
jne 0x91d1a
cmpl $0x12, -0x54(%rbp)
jne 0x91da2
testb $0x1, -0x3a(%rbp)
jne 0x91d26
testb $0x1, -0x3b(%rbp)
je 0x91da2
movq -0x18(%rbp), %rax
movq -0x48(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x53, %eax
je 0x91d4d
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x10(%rbp), %rdx
callq 0x93220
jmp 0x91de6
movb $0x1, -0x5d(%rbp)
movq -0x18(%rbp), %rax
movq -0x48(%rbp), %rcx
movsbl 0x1(%rax,%rcx), %eax
cmpl $0x42, %eax
sete %al
andb $0x1, %al
movb %al, -0x5c(%rbp)
movq -0x18(%rbp), %rax
movq -0x48(%rbp), %rcx
movsbl 0x1(%rax,%rcx), %eax
cmpl $0x48, %eax
sete %al
andb $0x1, %al
movb %al, -0x5a(%rbp)
testb $0x1, -0x5c(%rbp)
jne 0x91da0
testb $0x1, -0x5a(%rbp)
jne 0x91da0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x10(%rbp), %rdx
callq 0x93220
jmp 0x91de6
jmp 0x91dc1
movq -0x48(%rbp), %rax
cmpq -0x38(%rbp), %rax
je 0x91dbf
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x10(%rbp), %rdx
callq 0x93220
jmp 0x91de6
jmp 0x91dc1
jmp 0x91dc3
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x54(%rbp), %edx
movl -0x68(%rbp), %ecx
movl -0x64(%rbp), %r9d
movq -0x10(%rbp), %rax
leaq -0x5d(%rbp), %r8
movq %rax, (%rsp)
callq 0x937f0
addq $0x90, %rsp
popq %rbp
retq
nop