// File: jacky860226[P]JinkelaSat/src/include/JinkelaSat.hpp
// Function: MiniSat::JinkelaSat::litRedundant(MiniSat::Literal, std::vector<MiniSat::Literal, std::allocator<MiniSat::Literal>>&)
bool litRedundant(Literal p, std::vector<Literal> &analyze_toclear) {
    enum {
      seen_undef = 0,
      seen_source = 1,
      seen_removable = 2,
      seen_failed = 3
    };
    auto c = reason(p.var());
    std::vector<std::pair<uint32_t, Literal>> Stack;
    for (size_t i = 1;; ++i) {
      if (i < c->size()) {
        Literal l = (*c)[i];
        if (level(l.var()) == 0 || seen[l.var()] == seen_source ||
            seen[l.var()] == seen_removable)
          continue;
        if (reason(l.var()) == nullptr || seen[l.var()] == seen_failed) {
          Stack.emplace_back(0, p);
          for (auto v : Stack)
            if (seen[v.second.var()] == seen_undef) {
              seen[v.second.var()] = seen_failed;
              analyze_toclear.emplace_back(v.second);
            }
          return false;
        }
        Stack.emplace_back(i, p);
        i = 0, p = l;
        c = reason(p.var());
      } else {
        if (seen[p.var()] == seen_undef) {
          seen[p.var()] = seen_removable;
          analyze_toclear.emplace_back(p);
        }
        if (Stack.empty())
          break;
        std::tie(i, p) = Stack.back();
        c = reason(p.var());
        Stack.pop_back();
      }
    }
    return true;
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movl %esi, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x98(%rbp)
leaq -0x8(%rbp), %rdi
callq 0x37d0
movq -0x98(%rbp), %rdi
movl %eax, %esi
callq 0x145a0
movq %rax, -0x20(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x15ad0
movq $0x1, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x20(%rbp), %rdi
callq 0x3b30
movq %rax, %rcx
movq -0xa0(%rbp), %rax
cmpq %rcx, %rax
jae 0x14987
movq -0x20(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x3a20
movl (%rax), %eax
movl %eax, -0x44(%rbp)
leaq -0x44(%rbp), %rdi
callq 0x37d0
movq -0x98(%rbp), %rdi
movl %eax, %esi
callq 0x143c0
cmpq $0x0, %rax
je 0x147cb
movq -0x98(%rbp), %rax
addq $0xd8, %rax
movq %rax, -0xa8(%rbp)
leaq -0x44(%rbp), %rdi
callq 0x37d0
movq -0xa8(%rbp), %rdi
movslq %eax, %rsi
callq 0x143a0
movzbl (%rax), %eax
cmpl $0x1, %eax
je 0x147cb
movq -0x98(%rbp), %rax
addq $0xd8, %rax
movq %rax, -0xb0(%rbp)
leaq -0x44(%rbp), %rdi
callq 0x37d0
movq -0xb0(%rbp), %rdi
movslq %eax, %rsi
callq 0x143a0
movzbl (%rax), %eax
cmpl $0x2, %eax
jne 0x147d0
jmp 0x14a73
leaq -0x44(%rbp), %rdi
callq 0x37d0
movq -0x98(%rbp), %rdi
movl %eax, %esi
callq 0x145a0
cmpq $0x0, %rax
je 0x14825
movq -0x98(%rbp), %rax
addq $0xd8, %rax
movq %rax, -0xb8(%rbp)
leaq -0x44(%rbp), %rdi
callq 0x37d0
movq -0xb8(%rbp), %rdi
movslq %eax, %rsi
callq 0x143a0
movzbl (%rax), %eax
cmpl $0x3, %eax
jne 0x14946
movl $0x0, -0x48(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x48(%rbp), %rsi
leaq -0x8(%rbp), %rdx
callq 0x15af0
jmp 0x1483f
leaq -0x38(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
callq 0x15b70
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rdi
callq 0x15ba0
movq %rax, -0x70(%rbp)
leaq -0x68(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x15bd0
testb $0x1, %al
jne 0x14877
jmp 0x14936
leaq -0x68(%rbp), %rdi
callq 0x15c10
movq %rax, %rcx
movq -0x98(%rbp), %rax
movq (%rcx), %rcx
movq %rcx, -0x78(%rbp)
addq $0xd8, %rax
movq %rax, -0xc0(%rbp)
leaq -0x78(%rbp), %rdi
addq $0x4, %rdi
callq 0x37d0
movq -0xc0(%rbp), %rdi
movslq %eax, %rsi
callq 0x143a0
movzbl (%rax), %eax
cmpl $0x0, %eax
jne 0x14926
movq -0x98(%rbp), %rax
addq $0xd8, %rax
movq %rax, -0xd0(%rbp)
leaq -0x74(%rbp), %rdi
movq %rdi, -0xc8(%rbp)
callq 0x37d0
movq -0xd0(%rbp), %rdi
movslq %eax, %rsi
callq 0x143a0
movq -0xc8(%rbp), %rsi
movb $0x3, (%rax)
movq -0x18(%rbp), %rdi
callq 0xbed0
jmp 0x1490a
jmp 0x14926
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x15e20
jmp 0x14aa6
jmp 0x14928
leaq -0x68(%rbp), %rdi
callq 0x15c30
jmp 0x14861
movb $0x0, -0x1(%rbp)
movl $0x1, -0x7c(%rbp)
jmp 0x14a8f
leaq -0x38(%rbp), %rdi
leaq -0x40(%rbp), %rsi
leaq -0x8(%rbp), %rdx
callq 0x15c50
jmp 0x14959
movq $0x0, -0x40(%rbp)
movl -0x44(%rbp), %eax
movl %eax, -0x8(%rbp)
leaq -0x8(%rbp), %rdi
callq 0x37d0
movq -0x98(%rbp), %rdi
movl %eax, %esi
callq 0x145a0
movq %rax, -0x20(%rbp)
jmp 0x14a71
movq -0x98(%rbp), %rax
addq $0xd8, %rax
movq %rax, -0xd8(%rbp)
leaq -0x8(%rbp), %rdi
callq 0x37d0
movq -0xd8(%rbp), %rdi
movslq %eax, %rsi
callq 0x143a0
movzbl (%rax), %eax
cmpl $0x0, %eax
jne 0x14a05
movq -0x98(%rbp), %rax
addq $0xd8, %rax
movq %rax, -0xe8(%rbp)
leaq -0x8(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
callq 0x37d0
movq -0xe8(%rbp), %rdi
movslq %eax, %rsi
callq 0x143a0
movq -0xe0(%rbp), %rsi
movb $0x2, (%rax)
movq -0x18(%rbp), %rdi
callq 0xbed0
jmp 0x14a03
jmp 0x14a05
leaq -0x38(%rbp), %rdi
callq 0x15cd0
testb $0x1, %al
jne 0x14a14
jmp 0x14a16
jmp 0x14a84
leaq -0x38(%rbp), %rdi
callq 0x15d10
movq %rax, -0xf0(%rbp)
leaq -0x90(%rbp), %rdi
leaq -0x40(%rbp), %rsi
leaq -0x8(%rbp), %rdx
callq 0x15d50
movq -0xf0(%rbp), %rsi
leaq -0x90(%rbp), %rdi
callq 0x15d90
leaq -0x8(%rbp), %rdi
callq 0x37d0
movq -0x98(%rbp), %rdi
movl %eax, %esi
callq 0x145a0
movq %rax, -0x20(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x15df0
jmp 0x14a73
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x1470d
movb $0x1, -0x1(%rbp)
movl $0x1, -0x7c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x15e20
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0xf0, %rsp
popq %rbp
retq
movq -0x50(%rbp), %rdi
callq 0x22f0
nop