#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 */
unsigned int getStringAndHash(char *, char **, char **, unsigned int *);
unsigned int readNextString(char *start, char **first, char **last,
                            unsigned int *hash) {
  unsigned char state = 3;
  ++start;
  while (start[0] != '\0') {
    switch (state) {
    case 3:
      if (start[0] == ':') {
        state = 4;
      } else if (!(start[0] == ' ' || start[0] == '\t' || start[0] == '\n' ||
                   start[0] == '\t')) {
        return 204;
      }
      break;
    case 4:
      return getStringAndHash(start, first, last, hash);
    }
    ++start;
  }
  return 204;
}


x86 assembly (clang, -O0):
<readNextString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
movb   $0x3,-0x29(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     120b <readNextString+0xfb>
movzbl -0x29(%rbp),%eax
mov    %eax,-0x30(%rbp)
sub    $0x3,%eax
je     116e <readNextString+0x5e>
jmp    115d <readNextString+0x4d>
mov    -0x30(%rbp),%eax
sub    $0x4,%eax
je     11dd <readNextString+0xcd>
jmp    11fa <readNextString+0xea>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3a,%eax
jne    1187 <readNextString+0x77>
movb   $0x4,-0x29(%rbp)
jmp    11d8 <readNextString+0xc8>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
je     11d3 <readNextString+0xc3>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
je     11d3 <readNextString+0xc3>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
je     11d3 <readNextString+0xc3>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
je     11d3 <readNextString+0xc3>
movl   $0xcc,-0x4(%rbp)
jmp    1212 <readNextString+0x102>
jmp    11d8 <readNextString+0xc8>
jmp    11fa <readNextString+0xea>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
call   1030 <getStringAndHash@plt>
mov    %eax,-0x4(%rbp)
jmp    1212 <readNextString+0x102>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1138 <readNextString+0x28>
movl   $0xcc,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readNextString>:
mov    0x1(%rdi),%al
test   %al,%al
je     1165 <readNextString+0x55>
add    $0x1,%rdi
mov    $0x3,%r8b
jmp    1132 <readNextString+0x22>
cmp    $0x4,%r8b
je     116b <readNextString+0x5b>
movzbl 0x1(%rdi),%eax
add    $0x1,%rdi
test   %al,%al
je     1165 <readNextString+0x55>
cmp    $0x3,%r8b
jne    1120 <readNextString+0x10>
cmp    $0x1f,%al
jg     1150 <readNextString+0x40>
cmp    $0x9,%al
je     1160 <readNextString+0x50>
cmp    $0xa,%al
je     1160 <readNextString+0x50>
jmp    1165 <readNextString+0x55>
cs nopw 0x0(%rax,%rax,1)
cmp    $0x20,%al
je     1160 <readNextString+0x50>
mov    $0x4,%r8b
cmp    $0x3a,%al
je     1126 <readNextString+0x16>
jmp    1165 <readNextString+0x55>
nopl   (%rax)
mov    $0x3,%r8b
jmp    1126 <readNextString+0x16>
mov    $0xcc,%eax
ret
jmp    1030 <getStringAndHash@plt>

LLVM IR (-O0):
define i32 @readNextString(i8* %0, i8** %1, i8** %2, i32* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8**
%8 = alloca i8**
%9 = alloca i32*
%10 = alloca i8
store i8* %0, i8** %6
store i8** %1, i8*** %7
store i8** %2, i8*** %8
store i32* %3, i32** %9
store i8 3, i8* %10
%11 = load i8*, i8** %6
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %6
br label %13
13: ; preds = %62, %4
%14 = load i8*, i8** %6
%15 = getelementptr inbounds i8, i8* %14, i64 0
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %65
19: ; preds = %13
%20 = load i8, i8* %10
%21 = zext i8 %20 to i32
switch i32 %21, label %62 [
i32 3, label %22
i32 4, label %56
]
22: ; preds = %19
%23 = load i8*, i8** %6
%24 = getelementptr inbounds i8, i8* %23, i64 0
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 58
br i1 %27, label %28, label %29
28: ; preds = %22
store i8 4, i8* %10
br label %55
29: ; preds = %22
%30 = load i8*, i8** %6
%31 = getelementptr inbounds i8, i8* %30, i64 0
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 32
br i1 %34, label %54, label %35
35: ; preds = %29
%36 = load i8*, i8** %6
%37 = getelementptr inbounds i8, i8* %36, i64 0
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = icmp eq i32 %39, 9
br i1 %40, label %54, label %41
41: ; preds = %35
%42 = load i8*, i8** %6
%43 = getelementptr inbounds i8, i8* %42, i64 0
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = icmp eq i32 %45, 10
br i1 %46, label %54, label %47
47: ; preds = %41
%48 = load i8*, i8** %6
%49 = getelementptr inbounds i8, i8* %48, i64 0
%50 = load i8, i8* %49
%51 = sext i8 %50 to i32
%52 = icmp eq i32 %51, 9
br i1 %52, label %54, label %53
53: ; preds = %47
store i32 204, i32* %5
br label %66
54: ; preds = %47, %41, %35, %29
br label %55
55: ; preds = %54, %28
br label %62
56: ; preds = %19
%57 = load i8*, i8** %6
%58 = load i8**, i8*** %7
%59 = load i8**, i8*** %8
%60 = load i32*, i32** %9
%61 = call i32 @getStringAndHash(i8* %57, i8** %58, i8** %59, i32* %60)
store i32 %61, i32* %5
br label %66
62: ; preds = %19, %55
%63 = load i8*, i8** %6
%64 = getelementptr inbounds i8, i8* %63, i32 1
store i8* %64, i8** %6
br label %13
65: ; preds = %13
store i32 204, i32* %5
br label %66
66: ; preds = %65, %56, %53
%67 = load i32, i32* %5
ret i32 %67
}

LLVM IR (-O2):
define i32 @readNextString(i8* %0, i8** %1, i8** %2, i32* %3) {
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
br i1 %7, label %23, label %8
8: ; preds = %4, %18
%9 = phi i8 [ %21, %18 ], [ %6, %4 ]
%10 = phi i8* [ %20, %18 ], [ %5, %4 ]
%11 = phi i8 [ %19, %18 ], [ 3, %4 ]
switch i8 %11, label %18 [
i8 3, label %12
i8 4, label %13
]
12: ; preds = %8
switch i8 %9, label %23 [
i8 58, label %18
i8 32, label %15
i8 9, label %16
i8 10, label %17
]
13: ; preds = %8
%14 = tail call i32 @getStringAndHash(i8* %10, i8** %1, i8** %2, i32* %3)
br label %23
15: ; preds = %12
br label %18
16: ; preds = %12
br label %18
17: ; preds = %12
br label %18
18: ; preds = %12, %17, %16, %15, %8
%19 = phi i8 [ %11, %8 ], [ 4, %12 ], [ 3, %15 ], [ 3, %16 ], [ 3, %17 ]
%20 = getelementptr inbounds i8, i8* %10, i64 1
%21 = load i8, i8* %20
%22 = icmp eq i8 %21, 0
br i1 %22, label %23, label %8
23: ; preds = %12, %18, %4, %13
%24 = phi i32 [ %14, %13 ], [ 204, %4 ], [ 204, %18 ], [ 204, %12 ]
ret i32 %24
}