// File: /workspace/github_c_makefile_star2_O0/System-Glitch[P]ESGILinter-C/src/parsing_variables.c
// Function: parse_variable_name
match_t *parse_variable_name(char *names, unsigned int *start_index, unsigned int *array_count, char **value) {
	unsigned int index              = 0;
	unsigned int value_start_index  = 0;
	char *line                      = names + *start_index;
	unsigned int length             = strlen(line);
	match_t *match                  = NULL;
	unsigned char c;

	if(*start_index > strlen(names)) return NULL;

	match = match_init();

	if(match == NULL) return NULL;
	else if(line[index] == ';') {
		free(match);
		return NULL;
	}

	SKIP_WHITESPACES

	match->index_start = index;

	//Until not alphanumeric
	while((is_alphanumeric(c = line[index]) || c == '*') && index < length) {
		index++;
	}

	match->index_end = index;

	if(c != ';') {

		if(c != ',') {

			SKIP_WHITESPACES

			*array_count += parse_variable_array(line, length, &index);

			SKIP_WHITESPACES

			if(index < length) {
				//Equal symbol?
				if(line[index] == '=') {
					value_start_index = index + 1;
					if(!parse_variable_value(line, length, &index)) { //Invalid syntax or missing value before comma
						free(match);
						match = NULL;
					} else if(value != NULL) {
						*value = strsubstr(line, value_start_index, index - value_start_index - (line[index-1] == ';' || line[index-1] == ',' ? 1 : 0));
					}
				} else if(line[index] != ',' && line[index] != ';') { //Syntax error
					free(match);
					match = NULL;
				}
			}
		} else {
			index++;
		}
	}

	*start_index += index;

	return match;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
movl (%rcx), %ecx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
callq 0x2090
movl %eax, -0x3c(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x18(%rbp), %rax
movl (%rax), %eax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2090
movq %rax, %rcx
movq -0x58(%rbp), %rax
cmpq %rcx, %rax
jbe 0xb357
movq $0x0, -0x8(%rbp)
jmp 0xb628
movb $0x0, %al
callq 0xae40
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0xb376
movq $0x0, -0x8(%rbp)
jmp 0xb628
movq -0x38(%rbp), %rax
movl -0x2c(%rbp), %ecx
movsbl (%rax,%rcx), %eax
cmpl $0x3b, %eax
jne 0xb39c
movq -0x48(%rbp), %rdi
callq 0x2030
movq $0x0, -0x8(%rbp)
jmp 0xb628
jmp 0xb39e
jmp 0xb3a0
movq -0x38(%rbp), %rax
movl -0x2c(%rbp), %ecx
movb (%rax,%rcx), %al
movb %al, -0x49(%rbp)
movsbl %al, %edi
callq 0xa7d0
movsbl %al, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x59(%rbp)
je 0xb3ce
movl -0x2c(%rbp), %eax
cmpl -0x3c(%rbp), %eax
setb %al
movb %al, -0x59(%rbp)
movb -0x59(%rbp), %al
testb $0x1, %al
jne 0xb3d7
jmp 0xb3e2
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xb3a0
movl -0x2c(%rbp), %ecx
movq -0x48(%rbp), %rax
movl %ecx, (%rax)
movq -0x38(%rbp), %rax
movl -0x2c(%rbp), %ecx
movb (%rax,%rcx), %al
movb %al, -0x49(%rbp)
movsbl %al, %edi
callq 0xada0
movsbl %al, %eax
cmpl $0x0, %eax
jne 0xb416
movzbl -0x49(%rbp), %ecx
xorl %eax, %eax
cmpl $0x2a, %ecx
movb %al, -0x5a(%rbp)
jne 0xb422
movl -0x2c(%rbp), %eax
cmpl -0x3c(%rbp), %eax
setb %al
movb %al, -0x5a(%rbp)
movb -0x5a(%rbp), %al
testb $0x1, %al
jne 0xb42b
jmp 0xb436
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xb3eb
movl -0x2c(%rbp), %ecx
movq -0x48(%rbp), %rax
movl %ecx, 0x4(%rax)
movzbl -0x49(%rbp), %eax
cmpl $0x3b, %eax
je 0xb615
movzbl -0x49(%rbp), %eax
cmpl $0x2c, %eax
je 0xb60a
jmp 0xb45c
movq -0x38(%rbp), %rax
movl -0x2c(%rbp), %ecx
movb (%rax,%rcx), %al
movb %al, -0x49(%rbp)
movsbl %al, %edi
callq 0xa7d0
movsbl %al, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x5b(%rbp)
je 0xb48a
movl -0x2c(%rbp), %eax
cmpl -0x3c(%rbp), %eax
setb %al
movb %al, -0x5b(%rbp)
movb -0x5b(%rbp), %al
testb $0x1, %al
jne 0xb493
jmp 0xb49e
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xb45c
movq -0x38(%rbp), %rdi
movl -0x3c(%rbp), %eax
movl %eax, %esi
leaq -0x2c(%rbp), %rdx
callq 0xb640
movl %eax, %ecx
movq -0x20(%rbp), %rax
addl (%rax), %ecx
movl %ecx, (%rax)
movq -0x38(%rbp), %rax
movl -0x2c(%rbp), %ecx
movb (%rax,%rcx), %al
movb %al, -0x49(%rbp)
movsbl %al, %edi
callq 0xa7d0
movsbl %al, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x5c(%rbp)
je 0xb4e8
movl -0x2c(%rbp), %eax
cmpl -0x3c(%rbp), %eax
setb %al
movb %al, -0x5c(%rbp)
movb -0x5c(%rbp), %al
testb $0x1, %al
jne 0xb4f1
jmp 0xb4fc
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xb4ba
movl -0x2c(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jae 0xb608
movq -0x38(%rbp), %rax
movl -0x2c(%rbp), %ecx
movsbl (%rax,%rcx), %eax
cmpl $0x3d, %eax
jne 0xb5d3
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
movq -0x38(%rbp), %rdi
movl -0x3c(%rbp), %eax
movl %eax, %esi
leaq -0x2c(%rbp), %rdx
callq 0xb750
cmpb $0x0, %al
jne 0xb551
movq -0x48(%rbp), %rdi
callq 0x2030
movq $0x0, -0x48(%rbp)
jmp 0xb5d1
cmpq $0x0, -0x28(%rbp)
je 0xb5cf
movq -0x38(%rbp), %rax
movq %rax, -0x70(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x68(%rbp)
movl -0x2c(%rbp), %eax
subl -0x30(%rbp), %eax
movl %eax, -0x64(%rbp)
movq -0x38(%rbp), %rax
movl -0x2c(%rbp), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
movsbl (%rax,%rcx), %ecx
movb $0x1, %al
cmpl $0x3b, %ecx
movb %al, -0x5d(%rbp)
je 0xb5a2
movq -0x38(%rbp), %rax
movl -0x2c(%rbp), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
movsbl (%rax,%rcx), %eax
cmpl $0x2c, %eax
sete %al
movb %al, -0x5d(%rbp)
movl -0x68(%rbp), %esi
movq -0x70(%rbp), %rdi
movl -0x64(%rbp), %edx
movb -0x5d(%rbp), %r8b
xorl %eax, %eax
movl $0x1, %ecx
testb $0x1, %r8b
cmovnel %ecx, %eax
subl %eax, %edx
callq 0xa5e0
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
jmp 0xb5d1
jmp 0xb606
movq -0x38(%rbp), %rax
movl -0x2c(%rbp), %ecx
movsbl (%rax,%rcx), %eax
cmpl $0x2c, %eax
je 0xb604
movq -0x38(%rbp), %rax
movl -0x2c(%rbp), %ecx
movsbl (%rax,%rcx), %eax
cmpl $0x3b, %eax
je 0xb604
movq -0x48(%rbp), %rdi
callq 0x2030
movq $0x0, -0x48(%rbp)
jmp 0xb606
jmp 0xb608
jmp 0xb613
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xb615
movl -0x2c(%rbp), %ecx
movq -0x18(%rbp), %rax
addl (%rax), %ecx
movl %ecx, (%rax)
movq -0x48(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)