#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_2() {
  const char *input = "231+ 1421 - 7";
  unsigned int len, pos;
  len = strlen(input);
  pos = 0;
  check_token(input, len, &pos, "231", 0);
  pos += 3;
  check_token(input, len, &pos, "+", pos);
  pos += 1;
  check_token(input, len, &pos, "1421", pos + 1);
  pos += 4;
  check_token(input, len, &pos, "-", pos + 1);
  pos += 1;
  check_token(input, len, &pos, "7", pos + 1);
}


x86 assembly (clang, -O0):
<test_lex_look_ahead_2>:
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    0xeb6(%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
lea    -0x10(%rbp),%rdx
lea    0xe93(%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    0xe6d(%rip),%rcx
call   1040 <check_token@plt>
mov    -0x10(%rbp),%eax
add    $0x4,%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    0xe4a(%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    0xe15(%rip),%rcx
call   1040 <check_token@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_lex_look_ahead_2>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xed1(%rip),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
movl   $0x0,0xc(%rsp)
lea    0xec6(%rip),%rcx
lea    0xc(%rsp),%r14
mov    %rbx,%rdi
mov    %eax,%esi
mov    %r14,%rdx
xor    %r8d,%r8d
call   1040 <check_token@plt>
mov    0xc(%rsp),%r8d
add    $0x3,%r8d
mov    %r8d,0xc(%rsp)
lea    0xea0(%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
lea    0xe7d(%rip),%rcx
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
call   1040 <check_token@plt>
mov    0xc(%rsp),%r8d
lea    0x4(%r8),%eax
mov    %eax,0xc(%rsp)
add    $0x5,%r8d
lea    0xe5d(%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
lea    0xe2b(%rip),%rcx
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
call   1040 <check_token@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"231+ 1421 - 7\00"
@.str.1 = [4 x i8] c"231\00"
@.str.2 = [2 x i8] c"+\00"
@.str.3 = [5 x i8] c"1421\00"
@.str.4 = [2 x i8] c"-\00"
@.str.5 = [2 x i8] c"7\00"
define void @test_lex_look_ahead_2() {
%1 = alloca i8*
%2 = alloca i32
%3 = alloca i32
store i8* getelementptr inbounds ([14 x i8], [14 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 = 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 %13)
%15 = load i32, i32* %3
%16 = add i32 %15, 1
store i32 %16, i32* %3
%17 = load i8*, i8** %1
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = add i32 %19, 1
%21 = call i32 @check_token(i8* %17, i32 %18, i32* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %20)
%22 = load i32, i32* %3
%23 = add i32 %22, 4
store i32 %23, i32* %3
%24 = load i8*, i8** %1
%25 = load i32, i32* %2
%26 = load i32, i32* %3
%27 = add i32 %26, 1
%28 = 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 %27)
%29 = load i32, i32* %3
%30 = add i32 %29, 1
store i32 %30, i32* %3
%31 = load i8*, i8** %1
%32 = load i32, i32* %2
%33 = load i32, i32* %3
%34 = add i32 %33, 1
%35 = call i32 @check_token(i8* %31, i32 %32, i32* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i32 %34)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"231+ 1421 - 7\00"
@.str.1 = [4 x i8] c"231\00"
@.str.2 = [2 x i8] c"+\00"
@.str.3 = [5 x i8] c"1421\00"
@.str.4 = [2 x i8] c"-\00"
@.str.5 = [2 x i8] c"7\00"
define void @test_lex_look_ahead_2() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @strlen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %1
%4 = call i32 @check_token(i8* getelementptr inbounds ([14 x i8], [14 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 = call i32 @check_token(i8* getelementptr inbounds ([14 x i8], [14 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 %6)
%8 = load i32, i32* %1
%9 = add i32 %8, 1
store i32 %9, i32* %1
%10 = add i32 %8, 2
%11 = call i32 @check_token(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %3, i32* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %1
%13 = add i32 %12, 4
store i32 %13, i32* %1
%14 = add i32 %12, 5
%15 = call i32 @check_token(i8* getelementptr inbounds ([14 x i8], [14 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 %14)
%16 = load i32, i32* %1
%17 = add i32 %16, 1
store i32 %17, i32* %1
%18 = add i32 %16, 2
%19 = call i32 @check_token(i8* getelementptr inbounds ([14 x i8], [14 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 %18)
ret void
}