// File: /workspace/github_c_makefile_star2_O0/oridb[P]mc/mi/reaching.c
// Function: reaching
Reaching *
reaching(Cfg *cfg)
{
	Bitset **in, **out;
	Bitset **gen, **kill;
	Bitset *bbin, *bbout;
	Reaching *reaching;
	size_t **defs;        /* mapping from did => [def,list] */
	size_t *ndefs;
	size_t i, j;
	int changed;

	in = zalloc(cfg->nbb * sizeof(Bb*));
	out = zalloc(cfg->nbb * sizeof(Bb*));
	gen = zalloc(cfg->nbb * sizeof(Bb*));
	kill = zalloc(cfg->nbb * sizeof(Bb*));
	defs = zalloc(ndecls * sizeof(size_t*));
	ndefs = zalloc(ndecls * sizeof(size_t));

	collectdefs(cfg, defs, ndefs);
	for (i = 0; i < cfg->nbb; i++) {
		in[i] = mkbs();
		out[i] = mkbs();
		gen[i] = mkbs();
		kill[i] = mkbs();
		if (cfg->bb[i])
			genkill(cfg->bb[i], defs, ndefs, gen[i], kill[i]);
	}

	do {
		changed = 0;
		for (i = 0; i < cfg->nbb; i++) {
			if (!cfg->bb[i])
				continue;
			bbin = mkbs();
			for (j = 0; bsiter(cfg->bb[i]->pred, &j); j++)
				bsunion(bbin, out[j]);
			bbout = bsdup(bbin);
			bsdiff(bbout, kill[i]);
			bsunion(bbout, gen[i]);

			if (!bseq(out[i], bbout) || !bseq(in[i], bbin)) {
				changed = 1;
				bsfree(in[i]);
				bsfree(out[i]);
				in[i] = bbin;
				out[i] = bbout;
			} else {
				bsfree(bbin);
				bsfree(bbout);
			}
		}
	} while (changed);


	for (i = 0; i < cfg->nbb; i++) {
		bsfree(gen[i]);
		bsfree(kill[i]);
	}
	free(gen);
	free(kill);

	reaching = xalloc(sizeof(Reaching));
	reaching->in = in;
	reaching->out = out;
	reaching->defs = defs;
	reaching->ndefs = ndefs;
	reaching->nbb = cfg->nbb;
	return reaching;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
shlq $0x3, %rdi
callq 0x48160
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
shlq $0x3, %rdi
callq 0x48160
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
shlq $0x3, %rdi
callq 0x48160
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
shlq $0x3, %rdi
callq 0x48160
movq %rax, -0x28(%rbp)
leaq 0x35999(%rip), %rax     # 0x7d480
movq (%rax), %rdi
shlq $0x3, %rdi
callq 0x48160
movq %rax, -0x48(%rbp)
leaq 0x35982(%rip), %rax     # 0x7d480
movq (%rax), %rdi
shlq $0x3, %rdi
callq 0x48160
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x50(%rbp), %rdx
callq 0x47e10
movq $0x0, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x20(%rcx), %rax
jae 0x47be4
callq 0x48650
movq %rax, %rdx
movq -0x10(%rbp), %rax
movq -0x58(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
callq 0x48650
movq %rax, %rdx
movq -0x18(%rbp), %rax
movq -0x58(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
callq 0x48650
movq %rax, %rdx
movq -0x20(%rbp), %rax
movq -0x58(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
callq 0x48650
movq %rax, %rdx
movq -0x28(%rbp), %rax
movq -0x58(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x58(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x47bd1
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x48(%rbp), %rsi
movq -0x50(%rbp), %rdx
movq -0x20(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
movq -0x28(%rbp), %rax
movq -0x58(%rbp), %r8
movq (%rax,%r8,8), %r8
callq 0x47f60
jmp 0x47bd3
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x47b27
jmp 0x47be6
movl $0x0, -0x64(%rbp)
movq $0x0, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x20(%rcx), %rax
jae 0x47d50
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x58(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
jne 0x47c1f
jmp 0x47d3f
callq 0x48650
movq %rax, -0x30(%rbp)
movq $0x0, -0x60(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x28(%rax), %rdi
leaq -0x60(%rbp), %rsi
callq 0x48860
cmpl $0x0, %eax
je 0x47c75
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rax
movq -0x60(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x48b40
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x47c30
movq -0x30(%rbp), %rdi
callq 0x486d0
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
movq -0x28(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x48db0
movq -0x38(%rbp), %rdi
movq -0x20(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x48b40
movq -0x18(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x38(%rbp), %rsi
callq 0x48e20
cmpl $0x0, %eax
je 0x47ce0
movq -0x10(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x30(%rbp), %rsi
callq 0x48e20
cmpl $0x0, %eax
jne 0x47d2b
movl $0x1, -0x64(%rbp)
movq -0x10(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x48690
movq -0x18(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x48690
movq -0x30(%rbp), %rdx
movq -0x10(%rbp), %rax
movq -0x58(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x38(%rbp), %rdx
movq -0x18(%rbp), %rax
movq -0x58(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x47d3d
movq -0x30(%rbp), %rdi
callq 0x48690
movq -0x38(%rbp), %rdi
callq 0x48690
jmp 0x47d3f
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x47bf5
jmp 0x47d52
cmpl $0x0, -0x64(%rbp)
jne 0x47be6
movq $0x0, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x20(%rcx), %rax
jae 0x47da2
movq -0x20(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x48690
movq -0x28(%rbp), %rax
movq -0x58(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x48690
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x47d64
movq -0x20(%rbp), %rdi
callq 0x6040
movq -0x28(%rbp), %rdi
callq 0x6040
movl $0x28, %edi
callq 0x481b0
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x48(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x50(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x40(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax,%rax)