// File: lukewagner[P]asmjs2wasm/src/cashew/parser.h
// Function: cashew::Parser<asmjs_ast::Node*, Builder>::Frag::Frag(char*)
explicit Frag(char* src) {
      assert(!isSpace(*src));
      char *start = src;
      if (isIdentInit(*src)) {
        // read an identifier or a keyword
        src++;
        while (isIdentPart(*src)) {
          src++;
        }
        if (*src == 0) {
          str.set(start);
        } else {
          char temp = *src;
          *src = 0;
          str.set(start, false);
          *src = temp;
        }
        type = keywords.has(str) ? KEYWORD : IDENT;
      } else if (*src == '"' || *src == '\'') {
        char *end = strchr(src+1, *src);
        *end = 0;
        str.set(src+1);
        src = end+1;
        type = STRING;
      } else if (isDigit(*src) || (src[0] == '.' && isDigit(src[1]))) {
        if (src[0] == '0' && (src[1] == 'x' || src[1] == 'X')) {
          // Explicitly parse hex numbers of form "0x...", because strtod
          // supports hex number strings only in C++11, and Visual Studio 2013 does
          // not yet support that functionality.
          src += 2;
          num = 0;
          while (1) {
            if (*src >= '0' && *src <= '9') { num *= 16; num += *src - '0'; }
            else if (*src >= 'a' && *src <= 'f') { num *= 16; num += *src - 'a' + 10; }
            else if (*src >= 'A' && *src <= 'F') { num *= 16; num += *src - 'F' + 10; }
            else break;
            src++;
          }
        } else {
          num = strtod(start, &src);
        }
        // asm.js must have a '.' for double values. however, we also tolerate
        // uglify's tendency to emit without a '.' (and fix it later with a +).
        // for valid asm.js input, the '.' should be enough, and for uglify
        // in the emscripten optimizer pipeline, we use simple_ast where INT/DOUBLE
        // is quite the same at this point anyhow
        type = (std::find(start, src, '.') == src && is32Bit(num)) ? INT : DOUBLE;
        assert(src > start);
      } else if (hasChar(OPERATOR_INITS, *src)) {
        switch (*src) {
          case '!': str = src[1] == '=' ? NE : L_NOT; break;
          case '%': str = MOD; break;
          case '&': str = AND; break;
          case '*': str = MUL; break;
          case '+': str = PLUS; break;
          case ',': str = COMMA; break;
          case '-': str = MINUS; break;
          case '.': str = PERIOD; break;
          case '/': str = DIV; break;
          case ':': str = COLON; break;
          case '<': str = src[1] == '<' ? LSHIFT : (src[1] == '=' ? LE : LT); break;
          case '=': str = src[1] == '=' ? EQ : SET; break;
          case '>': str = src[1] == '>' ? (src[2] == '>' ? TRSHIFT : RSHIFT) : (src[1] == '=' ? GE : GT); break;
          case '?': str = QUESTION; break;
          case '^': str = XOR; break;
          case '|': str = OR; break;
          case '~': str = B_NOT; break;
        }
        assert(!str.isNull());
        size = strlen(str.str);
#ifndef NDEBUG
        char temp = start[size];
        start[size] = 0;
        assert(strcmp(str.str, start) == 0);
        start[size] = temp;
#endif
        type = OPERATOR;
        return;
      } else if (hasChar(SEPARATORS, *src)) {
        type = SEPARATOR;
        char temp = src[1];
        src[1] = 0;
        str.set(src, false);
        src[1] = temp;
        src++;
      } else {
        dump("frag parsing", src);
        assert(0);
      }
      size = src - start;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %edi
callq 0x7580
xorb $-0x1, %al
testb $0x1, %al
jne 0x5f2f
jmp 0x5f31
jmp 0x5f50
leaq 0xf3c0(%rip), %rdi      # 0x152f8
leaq 0xf3c8(%rip), %rsi      # 0x15307
movl $0xc1, %edx
leaq 0xf3d0(%rip), %rcx      # 0x1531b
callq 0x2130
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %edi
callq 0xf850
testb $0x1, %al
jne 0x5f6d
jmp 0x600e
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %edi
callq 0xf8b0
testb $0x1, %al
jne 0x5f8b
jmp 0x5f99
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x5f79
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x5fb9
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl $0x1, %edx
callq 0x75d0
jmp 0x5fe1
movq -0x38(%rbp), %rdi
movq -0x10(%rbp), %rax
movb (%rax), %al
movb %al, -0x19(%rbp)
movq -0x10(%rbp), %rax
movb $0x0, (%rax)
movq -0x18(%rbp), %rsi
xorl %edx, %edx
callq 0x75d0
movb -0x19(%rbp), %cl
movq -0x10(%rbp), %rax
movb %cl, (%rax)
movq -0x38(%rbp), %rsi
leaq 0x1c47c(%rip), %rdi     # 0x22468
callq 0x7760
movb %al, %sil
movq -0x38(%rbp), %rax
movl $0x2, %ecx
xorl %edx, %edx
testb $0x1, %sil
cmovnel %edx, %ecx
movl %ecx, 0xc(%rax)
jmp 0x6664
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x22, %eax
je 0x6026
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x27, %eax
jne 0x6077
movq -0x10(%rbp), %rdi
addq $0x1, %rdi
movq -0x10(%rbp), %rax
movsbl (%rax), %esi
callq 0x2080
movq -0x38(%rbp), %rdi
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movb $0x0, (%rax)
movq -0x10(%rbp), %rsi
addq $0x1, %rsi
movl $0x1, %edx
callq 0x75d0
movq -0x38(%rbp), %rax
movq -0x28(%rbp), %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
movl $0x3, 0xc(%rax)
jmp 0x6662
movq -0x10(%rbp), %rax
movsbl (%rax), %edi
callq 0x7790
testb $0x1, %al
jne 0x60ad
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2e, %eax
jne 0x6274
movq -0x10(%rbp), %rax
movsbl 0x1(%rax), %edi
callq 0x7790
testb $0x1, %al
jne 0x60ad
jmp 0x6274
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x30, %eax
jne 0x61e0
movq -0x10(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x78, %eax
je 0x60db
movq -0x10(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x58, %eax
jne 0x61e0
movq -0x38(%rbp), %rax
movq -0x10(%rbp), %rcx
addq $0x2, %rcx
movq %rcx, -0x10(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x30, %eax
jl 0x6139
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x39, %eax
jg 0x6139
movq -0x38(%rbp), %rax
movsd 0xef0a(%rip), %xmm0     # 0x15020
mulsd (%rax), %xmm0
movsd %xmm0, (%rax)
movq -0x10(%rbp), %rcx
movsbl (%rcx), %ecx
subl $0x30, %ecx
cvtsi2sd %ecx, %xmm0
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
jmp 0x61cd
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x61, %eax
jl 0x6180
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x66, %eax
jg 0x6180
movq -0x38(%rbp), %rax
movsd 0xeec3(%rip), %xmm0     # 0x15020
mulsd (%rax), %xmm0
movsd %xmm0, (%rax)
movq -0x10(%rbp), %rcx
movsbl (%rcx), %ecx
subl $0x61, %ecx
addl $0xa, %ecx
cvtsi2sd %ecx, %xmm0
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
jmp 0x61cb
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x41, %eax
jl 0x61c7
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x46, %eax
jg 0x61c7
movq -0x38(%rbp), %rax
movsd 0xee7c(%rip), %xmm0     # 0x15020
mulsd (%rax), %xmm0
movsd %xmm0, (%rax)
movq -0x10(%rbp), %rcx
movsbl (%rcx), %ecx
subl $0x46, %ecx
addl $0xa, %ecx
cvtsi2sd %ecx, %xmm0
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
jmp 0x61c9
jmp 0x61de
jmp 0x61cb
jmp 0x61cd
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x60f2
jmp 0x61f5
movq -0x18(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0x2150
movq -0x38(%rbp), %rax
movsd %xmm0, (%rax)
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
movb $0x2e, -0x29(%rbp)
leaq -0x29(%rbp), %rdx
callq 0x77c0
movq %rax, %rcx
xorl %eax, %eax
cmpq -0x10(%rbp), %rcx
movb %al, -0x39(%rbp)
jne 0x6228
movq -0x38(%rbp), %rax
movsd (%rax), %xmm0
callq 0x7810
movb %al, -0x39(%rbp)
movq -0x38(%rbp), %rax
movb -0x39(%rbp), %sil
movl $0x5, %ecx
movl $0x4, %edx
testb $0x1, %sil
cmovnel %edx, %ecx
movl %ecx, 0xc(%rax)
movq -0x10(%rbp), %rax
cmpq -0x18(%rbp), %rax
jbe 0x6250
jmp 0x626f
leaq 0xf134(%rip), %rdi      # 0x1538b
leaq 0xf0a9(%rip), %rsi      # 0x15307
movl $0xef, %edx
leaq 0xf0b1(%rip), %rcx      # 0x1531b
callq 0x2130
jmp 0x6660
leaq 0x1bf2d(%rip), %rax     # 0x221a8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movsbl (%rax), %esi
callq 0x5e70
testb $0x1, %al
jne 0x6293
jmp 0x65d1
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
addl $-0x21, %eax
movl %eax, %ecx
movq %rcx, -0x48(%rbp)
subl $0x5d, %eax
ja 0x651d
movq -0x48(%rbp), %rax
leaq 0xed71(%rip), %rcx      # 0x15028
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x3d, %eax
jne 0x62da
leaq 0x1c07c(%rip), %rax     # 0x22350
movq %rax, -0x50(%rbp)
jmp 0x62e7
leaq 0x1c037(%rip), %rax     # 0x22318
movq %rax, -0x50(%rbp)
jmp 0x62e7
movq -0x38(%rbp), %rax
movq -0x50(%rbp), %rcx
movq (%rcx), %rcx
movq %rcx, (%rax)
jmp 0x651d
movq -0x38(%rbp), %rax
leaq 0x1c05b(%rip), %rcx     # 0x22360
movq (%rcx), %rcx
movq %rcx, (%rax)
jmp 0x651d
movq -0x38(%rbp), %rax
leaq 0x1bfed(%rip), %rcx     # 0x22308
movq (%rcx), %rcx
movq %rcx, (%rax)
jmp 0x651d
movq -0x38(%rbp), %rax
leaq 0x1c037(%rip), %rcx     # 0x22368
movq (%rcx), %rcx
movq %rcx, (%rax)
jmp 0x651d
movq -0x38(%rbp), %rax
leaq 0x1bfa9(%rip), %rcx     # 0x222f0
movq (%rcx), %rcx
movq %rcx, (%rax)
jmp 0x651d
movq -0x38(%rbp), %rax
leaq 0x1c0ab(%rip), %rcx     # 0x22408
movq (%rcx), %rcx
movq %rcx, (%rax)
jmp 0x651d
movq -0x38(%rbp), %rax
leaq 0x1bf85(%rip), %rcx     # 0x222f8
movq (%rcx), %rcx
movq %rcx, (%rax)
jmp 0x651d
movq -0x38(%rbp), %rax
leaq 0x1c0af(%rip), %rcx     # 0x22438
movq (%rcx), %rcx
movq %rcx, (%rax)
jmp 0x651d
movq -0x38(%rbp), %rax
leaq 0x1bfb9(%rip), %rcx     # 0x22358
movq (%rcx), %rcx
movq %rcx, (%rax)
jmp 0x651d
movq -0x38(%rbp), %rax
leaq 0x1c063(%rip), %rcx     # 0x22418
movq (%rcx), %rcx
movq %rcx, (%rax)
jmp 0x651d
movq -0x10(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x3c, %eax
jne 0x63da
leaq 0x1bfa4(%rip), %rax     # 0x22378
movq %rax, -0x58(%rbp)
jmp 0x6409
movq -0x10(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x3d, %eax
jne 0x63f4
leaq 0x1bf4a(%rip), %rax     # 0x22338
movq %rax, -0x60(%rbp)
jmp 0x6401
leaq 0x1bf2d(%rip), %rax     # 0x22328
movq %rax, -0x60(%rbp)
jmp 0x6401
movq -0x60(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x38(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rcx), %rcx
movq %rcx, (%rax)
jmp 0x651d
movq -0x10(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x3d, %eax
jne 0x6436
leaq 0x1bf18(%rip), %rax     # 0x22348
movq %rax, -0x68(%rbp)
jmp 0x6443
leaq 0x1c023(%rip), %rax     # 0x22460
movq %rax, -0x68(%rbp)
jmp 0x6443
movq -0x38(%rbp), %rax
movq -0x68(%rbp), %rcx
movq (%rcx), %rcx
movq %rcx, (%rax)
jmp 0x651d
movq -0x10(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x3e, %eax
jne 0x6494
movq -0x10(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x3e, %eax
jne 0x647d
leaq 0x1bf09(%rip), %rax     # 0x22380
movq %rax, -0x70(%rbp)
jmp 0x648a
leaq 0x1beec(%rip), %rax     # 0x22370
movq %rax, -0x70(%rbp)
jmp 0x648a
movq -0x70(%rbp), %rax
movq %rax, -0x78(%rbp)
jmp 0x64c3
movq -0x10(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x3d, %eax
jne 0x64ae
leaq 0x1be88(%rip), %rax     # 0x22330
movq %rax, -0x80(%rbp)
jmp 0x64bb
leaq 0x1be8b(%rip), %rax     # 0x22340
movq %rax, -0x80(%rbp)
jmp 0x64bb
movq -0x80(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x38(%rbp), %rax
movq -0x78(%rbp), %rcx
movq (%rcx), %rcx
movq %rcx, (%rax)
jmp 0x651d
movq -0x38(%rbp), %rax
leaq 0x1bf32(%rip), %rcx     # 0x22410
movq (%rcx), %rcx
movq %rcx, (%rax)
jmp 0x651d
movq -0x38(%rbp), %rax
leaq 0x1be1f(%rip), %rcx     # 0x22310
movq (%rcx), %rcx
movq %rcx, (%rax)
jmp 0x651d
movq -0x38(%rbp), %rax
leaq 0x1bdfc(%rip), %rcx     # 0x22300
movq (%rcx), %rcx
movq %rcx, (%rax)
jmp 0x651d
movq -0x38(%rbp), %rax
leaq 0x1be09(%rip), %rcx     # 0x22320
movq (%rcx), %rcx
movq %rcx, (%rax)
movq -0x38(%rbp), %rdi
callq 0x7860
xorb $-0x1, %al
testb $0x1, %al
jne 0x652e
jmp 0x6530
jmp 0x654f
leaq 0xee60(%rip), %rdi      # 0x15397
leaq 0xedc9(%rip), %rsi      # 0x15307
movl $0x104, %edx            # imm = 0x104
leaq 0xedd1(%rip), %rcx      # 0x1531b
callq 0x2130
movq -0x38(%rbp), %rax
movq (%rax), %rdi
callq 0x20b0
movq %rax, %rcx
movq -0x38(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x18(%rbp), %rcx
movslq 0x8(%rax), %rdx
movb (%rcx,%rdx), %cl
movb %cl, -0x2a(%rbp)
movq -0x18(%rbp), %rcx
movslq 0x8(%rax), %rdx
movb $0x0, (%rcx,%rdx)
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x2230
cmpl $0x0, %eax
jne 0x6592
jmp 0x65b1
leaq 0xee0c(%rip), %rdi      # 0x153a5
leaq 0xed67(%rip), %rsi      # 0x15307
movl $0x109, %edx            # imm = 0x109
leaq 0xed6f(%rip), %rcx      # 0x1531b
callq 0x2130
movq -0x38(%rbp), %rax
movb -0x2a(%rbp), %sil
movq -0x18(%rbp), %rcx
movslq 0x8(%rax), %rdx
movb %sil, (%rcx,%rdx)
movl $0x1, 0xc(%rax)
jmp 0x6676
leaq 0x1bbd8(%rip), %rax     # 0x221b0
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movsbl (%rax), %esi
callq 0x5e70
testb $0x1, %al
jne 0x65ed
jmp 0x662d
movq -0x38(%rbp), %rdi
movl $0x6, 0xc(%rdi)
movq -0x10(%rbp), %rax
movb 0x1(%rax), %al
movb %al, -0x2b(%rbp)
movq -0x10(%rbp), %rax
movb $0x0, 0x1(%rax)
movq -0x10(%rbp), %rsi
xorl %edx, %edx
callq 0x75d0
movb -0x2b(%rbp), %cl
movq -0x10(%rbp), %rax
movb %cl, 0x1(%rax)
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x665c
movq -0x10(%rbp), %rsi
leaq 0xed89(%rip), %rdi      # 0x153c1
callq 0x7880
leaq 0xf577(%rip), %rdi      # 0x15bbb
leaq 0xecbc(%rip), %rsi      # 0x15307
movl $0x117, %edx            # imm = 0x117
leaq 0xecc4(%rip), %rcx      # 0x1531b
callq 0x2130
jmp 0x665e
jmp 0x6660
jmp 0x6662
jmp 0x6664
movq -0x38(%rbp), %rax
movq -0x10(%rbp), %rcx
movq -0x18(%rbp), %rdx
subq %rdx, %rcx
movl %ecx, 0x8(%rax)
addq $0x80, %rsp
popq %rbp
retq
nop