// File: /workspace/github_c_makefile_star2_O3/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 $0x48, %rsp
movq %rdi, 0x38(%rsp)
movl %edx, 0x1c(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movq (%rsi), %r15
movq %rsi, 0x40(%rsp)
movq 0x8(%rsi), %rax
movslq %ecx, %r14
cmpq %rax, %r15
je 0x141c
movl %edx, %ebx
leaq 0x3da8(%rip), %rbp      # 0x50e0
leaq 0x20(%rsp), %r13
movslq (%r15), %rcx
movl (%rbp,%rcx,4), %edx
movl (%rbp,%r14,4), %ecx
notl %edx
testl %edx, %ecx
jne 0x140f
andl 0x4(%r15), %ecx
cmpl %ebx, %ecx
jne 0x140f
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
movq (%rsp), %r12
cmpq 0x8(%rsp), %r12
je 0x13c7
movslq (%r12), %rax
movl (%rbp,%rax,4), %ecx
movslq (%r15), %rax
movl (%rbp,%rax,4), %eax
notl %ecx
testl %ecx, %eax
jne 0x139b
andl 0x4(%r12), %eax
cmpl 0x4(%r15), %eax
je 0x13c1
movq 0x28(%rsp), %rsi
cmpq 0x30(%rsp), %rsi
je 0x13b6
movq (%r12), %rax
movq %rax, (%rsi)
addq $0x8, 0x28(%rsp)
jmp 0x13c1
movq %r13, %rdi
movq %r12, %rdx
callq 0x2272
addq $0x8, %r12
jmp 0x1374
movq %rsp, %rdi
movq %r13, %rsi
callq 0x20b0
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x13ec
movq (%r15), %rax
movq %rax, (%rsi)
addq $0x8, 0x8(%rsp)
jmp 0x13f7
movq %rsp, %rdi
movq %r15, %rdx
callq 0x2272
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x1406
callq 0x10b0
movq 0x40(%rsp), %rax
movq 0x8(%rax), %rax
addq $0x8, %r15
cmpq %rax, %r15
jne 0x133d
leaq (%r14,%r14,2), %rdi
shlq $0x4, %rdi
movq 0x38(%rsp), %rbx
addq %rbx, %rdi
leaq 0x1c(%rsp), %rsi
callq 0x21a2
movl (%rax), %ebp
movq (%rsp), %r14
cmpq 0x8(%rsp), %r14
je 0x146e
movslq (%r14), %rax
leaq (%rax,%rax,2), %rdi
shlq $0x4, %rdi
addq %rbx, %rdi
addq $0x4, %r14
movq %r14, %rsi
callq 0x21a2
subl (%rax), %ebp
addq $0x4, %r14
cmpq 0x8(%rsp), %r14
jne 0x1443
movq (%rsp), %r14
testq %r14, %r14
je 0x147b
movq %r14, %rdi
callq 0x10b0
movl %ebp, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1490
jmp 0x1495
movq %rax, %rbx
jmp 0x14a7
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x14a7
callq 0x10b0
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x14b5
callq 0x10b0
movq %rbx, %rdi
callq 0x1170