// File: /workspace/github_c_makefile_star2_O1/lucvoo[P]sparse-dev/graph.c
// Function: graph_calls
static void graph_calls(struct entrypoint *ep, int internal)
{
	struct basic_block *bb;
	struct instruction *insn;

	show_ident(ep->name->ident);
	stream_name(ep->entry->bb->pos.stream);

	FOR_EACH_PTR(ep->bbs, bb) {
		if (!bb)
			continue;
		if (!bb->parents && !bb->children && !bb->insns && verbose < 2)
			continue;

		FOR_EACH_PTR(bb->insns, insn) {
			if (!insn->bb)
				continue;
			if (insn->opcode == OP_CALL &&
			    internal == !(insn->func->sym->ctype.modifiers & MOD_EXTERN)) {

				/* Find the symbol for the callee's definition */
				struct symbol * sym;
				if (insn->func->type == PSEUDO_SYM) {
					for (sym = insn->func->sym->ident->symbols;
					     sym; sym = sym->next_id) {
						if (sym->namespace & NS_SYMBOL && sym->ep)
							break;
					}

					if (sym)
						printf("bb%p -> bb%p"
						       "[label=%d,line=%d,col=%d,op=call,style=bold,weight=30];\n",
						       bb, sym->ep->entry->bb,
						       insn->pos.line, insn->pos.line, insn->pos.pos);
					else
						printf("bb%p -> \"%s\" "
						       "[label=%d,line=%d,col=%d,op=extern,style=dashed];\n",
						       bb, show_pseudo(insn->func),
						       insn->pos.line, insn->pos.line, insn->pos.pos);
				}
			}
		} END_FOR_EACH_PTR(insn);
	} END_FOR_EACH_PTR(bb);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, %ebx
movq %rdi, %r14
movq (%rdi), %rax
movq 0x18(%rax), %rdi
callq 0x2ea31
movq 0x28(%r14), %rax
movq 0x8(%rax), %rax
movl (%rax), %edi
shrl $0x6, %edi
andl $0x3fff, %edi           # imm = 0x3FFF
callq 0x2e990
movq 0x18(%r14), %rax
movq %rax, (%rsp)
testq %rax, %rax
je 0xf041
movq (%rsp), %rcx
cmpb $0x0, (%rcx)
jle 0xf033
xorl %edx, %edx
movq %rcx, 0x8(%rsp)
movq %rdx, 0x10(%rsp)
movq 0x18(%rcx,%rdx,8), %r12
testq %r12, %r12
je 0xeffa
cmpq $0x0, 0x18(%r12)
jne 0xeeea
cmpq $0x0, 0x20(%r12)
je 0xf016
movq 0x28(%r12), %r13
testq %r13, %r13
je 0xeffa
movq %r13, %r15
movzwl (%r15), %eax
testb %al, %al
jle 0xefed
xorl %r14d, %r14d
movq 0x18(%r15,%r14,8), %rbp
movzwl %ax, %eax
cmpl $0x100, %eax            # imm = 0x100
jb 0xef22
testq %rbp, %rbp
je 0xefda
cmpq $0x0, 0x8(%rbp)
je 0xefda
movl (%rbp), %eax
andl $0x7f, %eax
cmpl $0x4a, %eax
jne 0xefda
movq 0x30(%rbp), %rdi
movq 0x18(%rdi), %rax
xorl %ecx, %ecx
testb $0x8, 0x68(%rax)
sete %cl
cmpl %ebx, %ecx
jne 0xefda
cmpl $0x5, 0x4(%rdi)
jne 0xefda
movq 0x18(%rax), %rax
movq 0x8(%rax), %rax
testq %rax, %rax
je 0xef80
testb $0x10, 0x1(%rax)
je 0xef7a
movq 0xc0(%rax), %rcx
testq %rcx, %rcx
jne 0xefa9
movq 0x20(%rax), %rax
jmp 0xef63
callq 0x12888
movq 0x10(%rbp), %r9
movq %r9, %rcx
shrq $0x20, %rcx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
shrl $0x16, %r9d
leaq 0x3222e(%rip), %rdi     # 0x411cf
movq %r12, %rsi
movq %rax, %rdx
jmp 0xefd0
movq 0x28(%rcx), %rax
movq 0x8(%rax), %rdx
movq 0x10(%rbp), %r9
movq %r9, %rcx
shrq $0x20, %rcx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
shrl $0x16, %r9d
leaq 0x321bd(%rip), %rdi     # 0x4118a
movq %r12, %rsi
movl %ecx, %r8d
xorl %eax, %eax
callq 0xe0f0
incq %r14
movl (%r15), %eax
movsbq %al, %rcx
cmpq %rcx, %r14
jl 0xef0a
movq 0x10(%r15), %r15
cmpq %r13, %r15
jne 0xeefb
movq 0x10(%rsp), %rdx
incq %rdx
movq 0x8(%rsp), %rcx
movsbq (%rcx), %rax
cmpq %rax, %rdx
jl 0xeec3
jmp 0xf033
cmpq $0x0, 0x28(%r12)
jne 0xeeea
leaq 0x59e3b(%rip), %rax     # 0x68e64
cmpl $0x2, (%rax)
jl 0xeffa
jmp 0xeeea
movq 0x10(%rcx), %rcx
cmpq (%rsp), %rcx
jne 0xeeb3
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq