Decide a C integer literal Objective
Given an ASCII string, decide whether it is a valid C integer literal.
C integer literal
A C integer literal consists of:

One of:

0 followed by zero or more octal digits (0–7)

A nonzero decimal digit followed by zero or more decimal digits (0–9)

0X or 0x, followed by one or more hexadecimal digits (0–9, A–F, and a–f)



optionally followed by one of:

One of U or u, which are the &quot;unsigned&quot; suffixes

One of L, l, LL, or ll, which are the &quot;long&quot; and &quot;long long&quot; suffixes

Any combination of the above, in any order.




Note that there can be arbitrarily many digits, even though C doesn't support arbitrary-length integers. Likewise, even if the literal with l and co would overflow the long type or co, it is still considered a valid literal.
Also note that there must not be a leading plus or minus sign, for it is not considered to be a part of the literal.
Rules

It is implementation-defined to accept leading or trailing whitespaces.

Non-ASCII string falls in don't care situation.


Examples
Truthy

0

007

42u

42lu

42UL

19827489765981697847893769837689346573uLL (Digits can be arbitrarily many even if it wouldn't fit the unsigned long long type)

0x8f6aa032838467beee3939428l (So can to the long type)

0XCa0 (You can mix cases)


Falsy

08 (Non-octal digit)

0x (A digit must follow X or x)

-42 (Leading signature isn't a part of the literal)

42Ll (Only LL or ll is valid for the long long type)

42LLLL (Redundant type specifier)

42Uu (Redundant type specifier)

42Ulu (Redundant type specifier)

42lul (Redundant type specifier)

42H (Invalid type specifier)

0b1110010000100100001 (Valid C++, but not valid C)

Hello

Empty string


Ungolfed solution
Haskell
Doesn't recognize leading or trailing whitespaces.
Returns () on success. Monadic failure otherwise.
import Text.ParserCombinators.ReadP

decideCIntegerLit :: ReadP ()
decideCIntegerLit = do
    choice [
        do
            '0' &lt;- get
            munch (flip elem &quot;01234567&quot;),
        do
            satisfy (flip elem &quot;123456789&quot;)
            munch (flip elem &quot;0123456789&quot;),
        do
            '0' &lt;- get
            satisfy (flip elem &quot;Xx&quot;)
            munch1 (flip elem &quot;0123456789ABCDEFabcdef&quot;)
        ]
    let unsigned = satisfy (flip elem &quot;Uu&quot;)
    let long = string &quot;l&quot; +++ string &quot;L&quot; +++ string &quot;ll&quot; +++ string &quot;LL&quot;
    (unsigned &gt;&gt; long &gt;&gt; return ()) +++ (optional long &gt;&gt; optional unsigned)
    eof
Retina 0.8.2, 60 59 bytes
i`^(0[0-7]*|0x[\da-f]+|[1-9]\d*)(u)?(l)?(?-i:\3?)(?(2)|u?)$

Try it online! Link includes test cases. Edit: Saved 1 byte thanks to @FryAmTheEggMan. Explanation:
i`

Match case-insensitively.
^(0[0-7]*|0x[\da-f]+|[1-9]\d*)

Start with either octal, hex or decimal.
(u)?

Optional unsigned specifier.
(l)?

Optional length specifier.
(?-i:\3?)

Optionally repeat the length specifier case sensitively.
(?(2)|u?)$

If no unsigned specifier yet, then another chance for an optional specifier, before the end of the literal.