#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int isNumerich(char, char);
int matchStringPattern(char *, long *, long, char *);
char matchIntegerLiteral(char *fulltxt, long *cpos, long clen) {
  long cposOrig = *cpos;
  if (matchStringPattern(fulltxt, cpos, clen, "-") == 1) {
  }
  char hex = matchStringPattern(fulltxt, cpos, clen, "0x");
  if (isNumerich(fulltxt[*cpos], hex) == 0) {
    *cpos = cposOrig;
    return 0;
  }
  (*cpos)++;
  while (*cpos < clen && isNumerich(fulltxt[*cpos], hex) == 1) {
    (*cpos)++;
  }
  return 1;
}


x86 assembly (clang, -O0):
<matchIntegerLiteral>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xeae(%rip),%rcx
call   1030 <matchStringPattern@plt>
cmp    $0x1,%eax
jne    1165 <matchIntegerLiteral+0x45>
jmp    1165 <matchIntegerLiteral+0x45>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xe8a(%rip),%rcx
call   1030 <matchStringPattern@plt>
mov    %al,-0x29(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rcx),%rcx
mov    (%rax,%rcx,1),%al
movsbl %al,%edi
movsbl -0x29(%rbp),%esi
call   1040 <isNumerich@plt>
cmp    $0x0,%eax
jne    11b7 <matchIntegerLiteral+0x97>
mov    -0x28(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
movb   $0x0,-0x1(%rbp)
jmp    1225 <matchIntegerLiteral+0x105>
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
xor    %eax,%eax
cmp    -0x20(%rbp),%rcx
mov    %al,-0x2a(%rbp)
jge    11fe <matchIntegerLiteral+0xde>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rcx),%rcx
mov    (%rax,%rcx,1),%al
movsbl %al,%edi
movsbl -0x29(%rbp),%esi
call   1040 <isNumerich@plt>
cmp    $0x1,%eax
sete   %al
mov    %al,-0x2a(%rbp)
mov    -0x2a(%rbp),%al
test   $0x1,%al
jne    120e <matchIntegerLiteral+0xee>
jmp    1221 <matchIntegerLiteral+0x101>
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
jmp    11c5 <matchIntegerLiteral+0xa5>
movb   $0x1,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<matchIntegerLiteral>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
mov    (%rsi),%rbp
lea    0xec5(%rip),%rcx
call   1030 <matchStringPattern@plt>
lea    0xebb(%rip),%rcx
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <matchStringPattern@plt>
mov    (%rbx),%rcx
movsbl (%r15,%rcx,1),%edi
movsbl %al,%r12d
mov    %r12d,%esi
call   1040 <isNumerich@plt>
test   %eax,%eax
je     1196 <matchIntegerLiteral+0x76>
nopl   (%rax)
mov    (%rbx),%rax
add    $0x1,%rax
mov    %rax,(%rbx)
mov    $0x1,%bpl
cmp    %r14,%rax
jge    119b <matchIntegerLiteral+0x7b>
movsbl (%r15,%rax,1),%edi
mov    %r12d,%esi
call   1040 <isNumerich@plt>
cmp    $0x1,%eax
je     1170 <matchIntegerLiteral+0x50>
jmp    119b <matchIntegerLiteral+0x7b>
mov    %rbp,(%rbx)
xor    %ebp,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"-\00"
@.str.1 = [3 x i8] c"0x\00"
define signext i8 @matchIntegerLiteral(i8* %0, i64* %1, i64 %2) {
%4 = alloca i8
%5 = alloca i8*
%6 = alloca i64*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i8
store i8* %0, i8** %5
store i64* %1, i64** %6
store i64 %2, i64* %7
%10 = load i64*, i64** %6
%11 = load i64, i64* %10
store i64 %11, i64* %8
%12 = load i8*, i8** %5
%13 = load i64*, i64** %6
%14 = load i64, i64* %7
%15 = call i32 @matchStringPattern(i8* %12, i64* %13, i64 %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %18
17: ; preds = %3
br label %18
18: ; preds = %17, %3
%19 = load i8*, i8** %5
%20 = load i64*, i64** %6
%21 = load i64, i64* %7
%22 = call i32 @matchStringPattern(i8* %19, i64* %20, i64 %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%23 = trunc i32 %22 to i8
store i8 %23, i8* %9
%24 = load i8*, i8** %5
%25 = load i64*, i64** %6
%26 = load i64, i64* %25
%27 = getelementptr inbounds i8, i8* %24, i64 %26
%28 = load i8, i8* %27
%29 = load i8, i8* %9
%30 = call i32 @isNumerich(i8 signext %28, i8 signext %29)
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %18
%33 = load i64, i64* %8
%34 = load i64*, i64** %6
store i64 %33, i64* %34
store i8 0, i8* %4
br label %60
35: ; preds = %18
%36 = load i64*, i64** %6
%37 = load i64, i64* %36
%38 = add nsw i64 %37, 1
store i64 %38, i64* %36
br label %39
39: ; preds = %55, %35
%40 = load i64*, i64** %6
%41 = load i64, i64* %40
%42 = load i64, i64* %7
%43 = icmp slt i64 %41, %42
br i1 %43, label %44, label %53
44: ; preds = %39
%45 = load i8*, i8** %5
%46 = load i64*, i64** %6
%47 = load i64, i64* %46
%48 = getelementptr inbounds i8, i8* %45, i64 %47
%49 = load i8, i8* %48
%50 = load i8, i8* %9
%51 = call i32 @isNumerich(i8 signext %49, i8 signext %50)
%52 = icmp eq i32 %51, 1
br label %53
53: ; preds = %44, %39
%54 = phi i1 [ false, %39 ], [ %52, %44 ]
br i1 %54, label %55, label %59
55: ; preds = %53
%56 = load i64*, i64** %6
%57 = load i64, i64* %56
%58 = add nsw i64 %57, 1
store i64 %58, i64* %56
br label %39
59: ; preds = %53
store i8 1, i8* %4
br label %60
60: ; preds = %59, %32
%61 = load i8, i8* %4
ret i8 %61
}

LLVM IR (-O2):
@.str = [2 x i8] c"-\00"
@.str.1 = [3 x i8] c"0x\00"
define signext i8 @matchIntegerLiteral(i8* %0, i64* %1, i64 %2) {
%4 = load i64, i64* %1
%5 = tail call i32 @matchStringPattern(i8* %0, i64* %1, i64 %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @matchStringPattern(i8* %0, i64* %1, i64 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%7 = trunc i32 %6 to i8
%8 = load i64, i64* %1
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = tail call i32 @isNumerich(i8 signext %10, i8 signext %7)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %3
store i64 %4, i64* %1
br label %23
14: ; preds = %3, %18
%15 = load i64, i64* %1
%16 = add nsw i64 %15, 1
store i64 %16, i64* %1
%17 = icmp slt i64 %16, %2
br i1 %17, label %18, label %23
18: ; preds = %14
%19 = getelementptr inbounds i8, i8* %0, i64 %16
%20 = load i8, i8* %19
%21 = tail call i32 @isNumerich(i8 signext %20, i8 signext %7)
%22 = icmp eq i32 %21, 1
br i1 %22, label %14, label %23
23: ; preds = %18, %14, %13
%24 = phi i8 [ 0, %13 ], [ 1, %14 ], [ 1, %18 ]
ret i8 %24
}