// File: /workspace/github_cpp_makefile_star2_O3/lukewagner[P]asmjs2wasm/src/cashew/parser.h
// Function: cashew::Parser<asmjs_ast::Node*, Builder>::parseSwitch(cashew::Parser<asmjs_ast::Node*, Builder>::Frag&, char*&, char const*)
NodeRef parseSwitch(Frag& frag, char*& src, const char* seps) {
    NodeRef ret = builder.makeSwitch(parseParenned(src));
    src = skipSpace(src);
    assert(*src == '{');
    src++;
    while (1) {
      // find all cases and possibly a default
      src = skipSpace(src);
      if (*src == '}') break;
      Frag next(src);
      if (next.type == KEYWORD) {
        if (next.str == CASE) {
          src += next.size;
          src = skipSpace(src);
          NodeRef arg;
          Frag value(src);
          if (value.isNumber()) {
            arg = parseFrag(value);
            src += value.size;
          } else {
            assert(value.type == OPERATOR);
            assert(value.str == MINUS);
            src += value.size;
            src = skipSpace(src);
            Frag value2(src);
            assert(value2.isNumber());
            arg = builder.makePrefix(MINUS, parseFrag(value2));
            src += value2.size;
          }
          builder.appendCaseToSwitch(ret, arg);
          src = skipSpace(src);
          assert(*src == ':');
          src++;
          continue;
        } else if (next.str == DEFAULT) {
          src += next.size;
          builder.appendDefaultToSwitch(ret);
          src = skipSpace(src);
          assert(*src == ':');
          src++;
          continue;
        }
        // otherwise, may be some keyword that happens to start a block (e.g. case 1: _return_ 5)
      }
      // not case X: or default: or }, so must be some code
      src = skipSpace(src);
      bool explicitBlock = *src == '{';
      builder.appendCodeToSwitch(ret, parseMaybeBracketedBlock(src, ";}", CASE, DEFAULT), explicitBlock);
    }
    src = skipSpace(src);
    assert(*src == '}');
    src++;
    return ret;
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %rbx
movq %rdi, %r15
movq %rdx, %rsi
callq 0x61d4
movq %rax, %r12
movq 0x28(%r15), %rdi
movl $0x28, %esi
callq 0x3ca4
movq %rax, %r14
movq $0x0, (%rax)
movl $0x16, 0x8(%rax)
movq %r12, 0x10(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rax)
movq (%rbx), %rdi
callq 0x3692
movq %rax, (%rbx)
cmpb $0x7b, (%rax)
jne 0x5f94
incq %rax
movq %rax, (%rbx)
movq %rax, %rdi
callq 0x3692
movq %rax, (%rbx)
cmpb $0x7d, (%rax)
je 0x5ecd
leaq 0x28(%r15), %r12
leaq 0x10(%rsp), %r13
movq %rsp, %rbp
movq %r13, %rdi
movq %rax, %rsi
callq 0x3704
cmpl $0x0, 0x1c(%rsp)
je 0x5d64
movq (%rbx), %rdi
callq 0x3692
movq %rax, (%rbx)
xorl %ebp, %ebp
cmpb $0x7b, (%rax)
sete %bpl
leaq 0x76ce(%rip), %rax      # 0xd3f8
movq (%rax), %rcx
leaq 0x76cc(%rip), %rax      # 0xd400
movq (%rax), %r8
movq %r15, %rdi
movq %rbx, %rsi
leaq 0x282c(%rip), %rdx      # 0x8570
callq 0x63d2
movq %r12, %rdi
movq %r14, %rsi
movq %rax, %rdx
movl %ebp, %ecx
movq %rsp, %rbp
callq 0x6384
movq (%rbx), %rdi
jmp 0x5ebc
movq 0x10(%rsp), %rax
leaq 0x7688(%rip), %rcx      # 0xd3f8
cmpq (%rcx), %rax
je 0x5dad
leaq 0x7684(%rip), %rcx      # 0xd400
cmpq (%rcx), %rax
jne 0x5d0f
movslq 0x18(%rsp), %rax
addq %rax, (%rbx)
movq %r12, %rdi
movq %r14, %rsi
callq 0x6322
movq (%rbx), %rdi
callq 0x3692
movq %rax, (%rbx)
cmpb $0x3a, (%rax)
je 0x5eb3
jmp 0x5f18
movslq 0x18(%rsp), %rdi
addq (%rbx), %rdi
movq %rdi, (%rbx)
callq 0x3692
movq %rax, (%rbx)
movq %rbp, %rdi
movq %rax, %rsi
callq 0x3704
movl 0xc(%rsp), %eax
movl %eax, %ecx
andl $-0x2, %ecx
cmpl $0x4, %ecx
jne 0x5df4
movq %r15, %rdi
movq %rbp, %rsi
callq 0x5184
movq %rax, %rdx
movslq 0x8(%rsp), %rax
addq %rax, (%rbx)
jmp 0x5e98
cmpl $0x1, %eax
jne 0x5f37
movq (%rsp), %rax
leaq 0x74c8(%rip), %rcx      # 0xd2d0
cmpq (%rcx), %rax
leaq 0x28(%rsp), %rbp
jne 0x5f56
movslq 0x8(%rsp), %rdi
addq (%rbx), %rdi
movq %rdi, (%rbx)
callq 0x3692
movq %rax, (%rbx)
movq %rbp, %rdi
movq %rax, %rsi
callq 0x3704
movl 0x34(%rsp), %eax
andl $-0x2, %eax
cmpl $0x4, %eax
jne 0x5f75
leaq 0x7485(%rip), %rax      # 0xd2d0
movq (%rax), %rax
movq %rax, 0x20(%rsp)
movq %r15, %rdi
movq %rbp, %rsi
callq 0x5184
movq %rax, %rbp
movq 0x28(%r15), %rdi
movl $0x20, %esi
callq 0x3ca4
movq %rax, %rdx
movq $0x0, (%rax)
movl $0x6, 0x8(%rax)
movq 0x20(%rsp), %rax
movq %rax, 0x10(%rdx)
movq %rbp, 0x18(%rdx)
movslq 0x30(%rsp), %rax
addq %rax, (%rbx)
movq %rsp, %rbp
movq %r12, %rdi
movq %r14, %rsi
callq 0x62ac
movq (%rbx), %rdi
callq 0x3692
movq %rax, (%rbx)
cmpb $0x3a, (%rax)
jne 0x5ef9
movq %rax, %rdi
incq %rdi
movq %rdi, (%rbx)
callq 0x3692
movq %rax, (%rbx)
cmpb $0x7d, (%rax)
jne 0x5cfd
movq %rax, %rdi
callq 0x3692
movq %rax, (%rbx)
cmpb $0x7d, (%rax)
jne 0x5fb3
incq %rax
movq %rax, (%rbx)
movq %r14, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x29fe(%rip), %rdi      # 0x88fe
leaq 0x22f0(%rip), %rsi      # 0x81f7
leaq 0x2924(%rip), %rcx      # 0x8832
movl $0x1ee, %edx            # imm = 0x1EE
callq 0x2100
leaq 0x29df(%rip), %rdi      # 0x88fe
leaq 0x22d1(%rip), %rsi      # 0x81f7
leaq 0x2905(%rip), %rcx      # 0x8832
movl $0x1f5, %edx            # imm = 0x1F5
callq 0x2100
leaq 0x2984(%rip), %rdi      # 0x88c2
leaq 0x22b2(%rip), %rsi      # 0x81f7
leaq 0x28e6(%rip), %rcx      # 0x8832
movl $0x1e3, %edx            # imm = 0x1E3
callq 0x2100
leaq 0x297c(%rip), %rdi      # 0x88d9
leaq 0x2293(%rip), %rsi      # 0x81f7
leaq 0x28c7(%rip), %rcx      # 0x8832
movl $0x1e4, %edx            # imm = 0x1E4
callq 0x2100
leaq 0x2970(%rip), %rdi      # 0x88ec
leaq 0x2274(%rip), %rsi      # 0x81f7
leaq 0x28a8(%rip), %rcx      # 0x8832
movl $0x1e8, %edx            # imm = 0x1E8
callq 0x2100
leaq 0x253e(%rip), %rdi      # 0x84d9
leaq 0x2255(%rip), %rsi      # 0x81f7
leaq 0x2889(%rip), %rcx      # 0x8832
movl $0x1d2, %edx            # imm = 0x1D2
callq 0x2100
leaq 0x25b9(%rip), %rdi      # 0x8573
leaq 0x2236(%rip), %rsi      # 0x81f7
leaq 0x286a(%rip), %rcx      # 0x8832
movl $0x201, %edx            # imm = 0x201
callq 0x2100