// File: /workspace/github_c_makefile_star2_O0/aquaxis[P]synverll/src/parser_ir_top.c
// Function: search_top_signal_func
char *search_top_signal_func(char *func, char *call_name, char *args)
{
	TOP_SIGNAL_TREE *now_top_signal_tree = NULL;
	char *result = NULL;
	char *label = NULL;
	char *signal_name = NULL;
	char *verilog = NULL;

	result = calloc(STR_MAX, 1);
//printf("call_name: %s_%s(%d)\n", call_name, name, args_num);

	signal_name = calloc(STR_MAX, 1);
	label = calloc(STR_MAX, 1);

	sprintf(label, "__call_%s_%s", call_name, args);
	if(!strcmp(func, "call")){
		sprintf(label, "__%s_%s_%s", func, call_name, args);
	}else{
		sprintf(label, "__%s_%s", func, args);
	}
	sprintf(signal_name, "%s", label);
//printf("call_name: %s\n", signal_name);

	now_top_signal_tree = top_signal_tree_top;
    while(now_top_signal_tree != NULL){
//printf("    call_name: %s <> %s\n", now_top_signal_tree->label, label);
		if(now_top_signal_tree->flag == FLAG_CALL){
			if(!strcmp(now_top_signal_tree->label, label)){
				sprintf(result, "%s %s |", result, now_top_signal_tree->verilog_signal);
				now_top_signal_tree->used = 1;
//printf("    call_name: %s <> %s\n", now_top_signal_tree->label, label);
			}
		}else if(now_top_signal_tree->flag == FLAG_CTRL){
			if(!strcmp(now_top_signal_tree->label, label) && !strcmp(now_top_signal_tree->module_name, call_name)){
				sprintf(result, "%s %s |", result, now_top_signal_tree->verilog_signal);
				now_top_signal_tree->used = 1;
//printf("    call_name: %s <> %s\n", now_top_signal_tree->label, label);
			}
		}else if(now_top_signal_tree->flag == FLAG_GMEM){
			if(!strcmp(now_top_signal_tree->label, label)){
				sprintf(result, "%s %s |", result, now_top_signal_tree->verilog_signal);
				now_top_signal_tree->used = 1;
//printf("    call_name: %s <> %s\n", now_top_signal_tree->label, label);
			}
		}else if(now_top_signal_tree->flag == FLAG_RETURN){
			if(!strcmp(now_top_signal_tree->label, label) && !strcmp(now_top_signal_tree->module_name, call_name)){
				sprintf(result, "%s %s |", result, now_top_signal_tree->verilog_signal);
				now_top_signal_tree->used = 1;
//printf("    call_name: %s <> %s\n", now_top_signal_tree->label, label);
			}
		}


        now_top_signal_tree = now_top_signal_tree->next_ptr;
	}

	if(strlen(result) > 0){
		result[strlen(result)-1] = ';';
		verilog = calloc(strlen(result)+1, 1);
		strcpy(verilog, result);
//printf("    result: %s,%s\n", result, verilog);
	}

	free(result);

	return verilog;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movl $0x400, %edi            # imm = 0x400
movl $0x1, %esi
callq 0x10c0
movq %rax, -0x28(%rbp)
movl $0x400, %edi            # imm = 0x400
movl $0x1, %esi
callq 0x10c0
movq %rax, -0x38(%rbp)
movl $0x400, %edi            # imm = 0x400
movl $0x1, %esi
callq 0x10c0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
leaq 0x5550(%rip), %rsi      # 0x136b8
movb $0x0, %al
callq 0x1160
movq -0x8(%rbp), %rdi
leaq 0x50a3(%rip), %rsi      # 0x1321d
callq 0x10d0
cmpl $0x0, %eax
jne 0xe1a4
movq -0x30(%rbp), %rdi
movq -0x8(%rbp), %rdx
movq -0x10(%rbp), %rcx
movq -0x18(%rbp), %r8
leaq 0x6949(%rip), %rsi      # 0x14ae4
movb $0x0, %al
callq 0x1160
jmp 0xe1be
movq -0x30(%rbp), %rdi
movq -0x8(%rbp), %rdx
movq -0x18(%rbp), %rcx
leaq 0x6938(%rip), %rsi      # 0x14aef
movb $0x0, %al
callq 0x1160
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rdx
leaq 0x57fb(%rip), %rsi      # 0x139c8
movb $0x0, %al
callq 0x1160
movq 0xa3b5(%rip), %rax      # 0x18590
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0xe35f
movq -0x20(%rbp), %rax
cmpl $0x5, 0x30(%rax)
jne 0xe238
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x30(%rbp), %rsi
callq 0x10d0
cmpl $0x0, %eax
jne 0xe233
movq -0x28(%rbp), %rdi
movq -0x28(%rbp), %rdx
movq -0x20(%rbp), %rax
movq 0x50(%rax), %rcx
leaq 0x68bb(%rip), %rsi      # 0x14adc
movb $0x0, %al
callq 0x1160
movq -0x20(%rbp), %rax
movl $0x1, 0x20(%rax)
jmp 0xe34e
movq -0x20(%rbp), %rax
cmpl $0x1, 0x30(%rax)
jne 0xe29c
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x30(%rbp), %rsi
callq 0x10d0
cmpl $0x0, %eax
jne 0xe297
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x10d0
cmpl $0x0, %eax
jne 0xe297
movq -0x28(%rbp), %rdi
movq -0x28(%rbp), %rdx
movq -0x20(%rbp), %rax
movq 0x50(%rax), %rcx
leaq 0x6857(%rip), %rsi      # 0x14adc
movb $0x0, %al
callq 0x1160
movq -0x20(%rbp), %rax
movl $0x1, 0x20(%rax)
jmp 0xe34c
movq -0x20(%rbp), %rax
cmpl $0x2, 0x30(%rax)
jne 0xe2e7
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x30(%rbp), %rsi
callq 0x10d0
cmpl $0x0, %eax
jne 0xe2e5
movq -0x28(%rbp), %rdi
movq -0x28(%rbp), %rdx
movq -0x20(%rbp), %rax
movq 0x50(%rax), %rcx
leaq 0x6809(%rip), %rsi      # 0x14adc
movb $0x0, %al
callq 0x1160
movq -0x20(%rbp), %rax
movl $0x1, 0x20(%rax)
jmp 0xe34a
movq -0x20(%rbp), %rax
cmpl $0x6, 0x30(%rax)
jne 0xe348
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x30(%rbp), %rsi
callq 0x10d0
cmpl $0x0, %eax
jne 0xe346
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x10d0
cmpl $0x0, %eax
jne 0xe346
movq -0x28(%rbp), %rdi
movq -0x28(%rbp), %rdx
movq -0x20(%rbp), %rax
movq 0x50(%rax), %rcx
leaq 0x67a8(%rip), %rsi      # 0x14adc
movb $0x0, %al
callq 0x1160
movq -0x20(%rbp), %rax
movl $0x1, 0x20(%rax)
jmp 0xe348
jmp 0xe34a
jmp 0xe34c
jmp 0xe34e
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0xe1df
movq -0x28(%rbp), %rdi
callq 0x1070
cmpq $0x0, %rax
jbe 0xe3b9
movq -0x28(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x28(%rbp), %rdi
callq 0x1070
movq %rax, %rcx
movq -0x48(%rbp), %rax
subq $0x1, %rcx
movb $0x3b, (%rax,%rcx)
movq -0x28(%rbp), %rdi
callq 0x1070
movq %rax, %rdi
addq $0x1, %rdi
movl $0x1, %esi
callq 0x10c0
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x1050
movq -0x28(%rbp), %rdi
callq 0x1030
movq -0x40(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)