// File: /workspace/github_c_makefile_star2_O1/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 0x1100
movq %rax, %r14
movq 0xf13d(%rip), %r12      # 0x14560
testq %r12, %r12
je 0x5564
leaq 0xa843(%rip), %rbp      # 0xfc76
movq 0x20(%r12), %r13
testq %r13, %r13
je 0x5549
movl 0x20(%r13), %eax
cmpl $0x1, %eax
je 0x545a
testl %eax, %eax
jne 0x5475
movabsq $0x207475706e6909, %rax # imm = 0x207475706E6909
jmp 0x5472
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 0x5493
decl %ecx
movq %r14, %rdi
leaq 0x91c0(%rip), %rsi      # 0xe649
movq %r14, %rdx
xorl %eax, %eax
callq 0x11b0
movq 0x10(%r12), %rdi
movzbl (%rdi), %eax
cmpl $0x40, %eax
je 0x54a5
cmpl $0x25, %eax
jne 0x54a8
incq %rdi
callq 0x13b8
movq 0x10(%r13), %r8
movq %r14, %rdi
leaq 0x9198(%rip), %rsi      # 0xe653
movq %r14, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x11b0
movq 0x10(%r13), %r15
movq %r15, %rdi
leaq 0xa853(%rip), %rsi      # 0xfd29
callq 0x1110
testl %eax, %eax
je 0x5530
movq %r15, %rdi
leaq 0xa815(%rip), %rsi      # 0xfcfe
callq 0x1110
testl %eax, %eax
je 0x5530
movq %r15, %rdi
leaq 0xa7f6(%rip), %rsi      # 0xfcf2
callq 0x1110
testl %eax, %eax
je 0x5530
movq %r15, %rdi
leaq 0xa8cf(%rip), %rsi      # 0xfdde
callq 0x1110
testl %eax, %eax
je 0x5530
movl 0x28(%r13), %ecx
movq %r14, %rdi
leaq 0xa5d0(%rip), %rsi      # 0xfaf6
movq %r14, %rdx
xorl %eax, %eax
callq 0x11b0
movq %rbx, %rdi
movq %rbp, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x1120
movq 0x8(%r13), %r13
jmp 0x5438
movl $0xa, %edi
movq %rbx, %rsi
callq 0x10e0
movq 0x8(%r12), %r12
testq %r12, %r12
jne 0x5433
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)