// File: /workspace/github_cpp_makefile_star2_O1/WayfireWM[P]wf-utils/wayfire/parser/condition_parser.cpp
// Function: wf::condition_parser_t::_factor(wf::lexer_t&)
void condition_parser_t::_factor(lexer_t &lexer)
{
    _symbol = lexer.parse_symbol();

    if (_symbol.type == symbol_t::type_t::IDENTIFIER || _symbol.type == symbol_t::type_t::SIGNAL)
    {
        // Identifier.
        auto identifier = get_string(_symbol.value);

        // Keyword.
        _symbol = lexer.parse_symbol();
        if (_symbol.type != symbol_t::type_t::KEYWORD)
        {
            throw std::runtime_error("Condition parser error. Expected keyword.");
        }
        auto keyword = get_string(_symbol.value);
        if ((keyword != "equals") && (keyword != "contains") && (keyword != "is"))
        {
            std::string error = "Condition parser error. Unsupported keyword. keyword: ";
            error.append(keyword);
            throw std::runtime_error(error);
        }

        // Value.
        _symbol = lexer.parse_symbol();
        if (_symbol.type != symbol_t::type_t::LITERAL)
        {
            throw std::runtime_error("Condition parser error. Expected literal.");
        }

        // Create condition.
        if (keyword == "equals" || keyword == "is")
        {
            _root = std::make_shared<equals_condition_t>(identifier, _symbol.value);
        }
        if (keyword == "contains")
        {
            _root = std::make_shared<contains_condition_t>(identifier, _symbol.value);
        }

        _symbol = lexer.parse_symbol();
    }
    else if ((_symbol.type == symbol_t::type_t::OPERATOR) && (get_string(_symbol.value) == "!"))
    {
        auto not_condition = std::make_shared<not_condition_t>();
        _factor(lexer);
        not_condition->child = _root;
        _root = not_condition;
    }
    else if ((_symbol.type == symbol_t::type_t::STRUCTURAL) && (get_string(_symbol.value) == "("))
    {
        _expression(lexer);
        // Expect ) and discard it
        if (_symbol.type != symbol_t::type_t::STRUCTURAL || (get_string(_symbol.value) != ")"))
        {
            throw std::runtime_error("Condition parser error. Expected \')\'");
        }
        _symbol = lexer.parse_symbol();
    }
    else {
        throw std::runtime_error("Condition parser error. Unexpected symbol.");
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq %rsp, %r15
movq %r15, %rdi
callq 0x7384
movl (%r15), %eax
movl %eax, 0x10(%rbx)
leaq 0x18(%rbx), %r15
leaq 0x8(%rsp), %r12
leaq 0x50(%rsp), %rdi
movq %r15, (%rdi)
movzbl 0x20(%r12), %eax
leaq 0x9c4c(%rip), %rcx      # 0x13460
movq %r12, %rsi
callq *(%rcx,%rax,8)
movzbl 0x28(%rsp), %eax
leaq 0x94fa(%rip), %rcx      # 0x12d20
leaq 0x50(%rsp), %rdi
movq %r12, %rsi
movq %rcx, %rbp
callq *(%rcx,%rax,8)
movl 0x10(%rbx), %r13d
cmpl $0x6, %r13d
je 0x9848
cmpl $0x1, %r13d
jne 0x9aa3
leaq 0x50(%rsp), %rdi
movq %r15, %rsi
callq 0xb4ee
movq %rsp, %rdi
movq %r14, %rsi
callq 0x7384
leaq 0x8(%rsp), %r12
movl -0x8(%r12), %eax
movl %eax, 0x10(%rbx)
leaq 0x30(%rsp), %rdi
movq %r15, (%rdi)
movzbl 0x20(%r12), %eax
movq %r12, %rsi
leaq 0x9bdb(%rip), %rcx      # 0x13460
callq *(%rcx,%rax,8)
movzbl 0x28(%rsp), %eax
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
callq *(%rbp,%rax,8)
cmpl $0x4, 0x10(%rbx)
jne 0x9c8d
leaq 0x30(%rsp), %rdi
movq %r15, %rsi
callq 0xb4ee
leaq 0x3901(%rip), %rsi      # 0xd1b8
leaq 0x30(%rsp), %rdi
callq 0x5080
testl %eax, %eax
je 0x98f3
leaq 0x38f3(%rip), %rsi      # 0xd1bf
leaq 0x30(%rsp), %rdi
callq 0x5080
testl %eax, %eax
je 0x98f3
leaq 0x38d4(%rip), %rsi      # 0xd1b5
leaq 0x30(%rsp), %rdi
callq 0x5080
testl %eax, %eax
jne 0x9cf8
movq %rsp, %rdi
movq %r14, %rsi
callq 0x7384
leaq 0x8(%rsp), %r12
movl -0x8(%r12), %eax
movl %eax, 0x10(%rbx)
leaq 0x70(%rsp), %rdi
movq %r15, (%rdi)
movzbl 0x20(%r12), %eax
movq %r12, %rsi
leaq 0x9b3d(%rip), %rcx      # 0x13460
callq *(%rcx,%rax,8)
movzbl 0x28(%rsp), %eax
leaq 0x70(%rsp), %rdi
movq %r12, %rsi
callq *(%rbp,%rax,8)
cmpl $0x2, 0x10(%rbx)
jne 0x9cc4
leaq 0x3870(%rip), %rsi      # 0xd1b8
leaq 0x30(%rsp), %rdi
callq 0x5080
testl %eax, %eax
je 0x996b
leaq 0x3858(%rip), %rsi      # 0xd1b5
leaq 0x30(%rsp), %rdi
callq 0x5080
testl %eax, %eax
jne 0x99bc
leaq 0x8(%rsp), %rdi
movq $0x0, -0x8(%rdi)
movq %rsp, %rsi
leaq 0x70(%rsp), %rdx
leaq 0x50(%rsp), %rcx
movq %r15, %r8
callq 0xa242
vmovaps (%rsp), %xmm0
vxorps %xmm1, %xmm1, %xmm1
vmovaps %xmm1, (%rsp)
movq 0x8(%rbx), %rdi
vmovups %xmm0, (%rbx)
testq %rdi, %rdi
je 0x99ad
callq 0x6968
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x99bc
callq 0x6968
leaq 0x37fc(%rip), %rsi      # 0xd1bf
leaq 0x30(%rsp), %rdi
callq 0x5080
testl %eax, %eax
jne 0x9a22
leaq 0x8(%rsp), %rdi
movq $0x0, -0x8(%rdi)
movq %rsp, %rsi
leaq 0x70(%rsp), %rdx
leaq 0x50(%rsp), %rcx
movq %r15, %r8
callq 0xa326
vmovaps (%rsp), %xmm0
vxorps %xmm1, %xmm1, %xmm1
vmovaps %xmm1, (%rsp)
movq 0x8(%rbx), %rdi
vmovups %xmm0, (%rbx)
testq %rdi, %rdi
je 0x9a13
callq 0x6968
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x9a22
callq 0x6968
movq %rsp, %rdi
movq %r14, %rsi
callq 0x7384
leaq 0x8(%rsp), %r14
movl -0x8(%r14), %eax
movl %eax, 0x10(%rbx)
leaq 0x70(%rsp), %rdi
movq %r15, (%rdi)
movzbl 0x20(%r14), %eax
movq %r14, %rsi
leaq 0x9a10(%rip), %rcx      # 0x13460
callq *(%rcx,%rax,8)
movzbl 0x28(%rsp), %eax
leaq 0x70(%rsp), %rdi
movq %r14, %rsi
callq *(%rbp,%rax,8)
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9a7f
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x5230
leaq 0x60(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9c7b
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x5230
jmp 0x9c7b
cmpl $0x3, %r13d
jne 0x9ad0
leaq 0x50(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0xb4ee
leaq 0x35ad(%rip), %rsi      # 0xd06d
movq %r12, %rdi
callq 0x5080
testl %eax, %eax
sete %r12b
jmp 0x9ad3
xorl %r12d, %r12d
cmpl $0x3, %r13d
jne 0x9af4
leaq 0x60(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9af4
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x5230
testb %r12b, %r12b
je 0x9b66
leaq 0x8(%rsp), %r15
movq $0x0, -0x8(%r15)
movq %rsp, %rsi
leaq 0x30(%rsp), %rdx
movq %r15, %rdi
callq 0xa40a
movq %rbx, %rdi
movq %r14, %rsi
callq 0x97ce
movq (%rsp), %rdi
movq (%rbx), %rax
movq %rax, 0x8(%rdi)
addq $0x10, %rdi
leaq 0x8(%rbx), %r14
movq %r14, %rsi
callq 0x9e84
movq (%rsp), %rax
movq %rax, (%rbx)
movq %r14, %rdi
movq %r15, %rsi
callq 0x9e84
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x9c7b
callq 0x6968
jmp 0x9c7b
movl 0x10(%rbx), %r13d
cmpl $0x5, %r13d
jne 0x9b97
leaq 0x30(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0xb4ee
leaq 0x42e7(%rip), %rsi      # 0xde6e
movq %r12, %rdi
callq 0x5080
testl %eax, %eax
sete %r12b
jmp 0x9b9a
xorl %r12d, %r12d
cmpl $0x5, %r13d
jne 0x9bbb
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9bbb
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x5230
testb %r12b, %r12b
je 0x9d57
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9566
movl 0x10(%rbx), %r13d
movb $0x1, %r12b
cmpl $0x5, %r13d
jne 0x9c01
leaq 0x70(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0xb4ee
leaq 0x4250(%rip), %rsi      # 0xde43
movq %r12, %rdi
callq 0x5080
testl %eax, %eax
setne %r12b
cmpl $0x5, %r13d
jne 0x9c28
leaq 0x80(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9c28
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x5230
testb %r12b, %r12b
jne 0x9d75
movq %rsp, %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x7384
movl (%r12), %eax
movl %eax, 0x10(%rbx)
leaq 0x8(%rsp), %rbx
leaq 0x90(%rsp), %rdi
movq %r15, (%rdi)
movzbl 0x20(%rbx), %eax
movq %rbx, %rsi
leaq 0x97fc(%rip), %rcx      # 0x13460
callq *(%rcx,%rax,8)
movzbl 0x28(%rsp), %eax
leaq 0x90(%rsp), %rdi
movq %rbx, %rsi
callq *(%rbp,%rax,8)
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x5110
movq %rax, %r14
leaq 0x3995(%rip), %rsi      # 0xd636
movq %rax, %rdi
callq 0x50d0
movq 0xa340(%rip), %rsi      # 0x13ff0
movq 0xa301(%rip), %rdx      # 0x13fb8
movq %r14, %rdi
callq 0x5370
jmp 0x9d57
movl $0x10, %edi
callq 0x5110
movq %rax, %r14
leaq 0x39bf(%rip), %rsi      # 0xd697
movq %rax, %rdi
callq 0x50d0
movq 0xa309(%rip), %rsi      # 0x13ff0
movq 0xa2ca(%rip), %rdx      # 0x13fb8
movq %r14, %rdi
callq 0x5370
jmp 0x9d57
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x3958(%rip), %rsi      # 0xd660
leaq 0x3987(%rip), %rdx      # 0xd696
movq %rsp, %rdi
callq 0x6382
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
movq %rsp, %rdi
callq 0x5090
movl $0x10, %edi
callq 0x5110
movq %rax, %r14
movq %rsp, %rsi
movq %rax, %rdi
callq 0x5350
movq 0xa2a8(%rip), %rsi      # 0x13ff0
movq 0xa269(%rip), %rdx      # 0x13fb8
movq %r14, %rdi
callq 0x5370
movl $0x10, %edi
callq 0x5110
movq %rax, %r14
leaq 0x397b(%rip), %rsi      # 0xd6e6
movq %rax, %rdi
callq 0x50d0
jmp 0x9d91
movl $0x10, %edi
callq 0x5110
movq %rax, %r14
leaq 0x3938(%rip), %rsi      # 0xd6c1
movq %rax, %rdi
callq 0x50d0
movq 0xa258(%rip), %rsi      # 0x13ff0
movq 0xa219(%rip), %rdx      # 0x13fb8
movq %r14, %rdi
callq 0x5370
movq %rax, %rbx
movq %r14, %rdi
callq 0x51a0
jmp 0x9dc9
jmp 0x9db6
movq %rax, %rbx
movq %r14, %rdi
callq 0x51a0
jmp 0x9e71
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x9e30
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x5230
jmp 0x9e30
jmp 0x9e2d
jmp 0x9e7b
jmp 0x9e7b
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x9e71
callq 0x6968
jmp 0x9e71
jmp 0x9e2d
jmp 0x9e2d
movq %rax, %rbx
movq %r14, %rdi
callq 0x51a0
jmp 0x9e30
jmp 0x9e53
movq %rax, %rbx
movq %r14, %rdi
callq 0x51a0
jmp 0x9e56
jmp 0x9e2d
jmp 0x9e7b
jmp 0x9e7b
jmp 0x9e2d
jmp 0x9e7b
jmp 0x9e7b
movq %rax, %rbx
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9e56
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x5230
jmp 0x9e56
jmp 0x9e53
jmp 0x9e7b
jmp 0x9e7b
movq %rax, %rbx
leaq 0x60(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9e71
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x5230
movq %rbx, %rdi
callq 0x5390
jmp 0x9e7b
movq %rax, %rdi
callq 0x6209
nop