// File: /workspace/github_c_makefile_star2_O3/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 0x2e409
movq 0x28(%r14), %rax
movq 0x8(%rax), %rax
movl (%rax), %edi
shrl $0x6, %edi
andl $0x3fff, %edi           # imm = 0x3FFF
callq 0x2e368
movq 0x18(%r14), %rax
movq %rax, (%rsp)
testq %rax, %rax
je 0xf061
movq (%rsp), %rdx
movzwl (%rdx), %eax
testb %al, %al
jle 0xf053
xorl %esi, %esi
movq %rdx, 0x8(%rsp)
movq 0x18(%rdx,%rsi,8), %r12
testq %r12, %r12
je 0xf021
cmpq $0x0, 0x18(%r12)
jne 0xeeff
cmpq $0x0, 0x20(%r12)
je 0xf036
movq 0x28(%r12), %r13
testq %r13, %r13
je 0xf021
movq %rsi, 0x10(%rsp)
movq %r13, %r15
movzwl (%r15), %eax
testb %al, %al
jle 0xf007
xorl %r14d, %r14d
movq 0x18(%r15,%r14,8), %rbp
movzwl %ax, %eax
cmpl $0x100, %eax            # imm = 0x100
jb 0xef3c
testq %rbp, %rbp
je 0xeff4
cmpq $0x0, 0x8(%rbp)
je 0xeff4
movl (%rbp), %eax
andl $0x7f, %eax
cmpl $0x4a, %eax
jne 0xeff4
movq 0x30(%rbp), %rdi
movq 0x18(%rdi), %rax
xorl %ecx, %ecx
testb $0x8, 0x68(%rax)
sete %cl
cmpl %ebx, %ecx
jne 0xeff4
cmpl $0x5, 0x4(%rdi)
jne 0xeff4
movq 0x18(%rax), %rax
movq 0x8(%rax), %rax
testq %rax, %rax
je 0xef9a
testb $0x10, 0x1(%rax)
je 0xef94
movq 0xc0(%rax), %rcx
testq %rcx, %rcx
jne 0xefc3
movq 0x20(%rax), %rax
jmp 0xef7d
callq 0x128d4
movq 0x10(%rbp), %r9
movq %r9, %rcx
shrq $0x20, %rcx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
shrl $0x16, %r9d
leaq 0x31214(%rip), %rdi     # 0x401cf
movq %r12, %rsi
movq %rax, %rdx
jmp 0xefea
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 0x311a3(%rip), %rdi     # 0x4018a
movq %r12, %rsi
movl %ecx, %r8d
xorl %eax, %eax
callq 0xe0f0
incq %r14
movl (%r15), %eax
movsbq %al, %rcx
cmpq %rcx, %r14
jl 0xef24
movq 0x10(%r15), %r15
cmpq %r13, %r15
jne 0xef15
movq 0x8(%rsp), %rdx
movzwl (%rdx), %eax
movq 0x10(%rsp), %rsi
incq %rsi
movzwl %ax, %ecx
movsbq %cl, %rcx
cmpq %rcx, %rsi
jl 0xeedd
jmp 0xf053
cmpq $0x0, 0x28(%r12)
jne 0xeeff
leaq 0x57e1b(%rip), %rcx     # 0x66e64
cmpl $0x2, (%rcx)
jl 0xf021
jmp 0xeeff
movq 0x10(%rdx), %rdx
cmpq (%rsp), %rdx
jne 0xeecb
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq