// File: /workspace/github_c_makefile_star2_O2/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 0x298ed
movq 0x28(%r14), %rax
movq 0x8(%rax), %rax
movl (%rax), %edi
shrl $0x6, %edi
andl $0x3fff, %edi           # imm = 0x3FFF
callq 0x29858
movq 0x18(%r14), %rax
movq %rax, (%rsp)
testq %rax, %rax
je 0xea5d
movq (%rsp), %rcx
xorl %edx, %edx
movq %rcx, 0x8(%rsp)
movsbq (%rcx), %rax
cmpq %rax, %rdx
jge 0xea4f
movq %rdx, 0x10(%rsp)
movq 0x18(%rcx,%rdx,8), %r12
testq %r12, %r12
je 0xea20
cmpq $0x0, 0x18(%r12)
jne 0xe914
cmpq $0x0, 0x20(%r12)
je 0xea32
movq 0x28(%r12), %r15
testq %r15, %r15
je 0xea20
movq %r15, %r13
xorl %ebp, %ebp
movl (%r13), %eax
movsbq %al, %rcx
cmpq %rcx, %rbp
jge 0xea13
movq 0x18(%r13,%rbp,8), %r14
cmpw $0x100, %ax             # imm = 0x100
jb 0xe94c
testq %r14, %r14
je 0xea0b
cmpq $0x0, 0x8(%r14)
je 0xea0b
movl (%r14), %eax
andl $0x7f, %eax
cmpl $0x4a, %eax
jne 0xea0b
movq 0x30(%r14), %rdi
movq 0x18(%rdi), %rax
xorl %ecx, %ecx
testb $0x8, 0x68(%rax)
sete %cl
cmpl %ebx, %ecx
jne 0xea0b
cmpl $0x5, 0x4(%rdi)
jne 0xea0b
movq 0x18(%rax), %rax
addq $0x8, %rax
movq (%rax), %rax
testq %rax, %rax
je 0xe9b1
testb $0x10, 0x1(%rax)
je 0xe9ab
movq 0xc0(%rax), %rcx
testq %rcx, %rcx
jne 0xe9da
addq $0x20, %rax
jmp 0xe991
callq 0x11fce
movq 0x10(%r14), %r9
movq %r9, %rcx
shrq $0x20, %rcx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
shrl $0x16, %r9d
leaq 0x2a7fd(%rip), %rdi     # 0x391cf
movq %r12, %rsi
movq %rax, %rdx
jmp 0xea01
movq 0x28(%rcx), %rax
movq 0x8(%rax), %rdx
movq 0x10(%r14), %r9
movq %r9, %rcx
shrq $0x20, %rcx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
shrl $0x16, %r9d
leaq 0x2a78c(%rip), %rdi     # 0x3918a
movq %r12, %rsi
movl %ecx, %r8d
xorl %eax, %eax
callq 0xe0f0
incq %rbp
jmp 0xe927
movq 0x10(%r13), %r13
cmpq %r15, %r13
jne 0xe925
movq 0x10(%rsp), %rdx
incq %rdx
movq 0x8(%rsp), %rcx
jmp 0xe8e0
cmpq $0x0, 0x28(%r12)
jne 0xe914
leaq 0x5241f(%rip), %rax     # 0x60e64
cmpl $0x2, (%rax)
jl 0xea20
jmp 0xe914
movq 0x10(%rcx), %rcx
cmpq (%rsp), %rcx
jne 0xe8d9
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq