// File: AgathokakologicalBit[P]wit/src/parsing/parsing.cpp
// Function: akbit::system::parsing::ParserState::consume(akbit::system::parsing::TokenType, akbit::system::parsing::TokenSubType)
Token ParserState::consume(TokenType const type, TokenSubType const subtype)
  {
    Token tok = this->peek();
    if (type != tok.type || (subtype != TokenSubType::t_unknown && subtype != tok.sub_type))
    {
      std::string expected = (subtype != TokenSubType::t_unknown ? get_sub_type_name(subtype) : get_type_name(type));
      this->error.code = error_t::p_unexpected_token;
      this->error.message = "[somewhere]: <" + expected + "> expected, but <"
      + get_sub_type_name(tok.sub_type) + "> was given";
      return tok;
    }

    this->move();
    return tok;
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x100(%rbp)
movq %rdi, %rax
movq %rax, -0x110(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movq -0x10(%rbp), %rsi
movq %rsi, -0x108(%rbp)
movb $0x0, -0x19(%rbp)
callq 0xf140
movq -0x100(%rbp), %rdi
movl -0x14(%rbp), %eax
cmpl 0x30(%rdi), %eax
jne 0x1267a
cmpl $0x0, -0x18(%rbp)
je 0x1282d
movq -0x100(%rbp), %rcx
movl -0x18(%rbp), %eax
cmpl 0x34(%rcx), %eax
je 0x1282d
cmpl $0x0, -0x18(%rbp)
je 0x12690
movl -0x18(%rbp), %esi
leaq -0x40(%rbp), %rdi
callq 0x10180
jmp 0x1268e
jmp 0x126a0
movl -0x14(%rbp), %esi
leaq -0x40(%rbp), %rdi
callq 0xfed0
jmp 0x1269e
jmp 0x126a0
movq -0x108(%rbp), %rax
movl $0x7da, 0x10(%rax)      # imm = 0x7DA
leaq 0x241e6(%rip), %rsi     # 0x3689b
leaq -0xd0(%rbp), %rdi
leaq -0x40(%rbp), %rdx
callq 0x15990
jmp 0x126c7
leaq 0x241dc(%rip), %rdx     # 0x368aa
leaq -0xb0(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x11a50
jmp 0x126e3
movq -0x100(%rbp), %rax
movl 0x34(%rax), %esi
leaq -0xf0(%rbp), %rdi
callq 0x10180
jmp 0x126fb
leaq -0x90(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
leaq -0xf0(%rbp), %rdx
callq 0x158c0
jmp 0x12717
leaq 0x2419e(%rip), %rdx     # 0x368bc
leaq -0x70(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x11a50
jmp 0x12730
movq -0x108(%rbp), %rdi
addq $0x10, %rdi
addq $0x8, %rdi
leaq -0x70(%rbp), %rsi
callq 0x43e0
leaq -0x70(%rbp), %rdi
callq 0x4210
leaq -0x90(%rbp), %rdi
callq 0x4210
leaq -0xf0(%rbp), %rdi
callq 0x4210
leaq -0xb0(%rbp), %rdi
callq 0x4210
leaq -0xd0(%rbp), %rdi
callq 0x4210
movb $0x1, -0x19(%rbp)
movl $0x1, -0xf4(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x4210
jmp 0x12847
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x12869
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x12822
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x12816
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x1280a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x127fe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x4210
leaq -0xf0(%rbp), %rdi
callq 0x4210
leaq -0xb0(%rbp), %rdi
callq 0x4210
leaq -0xd0(%rbp), %rdi
callq 0x4210
leaq -0x40(%rbp), %rdi
callq 0x4210
jmp 0x12869
movq -0x108(%rbp), %rdi
callq 0x15aa0
movb $0x1, -0x19(%rbp)
movl $0x1, -0xf4(%rbp)
testb $0x1, -0x19(%rbp)
jne 0x12859
movq -0x100(%rbp), %rdi
callq 0xec00
movq -0x110(%rbp), %rax
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
movq -0x100(%rbp), %rdi
callq 0xec00
movq -0x48(%rbp), %rdi
callq 0x4560
nop