#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 /*<<< orphan*/ check_token(char const *, unsigned int, unsigned int *,
                               char *, unsigned int);
unsigned int strlen(char const *);
void test_lex_look_ahead_3() {
  const char *input = "int a=2; int b=17;";
  unsigned int len, pos;
  len = strlen(input);
  pos = 0;
  check_token(input, len, &pos, "int", 0);
  pos += 3;
  check_token(input, len, &pos, "a", pos + 1);
  pos += 1;
  check_token(input, len, &pos, "=", pos);
  pos += 1;
  check_token(input, len, &pos, "2", pos);
  pos += 1;
  check_token(input, len, &pos, ";", pos);
  pos += 1;
  check_token(input, len, &pos, "int", pos + 1);
  pos += 3;
  check_token(input, len, &pos, "b", pos + 1);
  pos += 1;
  check_token(input, len, &pos, "=", pos);
  pos += 1;
  check_token(input, len, &pos, "17", pos);
}


x86 assembly (clang, -O0):
<test_lex_look_ahead_3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    -0x10(%rbp),%rdx
lea    0xebb(%rip),%rcx
xor    %r8d,%r8d
call   1040 <check_token@plt>
mov    -0x10(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%r8d
add    $0x1,%r8d
lea    -0x10(%rbp),%rdx
lea    0xe94(%rip),%rcx
call   1040 <check_token@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%r8d
lea    -0x10(%rbp),%rdx
lea    0xe72(%rip),%rcx
call   1040 <check_token@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%r8d
lea    -0x10(%rbp),%rdx
lea    0xe50(%rip),%rcx
call   1040 <check_token@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%r8d
lea    -0x10(%rbp),%rdx
lea    0xe22(%rip),%rcx
call   1040 <check_token@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%r8d
add    $0x1,%r8d
lea    -0x10(%rbp),%rdx
lea    0xdfc(%rip),%rcx
call   1040 <check_token@plt>
mov    -0x10(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%r8d
add    $0x1,%r8d
lea    -0x10(%rbp),%rdx
lea    0xdde(%rip),%rcx
call   1040 <check_token@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%r8d
lea    -0x10(%rbp),%rdx
lea    0xdb6(%rip),%rcx
call   1040 <check_token@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%r8d
lea    -0x10(%rbp),%rdx
lea    0xd98(%rip),%rcx
call   1040 <check_token@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_lex_look_ahead_3>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xecd(%rip),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
movl   $0x0,0xc(%rsp)
lea    0xec7(%rip),%r15
lea    0xc(%rsp),%r14
mov    %rbx,%rdi
mov    %eax,%esi
mov    %r14,%rdx
mov    %r15,%rcx
xor    %r8d,%r8d
call   1040 <check_token@plt>
mov    0xc(%rsp),%r8d
lea    0x3(%r8),%eax
mov    %eax,0xc(%rsp)
add    $0x4,%r8d
lea    0xe9b(%rip),%rcx
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
call   1040 <check_token@plt>
mov    0xc(%rsp),%r8d
add    $0x1,%r8d
mov    %r8d,0xc(%rsp)
lea    0xe7b(%rip),%r12
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
mov    %r12,%rcx
call   1040 <check_token@plt>
mov    0xc(%rsp),%r8d
add    $0x1,%r8d
mov    %r8d,0xc(%rsp)
lea    0xe58(%rip),%rcx
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
call   1040 <check_token@plt>
mov    0xc(%rsp),%r8d
add    $0x1,%r8d
mov    %r8d,0xc(%rsp)
lea    0xe2c(%rip),%rcx
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
call   1040 <check_token@plt>
mov    0xc(%rsp),%r8d
lea    0x1(%r8),%eax
mov    %eax,0xc(%rsp)
add    $0x2,%r8d
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
mov    %r15,%rcx
call   1040 <check_token@plt>
mov    0xc(%rsp),%r8d
lea    0x3(%r8),%eax
mov    %eax,0xc(%rsp)
add    $0x4,%r8d
lea    0xdf2(%rip),%rcx
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
call   1040 <check_token@plt>
mov    0xc(%rsp),%r8d
add    $0x1,%r8d
mov    %r8d,0xc(%rsp)
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
mov    %r12,%rcx
call   1040 <check_token@plt>
mov    0xc(%rsp),%r8d
add    $0x1,%r8d
mov    %r8d,0xc(%rsp)
lea    0xdb4(%rip),%rcx
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
call   1040 <check_token@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"int a=2; int b=17;\00"
@.str.1 = [4 x i8] c"int\00"
@.str.2 = [2 x i8] c"a\00"
@.str.3 = [2 x i8] c"=\00"
@.str.4 = [2 x i8] c"2\00"
@.str.5 = [2 x i8] c";\00"
@.str.6 = [2 x i8] c"b\00"
@.str.7 = [3 x i8] c"17\00"
define void @test_lex_look_ahead_3() {
%1 = alloca i8*
%2 = alloca i32
%3 = alloca i32
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8** %1
%4 = load i8*, i8** %1
%5 = call i32 @strlen(i8* %4)
store i32 %5, i32* %2
store i32 0, i32* %3
%6 = load i8*, i8** %1
%7 = load i32, i32* %2
%8 = call i32 @check_token(i8* %6, i32 %7, i32* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 0)
%9 = load i32, i32* %3
%10 = add i32 %9, 3
store i32 %10, i32* %3
%11 = load i8*, i8** %1
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = add i32 %13, 1
%15 = call i32 @check_token(i8* %11, i32 %12, i32* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 %14)
%16 = load i32, i32* %3
%17 = add i32 %16, 1
store i32 %17, i32* %3
%18 = load i8*, i8** %1
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = call i32 @check_token(i8* %18, i32 %19, i32* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 %20)
%22 = load i32, i32* %3
%23 = add i32 %22, 1
store i32 %23, i32* %3
%24 = load i8*, i8** %1
%25 = load i32, i32* %2
%26 = load i32, i32* %3
%27 = call i32 @check_token(i8* %24, i32 %25, i32* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32 %26)
%28 = load i32, i32* %3
%29 = add i32 %28, 1
store i32 %29, i32* %3
%30 = load i8*, i8** %1
%31 = load i32, i32* %2
%32 = load i32, i32* %3
%33 = call i32 @check_token(i8* %30, i32 %31, i32* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i32 %32)
%34 = load i32, i32* %3
%35 = add i32 %34, 1
store i32 %35, i32* %3
%36 = load i8*, i8** %1
%37 = load i32, i32* %2
%38 = load i32, i32* %3
%39 = add i32 %38, 1
%40 = call i32 @check_token(i8* %36, i32 %37, i32* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %39)
%41 = load i32, i32* %3
%42 = add i32 %41, 3
store i32 %42, i32* %3
%43 = load i8*, i8** %1
%44 = load i32, i32* %2
%45 = load i32, i32* %3
%46 = add i32 %45, 1
%47 = call i32 @check_token(i8* %43, i32 %44, i32* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), i32 %46)
%48 = load i32, i32* %3
%49 = add i32 %48, 1
store i32 %49, i32* %3
%50 = load i8*, i8** %1
%51 = load i32, i32* %2
%52 = load i32, i32* %3
%53 = call i32 @check_token(i8* %50, i32 %51, i32* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 %52)
%54 = load i32, i32* %3
%55 = add i32 %54, 1
store i32 %55, i32* %3
%56 = load i8*, i8** %1
%57 = load i32, i32* %2
%58 = load i32, i32* %3
%59 = call i32 @check_token(i8* %56, i32 %57, i32* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32 %58)
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"int a=2; int b=17;\00"
@.str.1 = [4 x i8] c"int\00"
@.str.2 = [2 x i8] c"a\00"
@.str.3 = [2 x i8] c"=\00"
@.str.4 = [2 x i8] c"2\00"
@.str.5 = [2 x i8] c";\00"
@.str.6 = [2 x i8] c"b\00"
@.str.7 = [3 x i8] c"17\00"
define void @test_lex_look_ahead_3() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @strlen(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %1
%4 = call i32 @check_token(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %3, i32* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 0)
%5 = load i32, i32* %1
%6 = add i32 %5, 3
store i32 %6, i32* %1
%7 = add i32 %5, 4
%8 = call i32 @check_token(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %3, i32* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%9 = load i32, i32* %1
%10 = add i32 %9, 1
store i32 %10, i32* %1
%11 = call i32 @check_token(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %3, i32* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %1
%13 = add i32 %12, 1
store i32 %13, i32* %1
%14 = call i32 @check_token(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %3, i32* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32 %13)
%15 = load i32, i32* %1
%16 = add i32 %15, 1
store i32 %16, i32* %1
%17 = call i32 @check_token(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %3, i32* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i32 %16)
%18 = load i32, i32* %1
%19 = add i32 %18, 1
store i32 %19, i32* %1
%20 = add i32 %18, 2
%21 = call i32 @check_token(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %3, i32* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = load i32, i32* %1
%23 = add i32 %22, 3
store i32 %23, i32* %1
%24 = add i32 %22, 4
%25 = call i32 @check_token(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %3, i32* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), i32 %24)
%26 = load i32, i32* %1
%27 = add i32 %26, 1
store i32 %27, i32* %1
%28 = call i32 @check_token(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %3, i32* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 %27)
%29 = load i32, i32* %1
%30 = add i32 %29, 1
store i32 %30, i32* %1
%31 = call i32 @check_token(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %3, i32* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32 %30)
ret void
}