// File: /workspace/github_c_makefile_star2_O0/aquaxis[P]synverll/src/parser_ir_memory.c
// Function: output_memory_tree
int output_memory_tree(FILE *fp, int flag)
{
	MEMORY_TREE *now_memory_tree;

    now_memory_tree = memory_tree_top;
    while(now_memory_tree != NULL){
		switch(flag){
			case 0:
				// 引数の表示
				if(now_memory_tree->verilog_args != NULL){
					if(strlen(now_memory_tree->verilog_args) > 0){
						if(
							(get_adrs_memmap("GLOBAL", now_memory_tree->label) == -1) &&
							(now_memory_tree->flag != MEMORY_FLAG_RETURN)
						){
							fprintf(fp, "%s\n", now_memory_tree->verilog_args);
						}else if(now_memory_tree->flag == MEMORY_FLAG_RETURN){
						}else{
							now_memory_tree->flag = MEMORY_FLAG_LOCAL;
						}
					}
				}
				break;
			case 1:
				// returnの表示
				if(now_memory_tree->verilog_args != NULL){
					if(strlen(now_memory_tree->verilog_args) > 0){
						if(
							(get_adrs_memmap("GLOBAL", now_memory_tree->label) == -1) &&
							(now_memory_tree->flag == MEMORY_FLAG_RETURN)
						){
							fprintf(fp, "%s\n", now_memory_tree->verilog_args);
						}
					}
				}
				break;
			case 2:
				// 宣言の表示
				if(now_memory_tree->verilog_decl != NULL){
					if(strlen(now_memory_tree->verilog_decl) > 0){
						if(get_adrs_memmap("GLOBAL", now_memory_tree->label) == -1){
							fprintf(fp, "%s\n", now_memory_tree->verilog_decl);
						}
					}
				}
				break;
			case 3:
				// procの表示
				if(now_memory_tree->verilog_proc != NULL){
					if(strlen(now_memory_tree->verilog_proc) > 0){
						if(get_adrs_memmap("GLOBAL", now_memory_tree->label) == -1){
							fprintf(fp, "%s\n", now_memory_tree->verilog_proc);
						}
					}
				}
				break;
			default:
				printf("[ERROR] output_memory_tree()\n");
				break;
		}
        now_memory_tree = now_memory_tree->next_ptr;
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq 0x10842(%rip), %rax     # 0x18548
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x7eea
movl -0xc(%rbp), %eax
movq %rax, -0x20(%rbp)
subq $0x3, %rax
ja 0x7ecb
movq -0x20(%rbp), %rax
leaq 0xba4f(%rip), %rcx      # 0x13780
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x18(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x7db4
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x1070
cmpq $0x0, %rax
jbe 0x7db2
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rsi
leaq 0xba29(%rip), %rdi      # 0x13790
callq 0x7980
cmpl $-0x1, %eax
jne 0x7d97
movq -0x18(%rbp), %rax
cmpl $0x5, 0x10(%rax)
je 0x7d97
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rdx
leaq 0xbd3c(%rip), %rsi      # 0x13aca
movb $0x0, %al
callq 0x10e0
jmp 0x7db0
movq -0x18(%rbp), %rax
cmpl $0x5, 0x10(%rax)
jne 0x7da3
jmp 0x7dae
movq -0x18(%rbp), %rax
movl $0x2, 0x10(%rax)
jmp 0x7db0
jmp 0x7db2
jmp 0x7db4
jmp 0x7ed9
movq -0x18(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x7e18
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x1070
cmpq $0x0, %rax
jbe 0x7e16
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rsi
leaq 0xb9aa(%rip), %rdi      # 0x13790
callq 0x7980
cmpl $-0x1, %eax
jne 0x7e14
movq -0x18(%rbp), %rax
cmpl $0x5, 0x10(%rax)
jne 0x7e14
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rdx
leaq 0xbcbd(%rip), %rsi      # 0x13aca
movb $0x0, %al
callq 0x10e0
jmp 0x7e16
jmp 0x7e18
jmp 0x7ed9
movq -0x18(%rbp), %rax
cmpq $0x0, 0x38(%rax)
je 0x7e72
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x1070
cmpq $0x0, %rax
jbe 0x7e70
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rsi
leaq 0xb946(%rip), %rdi      # 0x13790
callq 0x7980
cmpl $-0x1, %eax
jne 0x7e6e
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rdx
leaq 0xbc63(%rip), %rsi      # 0x13aca
movb $0x0, %al
callq 0x10e0
jmp 0x7e70
jmp 0x7e72
jmp 0x7ed9
movq -0x18(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0x7ec9
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rdi
callq 0x1070
cmpq $0x0, %rax
jbe 0x7ec7
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rsi
leaq 0xb8ef(%rip), %rdi      # 0x13790
callq 0x7980
cmpl $-0x1, %eax
jne 0x7ec5
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rdx
leaq 0xbc0c(%rip), %rsi      # 0x13aca
movb $0x0, %al
callq 0x10e0
jmp 0x7ec7
jmp 0x7ec9
jmp 0x7ed9
leaq 0xb8c5(%rip), %rdi      # 0x13797
movb $0x0, %al
callq 0x1090
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x7d0a
xorl %eax, %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)