// File: /workspace/github_c_makefile_star2_O3/aquaxis[P]synverll/src/parser_ir_call.c
// Function: output_call_signal_tree
int output_call_signal_tree(FILE *fp)
{
	CALL_TREE *now_call_tree;
	CALL_SIGNAL_TREE *now_call_signal_tree;
	char *temp;

	temp = calloc(STR_MAX, 1);

    now_call_tree = call_tree_top;
    while(now_call_tree != NULL){
		now_call_signal_tree = now_call_tree->signal_top_ptr;
		while(now_call_signal_tree != NULL){
			switch(now_call_signal_tree->inout){
				case 0:	// in
					sprintf(temp, "\tinput ");
					break;
				case 1:	// out
					sprintf(temp, "\toutput reg ");
					break;
			}
			if(now_call_signal_tree->size > 0){
					sprintf(temp, "%s[%d:0] ", temp, now_call_signal_tree->size -1);
			}
			sprintf(temp, "%s__call_%s_%s",
				temp,
				convname(sep_p(now_call_tree->call_name)),
				now_call_signal_tree->signal_name
			);
			if(
				strcmp(now_call_signal_tree->signal_name, "req") &&
				strcmp(now_call_signal_tree->signal_name, "ready") &&
				strcmp(now_call_signal_tree->signal_name, "done") &&
				strcmp(now_call_signal_tree->signal_name, "result")
			){
				sprintf(temp, "%s_%d",
					temp,
					now_call_signal_tree->num
				);
			}
			fprintf(fp, "%s,\n", temp);
			now_call_signal_tree = now_call_signal_tree->next_ptr;
		}
		fprintf(fp, "\n");

        now_call_tree = now_call_tree->next_ptr;
    }

	free(temp);

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x400, %edi            # imm = 0x400
movl $0x1, %esi
callq 0x10f0
movq %rax, %r14
movq 0xf219(%rip), %r12      # 0x14550
testq %r12, %r12
je 0x5478
leaq 0xa923(%rip), %rbp      # 0xfc6a
movq 0x20(%r12), %r13
testq %r13, %r13
je 0x545d
movl 0x20(%r13), %eax
cmpl $0x1, %eax
je 0x536e
testl %eax, %eax
jne 0x5389
movabsq $0x207475706e6909, %rax # imm = 0x207475706E6909
jmp 0x5386
movabsq $0x20676572207475, %rax # imm = 0x20676572207475
movq %rax, 0x5(%r14)
movabsq $0x2074757074756f09, %rax # imm = 0x2074757074756F09
movq %rax, (%r14)
movl 0x24(%r13), %ecx
testl %ecx, %ecx
jle 0x53a7
decl %ecx
movq %r14, %rdi
leaq 0x929e(%rip), %rsi      # 0xe63b
movq %r14, %rdx
xorl %eax, %eax
callq 0x11a0
movq 0x10(%r12), %rdi
movzbl (%rdi), %eax
cmpl $0x40, %eax
je 0x53b9
cmpl $0x25, %eax
jne 0x53bc
incq %rdi
callq 0x139f
movq 0x10(%r13), %r8
movq %r14, %rdi
leaq 0x9276(%rip), %rsi      # 0xe645
movq %r14, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x11a0
movq 0x10(%r13), %r15
movq %r15, %rdi
leaq 0xa933(%rip), %rsi      # 0xfd1d
callq 0x1100
testl %eax, %eax
je 0x5444
movq %r15, %rdi
leaq 0xa8f5(%rip), %rsi      # 0xfcf2
callq 0x1100
testl %eax, %eax
je 0x5444
movq %r15, %rdi
leaq 0xa8d6(%rip), %rsi      # 0xfce6
callq 0x1100
testl %eax, %eax
je 0x5444
movq %r15, %rdi
leaq 0xa9af(%rip), %rsi      # 0xfdd2
callq 0x1100
testl %eax, %eax
je 0x5444
movl 0x28(%r13), %ecx
movq %r14, %rdi
leaq 0xa6b0(%rip), %rsi      # 0xfaea
movq %r14, %rdx
xorl %eax, %eax
callq 0x11a0
movq %rbx, %rdi
movq %rbp, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x1110
movq 0x8(%r13), %r13
jmp 0x534c
movl $0xa, %edi
movq %rbx, %rsi
callq 0x10d0
movq 0x8(%r12), %r12
testq %r12, %r12
jne 0x5347
movq %r14, %rdi
callq 0x1030
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)