// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl $0x400, %edi            # imm = 0x400
movl $0x1, %esi
callq 0x10c0
movq %rax, -0x20(%rbp)
movq 0x1100a(%rip), %rax     # 0x18530
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x76f9
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x76d6
movq -0x18(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, -0x24(%rbp)
testl %eax, %eax
je 0x7566
jmp 0x755c
movl -0x24(%rbp), %eax
subl $0x1, %eax
je 0x757a
jmp 0x758c
movq -0x20(%rbp), %rdi
leaq 0xc126(%rip), %rsi      # 0x13697
movb $0x0, %al
callq 0x1160
jmp 0x758c
movq -0x20(%rbp), %rdi
leaq 0xc11a(%rip), %rsi      # 0x1369f
movb $0x0, %al
callq 0x1160
movq -0x18(%rbp), %rax
cmpl $0x0, 0x24(%rax)
jle 0x75b6
movq -0x20(%rbp), %rdi
movq -0x20(%rbp), %rdx
movq -0x18(%rbp), %rax
movl 0x24(%rax), %ecx
subl $0x1, %ecx
leaq 0xc0fd(%rip), %rsi      # 0x136ac
movb $0x0, %al
callq 0x1160
movq -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movsbl (%rax), %eax
cmpl $0x25, %eax
je 0x75e6
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movsbl (%rax), %eax
cmpl $0x40, %eax
jne 0x75f8
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x7604
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
callq 0x1400
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rdx
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq 0x10(%rax), %r8
leaq 0xc08f(%rip), %rsi      # 0x136b6
movb $0x0, %al
callq 0x1160
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdi
leaq 0xd6d6(%rip), %rsi      # 0x14d13
callq 0x10d0
cmpl $0x0, %eax
je 0x76af
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdi
leaq 0xd692(%rip), %rsi      # 0x14ce8
callq 0x10d0
cmpl $0x0, %eax
je 0x76af
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdi
leaq 0xd66d(%rip), %rsi      # 0x14cdc
callq 0x10d0
cmpl $0x0, %eax
je 0x76af
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdi
leaq 0xd748(%rip), %rsi      # 0x14dd0
callq 0x10d0
cmpl $0x0, %eax
je 0x76af
movq -0x20(%rbp), %rdi
movq -0x20(%rbp), %rdx
movq -0x18(%rbp), %rax
movl 0x28(%rax), %ecx
leaq 0xd42e(%rip), %rsi      # 0x14ad6
movb $0x0, %al
callq 0x1160
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0xd58d(%rip), %rsi      # 0x14c4b
movb $0x0, %al
callq 0x10e0
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x7541
movq -0x8(%rbp), %rdi
leaq 0xd8df(%rip), %rsi      # 0x14fc0
movb $0x0, %al
callq 0x10e0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x752a
movq -0x20(%rbp), %rdi
callq 0x1030
xorl %eax, %eax
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)