// File: /workspace/github_c_makefile_star2_O0/System-Glitch[P]ESGILinter-C/src/parsing_variables.c
// Function: parse_variable_value
static char parse_variable_value(char *line, size_t length, unsigned int *i) {
	unsigned int index              = *i;
	unsigned char in_content        = 0;
	unsigned char error             = 0;
	unsigned char expect_comma      = 0;
	unsigned int nested             = 0;
	unsigned char value_start_index = 0;
	char c;

	SKIP_WHITESPACES

	//Expect value
	//Until comma (if outside quotes and braces)
	value_start_index = index;
	do {
		c = line[index];
		if(!expect_comma && !in_content && (c == '"' || c == '{' || c == '(')) {
			in_content = c;
			nested = 1;
		} else if(!expect_comma && in_content) {

			if((in_content == '{' && c == '{') || (in_content == '(' && c == '(')) {
				nested++;
			} else if((in_content == '{' && c == '}') || (in_content == '(' && c == ')')) {
				nested--;
				if(nested <= 0) {
					in_content = 0;
					expect_comma = 1;
				}
			} else if(in_content == '"' && c == '"' && line[index - 1] != '\\') {
				in_content = 0;
				nested = 0;
				expect_comma = 1;
			}

		} else if(c == ',') {
			index++;
			break;
		} else if(!in_content && (c == ')' || c == '}')) {
			error = 1;
			break;
		}
		index++;
	} while(index < length);

	*i = index;
	return !error && !(in_content > 0 || nested > 0 || index - 1 == value_start_index); //Check for invalid syntax or missing value before comma
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x1c(%rbp)
movb $0x0, -0x1d(%rbp)
movb $0x0, -0x1e(%rbp)
movb $0x0, -0x1f(%rbp)
movl $0x0, -0x24(%rbp)
movb $0x0, -0x25(%rbp)
movq -0x8(%rbp), %rax
movl -0x1c(%rbp), %ecx
movb (%rax,%rcx), %al
movb %al, -0x26(%rbp)
movsbl %al, %edi
callq 0xa7d0
movsbl %al, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x27(%rbp)
je 0xb7b3
movl -0x1c(%rbp), %eax
cmpq -0x10(%rbp), %rax
setb %al
movb %al, -0x27(%rbp)
movb -0x27(%rbp), %al
testb $0x1, %al
jne 0xb7bc
jmp 0xb7c7
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xb784
movl -0x1c(%rbp), %eax
movb %al, -0x25(%rbp)
movq -0x8(%rbp), %rax
movl -0x1c(%rbp), %ecx
movb (%rax,%rcx), %al
movb %al, -0x26(%rbp)
cmpb $0x0, -0x1f(%rbp)
jne 0xb813
cmpb $0x0, -0x1d(%rbp)
jne 0xb813
movsbl -0x26(%rbp), %eax
cmpl $0x22, %eax
je 0xb801
movsbl -0x26(%rbp), %eax
cmpl $0x7b, %eax
je 0xb801
movsbl -0x26(%rbp), %eax
cmpl $0x28, %eax
jne 0xb813
movb -0x26(%rbp), %al
movb %al, -0x1d(%rbp)
movl $0x1, -0x24(%rbp)
jmp 0xb90a
cmpb $0x0, -0x1f(%rbp)
jne 0xb8d2
movzbl -0x1d(%rbp), %eax
cmpl $0x0, %eax
je 0xb8d2
movzbl -0x1d(%rbp), %eax
cmpl $0x7b, %eax
jne 0xb83c
movsbl -0x26(%rbp), %eax
cmpl $0x7b, %eax
je 0xb84e
movzbl -0x1d(%rbp), %eax
cmpl $0x28, %eax
jne 0xb859
movsbl -0x26(%rbp), %eax
cmpl $0x28, %eax
jne 0xb859
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xb8d0
movzbl -0x1d(%rbp), %eax
cmpl $0x7b, %eax
jne 0xb86b
movsbl -0x26(%rbp), %eax
cmpl $0x7d, %eax
je 0xb87d
movzbl -0x1d(%rbp), %eax
cmpl $0x28, %eax
jne 0xb896
movsbl -0x26(%rbp), %eax
cmpl $0x29, %eax
jne 0xb896
movl -0x24(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
ja 0xb894
movb $0x0, -0x1d(%rbp)
movb $0x1, -0x1f(%rbp)
jmp 0xb8ce
movzbl -0x1d(%rbp), %eax
cmpl $0x22, %eax
jne 0xb8cc
movsbl -0x26(%rbp), %eax
cmpl $0x22, %eax
jne 0xb8cc
movq -0x8(%rbp), %rax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
movsbl (%rax,%rcx), %eax
cmpl $0x5c, %eax
je 0xb8cc
movb $0x0, -0x1d(%rbp)
movl $0x0, -0x24(%rbp)
movb $0x1, -0x1f(%rbp)
jmp 0xb8ce
jmp 0xb8d0
jmp 0xb908
movsbl -0x26(%rbp), %eax
cmpl $0x2c, %eax
jne 0xb8e6
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xb920
cmpb $0x0, -0x1d(%rbp)
jne 0xb904
movsbl -0x26(%rbp), %eax
cmpl $0x29, %eax
je 0xb8fe
movsbl -0x26(%rbp), %eax
cmpl $0x7d, %eax
jne 0xb904
movb $0x1, -0x1e(%rbp)
jmp 0xb920
jmp 0xb906
jmp 0xb908
jmp 0xb90a
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpq -0x10(%rbp), %rax
jb 0xb7cd
movl -0x1c(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
xorl %eax, %eax
cmpb $0x0, -0x1e(%rbp)
movb %al, -0x28(%rbp)
jne 0xb967
movzbl -0x1d(%rbp), %ecx
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, -0x29(%rbp)
jg 0xb95f
movb $0x1, %al
cmpl $0x0, -0x24(%rbp)
movb %al, -0x29(%rbp)
ja 0xb95f
movl -0x1c(%rbp), %eax
subl $0x1, %eax
movzbl -0x25(%rbp), %ecx
cmpl %ecx, %eax
sete %al
movb %al, -0x29(%rbp)
movb -0x29(%rbp), %al
xorb $-0x1, %al
movb %al, -0x28(%rbp)
movb -0x28(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)