#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 */
char *nextToken(int argc, char **argv) {
  static int count;
  static char **ptr;
  static int index = 0;
  if (argv) {
    ptr = argv;
    count = argc;
  }
  if (index == count)
    return NULL;
  else
    return ptr[index++];
}


x86 assembly (clang, -O0):
<nextToken>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     112a <nextToken+0x2a>
mov    -0x18(%rbp),%rax
mov    %rax,0x2f0f(%rip)
mov    -0xc(%rbp),%eax
mov    %eax,0x2efe(%rip)
mov    0x2f08(%rip),%eax
cmp    0x2ef2(%rip),%eax
jne    1149 <nextToken+0x49>
movq   $0x0,-0x8(%rbp)
jmp    116c <nextToken+0x6c>
mov    0x2ee0(%rip),%rax
mov    0x2ee2(%rip),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,0x2ed7(%rip)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nextToken>:
test   %rsi,%rsi
je     1114 <nextToken+0x14>
mov    %rsi,0x2f24(%rip)
mov    %edi,0x2f16(%rip)
jmp    111a <nextToken+0x1a>
mov    0x2f0e(%rip),%edi
movslq 0x2f17(%rip),%rax
cmp    %edi,%eax
jne    1128 <nextToken+0x28>
xor    %eax,%eax
ret
mov    0x2f01(%rip),%rcx
lea    0x1(%rax),%edx
mov    %edx,0x2f00(%rip)
mov    (%rcx,%rax,8),%rax
ret

LLVM IR (-O0):
@nextToken.count = internal global i32 0
@nextToken.ptr = internal global i8** null
@nextToken.index = internal global i32 0
define i8* @nextToken(i32 %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8**
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i8**, i8*** %5
%7 = icmp ne i8** %6, null
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i8**, i8*** %5
store i8** %9, i8*** @nextToken.ptr
%10 = load i32, i32* %4
store i32 %10, i32* @nextToken.count
br label %11
11: ; preds = %8, %2
%12 = load i32, i32* @nextToken.index
%13 = load i32, i32* @nextToken.count
%14 = icmp eq i32 %12, %13
br i1 %14, label %15, label %16
15: ; preds = %11
store i8* null, i8** %3
br label %23
16: ; preds = %11
%17 = load i8**, i8*** @nextToken.ptr
%18 = load i32, i32* @nextToken.index
%19 = add nsw i32 %18, 1
store i32 %19, i32* @nextToken.index
%20 = sext i32 %18 to i64
%21 = getelementptr inbounds i8*, i8** %17, i64 %20
%22 = load i8*, i8** %21
store i8* %22, i8** %3
br label %23
23: ; preds = %16, %15
%24 = load i8*, i8** %3
ret i8* %24
}

LLVM IR (-O2):
@nextToken.count = internal unnamed_addr global i32 0
@nextToken.ptr = internal unnamed_addr global i8** null
@nextToken.index = internal unnamed_addr global i32 0
define i8* @nextToken(i32 %0, i8** %1) {
%3 = icmp eq i8** %1, null
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = load i32, i32* @nextToken.count
br label %7
6: ; preds = %2
store i8** %1, i8*** @nextToken.ptr
store i32 %0, i32* @nextToken.count
br label %7
7: ; preds = %4, %6
%8 = phi i32 [ %5, %4 ], [ %0, %6 ]
%9 = load i32, i32* @nextToken.index
%10 = icmp eq i32 %9, %8
br i1 %10, label %17, label %11
11: ; preds = %7
%12 = load i8**, i8*** @nextToken.ptr
%13 = add nsw i32 %9, 1
store i32 %13, i32* @nextToken.index
%14 = sext i32 %9 to i64
%15 = getelementptr inbounds i8*, i8** %12, i64 %14
%16 = load i8*, i8** %15
br label %17
17: ; preds = %7, %11
%18 = phi i8* [ %16, %11 ], [ null, %7 ]
ret i8* %18
}