// File: AgathokakologicalBit[P]wit/src/parsing/parsing.cpp
// Function: akbit::system::parsing::(anonymous namespace)::parse_unit(akbit::system::parsing::ParserState&)
std::shared_ptr<Node> parse_unit(ParserState &state)
    {
      if (state.peek().sub_type == TokenSubType::t_brace_round_left)
      {
        state.move();
        if (state.peek().sub_type == TokenSubType::t_brace_round_right)
        {
          auto container = std::make_shared<Node>(Node::value_tuple_t{
            .entries = {},
          });
          state.move();
          return container;
        }

        auto res = parse_statement(state);
        if (not state.is_failed())
          state.consume(TokenSubType::t_brace_round_right);
        return res;
      }

      if (state.peek().sub_type == TokenSubType::t_brace_curly_left)
      {
        state.move();
        auto container = std::make_shared<Node>(Node::block_t{
          .code = {},
        });

        while (!state.is_eof() && !state.is_failed() && state.peek().sub_type != TokenSubType::t_brace_curly_right)
        {
          auto line = parse_statement(state);
          std::get<Node::block_t>(container->value).code.push_back(line);
        }
        
        if (!state.is_failed())
          state.consume(TokenSubType::t_brace_curly_right);

        return container;
      }

      if (state.peek().sub_type == TokenSubType::t_dash || state.peek().sub_type == TokenSubType::t_plus)
      {
        auto container = std::make_shared<Node>(Node::unary_operation_t{
          .operation = &parse_operator(state),
          .expression = parse_composite_unit(state),
        });
        return container;
      }

      return parse_value(state);
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2b0, %rsp            # imm = 0x2B0
movq %rdi, -0x270(%rbp)
movq %rdi, %rax
movq %rax, -0x268(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0xf140
movl -0x14(%rbp), %eax
movl %eax, -0x25c(%rbp)
leaq -0x48(%rbp), %rdi
callq 0xec00
movl -0x25c(%rbp), %eax
cmpl $0x9, %eax
jne 0x15195
movq -0x10(%rbp), %rdi
callq 0x15aa0
movq -0x10(%rbp), %rsi
leaq -0x80(%rbp), %rdi
callq 0xf140
movl -0x4c(%rbp), %eax
movl %eax, -0x274(%rbp)
leaq -0x80(%rbp), %rdi
callq 0xec00
movl -0x274(%rbp), %eax
cmpl $0xa, %eax
jne 0x15108
movb $0x0, -0x81(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0xa0(%rbp)
movq $0x0, -0x90(%rbp)
leaq -0xa0(%rbp), %rdi
movq %rdi, -0x280(%rbp)
callq 0x15f60
movq -0x270(%rbp), %rdi
movq -0x280(%rbp), %rsi
callq 0x15cb0
jmp 0x150ad
leaq -0xa0(%rbp), %rdi
callq 0xc7d0
movq -0x10(%rbp), %rdi
callq 0x15aa0
movb $0x1, -0x81(%rbp)
testb $0x1, -0x81(%rbp)
jne 0x15103
jmp 0x150f7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0xc7d0
jmp 0x154fe
movq -0x270(%rbp), %rdi
callq 0x9b50
jmp 0x154ee
movq -0x270(%rbp), %rdi
movb $0x0, -0xad(%rbp)
movq -0x10(%rbp), %rsi
callq 0x13390
movq -0x10(%rbp), %rdi
callq 0x15c20
testb $0x1, %al
jne 0x15174
movq -0x10(%rbp), %rsi
leaq -0xe8(%rbp), %rdi
movl $0xa, %edx
callq 0x12880
jmp 0x15143
leaq -0xe8(%rbp), %rdi
callq 0xec00
jmp 0x15174
movq -0x270(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
callq 0x9b50
jmp 0x154fe
movb $0x1, -0xad(%rbp)
testb $0x1, -0xad(%rbp)
jne 0x15190
movq -0x270(%rbp), %rdi
callq 0x9b50
jmp 0x154ee
movq -0x10(%rbp), %rsi
leaq -0x120(%rbp), %rdi
callq 0xf140
movl -0xec(%rbp), %eax
movl %eax, -0x284(%rbp)
leaq -0x120(%rbp), %rdi
callq 0xec00
movl -0x284(%rbp), %eax
cmpl $0xf, %eax
jne 0x153c7
movq -0x10(%rbp), %rdi
callq 0x15aa0
movb $0x0, -0x121(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x140(%rbp)
movq $0x0, -0x130(%rbp)
leaq -0x140(%rbp), %rdi
movq %rdi, -0x290(%rbp)
callq 0x15f60
movq -0x270(%rbp), %rdi
movq -0x290(%rbp), %rsi
callq 0x1d380
jmp 0x15219
leaq -0x140(%rbp), %rdi
callq 0xb220
movq -0x10(%rbp), %rdi
callq 0x15fa0
movb %al, %cl
movb $0x0, -0x179(%rbp)
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x291(%rbp)
jne 0x15283
movq -0x10(%rbp), %rdi
callq 0x15c20
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x291(%rbp)
jne 0x15283
movq -0x10(%rbp), %rsi
leaq -0x178(%rbp), %rdi
callq 0xf140
movb $0x1, -0x179(%rbp)
cmpl $0x10, -0x144(%rbp)
setne %al
movb %al, -0x291(%rbp)
movb -0x291(%rbp), %al
movb %al, -0x292(%rbp)
testb $0x1, -0x179(%rbp)
jne 0x1529a
jmp 0x152a6
leaq -0x178(%rbp), %rdi
callq 0xec00
movb -0x292(%rbp), %al
testb $0x1, %al
jne 0x152b5
jmp 0x15365
movq -0x10(%rbp), %rsi
leaq -0x190(%rbp), %rdi
callq 0x13390
jmp 0x152c7
movq -0x270(%rbp), %rdi
callq 0x9b90
movq %rax, %rdi
addq $0x10, %rdi
callq 0x1d3f0
movq %rax, -0x2a0(%rbp)
jmp 0x152e8
movq -0x2a0(%rbp), %rdi
leaq -0x190(%rbp), %rsi
callq 0x1ca20
jmp 0x152fd
leaq -0x190(%rbp), %rdi
callq 0x9b50
jmp 0x15225
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x140(%rbp), %rdi
callq 0xb220
jmp 0x154fe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0x153b6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x190(%rbp), %rdi
callq 0x9b50
jmp 0x153b6
movq -0x10(%rbp), %rdi
callq 0x15c20
testb $0x1, %al
jne 0x15395
movq -0x10(%rbp), %rsi
leaq -0x1c8(%rbp), %rdi
movl $0x10, %edx
callq 0x12880
jmp 0x15389
leaq -0x1c8(%rbp), %rdi
callq 0xec00
movb $0x1, -0x121(%rbp)
testb $0x1, -0x121(%rbp)
jne 0x153b1
movq -0x270(%rbp), %rdi
callq 0x9b50
jmp 0x154ee
movq -0x270(%rbp), %rdi
callq 0x9b50
jmp 0x154fe
movq -0x10(%rbp), %rsi
leaq -0x200(%rbp), %rdi
callq 0xf140
movl -0x1cc(%rbp), %ecx
movb $0x0, -0x239(%rbp)
movb $0x1, %al
cmpl $0x12, %ecx
movb %al, -0x2a1(%rbp)
je 0x15418
movq -0x10(%rbp), %rsi
leaq -0x238(%rbp), %rdi
callq 0xf140
movb $0x1, -0x239(%rbp)
cmpl $0x11, -0x204(%rbp)
sete %al
movb %al, -0x2a1(%rbp)
movb -0x2a1(%rbp), %al
movb %al, -0x2a2(%rbp)
testb $0x1, -0x239(%rbp)
jne 0x1542f
jmp 0x1543b
leaq -0x238(%rbp), %rdi
callq 0xec00
leaq -0x200(%rbp), %rdi
callq 0xec00
movb -0x2a2(%rbp), %al
testb $0x1, %al
jne 0x15456
jmp 0x154de
movb $0x0, -0x23a(%rbp)
movq -0x10(%rbp), %rdi
callq 0x147e0
movq %rax, -0x258(%rbp)
leaq -0x250(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x14e80
movq -0x270(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x1d410
jmp 0x15492
leaq -0x258(%rbp), %rdi
callq 0xb520
movb $0x1, -0x23a(%rbp)
testb $0x1, -0x23a(%rbp)
jne 0x154dc
jmp 0x154d0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x258(%rbp), %rdi
callq 0xb520
jmp 0x154fe
movq -0x270(%rbp), %rdi
callq 0x9b50
jmp 0x154ee
movq -0x270(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x15510
movq -0x268(%rbp), %rax
addq $0x2b0, %rsp            # imm = 0x2B0
popq %rbp
retq
movq -0xa8(%rbp), %rdi
callq 0x4560
nopw (%rax,%rax)