// File: /workspace/github_c_makefile_star2_O1/ranbenbasat[P]RHHH/check1.cpp
// Function: conditionedcount(std::map<unsigned int, Counter, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, Counter>>>*, std::vector<std::pair<int, unsigned int>, std::allocator<std::pair<int, unsigned int>>> const&, unsigned int, int)
int conditionedcount(map<Item, Counter> * m, const vector<Pair> &p, Item item, int mask) {
	vector<Pair> descendants; //the direct descendants of item,mask
	//int countcandidates=0;
	for (vector<Pair>::const_iterator it = p.begin(); it != p.end(); ++it) {
		if ((masks[it->first] & masks[mask]) == masks[mask] && (it->second & masks[mask]) == item) {
			//it is a descendant, now eliminate non-direct descendants
			vector<Pair> newdescendants;
			for (vector<Pair>::const_iterator iter = descendants.begin(); iter != descendants.end(); ++iter) {
				if ((masks[iter->first] & masks[it->first]) != masks[it->first] || (iter->second & masks[it->first]) != it->second) {
					newdescendants.push_back(*iter);
				}
			}
			descendants = newdescendants;
			descendants.push_back(*it);
		}
	}
	
	int s = m[mask][item].get();
	for (vector<Pair>::iterator iter = descendants.begin(); iter != descendants.end(); ++iter) {
		s -= m[iter->first][iter->second].get();
	}

	return s;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, 0x50(%rsp)
movl %edx, 0xc(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq (%rsi), %r15
movslq %ecx, %r12
cmpq 0x8(%rsi), %r15
je 0x140f
movq %rsi, %r14
leaq 0x3dae(%rip), %rbx      # 0x50e0
leaq 0x30(%rsp), %r13
movslq (%r15), %rax
movl (%rbx,%rax,4), %ecx
movl (%rbx,%r12,4), %eax
notl %ecx
testl %ecx, %eax
jne 0x1401
andl 0x4(%r15), %eax
cmpl 0xc(%rsp), %eax
jne 0x1401
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
movq 0x10(%rsp), %rbp
cmpq 0x18(%rsp), %rbp
je 0x13be
movslq (%rbp), %rax
movl (%rbx,%rax,4), %ecx
movslq (%r15), %rax
movl (%rbx,%rax,4), %eax
notl %ecx
testl %ecx, %eax
jne 0x1392
andl 0x4(%rbp), %eax
cmpl 0x4(%r15), %eax
je 0x13b8
movq 0x38(%rsp), %rsi
cmpq 0x40(%rsp), %rsi
je 0x13ad
movq (%rbp), %rax
movq %rax, (%rsi)
addq $0x8, 0x38(%rsp)
jmp 0x13b8
movq %r13, %rdi
movq %rbp, %rdx
callq 0x2256
addq $0x8, %rbp
jmp 0x136f
leaq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0x2092
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x13e5
movq (%r15), %rax
movq %rax, (%rsi)
addq $0x8, 0x18(%rsp)
jmp 0x13f2
leaq 0x10(%rsp), %rdi
movq %r15, %rdx
callq 0x2256
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x1401
callq 0x10b0
addq $0x8, %r15
cmpq 0x8(%r14), %r15
jne 0x1337
leaq (%r12,%r12,2), %rdi
shlq $0x4, %rdi
movq 0x50(%rsp), %rbx
addq %rbx, %rdi
leaq 0xc(%rsp), %rsi
callq 0x2182
movl (%rax), %ebp
movq 0x10(%rsp), %r14
cmpq 0x18(%rsp), %r14
je 0x1459
movslq (%r14), %rax
leaq (%rax,%rax,2), %rdi
shlq $0x4, %rdi
addq %rbx, %rdi
addq $0x4, %r14
movq %r14, %rsi
callq 0x2182
subl (%rax), %ebp
addq $0x4, %r14
jmp 0x1430
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x1468
callq 0x10b0
movl %ebp, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x147d
jmp 0x1482
movq %rax, %rbx
jmp 0x1494
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x1494
callq 0x10b0
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x14a3
callq 0x10b0
movq %rbx, %rdi
callq 0x1170