// File: /workspace/github_cpp_makefile_star2_O3/WayfireWM[P]wf-utils/wayfire/parser/condition_parser.cpp
// Function: wf::condition_parser_t::parse(wf::lexer_t&)
std::shared_ptr<condition_t> condition_parser_t::parse(lexer_t &lexer)
{
    // Peek at the first symbol to see if we consider a catch-all or catch-none condition.
    auto symbol = lexer.parse_symbol();
    lexer.reverse();

    if (symbol.type == symbol_t::type_t::KEYWORD)
    {
        auto keyword = get_string(symbol.value);
        if (keyword == "all")
        {
            _root = std::make_shared<true_condition_t>();
        }
        else if (keyword == "none")
        {
            _root = std::make_shared<false_condition_t>();
        }
        else
        {
            throw std::runtime_error("Condition parser error. Single keyword rules must be 'all' or 'none'.");
        }
    }
    else
    {
        _expression(lexer);
        lexer.reverse();
    }

    std::cout << _root->to_string() << std::endl;

    return _root;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x70, %rsp
movq %rdi, %rbx
leaq 0x40(%rsp), %rdi
movq %rsi, %r14
movq %rdx, %rsi
movq %rdx, %r15
callq 0x738e
movq %r15, %rdi
callq 0x7800
cmpl $0x4, 0x40(%rsp)
jne 0x92c3
leaq 0x48(%rsp), %rsi
leaq 0x20(%rsp), %rdi
callq 0xb34c
leaq 0x2f5a(%rip), %rsi      # 0xc1d8
leaq 0x20(%rsp), %rdi
callq 0x5080
testl %eax, %eax
je 0x92d8
leaq 0x2f49(%rip), %rsi      # 0xc1dc
leaq 0x20(%rsp), %rdi
callq 0x5080
testl %eax, %eax
jne 0x93f7
leaq 0x18(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x10(%rsp), %rsi
leaq 0xf(%rsp), %rdx
callq 0x9e66
jmp 0x92f4
movq %r14, %rdi
movq %r15, %rsi
callq 0x947e
movq %r15, %rdi
callq 0x7800
jmp 0x9341
leaq 0x18(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x10(%rsp), %rsi
leaq 0xf(%rsp), %rdx
callq 0x9d82
vmovaps 0x10(%rsp), %xmm0
vxorps %xmm1, %xmm1, %xmm1
vmovaps %xmm1, 0x10(%rsp)
movq 0x8(%r14), %rdi
vmovups %xmm0, (%r14)
testq %rdi, %rdi
je 0x9326
callq 0x6972
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x9326
callq 0x6972
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9341
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x5230
movq (%r14), %rsi
movq (%rsi), %rax
leaq 0x20(%rsp), %rdi
callq *0x18(%rax)
movq 0x28(%rsp), %rdx
movq 0x20(%rsp), %rsi
movq 0x9c68(%rip), %rdi      # 0x12fc8
callq 0x5270
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x5200
movsbl %al, %esi
movq %r15, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5160
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x93aa
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x5230
movq (%r14), %rax
movq %rax, (%rbx)
movq 0x8(%r14), %rax
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0x93d2
movq 0x9bfc(%rip), %rcx      # 0x12fc0
cmpb $0x0, (%rcx)
je 0x93ce
incl 0x8(%rax)
jmp 0x93d2
lock
incl 0x8(%rax)
leaq 0x48(%rsp), %rsi
leaq 0x8942(%rip), %rcx      # 0x11d20
movzbl 0x20(%rsi), %eax
leaq 0x20(%rsp), %rdi
callq *(%rcx,%rax,8)
movq %rbx, %rax
addq $0x70, %rsp
popq %rbx
popq %r14
popq %r15
retq
movl $0x10, %edi
callq 0x5110
movq %rax, %r14
leaq 0x31cd(%rip), %rsi      # 0xc5d8
movq %rax, %rdi
callq 0x50d0
movq 0x9bd6(%rip), %rsi      # 0x12ff0
movq 0x9b97(%rip), %rdx      # 0x12fb8
movq %r14, %rdi
callq 0x5370
jmp 0x944d
movq %r14, %rdi
movq %rax, %rbx
callq 0x51a0
jmp 0x9450
jmp 0x944d
jmp 0x944d
jmp 0x9448
movq %rax, %rdi
callq 0x6209
jmp 0x9448
movq %rax, %rbx
jmp 0x946b
movq %rax, %rbx
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x946b
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x5230
leaq 0x40(%rsp), %rdi
callq 0x7568
movq %rbx, %rdi
callq 0x5390
nop