#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*/ isspace(char);
int lexer(char *);
int /*<<< orphan*/ printf(char *, char *, int, int);
int strlen(char *);
void tokenize(char *data) {
  int i = 0;
  int j = 0;
  char retval[20][80];
  while (*data != '\0') {
    if (!isspace(*data)) {
      retval[i][j] = *data;
      data++;
      j++;
    } else {
      data++;
      j = 0;
      i++;
    }
    retval[i][j] = '\0';
  }
  int k;
  for (k = 0; k < 9; k++) {
    int len = strlen(retval[k]);
    printf("Token: %s Length: %d Type: %d \n", retval[k], len,
           lexer(retval[k]));
  }
}


x86 assembly (clang, -O0):
<tokenize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x670,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11f6 <tokenize+0xb6>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1050 <isspace@plt>
cmp    $0x0,%eax
jne    11bb <tokenize+0x7b>
mov    -0x8(%rbp),%rax
mov    (%rax),%dl
movslq -0xc(%rbp),%rcx
lea    -0x650(%rbp),%rax
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11d7 <tokenize+0x97>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
movslq -0xc(%rbp),%rcx
lea    -0x650(%rbp),%rax
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    115d <tokenize+0x1d>
movl   $0x0,-0x654(%rbp)
cmpl   $0x9,-0x654(%rbp)
jge    129e <tokenize+0x15e>
movslq -0x654(%rbp),%rax
lea    -0x650(%rbp),%rdi
imul   $0x50,%rax,%rax
add    %rax,%rdi
call   1030 <strlen@plt>
mov    %eax,-0x658(%rbp)
movslq -0x654(%rbp),%rcx
lea    -0x650(%rbp),%rax
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
mov    %rax,-0x668(%rbp)
mov    -0x658(%rbp),%eax
mov    %eax,-0x65c(%rbp)
movslq -0x654(%rbp),%rax
lea    -0x650(%rbp),%rdi
imul   $0x50,%rax,%rax
add    %rax,%rdi
call   1060 <lexer@plt>
mov    -0x668(%rbp),%rsi
mov    -0x65c(%rbp),%edx
mov    %eax,%ecx
lea    0xd7b(%rip),%rdi
call   1040 <printf@plt>
mov    -0x654(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x654(%rbp)
jmp    1200 <tokenize+0xc0>
add    $0x670,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tokenize>:
push   %rbp
push   %r14
push   %rbx
sub    $0x640,%rsp
mov    (%rdi),%al
test   %al,%al
je     11b0 <tokenize+0x70>
mov    %rdi,%rbx
add    $0x1,%rbx
xor    %ebp,%ebp
xor    %r14d,%r14d
jmp    1186 <tokenize+0x46>
nop
add    $0x1,%r14d
movslq %r14d,%rax
xor    %ebp,%ebp
movslq %ebp,%rcx
lea    (%rax,%rax,4),%rax
shl    $0x4,%rax
add    %rsp,%rax
movb   $0x0,(%rcx,%rax,1)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     11b0 <tokenize+0x70>
movsbl %al,%edi
call   1050 <isspace@plt>
test   %eax,%eax
jne    1160 <tokenize+0x20>
movzbl -0x1(%rbx),%ecx
movslq %r14d,%rax
movslq %ebp,%rbp
lea    (%rax,%rax,4),%rdx
shl    $0x4,%rdx
add    %rsp,%rdx
mov    %cl,0x0(%rbp,%rdx,1)
add    $0x1,%ebp
jmp    1169 <tokenize+0x29>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1060 <lexer@plt>
lea    0xe34(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
mov    %eax,%ecx
call   1040 <printf@plt>
lea    0x50(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1060 <lexer@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
mov    %eax,%ecx
call   1040 <printf@plt>
lea    0xa0(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1060 <lexer@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
mov    %eax,%ecx
call   1040 <printf@plt>
lea    0xf0(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1060 <lexer@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
mov    %eax,%ecx
call   1040 <printf@plt>
lea    0x140(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1060 <lexer@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
mov    %eax,%ecx
call   1040 <printf@plt>
lea    0x190(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1060 <lexer@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
mov    %eax,%ecx
call   1040 <printf@plt>
lea    0x1e0(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1060 <lexer@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
mov    %eax,%ecx
call   1040 <printf@plt>
lea    0x230(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1060 <lexer@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
mov    %eax,%ecx
call   1040 <printf@plt>
lea    0x280(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1060 <lexer@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
mov    %eax,%ecx
call   1040 <printf@plt>
add    $0x640,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Token: %s Length: %d Type: %d \0A\00"
define void @tokenize(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca [20 x [80 x i8]]
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
store i32 0, i32* %4
br label %8
8: ; preds = %36, %1
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %43
13: ; preds = %8
%14 = load i8*, i8** %2
%15 = load i8, i8* %14
%16 = call i32 @isspace(i8 signext %15)
%17 = icmp ne i32 %16, 0
br i1 %17, label %31, label %18
18: ; preds = %13
%19 = load i8*, i8** %2
%20 = load i8, i8* %19
%21 = load i32, i32* %3
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [20 x [80 x i8]], [20 x [80 x i8]]* %5, i64 0, i64 %22
%24 = load i32, i32* %4
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [80 x i8], [80 x i8]* %23, i64 0, i64 %25
store i8 %20, i8* %26
%27 = load i8*, i8** %2
%28 = getelementptr inbounds i8, i8* %27, i32 1
store i8* %28, i8** %2
%29 = load i32, i32* %4
%30 = add nsw i32 %29, 1
store i32 %30, i32* %4
br label %36
31: ; preds = %13
%32 = load i8*, i8** %2
%33 = getelementptr inbounds i8, i8* %32, i32 1
store i8* %33, i8** %2
store i32 0, i32* %4
%34 = load i32, i32* %3
%35 = add nsw i32 %34, 1
store i32 %35, i32* %3
br label %36
36: ; preds = %31, %18
%37 = load i32, i32* %3
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [20 x [80 x i8]], [20 x [80 x i8]]* %5, i64 0, i64 %38
%40 = load i32, i32* %4
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [80 x i8], [80 x i8]* %39, i64 0, i64 %41
store i8 0, i8* %42
br label %8
43: ; preds = %8
store i32 0, i32* %6
br label %44
44: ; preds = %64, %43
%45 = load i32, i32* %6
%46 = icmp slt i32 %45, 9
br i1 %46, label %47, label %67
47: ; preds = %44
%48 = load i32, i32* %6
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [20 x [80 x i8]], [20 x [80 x i8]]* %5, i64 0, i64 %49
%51 = getelementptr inbounds [80 x i8], [80 x i8]* %50, i64 0, i64 0
%52 = call i32 @strlen(i8* %51)
store i32 %52, i32* %7
%53 = load i32, i32* %6
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [20 x [80 x i8]], [20 x [80 x i8]]* %5, i64 0, i64 %54
%56 = getelementptr inbounds [80 x i8], [80 x i8]* %55, i64 0, i64 0
%57 = load i32, i32* %7
%58 = load i32, i32* %6
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [20 x [80 x i8]], [20 x [80 x i8]]* %5, i64 0, i64 %59
%61 = getelementptr inbounds [80 x i8], [80 x i8]* %60, i64 0, i64 0
%62 = call i32 @lexer(i8* %61)
%63 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %56, i32 %57, i32 %62)
br label %64
64: ; preds = %47
%65 = load i32, i32* %6
%66 = add nsw i32 %65, 1
store i32 %66, i32* %6
br label %44
67: ; preds = %44
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"Token: %s Length: %d Type: %d \0A\00"
define void @tokenize(i8* nocapture %0) {
%2 = alloca [20 x [80 x i8]]
%3 = getelementptr inbounds [20 x [80 x i8]], [20 x [80 x i8]]* %2, i64 0, i64 0, i64 0
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %6, label %42
6: ; preds = %58, %1
%7 = call i32 @strlen(i8* %3)
%8 = call i32 @lexer(i8* %3)
%9 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %3, i32 %7, i32 %8)
%10 = getelementptr inbounds [20 x [80 x i8]], [20 x [80 x i8]]* %2, i64 0, i64 1, i64 0
%11 = call i32 @strlen(i8* %10)
%12 = call i32 @lexer(i8* %10)
%13 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %10, i32 %11, i32 %12)
%14 = getelementptr inbounds [20 x [80 x i8]], [20 x [80 x i8]]* %2, i64 0, i64 2, i64 0
%15 = call i32 @strlen(i8* %14)
%16 = call i32 @lexer(i8* %14)
%17 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %14, i32 %15, i32 %16)
%18 = getelementptr inbounds [20 x [80 x i8]], [20 x [80 x i8]]* %2, i64 0, i64 3, i64 0
%19 = call i32 @strlen(i8* %18)
%20 = call i32 @lexer(i8* %18)
%21 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %18, i32 %19, i32 %20)
%22 = getelementptr inbounds [20 x [80 x i8]], [20 x [80 x i8]]* %2, i64 0, i64 4, i64 0
%23 = call i32 @strlen(i8* %22)
%24 = call i32 @lexer(i8* %22)
%25 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %22, i32 %23, i32 %24)
%26 = getelementptr inbounds [20 x [80 x i8]], [20 x [80 x i8]]* %2, i64 0, i64 5, i64 0
%27 = call i32 @strlen(i8* %26)
%28 = call i32 @lexer(i8* %26)
%29 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %26, i32 %27, i32 %28)
%30 = getelementptr inbounds [20 x [80 x i8]], [20 x [80 x i8]]* %2, i64 0, i64 6, i64 0
%31 = call i32 @strlen(i8* %30)
%32 = call i32 @lexer(i8* %30)
%33 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %30, i32 %31, i32 %32)
%34 = getelementptr inbounds [20 x [80 x i8]], [20 x [80 x i8]]* %2, i64 0, i64 7, i64 0
%35 = call i32 @strlen(i8* %34)
%36 = call i32 @lexer(i8* %34)
%37 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %34, i32 %35, i32 %36)
%38 = getelementptr inbounds [20 x [80 x i8]], [20 x [80 x i8]]* %2, i64 0, i64 8, i64 0
%39 = call i32 @strlen(i8* %38)
%40 = call i32 @lexer(i8* %38)
%41 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %38, i32 %39, i32 %40)
ret void
42: ; preds = %1, %58
%43 = phi i8 [ %65, %58 ], [ %4, %1 ]
%44 = phi i8* [ %62, %58 ], [ %0, %1 ]
%45 = phi i32 [ %61, %58 ], [ 0, %1 ]
%46 = phi i32 [ %60, %58 ], [ 0, %1 ]
%47 = tail call i32 @isspace(i8 signext %43)
%48 = icmp eq i32 %47, 0
br i1 %48, label %49, label %55
49: ; preds = %42
%50 = load i8, i8* %44
%51 = sext i32 %46 to i64
%52 = sext i32 %45 to i64
%53 = getelementptr inbounds [20 x [80 x i8]], [20 x [80 x i8]]* %2, i64 0, i64 %51, i64 %52
store i8 %50, i8* %53
%54 = add nsw i32 %45, 1
br label %58
55: ; preds = %42
%56 = add nsw i32 %46, 1
%57 = sext i32 %56 to i64
br label %58
58: ; preds = %55, %49
%59 = phi i64 [ %57, %55 ], [ %51, %49 ]
%60 = phi i32 [ %56, %55 ], [ %46, %49 ]
%61 = phi i32 [ 0, %55 ], [ %54, %49 ]
%62 = getelementptr inbounds i8, i8* %44, i64 1
%63 = sext i32 %61 to i64
%64 = getelementptr inbounds [20 x [80 x i8]], [20 x [80 x i8]]* %2, i64 0, i64 %59, i64 %63
store i8 0, i8* %64
%65 = load i8, i8* %62
%66 = icmp eq i8 %65, 0
br i1 %66, label %6, label %42
}