import re


def is_function_decl(index, lines):
    """Check that the line is a function declaration"""

    line = lines[index]
    previous_line = lines[index - 1]
    types = ["char", "signed char", "unsigned char", "string", "short", "short int",
             "signed short", "signed short int", "unsigned short", "unsigned short int",
             "int", "signed", "signed int", "unsigned", "unsigned int", "long", "long int",
             "signed long", "signed long int", "unsigned long", "unsigned long int", "long long",
             "long long int", "signed long long", "signed long long int", "unsigned long long",
             "unsigned long long int", "float", "double", "long double", "struct", "bool", "void"]
    return_types = "".join([r"(?<=%s\s)|" % x for x in types])[:-1]
    previous_types = "".join(["%s|" % t for t in types])[:-1]

    return (re.search(r"\(", line) and
            re.search(r"^[^<;>]+$", line) and
            re.search(r"^[^<:>]+$", line) and
            not re.search(r"^\#", line) and
            not re.search(r"\(.*?\(", line) and
            not re.search(r"\=", line) and
            (re.search(r"(?<=%s).*?(?=\s?\()" % return_types, line) or
             re.search(r"((%s)\s*)$" % previous_types, previous_line)))