// File: /workspace/github_c_makefile_star2_O0/System-Glitch[P]ESGILinter-C/src/parsing_expressions.c
// Function: parse_control
static char *parse_control(char *line, int index, int length, char **following, unsigned char *is_return, unsigned char *is_for) {
	static const char *simple_controls[] = {
		"if", "switch", "while", NULL
	};
	const char *word = NULL;
	char *expr       = NULL;
	size_t i         = 0;
	int last_index   = -1;
	int start_index  = -1;
	char c;

	while((word = simple_controls[i++]) != NULL) {
		if(strstr(line + index, word) == line + index) {
			index += strlen(word);
			c = line[index];

			SKIP_WHITESPACES

			if(c == '(') {
				last_index = strlastindexof(line, ')');
				if(last_index > index) {
					index++;
					return strsubstr(line, index, last_index - index);
				}
			}
			break;
		}
	}

	//Specific
	if(strstr(line + index, "else") == line + index) {
		index += 4;
		last_index = index;

		SKIP_WHITESPACES

		if(index != last_index && strstr(line + index, "if") == line + index) {
			index += 2;

			SKIP_WHITESPACES

			if(c == '(') {
				last_index = strlastindexof(line, ')');
				if(last_index > index) {
					index++;
					return strsubstr(line, index, last_index - index);
				}
			}
		}

	} else if(strstr(line + index, "return") == line + index) {
		index += 6;

		SKIP_WHITESPACES
		*is_return = 1;
		return strsubstr(line, index, length - index);
	} else if(strstr(line + index, "case") == line + index) {

		index += 4;

		SKIP_WHITESPACES

		//Condition
		start_index = index;

		while(index < length) {
			while((c = line[index]) != ':' && index < length) {
				index++;
			}

			if(c == ':' && !check_quotes(line, line + index, length)) {

				expr = strsubstr(line, start_index, index - start_index);
				if(++index < length) {
					*following = strsubstr(line, index, length - index);
				}

				return expr;
			}
			index++;

		}

	} else if(strstr(line + index, "default") == line + index) {
		index += 7;

		SKIP_WHITESPACES

		if(c == ':' && ++index < length) {
			return strsubstr(line, index, length - index);
		}
	} else if(strstr(line + index, "for") == line + index) {
		index += 3;

		SKIP_WHITESPACES

		if(c == '(') {
			last_index = strlastindexof(line, ')');
			if(last_index > index) {
				index++;
				expr = strsubstr(line, index, last_index - index);
				if(strcount(expr, ';') < 2) {
					free(expr);
					return NULL;
				} else {
					*is_for = 1;
					return expr;
				}
			}
		}
	}

	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movl $0xffffffff, -0x4c(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x50(%rbp) # imm = 0xFFFFFFFF
movq -0x48(%rbp), %rcx
movq %rcx, %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
leaq 0x7b96(%rip), %rax      # 0x184c0
movq (%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
je 0x10a1a
movq -0x10(%rbp), %rdi
movslq -0x14(%rbp), %rax
addq %rax, %rdi
movq -0x38(%rbp), %rsi
callq 0x2190
movq -0x10(%rbp), %rcx
movslq -0x14(%rbp), %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
jne 0x10a15
movq -0x38(%rbp), %rdi
callq 0x2090
movq %rax, %rcx
movslq -0x14(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movb (%rax,%rcx), %al
movb %al, -0x51(%rbp)
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movb (%rax,%rcx), %al
movb %al, -0x51(%rbp)
movsbl %al, %edi
callq 0xa7d0
movsbl %al, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x52(%rbp)
je 0x109b7
movl -0x14(%rbp), %eax
cmpl -0x18(%rbp), %eax
setl %al
movb %al, -0x52(%rbp)
movb -0x52(%rbp), %al
testb $0x1, %al
jne 0x109c0
jmp 0x109cb
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x10988
movsbl -0x51(%rbp), %eax
cmpl $0x28, %eax
jne 0x10a13
movq -0x10(%rbp), %rdi
movl $0x29, %esi
callq 0xa940
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jle 0x10a11
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x4c(%rbp), %edx
subl -0x14(%rbp), %edx
callq 0xa5e0
movq %rax, -0x8(%rbp)
jmp 0x10ef9
jmp 0x10a13
jmp 0x10a1a
jmp 0x10914
movq -0x10(%rbp), %rdi
movslq -0x14(%rbp), %rax
addq %rax, %rdi
leaq 0x3dac(%rip), %rsi      # 0x147d8
callq 0x2190
movq -0x10(%rbp), %rcx
movslq -0x14(%rbp), %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
jne 0x10b69
movl -0x14(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x4c(%rbp)
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movb (%rax,%rcx), %al
movb %al, -0x51(%rbp)
movsbl %al, %edi
callq 0xa7d0
movsbl %al, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x53(%rbp)
je 0x10a83
movl -0x14(%rbp), %eax
cmpl -0x18(%rbp), %eax
setl %al
movb %al, -0x53(%rbp)
movb -0x53(%rbp), %al
testb $0x1, %al
jne 0x10a8c
jmp 0x10a97
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x10a54
movl -0x14(%rbp), %eax
cmpl -0x4c(%rbp), %eax
je 0x10b64
movq -0x10(%rbp), %rdi
movslq -0x14(%rbp), %rax
addq %rax, %rdi
leaq 0x3d39(%rip), %rsi      # 0x147ee
callq 0x2190
movq -0x10(%rbp), %rcx
movslq -0x14(%rbp), %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
jne 0x10b64
movl -0x14(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movb (%rax,%rcx), %al
movb %al, -0x51(%rbp)
movsbl %al, %edi
callq 0xa7d0
movsbl %al, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x54(%rbp)
je 0x10b06
movl -0x14(%rbp), %eax
cmpl -0x18(%rbp), %eax
setl %al
movb %al, -0x54(%rbp)
movb -0x54(%rbp), %al
testb $0x1, %al
jne 0x10b0f
jmp 0x10b1a
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x10ad7
movsbl -0x51(%rbp), %eax
cmpl $0x28, %eax
jne 0x10b62
movq -0x10(%rbp), %rdi
movl $0x29, %esi
callq 0xa940
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jle 0x10b60
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x4c(%rbp), %edx
subl -0x14(%rbp), %edx
callq 0xa5e0
movq %rax, -0x8(%rbp)
jmp 0x10ef9
jmp 0x10b62
jmp 0x10b64
jmp 0x10ef1
movq -0x10(%rbp), %rdi
movslq -0x14(%rbp), %rax
addq %rax, %rdi
leaq 0x3c8f(%rip), %rsi      # 0x1480a
callq 0x2190
movq -0x10(%rbp), %rcx
movslq -0x14(%rbp), %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
jne 0x10bfe
movl -0x14(%rbp), %eax
addl $0x6, %eax
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movb (%rax,%rcx), %al
movb %al, -0x51(%rbp)
movsbl %al, %edi
callq 0xa7d0
movsbl %al, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x55(%rbp)
je 0x10bc8
movl -0x14(%rbp), %eax
cmpl -0x18(%rbp), %eax
setl %al
movb %al, -0x55(%rbp)
movb -0x55(%rbp), %al
testb $0x1, %al
jne 0x10bd1
jmp 0x10bdc
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x10b99
movq -0x28(%rbp), %rax
movb $0x1, (%rax)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
subl -0x14(%rbp), %edx
callq 0xa5e0
movq %rax, -0x8(%rbp)
jmp 0x10ef9
movq -0x10(%rbp), %rdi
movslq -0x14(%rbp), %rax
addq %rax, %rdi
leaq 0x3ba9(%rip), %rsi      # 0x147b9
callq 0x2190
movq -0x10(%rbp), %rcx
movslq -0x14(%rbp), %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
jne 0x10d48
movl -0x14(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movb (%rax,%rcx), %al
movb %al, -0x51(%rbp)
movsbl %al, %edi
callq 0xa7d0
movsbl %al, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x56(%rbp)
je 0x10c61
movl -0x14(%rbp), %eax
cmpl -0x18(%rbp), %eax
setl %al
movb %al, -0x56(%rbp)
movb -0x56(%rbp), %al
testb $0x1, %al
jne 0x10c6a
jmp 0x10c75
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x10c32
movl -0x14(%rbp), %eax
movl %eax, -0x50(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x10d43
jmp 0x10c89
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movb (%rax,%rcx), %al
movb %al, -0x51(%rbp)
movsbl %al, %ecx
xorl %eax, %eax
cmpl $0x3a, %ecx
movb %al, -0x57(%rbp)
je 0x10cb0
movl -0x14(%rbp), %eax
cmpl -0x18(%rbp), %eax
setl %al
movb %al, -0x57(%rbp)
movb -0x57(%rbp), %al
testb $0x1, %al
jne 0x10cb9
jmp 0x10cc4
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x10c89
movsbl -0x51(%rbp), %eax
cmpl $0x3a, %eax
jne 0x10d35
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rsi
movslq -0x14(%rbp), %rax
addq %rax, %rsi
movl -0x18(%rbp), %edx
callq 0xae60
cmpb $0x0, %al
jne 0x10d35
movq -0x10(%rbp), %rdi
movl -0x50(%rbp), %esi
movl -0x14(%rbp), %edx
subl -0x50(%rbp), %edx
callq 0xa5e0
movq %rax, -0x40(%rbp)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
cmpl -0x18(%rbp), %eax
jge 0x10d28
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
subl -0x14(%rbp), %edx
callq 0xa5e0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x40(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x10ef9
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x10c7b
jmp 0x10eed
movq -0x10(%rbp), %rdi
movslq -0x14(%rbp), %rax
addq %rax, %rdi
leaq 0x3a73(%rip), %rsi      # 0x147cd
callq 0x2190
movq -0x10(%rbp), %rcx
movslq -0x14(%rbp), %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
jne 0x10df6
movl -0x14(%rbp), %eax
addl $0x7, %eax
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movb (%rax,%rcx), %al
movb %al, -0x51(%rbp)
movsbl %al, %edi
callq 0xa7d0
movsbl %al, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x58(%rbp)
je 0x10dab
movl -0x14(%rbp), %eax
cmpl -0x18(%rbp), %eax
setl %al
movb %al, -0x58(%rbp)
movb -0x58(%rbp), %al
testb $0x1, %al
jne 0x10db4
jmp 0x10dbf
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x10d7c
movsbl -0x51(%rbp), %eax
cmpl $0x3a, %eax
jne 0x10df1
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
cmpl -0x18(%rbp), %eax
jge 0x10df1
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
subl -0x14(%rbp), %edx
callq 0xa5e0
movq %rax, -0x8(%rbp)
jmp 0x10ef9
jmp 0x10eeb
movq -0x10(%rbp), %rdi
movslq -0x14(%rbp), %rax
addq %rax, %rdi
leaq 0x2222(%rip), %rsi      # 0x1302a
callq 0x2190
movq -0x10(%rbp), %rcx
movslq -0x14(%rbp), %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
jne 0x10ee9
movl -0x14(%rbp), %eax
addl $0x3, %eax
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movb (%rax,%rcx), %al
movb %al, -0x51(%rbp)
movsbl %al, %edi
callq 0xa7d0
movsbl %al, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x59(%rbp)
je 0x10e59
movl -0x14(%rbp), %eax
cmpl -0x18(%rbp), %eax
setl %al
movb %al, -0x59(%rbp)
movb -0x59(%rbp), %al
testb $0x1, %al
jne 0x10e62
jmp 0x10e6d
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x10e2a
movsbl -0x51(%rbp), %eax
cmpl $0x28, %eax
jne 0x10ee7
movq -0x10(%rbp), %rdi
movl $0x29, %esi
callq 0xa940
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jle 0x10ee5
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x4c(%rbp), %edx
subl -0x14(%rbp), %edx
callq 0xa5e0
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
movl $0x3b, %esi
callq 0xa660
cmpl $0x2, %eax
jae 0x10ed4
movq -0x40(%rbp), %rdi
callq 0x2030
movq $0x0, -0x8(%rbp)
jmp 0x10ef9
movq -0x30(%rbp), %rax
movb $0x1, (%rax)
movq -0x40(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x10ef9
jmp 0x10ee7
jmp 0x10ee9
jmp 0x10eeb
jmp 0x10eed
jmp 0x10eef
jmp 0x10ef1
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)