// File: /workspace/github_c_makefile_star2_O0/System-Glitch[P]ESGILinter-C/src/parsing_type.c
// Function: parse_type
match_t *parse_type(char *line) {
	unsigned int index = 0;
	int type_start = -1;
	int type_end = -1;

	size_t length = strlen(line);
	unsigned char c;
	match_t *match = NULL;

	if(length < 3) return NULL; //3 is the minimum size for a declaration

	SKIP_WHITESPACES

	if(strstr(line + index, "extern") == line + index) //Skip extern keyword
		index += 6;

	SKIP_WHITESPACES

	if(strstr(line + index, "static") == line + index) //Skip static keyword
		index += 6;

	SKIP_WHITESPACES

	if(strstr(line + index, "volatile") == line + index) //Skip volatile keyword
		index += 8;

	SKIP_WHITESPACES

	if(strstr(line + index, "const") == line + index) //Skip const keyword
		index += 5;

	SKIP_WHITESPACES

	if(strstr(line + index, "signed") == line + index) //Skip signed keyword
		index += 6;

	SKIP_WHITESPACES

	type_start = index;

	if(!parse_type_word(line, length, &index)) //No type word found, it's not a variable declaration
		return NULL;

	if(line[index] == ';') //If found semi-colon, it's not a variable declaration
		return NULL;

	//Find star	
	while(index < length) {
		SKIP_WHITESPACES

		//If found something else than star, end
		if(c != '*') {
			index--;
			break;
		} else if(c == ';') //If found semi-colon, it's not a variable declaration
			return NULL;
		else
			index++;
	}

	type_end = index;

	if(type_end != -1) {
		match = match_init();
		if(match != NULL) {
			match->index_start = type_start;
			match->index_end = type_end;
		}
	}

	return match;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl $0xffffffff, -0x18(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x1c(%rbp) # imm = 0xFFFFFFFF
movq -0x10(%rbp), %rdi
callq 0x2090
movq %rax, -0x28(%rbp)
movq $0x0, -0x38(%rbp)
cmpq $0x3, -0x28(%rbp)
jae 0x8ada
movq $0x0, -0x8(%rbp)
jmp 0x8e65
jmp 0x8adc
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
movb (%rax,%rcx), %al
movb %al, -0x29(%rbp)
movsbl %al, %edi
callq 0xa7d0
movsbl %al, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x39(%rbp)
je 0x8b0b
movl -0x14(%rbp), %eax
cmpq -0x28(%rbp), %rax
setb %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
testb $0x1, %al
jne 0x8b14
jmp 0x8b1f
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x8adc
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %eax
addq %rax, %rdi
leaq 0xbcb2(%rip), %rsi      # 0x147e2
callq 0x2190
movq -0x10(%rbp), %rcx
movl -0x14(%rbp), %edx
addq %rdx, %rcx
cmpq %rcx, %rax
jne 0x8b4d
movl -0x14(%rbp), %eax
addl $0x6, %eax
movl %eax, -0x14(%rbp)
jmp 0x8b4f
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
movb (%rax,%rcx), %al
movb %al, -0x29(%rbp)
movsbl %al, %edi
callq 0xa7d0
movsbl %al, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x3a(%rbp)
je 0x8b7e
movl -0x14(%rbp), %eax
cmpq -0x28(%rbp), %rax
setb %al
movb %al, -0x3a(%rbp)
movb -0x3a(%rbp), %al
testb $0x1, %al
jne 0x8b87
jmp 0x8b92
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x8b4f
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %eax
addq %rax, %rdi
leaq 0xbc6e(%rip), %rsi      # 0x14811
callq 0x2190
movq -0x10(%rbp), %rcx
movl -0x14(%rbp), %edx
addq %rdx, %rcx
cmpq %rcx, %rax
jne 0x8bc0
movl -0x14(%rbp), %eax
addl $0x6, %eax
movl %eax, -0x14(%rbp)
jmp 0x8bc2
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
movb (%rax,%rcx), %al
movb %al, -0x29(%rbp)
movsbl %al, %edi
callq 0xa7d0
movsbl %al, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x3b(%rbp)
je 0x8bf1
movl -0x14(%rbp), %eax
cmpq -0x28(%rbp), %rax
setb %al
movb %al, -0x3b(%rbp)
movb -0x3b(%rbp), %al
testb $0x1, %al
jne 0x8bfa
jmp 0x8c05
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x8bc2
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %eax
addq %rax, %rdi
leaq 0xbc1e(%rip), %rsi      # 0x14834
callq 0x2190
movq -0x10(%rbp), %rcx
movl -0x14(%rbp), %edx
addq %rdx, %rcx
cmpq %rcx, %rax
jne 0x8c33
movl -0x14(%rbp), %eax
addl $0x8, %eax
movl %eax, -0x14(%rbp)
jmp 0x8c35
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
movb (%rax,%rcx), %al
movb %al, -0x29(%rbp)
movsbl %al, %edi
callq 0xa7d0
movsbl %al, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x3c(%rbp)
je 0x8c64
movl -0x14(%rbp), %eax
cmpq -0x28(%rbp), %rax
setb %al
movb %al, -0x3c(%rbp)
movb -0x3c(%rbp), %al
testb $0x1, %al
jne 0x8c6d
jmp 0x8c78
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x8c35
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %eax
addq %rax, %rdi
leaq 0xbb35(%rip), %rsi      # 0x147be
callq 0x2190
movq -0x10(%rbp), %rcx
movl -0x14(%rbp), %edx
addq %rdx, %rcx
cmpq %rcx, %rax
jne 0x8ca6
movl -0x14(%rbp), %eax
addl $0x5, %eax
movl %eax, -0x14(%rbp)
jmp 0x8ca8
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
movb (%rax,%rcx), %al
movb %al, -0x29(%rbp)
movsbl %al, %edi
callq 0xa7d0
movsbl %al, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x3d(%rbp)
je 0x8cd7
movl -0x14(%rbp), %eax
cmpq -0x28(%rbp), %rax
setb %al
movb %al, -0x3d(%rbp)
movb -0x3d(%rbp), %al
testb $0x1, %al
jne 0x8ce0
jmp 0x8ceb
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x8ca8
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %eax
addq %rax, %rdi
leaq 0xba9f(%rip), %rsi      # 0x1479b
callq 0x2190
movq -0x10(%rbp), %rcx
movl -0x14(%rbp), %edx
addq %rdx, %rcx
cmpq %rcx, %rax
jne 0x8d19
movl -0x14(%rbp), %eax
addl $0x6, %eax
movl %eax, -0x14(%rbp)
jmp 0x8d1b
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
movb (%rax,%rcx), %al
movb %al, -0x29(%rbp)
movsbl %al, %edi
callq 0xa7d0
movsbl %al, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x3e(%rbp)
je 0x8d4a
movl -0x14(%rbp), %eax
cmpq -0x28(%rbp), %rax
setb %al
movb %al, -0x3e(%rbp)
movb -0x3e(%rbp), %al
testb $0x1, %al
jne 0x8d53
jmp 0x8d5e
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x8d1b
movl -0x14(%rbp), %eax
movl %eax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
leaq -0x14(%rbp), %rdx
callq 0x8e70
cmpb $0x0, %al
jne 0x8d86
movq $0x0, -0x8(%rbp)
jmp 0x8e65
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
movsbl (%rax,%rcx), %eax
cmpl $0x3b, %eax
jne 0x8da3
movq $0x0, -0x8(%rbp)
jmp 0x8e65
jmp 0x8da5
movl -0x14(%rbp), %eax
cmpq -0x28(%rbp), %rax
jae 0x8e2a
jmp 0x8db0
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
movb (%rax,%rcx), %al
movb %al, -0x29(%rbp)
movsbl %al, %edi
callq 0xa7d0
movsbl %al, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x3f(%rbp)
je 0x8ddf
movl -0x14(%rbp), %eax
cmpq -0x28(%rbp), %rax
setb %al
movb %al, -0x3f(%rbp)
movb -0x3f(%rbp), %al
testb $0x1, %al
jne 0x8de8
jmp 0x8df3
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x8db0
movzbl -0x29(%rbp), %eax
cmpl $0x2a, %eax
je 0x8e07
movl -0x14(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x8e2a
movzbl -0x29(%rbp), %eax
cmpl $0x3b, %eax
jne 0x8e1a
movq $0x0, -0x8(%rbp)
jmp 0x8e65
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x8e25
jmp 0x8da5
movl -0x14(%rbp), %eax
movl %eax, -0x1c(%rbp)
cmpl $-0x1, -0x1c(%rbp)
je 0x8e5d
movb $0x0, %al
callq 0xae40
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x8e5b
movl -0x18(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, (%rax)
movl -0x1c(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x4(%rax)
jmp 0x8e5d
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nop