// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, 0x40(%rsp)
movq %rdi, %r14
leaq 0xc(%rsp), %rax
movl %esi, (%rax)
sarl %esi
movslq %esi, %rax
movq 0x80(%rdi), %rcx
shlq $0x4, %rax
movq (%rcx,%rax), %r13
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %rax
movaps %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movl $0x1, %ebp
movq %rbp, 0x18(%rsp)
movq (%r13), %rax
movq 0x8(%r13), %r12
subq %rax, %r12
sarq $0x2, %r12
cmpq %r12, %rbp
jb 0x6453
movl 0xc(%rsp), %eax
sarl %eax
cltq
movq 0xd8(%r14), %rcx
cmpb $0x0, (%rcx,%rax)
jne 0x6562
movb $0x2, (%rcx,%rax)
movq 0x40(%rsp), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x6558
movl 0xc(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x6562
movl (%rax,%rbp,4), %ebx
movl %ebx, %eax
sarl %eax
movslq %eax, %rcx
movq 0x80(%r14), %rax
movq %rcx, %r15
shlq $0x4, %r15
cmpq $0x0, 0x8(%rax,%r15)
je 0x6485
movq 0xd8(%r14), %rdx
movb (%rdx,%rcx), %cl
leal -0x1(%rcx), %edx
cmpb $0x2, %dl
jae 0x6497
movl $0x4, %eax
testb $0x3, %al
je 0x6599
jmp 0x65a6
cmpb $0x3, %cl
je 0x64d3
cmpq $0x0, (%rax,%r15)
je 0x64d3
leaq 0x20(%rsp), %rdi
leaq 0x18(%rsp), %rsi
leaq 0xc(%rsp), %rdx
callq 0x69fe
movq $0x0, 0x18(%rsp)
movl %ebx, 0xc(%rsp)
movq 0x80(%r14), %rax
movq (%rax,%r15), %r13
xorl %eax, %eax
jmp 0x648a
movl $0x0, 0x10(%rsp)
leaq 0x20(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0xc(%rsp), %rdx
callq 0x69c4
movq 0x20(%rsp), %rbx
movq 0x28(%rsp), %r15
cmpq %r15, %rbx
je 0x654e
movq (%rbx), %rax
movq %rax, 0x10(%rsp)
movl 0x14(%rsp), %eax
sarl %eax
cltq
movq 0xd8(%r14), %rcx
cmpb $0x0, (%rcx,%rax)
jne 0x6548
movb $0x3, (%rcx,%rax)
movq 0x40(%rsp), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x653e
movl 0x14(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x6548
leaq 0x14(%rsp), %rdx
callq 0x469e
addq $0x8, %rbx
jmp 0x64f9
movl $0x1, %eax
jmp 0x648a
leaq 0xc(%rsp), %rdx
callq 0x469e
movq 0x28(%rsp), %rax
cmpq %rax, 0x20(%rsp)
je 0x65a6
leaq -0x8(%rax), %rcx
movl -0x8(%rax), %edx
movq %rdx, 0x18(%rsp)
movl -0x4(%rax), %eax
movl %eax, 0xc(%rsp)
sarl %eax
cltq
movq 0x80(%r14), %rdx
shlq $0x4, %rax
movq (%rdx,%rax), %r13
movq %rcx, 0x28(%rsp)
movq 0x18(%rsp), %rbp
incq %rbp
jmp 0x63f7
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x65bd
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
cmpq %r12, %rbp
setae %al
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x65d8
jmp 0x65d8
jmp 0x65d8
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x65f2
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x2180
movq %rbx, %rdi
callq 0x2240