LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/carlitosmarin[P]Sistema-Ficheros-SOII/./src/directorios.c
// Function: mi_chmod
int mi_chmod (const char *camino, unsigned char permisos) {
	int pid = 0, pi = 0, pe = 0;
	int BE = buscar_entrada(camino, &pid, &pi, &pe, 0, 0);

	if(BE < 0) { //Tratamiento de errores
		switch(BE){
		case -1: printf("\"%s\" Camino no valido\n", camino); break;
		case -2: printf("No tienes permisos de lectura\n"); break;
		case -3: printf("Error en la lectura de la entrada \"%s\"\n", camino); break;
		case -4: printf("No existe la entrada \"%s\"\n", camino); break;
		case -5: printf("Error a la hora de reservar un inodo"); break;
		case -6: printf("No existe directorio intermedio a \"%s\"", camino); break;
		case -7: printf("Error a la hora de liberar un inodo"); break;
		case -8: printf("Error en la escritura de la entrada \"%s\"\n", camino); break;
		case -9: printf("Ya existe la entrada \"%s\"\n", camino); break;
		}
		return -1; //Error BE
	} else {
		if(mi_chmod_f(pi,permisos) < 0) return -2; //Error CHMOD
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x18, %rsp
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x14(%rsp), %rsi
andl $0x0, (%rsi)
leaq 0xc(%rsp), %rdx
andl $0x0, (%rdx)
leaq 0x10(%rsp), %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x2d09
testl %eax, %eax
js 0x3810
movl 0xc(%rsp), %edi
movzbl %bpl, %esi
callq 0x2b29
sarl $0x1f, %eax
andl $-0x2, %eax
jmp 0x388b
addl $0x9, %eax
leaq 0xad2(%rip), %rcx       # 0x42ec
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0xc46(%rip), %rdi       # 0x4470
jmp 0x387e
leaq 0xba3(%rip), %rdi       # 0x43d6
jmp 0x383c
leaq 0xbe6(%rip), %rdi       # 0x4422
xorl %eax, %eax
callq 0x1090
jmp 0x3888
leaq 0xbaf(%rip), %rdi       # 0x43fb
jmp 0x387e
leaq 0xcac(%rip), %rdi       # 0x4501
callq 0x1060
jmp 0x3888
leaq 0xbe3(%rip), %rdi       # 0x4446
jmp 0x387e
leaq 0xb4f(%rip), %rdi       # 0x43bb
jmp 0x387e
leaq 0xb1e(%rip), %rdi       # 0x4393
jmp 0x387e
leaq 0xafe(%rip), %rdi       # 0x437c
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1090
pushq $-0x1
popq %rax
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/carlitosmarin[P]Sistema-Ficheros-SOII/./src/directorios.c
// Function: mi_stat
int mi_stat (const char *camino, struct STAT *p_stat) {
	int pid = 0, pi = 0, pe = 0;
	int BE = buscar_entrada(camino, &pid, &pi, &pe, 0, 0);

	if(BE < 0) { //Tratamiento de errores
		switch(BE){
		case -1: printf("\"%s\" Camino no valido\n", camino); break;
		case -2: printf("No tienes permisos de lectura\n"); break;
		case -3: printf("Error en la lectura de la entrada \"%s\"\n", camino); break;
		case -4: printf("No existe la entrada \"%s\"\n", camino); break;
		case -5: printf("Error a la hora de reservar un inodo"); break;
		case -6: printf("No existe directorio intermedio a \"%s\"", camino); break;
		case -7: printf("Error a la hora de liberar un inodo"); break;
		case -8: printf("Error en la escritura de la entrada \"%s\"\n", camino); break;
		case -9: printf("Ya existe la entrada \"%s\"\n", camino); break;
		}
		return -1; //Error BE
	} else {
		if(mi_stat_f(pi,p_stat) < 0) return -2; //Error STAT
	}
	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x14(%rsp), %rsi
andl $0x0, (%rsi)
leaq 0xc(%rsp), %rdx
andl $0x0, (%rdx)
leaq 0x10(%rsp), %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x2d09
testl %eax, %eax
js 0x38d7
movl 0xc(%rsp), %edi
movq %r14, %rsi
callq 0x2c5b
sarl $0x1f, %eax
andl $-0x2, %eax
jmp 0x3952
addl $0x9, %eax
leaq 0xa2f(%rip), %rcx       # 0x4310
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0xb7f(%rip), %rdi       # 0x4470
jmp 0x3945
leaq 0xadc(%rip), %rdi       # 0x43d6
jmp 0x3903
leaq 0xb1f(%rip), %rdi       # 0x4422
xorl %eax, %eax
callq 0x1090
jmp 0x394f
leaq 0xae8(%rip), %rdi       # 0x43fb
jmp 0x3945
leaq 0xbe5(%rip), %rdi       # 0x4501
callq 0x1060
jmp 0x394f
leaq 0xb1c(%rip), %rdi       # 0x4446
jmp 0x3945
leaq 0xa88(%rip), %rdi       # 0x43bb
jmp 0x3945
leaq 0xa57(%rip), %rdi       # 0x4393
jmp 0x3945
leaq 0xa37(%rip), %rdi       # 0x437c
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1090
pushq $-0x1
popq %rax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/carlitosmarin[P]Sistema-Ficheros-SOII/./src/directorios.c
// Function: mi_read
int mi_read (const char *camino, void *buf, unsigned int offset, unsigned int nbytes) {
	int pid = 0, pi = 0, pe = 0, bytesLeidos;
	int BE = buscar_entrada(camino, &pid, &pi, &pe, 0, 0);

	if(BE < 0) { //Tratamiento de errores
		switch(BE){
		case -1: printf("\"%s\" Camino no valido\n", camino); break;
		case -2: printf("No tienes permisos de lectura\n"); break;
		case -3: printf("Error en la lectura de la entrada \"%s\"\n", camino); break;
		case -4: printf("No existe la entrada \"%s\"\n", camino); break;
		case -5: printf("Error a la hora de reservar un inodo"); break;
		case -6: printf("No existe directorio intermedio a \"%s\"", camino); break;
		case -7: printf("Error a la hora de liberar un inodo"); break;
		case -8: printf("Error en la escritura de la entrada \"%s\"\n", camino); break;
		case -9: printf("Ya existe la entrada \"%s\"\n", camino); break;
		}
		puts("Falla MI_READ");
		return -1; //Error READ
	} else {
		if((bytesLeidos = mi_read_f(pi,buf,offset,nbytes)) < 0) return -2; //Error READ
	}
	return bytesLeidos;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movl %ecx, %ebp
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x14(%rsp), %rsi
andl $0x0, (%rsi)
leaq 0xc(%rsp), %rdx
andl $0x0, (%rdx)
leaq 0x10(%rsp), %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x2d09
testl %eax, %eax
js 0x39b3
movl 0xc(%rsp), %edi
movq %r15, %rsi
movl %r14d, %edx
movl %ebp, %ecx
callq 0x27ed
movl %eax, %ecx
testl %eax, %eax
pushq $-0x2
popq %rax
cmovnsl %ecx, %eax
jmp 0x3a3a
addl $0x9, %eax
leaq 0x977(%rip), %rcx       # 0x4334
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0xaa3(%rip), %rdi       # 0x4470
jmp 0x3a21
leaq 0xa00(%rip), %rdi       # 0x43d6
jmp 0x39df
leaq 0xa43(%rip), %rdi       # 0x4422
xorl %eax, %eax
callq 0x1090
jmp 0x3a2b
leaq 0xa0c(%rip), %rdi       # 0x43fb
jmp 0x3a21
leaq 0xb09(%rip), %rdi       # 0x4501
callq 0x1060
jmp 0x3a2b
leaq 0xa40(%rip), %rdi       # 0x4446
jmp 0x3a21
leaq 0x9ac(%rip), %rdi       # 0x43bb
jmp 0x3a21
leaq 0x97b(%rip), %rdi       # 0x4393
jmp 0x3a21
leaq 0x95b(%rip), %rdi       # 0x437c
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1090
leaq 0xa92(%rip), %rdi       # 0x44c4
callq 0x1060
pushq $-0x1
popq %rax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/carlitosmarin[P]Sistema-Ficheros-SOII/./src/directorios.c
// Function: mi_write
int mi_write (const char *camino, const void *buf, unsigned int offset, unsigned int nbytes) {
	int pid = 0, pi = 0, pe = 0, bytesLeidos;
	mi_waitSem();
	int BE = buscar_entrada(camino, &pid, &pi, &pe, 0, 6);
	if(BE < 0) { //Tratamiento de errores
		switch(BE){
		case -1: printf("\"%s\" Camino no valido\n", camino); break;
		case -2: printf("No tienes permisos de lectura\n"); break;
		case -3: printf("Error en la lectura de la entrada \"%s\"\n", camino); break;
		case -4: printf("No existe la entrada \"%s\"\n", camino); break;
		case -5: printf("Error a la hora de reservar un inodo"); break;
		case -6: printf("No existe directorio intermedio a \"%s\"", camino); break;
		case -7: printf("Error a la hora de liberar un inodo"); break;
		case -8: printf("Error en la escritura de la entrada \"%s\"\n", camino); break;
		case -9: printf("Ya existe la entrada \"%s\"\n", camino); break;
		}
		mi_signalSem();
		puts("Falla MI_WRITE");
		return -1; //Error READ
	}
	struct inodo in = leer_inodo(pi);
	if(in.tipo != 'f'){
		puts("No se puede leer un directorio."); //Error LECTURA_DIRECTORIO
		mi_signalSem();
		return -3;
	}

	if((bytesLeidos = mi_write_f(pi,buf,offset,nbytes)) < 0) return -2; //Error WRITE
	mi_signalSem();
	return bytesLeidos;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movl %ecx, %ebp
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x14(%rsp), %r12
andl $0x0, (%r12)
leaq 0xc(%rsp), %r13
andl $0x0, (%r13)
xorl %eax, %eax
callq 0x134f
leaq 0x10(%rsp), %rcx
pushq $0x6
popq %r9
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
xorl %r8d, %r8d
callq 0x2d09
testl %eax, %eax
js 0x3ad0
movl 0xc(%rsp), %ebx
leaq 0x18(%rsp), %r12
movq %r12, %rdi
movl %ebx, %esi
callq 0x194e
cmpb $0x66, (%r12)
jne 0x3aec
movl %ebx, %edi
movq %r15, %rsi
movl %r14d, %edx
movl %ebp, %ecx
callq 0x24dc
movl %eax, %ebx
testl %eax, %eax
jns 0x3afb
pushq $-0x2
jmp 0x3b75
addl $0x9, %eax
leaq 0x87e(%rip), %rcx       # 0x4358
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x986(%rip), %rdi       # 0x4470
jmp 0x3b56
leaq 0x9ee(%rip), %rdi       # 0x44e1
callq 0x1060
pushq $-0x3
popq %rbx
xorl %eax, %eax
callq 0x135b
jmp 0x3b76
leaq 0x8cb(%rip), %rdi       # 0x43d6
jmp 0x3b14
leaq 0x90e(%rip), %rdi       # 0x4422
xorl %eax, %eax
callq 0x1090
jmp 0x3b60
leaq 0x8d7(%rip), %rdi       # 0x43fb
jmp 0x3b56
leaq 0x9d4(%rip), %rdi       # 0x4501
callq 0x1060
jmp 0x3b60
leaq 0x90b(%rip), %rdi       # 0x4446
jmp 0x3b56
leaq 0x877(%rip), %rdi       # 0x43bb
jmp 0x3b56
leaq 0x846(%rip), %rdi       # 0x4393
jmp 0x3b56
leaq 0x826(%rip), %rdi       # 0x437c
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1090
xorl %eax, %eax
callq 0x135b
leaq 0x964(%rip), %rdi       # 0x44d2
callq 0x1060
pushq $-0x1
popq %rbx
movl %ebx, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O2/carlitosmarin[P]Sistema-Ficheros-SOII/mi_rm.c
// Function: main
int main (int argc, char **argv) {
	if (argc != 3) {
		printf("Número de parametros incorrectos\n");
		return -1;
	}
	//Montamos el disco
	bmount(argv[1]);

	struct STAT stat;
	if(mi_stat(argv[2],&stat) < 0){
		bumount();
		return 0;
	}

	if(stat.tipo == 'd' && stat.tamBytesLogicos != 0){
		printf("El directorio %s no está vacio, no puede ser borrado\n", argv[2]);
		bumount();
		return 0;
	}
	if(mi_unlink(argv[2]) == 0){
		puts("Se ha borrado correctamente.");
	} else ("Error: No se ha podido eliminar el fichero con mi_rm\n");

	bumount();
	return 0;
}

// Assembly:
pushq %rbx
subq $0x30, %rsp
cmpl $0x3, %edi
jne 0x3c03
movq %rsi, %rbx
movq 0x8(%rsi), %rdi
callq 0x127c
movq 0x10(%rbx), %rdi
movq %rsp, %rsi
callq 0x3892
testl %eax, %eax
js 0x3c2c
cmpb $0x64, (%rsp)
movq 0x10(%rbx), %rsi
jne 0x3c14
cmpl $0x0, 0x24(%rsp)
je 0x3c14
leaq 0x92e(%rip), %rdi       # 0x4528
xorl %eax, %eax
callq 0x1090
jmp 0x3c2c
leaq 0x972(%rip), %rdi       # 0x457c
callq 0x1060
pushq $-0x1
popq %rbx
jmp 0x3c35
movq %rsi, %rdi
callq 0x35ce
testl %eax, %eax
jne 0x3c2c
leaq 0x938(%rip), %rdi       # 0x455f
callq 0x1060
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x12b8
movl %ebx, %eax
addq $0x30, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/aquaxis[P]synverll/src/common.c
// Function: get_width
int get_width(char *buf)
{
	int size = 0;
	
	if(!strcmp(buf, "void")){
		size = 0;
	}else if(!strcmp(buf, "i1")){
		size = 1;
	}else if(!strcmp(buf, "i8")){
		size = 8;
	}else if(!strcmp(buf, "i16")){
		size = 16;
	}else if(!strcmp(buf, "i32")){
		size = 32;
	}else if(buf[strlen(buf)-1] == '*'){
		// �|�C���^�錾(�|�C���^�͍Ō���'*'���t��)
		// �|�C���^��i8*, i16*, i32*, %�\���̖�*, ARRAY�錾*, ���z��
		size = 32;
	}else{
		/*
		 * ToDo:
		 * �������Ə������邱�ƁB���܂̂Ƃ����b�肾���B
		 */
		size = 32;
		printf("[WRANING] get_width(): %s\n", buf);
	}

	return size;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0xbd1b(%rip), %rsi      # 0xd004
callq 0x1100
testl %eax, %eax
je 0x135a
cmpb $0x69, (%rbx)
jne 0x130f
cmpb $0x31, 0x1(%rbx)
jne 0x1303
cmpb $0x0, 0x2(%rbx)
je 0x1362
cmpb $0x38, 0x1(%rbx)
jne 0x130f
cmpb $0x0, 0x2(%rbx)
je 0x1366
leaq 0xbcf3(%rip), %rsi      # 0xd009
movq %rbx, %rdi
callq 0x1100
testl %eax, %eax
je 0x135e
leaq 0xcf08(%rip), %rsi      # 0xe231
movq %rbx, %rdi
callq 0x1100
pushq $0x20
popq %rbp
testl %eax, %eax
je 0x1369
movq %rbx, %rdi
callq 0x1090
cmpb $0x2a, -0x1(%rbx,%rax)
je 0x1369
leaq 0xbcbf(%rip), %rdi      # 0xd00d
movq %rbx, %rsi
xorl %eax, %eax
callq 0x10b0
jmp 0x1369
xorl %ebp, %ebp
jmp 0x1369
pushq $0x10
jmp 0x1368
pushq $0x1
jmp 0x1368
pushq $0x8
popq %rbp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/aquaxis[P]synverll/src/common.c
// Function: convname
char *convname(char *buf)
{
	int i;
	if((buf[0] == '%') || (buf[0] == '@')){
		for(i=0;i<strlen(buf)-1;i++){
			buf[i] = buf[i+1];
		}
		buf[strlen(buf)-1] = 0;
	}
	
	for(i=0;i<strlen(buf);i++){
		if(buf[i] == '.') buf[i] = '_';
	}

	return buf;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movzbl (%rdi), %eax
cmpl $0x40, %eax
je 0x13a7
cmpl $0x25, %eax
jne 0x13cc
xorl %r14d, %r14d
movq %rbx, %rdi
callq 0x1090
decq %rax
cmpq %r14, %rax
jbe 0x13c8
movb 0x1(%rbx,%r14), %al
movb %al, (%rbx,%r14)
incq %r14
jmp 0x13aa
movb $0x0, (%rbx,%rax)
xorl %r14d, %r14d
movq %rbx, %rdi
callq 0x1090
cmpq %r14, %rax
jbe 0x13ed
cmpb $0x2e, (%rbx,%r14)
jne 0x13e8
movb $0x5f, (%rbx,%r14)
incq %r14
jmp 0x13cf
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/aquaxis[P]synverll/src/parser.c
// Function: insert_parser_tree
int insert_parser_tree(char *str)
{
    // パーサーツリーの新規登録
    if(parser_tree_top == NULL){
        parser_tree_top     = (PARSER_TREE *)malloc(sizeof(PARSER_TREE));
        parser_tree_current = parser_tree_top;
    }else{
        parser_tree_current->next_ptr   = (PARSER_TREE *)malloc(sizeof(PARSER_TREE));
        parser_tree_prev                = parser_tree_current;
        parser_tree_current             = parser_tree_current->next_ptr;
        parser_tree_current->prev_ptr   = parser_tree_prev;
        parser_tree_current->next_ptr   = NULL;
    }

    // パーサーツリーに文字列の登録
	parser_tree_current->str = charalloc(str);
    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x11cee(%rip), %r14     # 0x13110
movl $0x6c58, %edi           # imm = 0x6C58
callq 0x1130
testq %r14, %r14
je 0x144d
movq 0x11ce0(%rip), %rcx     # 0x13118
movq %rax, 0x8(%rcx)
movq %rcx, 0x11cdd(%rip)     # 0x13120
movq %rcx, (%rax)
andq $0x0, 0x8(%rax)
jmp 0x1454
movq %rax, 0x11cbc(%rip)     # 0x13110
movq %rax, 0x11cbd(%rip)     # 0x13118
movq %rbx, %rdi
callq 0x1372
movq 0x11cae(%rip), %rcx     # 0x13118
movq %rax, 0x18(%rcx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/aquaxis[P]synverll/src/parser.c
// Function: create_proc_source
int create_proc_source()
{
//    PARSER_TREE *now_parser_tree;
//    PARSER_TREE *parser_tree_process;
//    unsigned int now_level;
    char *token;
    char *line;
    int func_num = 0;
	char *filename;
	FILE *fp;
	int size;
	char *const_header = "#include \"__extern.h\"\n\n\0";

    printf(" -> Create Process Source\n");
	
	token = calloc(STR_MAX, 1);
	line = calloc(STR_MAX, 1);

	filename = (char *)malloc(128);
	memset(filename, 0, 128);

    parser_tree_current = parser_tree_top;
    while(parser_tree_current != NULL){
        if(parser_tree_current->flag == PARSER_FLAG_PROCESS){
			sprintf(filename, "__%03d.c", func_num);
			func_num++;
			fp = fopen(filename, "wb+");
			/*
			 * ToDo: fopenのエラー処理が必要
			 */
			size = strlen(parser_tree_current->line.body);
			fwrite(const_header, 1, strlen(const_header), fp);
			fwrite(parser_tree_current->line.body, 1, size, fp);
			fclose(fp);
        }
        parser_tree_current = parser_tree_current->next_ptr;
    }

	free(token);
	free(line);

	free(filename);

    return func_num;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0xbc0a(%rip), %rdi      # 0xd0ad
callq 0x1070
pushq $0x1
popq %rbx
movl $0x80, %esi
movq %rbx, %rdi
callq 0x10f0
movq %rax, %r14
leaq 0x11c4e(%rip), %rax     # 0x13110
pushq $0x17
popq %r15
xorl %ebp, %ebp
movq (%rax), %rax
movq %rax, 0x11c46(%rip)     # 0x13118
testq %rax, %rax
je 0x1567
cmpl $0x19, 0x10(%rax)
jne 0x155e
movq %r14, %rdi
leaq 0xdb6d(%rip), %rsi      # 0xf058
movl %ebp, %edx
xorl %eax, %eax
callq 0x11a0
incl %ebp
movq %r14, %rdi
leaq 0xbb6c(%rip), %rsi      # 0xd06c
callq 0x1160
movq %rax, %r12
movq 0x11c09(%rip), %rax     # 0x13118
movq 0x6c50(%rax), %rdi
callq 0x1090
movq %rax, %r13
leaq 0xbb03(%rip), %rdi      # 0xd028
movq %rbx, %rsi
movq %r15, %rdx
movq %r12, %rcx
callq 0x11c0
movq 0x11bde(%rip), %rax     # 0x13118
movq 0x6c50(%rax), %rdi
movslq %r13d, %rdx
movq %rbx, %rsi
movq %r12, %rcx
callq 0x11c0
movq %r12, %rdi
callq 0x1080
movq 0x11bba(%rip), %rax     # 0x13118
addq $0x8, %rax
jmp 0x14c8
movq %r14, %rdi
callq 0x1030
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/aquaxis[P]synverll/src/parser_ir.c
// Function: insert_parser_tree_ir
int insert_parser_tree_ir(char *str)
{
    // パーサーツリーの新規登録
    if(parser_tree_ir_top == NULL){
        parser_tree_ir_top     = (PARSER_TREE_IR *)malloc(sizeof(PARSER_TREE_IR));
        memset(parser_tree_ir_top, 0, sizeof(PARSER_TREE_IR));
        parser_tree_ir_current = parser_tree_ir_top;
    }else{
        parser_tree_ir_current->next_ptr   = (PARSER_TREE_IR *)malloc(sizeof(PARSER_TREE_IR));
        memset(parser_tree_ir_current->next_ptr, 0, sizeof(PARSER_TREE_IR));
        parser_tree_ir_prev                = parser_tree_ir_current;
        parser_tree_ir_current             = parser_tree_ir_current->next_ptr;
        parser_tree_ir_current->prev_ptr   = parser_tree_ir_prev;
        parser_tree_ir_current->next_ptr   = NULL;
    }

    // 原文の保存
    parser_tree_ir_current->str = calloc(strlen(str)+1,1);
    strcpy(parser_tree_ir_current->str, str);

    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x11349(%rip), %r15     # 0x13130
pushq $0x1
popq %rdi
movl $0xb838, %esi           # imm = 0xB838
callq 0x10f0
movq %rax, %r14
testq %r15, %r15
je 0x1e1a
movq 0x11335(%rip), %rax     # 0x13138
movq %r14, 0x8(%rax)
movq %rax, 0x11332(%rip)     # 0x13140
movq %r14, 0x11323(%rip)     # 0x13138
movq %rax, (%r14)
jmp 0x1e28
movq %r14, 0x1130f(%rip)     # 0x13130
movq %r14, 0x11310(%rip)     # 0x13138
movq %rbx, %rdi
callq 0x1090
leaq 0x1(%rax), %rdi
pushq $0x1
popq %rsi
callq 0x10f0
movq %rax, 0x28(%r14)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x1060
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/aquaxis[P]synverll/src/parser_ir.c
// Function: clean_parser_tree_ir
int clean_parser_tree_ir()
{
	PARSER_TREE_IR *now_parser_tree_ir;
	PARSER_TREE_IR *new_parser_tree_ir;

    now_parser_tree_ir = parser_tree_ir_top;
    while(1){
        if(now_parser_tree_ir == NULL) break;
        new_parser_tree_ir = now_parser_tree_ir->next_ptr;
		if(now_parser_tree_ir->str != NULL) free(now_parser_tree_ir->str);
        free(now_parser_tree_ir);
        now_parser_tree_ir = new_parser_tree_ir;
    }
    parser_tree_ir_top = NULL;

	if(module_name != NULL){
		free(module_name);
		module_name = NULL;
	}

    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0x112d2(%rip), %rbx     # 0x13130
testq %rbx, %rbx
je 0x1e7d
movq 0x8(%rbx), %r14
movq 0x28(%rbx), %rdi
callq 0x1030
movq %rbx, %rdi
callq 0x1030
movq %r14, %rbx
jmp 0x1e5e
andq $0x0, 0x112ab(%rip)     # 0x13130
movq 0x112bc(%rip), %rdi     # 0x13148
testq %rdi, %rdi
je 0x1e9e
callq 0x1030
andq $0x0, 0x112aa(%rip)     # 0x13148
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/aquaxis[P]synverll/src/parser_ir.c
// Function: get_pointer_llvm
int get_pointer_llvm(char *line, char *token)
{
	char *result;
	char *line_org;

	result = calloc(STR_MAX,1 );

	line_org = charalloc(line);

	// getelementptr
	get_token_llvm(line_org, token);
	strcpy(result, "");

	// inbounds
	get_token_llvm(line_org, token);
	strcpy(result, "");

	if(!strcmp(token, "inbounds")){
		// inboundsは無視して良い
		// "("
		get_token_llvm(line_org, token);
	}else{
		/*
		 * %x,@xの場合
		 */
		strcpy(result, token);
		strcpy(token, result);

		free(line_org);
		return 0;
	}

	// Type
	get_irtype_llvm(line_org, token);
	// Name
	get_token_llvm(line_org, token);
	strcpy(result, token);
	strcpy(token, result);

	free(line_org);
	free(result);

	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %r15
pushq $0x1
popq %rsi
movl $0x400, %edi            # imm = 0x400
callq 0x10f0
movq %rax, %rbx
movq %r15, %rdi
callq 0x1372
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
callq 0xc4ad
movq %r15, %rdi
movq %r14, %rsi
callq 0xc4ad
leaq 0xaea6(%rip), %rsi      # 0xd1b8
movq %r14, %rdi
callq 0x1100
testl %eax, %eax
je 0x2339
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1060
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1060
movq %r15, %rdi
jmp 0x237b
movq %r15, %rdi
movq %r14, %rsi
callq 0xc4ad
movq %r15, %rdi
movq %r14, %rsi
callq 0x1ec1
movq %r15, %rdi
movq %r14, %rsi
callq 0xc4ad
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1060
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1060
movq %r15, %rdi
callq 0x1030
movq %rbx, %rdi
callq 0x1030
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/aquaxis[P]synverll/src/parser_ir.c
// Function: get_stage_label
int get_stage_label(char *label)
{
	PARSER_TREE_IR *now_parser_tree_ir;

    now_parser_tree_ir = parser_tree_ir_top;
    while(now_parser_tree_ir != NULL){
		/*
		 * 本当はフラグも一緒に判定しておかなかければいけないかもしれない
		 */
		if(now_parser_tree_ir->flag == PARSER_IR_FLAG_LABEL){
			if(!strcmp(now_parser_tree_ir->label, sep_p(label))){
				return now_parser_tree_ir->stage;
			}
		}
        now_parser_tree_ir = now_parser_tree_ir->next_ptr;
	}

	return -1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
leaq 0x1(%rdi), %r12
leaq 0xf3ca(%rip), %r15      # 0x13130
pushq $-0x1
popq %rbx
movq (%r15), %r15
testq %r15, %r15
je 0x3da3
cmpl $0xe, 0x10(%r15)
jne 0x3d99
movzbl (%r14), %eax
cmpl $0x40, %eax
je 0x3d89
movq %r14, %rsi
cmpl $0x25, %eax
jne 0x3d8c
movq %r12, %rsi
leaq 0x30(%r15), %rdi
callq 0x1100
testl %eax, %eax
je 0x3d9f
addq $0x8, %r15
jmp 0x3d69
movl 0x1c(%r15), %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/aquaxis[P]synverll/src/parser_ir.c
// Function: search_module_llvm
int search_module_llvm(char *name, char *args)
{
	char *line;
	char *token;

	token = calloc(STR_MAX, 1);
	line = charalloc(args);

	while(strcmp(line, "")){
		get_token_llvm(line, token);

		if(!strcmp(token, name)){
			free(line);
			return 0;
		}
	}
	free(token);
	free(line);

	return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x1
popq %rsi
movl $0x400, %edi            # imm = 0x400
callq 0x10f0
movq %rax, %r15
movq %rbx, %rdi
callq 0x1372
movq %rax, %rbx
cmpb $0x0, (%rbx)
je 0x473a
movq %rbx, %rdi
movq %r15, %rsi
callq 0xc4ad
movq %r15, %rdi
movq %r14, %rsi
callq 0x1100
testl %eax, %eax
jne 0x4717
xorl %ebp, %ebp
jmp 0x4745
movq %r15, %rdi
callq 0x1030
pushq $-0x1
popq %rbp
movq %rbx, %rdi
callq 0x1030
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/aquaxis[P]synverll/src/parser_ir.c
// Function: search_args_llvm
INST_STAGE search_args_llvm(PARSER_TREE_IR *now_parser_tree_ir, char *name, char *args)
{
	char *line;
	char *token;
	int max_parallel = 0;
	int max_stage = 0;
	INST_STAGE inst_stage;

	token = calloc(STR_MAX, 1);
	line = charalloc(args);

	// "("
	get_token_llvm(line, token);

	while(strlen(line) > 0){
		// タイプ
		get_irtype_llvm(line, token);
		if(!strcmp(token, "")) break;
		// 変数名
		get_token_llvm(line, token);
		if(!strcmp(token, "zeroext")) get_token_llvm (line, token);
		inst_stage = search_reg_llvm(now_parser_tree_ir, name ,token , "");
		if((inst_stage.parallel > max_parallel) || (inst_stage.stage > max_stage)){
			max_parallel = inst_stage.parallel;
			max_stage = inst_stage.stage;
		}
		// ","
		get_token_llvm(line, token);
	}

	free(line);

	inst_stage.stage = max_stage;
	inst_stage.parallel = max_parallel;

	return inst_stage;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rdi, (%rsp)
pushq $0x1
popq %rsi
movl $0x400, %edi            # imm = 0x400
callq 0x10f0
movq %rax, %r14
movq %r15, %rdi
callq 0x1372
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
callq 0xc4ad
xorl %r12d, %r12d
xorl %ebx, %ebx
cmpb $0x0, (%r15)
je 0x4931
movq %r15, %rdi
movq %r14, %rsi
callq 0x1ec1
cmpb $0x0, (%r14)
je 0x4931
movq %r15, %rdi
movq %r14, %rsi
callq 0xc4ad
movq %r14, %rdi
leaq 0x8c97(%rip), %rsi      # 0xd56b
callq 0x1100
testl %eax, %eax
jne 0x48e8
movq %r15, %rdi
movq %r14, %rsi
callq 0xc4ad
movq (%rsp), %rdi
movq %r14, %rdx
leaq 0xa6ad(%rip), %rcx      # 0xefa3
callq 0x475a
movq %rax, %rbp
movq %rax, %r13
shrq $0x20, %r13
cmpl %ebp, %r12d
setl %al
cmpl %r13d, %ebx
setl %cl
orb %al, %cl
jne 0x491b
movl %r12d, %ebp
movl %ebx, %r13d
movq %r15, %rdi
movq %r14, %rsi
callq 0xc4ad
movl %ebp, %r12d
movl %r13d, %ebx
jmp 0x48a4
movq %r15, %rdi
callq 0x1030
shlq $0x20, %rbx
movl %r12d, %eax
orq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/aquaxis[P]synverll/src/parser_ir.c
// Function: is_register_name
int is_register_name(char *name)
{
	int ret = 1;
	int i = 0;

	if(name[0] == '@'){
		ret = 0;
		return ret;
	}

	i = 1;

	while(name[i] != '\0'){
		if(isalpha(name[i])){
			ret = 0;
		}
		i++;
	}

	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
xorl %ebx, %ebx
cmpb $0x40, (%rdi)
jne 0x4dcc
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rdi, %r14
incq %r14
pushq $0x1
popq %rbx
xorl %ebp, %ebp
movsbq (%r14), %r15
testq %r15, %r15
je 0x4dbf
callq 0x11d0
movq (%rax), %rax
testb $0x4, 0x1(%rax,%r15,2)
cmovnel %ebp, %ebx
incq %r14
jmp 0x4dd7
nop
// File: /workspace/github_c_makefile_star2_O2/aquaxis[P]synverll/src/parser_ir_call.c
// Function: clean_call_tree
int clean_call_tree()
{
	CALL_TREE *now_call_tree;
	CALL_TREE *new_call_tree;

    now_call_tree = call_tree_top;
    while(now_call_tree != NULL){
        new_call_tree = now_call_tree->next_ptr;
        if(now_call_tree->call_name != NULL)	free(now_call_tree->call_name);
        if(now_call_tree->verilog != NULL)	free(now_call_tree->verilog);
        free(now_call_tree);
        now_call_tree = new_call_tree;
    }
    call_tree_top = NULL;
    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0xe74d(%rip), %rbx      # 0x13550
testq %rbx, %rbx
je 0x4e2b
movq 0x8(%rbx), %r14
movq 0x10(%rbx), %rdi
callq 0x1030
movq 0x18(%rbx), %rdi
callq 0x1030
movq %rbx, %rdi
callq 0x1030
movq %r14, %rbx
jmp 0x4e03
andq $0x0, 0xe71d(%rip)      # 0x13550
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/aquaxis[P]synverll/src/parser_ir_call.c
// Function: is_call_tree
int is_call_tree(char *call_name)
{
	CALL_TREE *now_call_tree = NULL;
	now_call_tree = call_tree_top;
	while(now_call_tree != NULL){
		if(!strcmp(now_call_tree->call_name, call_name)) return 1;
		now_call_tree = now_call_tree->next_ptr;
	}
    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %r14
leaq 0xe704(%rip), %r15      # 0x13550
pushq $0x1
popq %rbx
movq (%r15), %r15
testq %r15, %r15
je 0x4e6d
movq 0x10(%r15), %rdi
movq %r14, %rsi
callq 0x1100
addq $0x8, %r15
testl %eax, %eax
jne 0x4e4f
jmp 0x4e6f
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/aquaxis[P]synverll/src/parser_ir_call.c
// Function: search_call_tree
CALL_TREE * search_call_tree(char *call_name)
{
	CALL_TREE *now_call_tree = NULL;
	now_call_tree = call_tree_top;
	while(now_call_tree != NULL){
		if(!strcmp(now_call_tree->call_name, call_name)) return now_call_tree;
		now_call_tree = now_call_tree->next_ptr;
	}
    return NULL;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
leaq 0xe6cb(%rip), %rbx      # 0x13550
movq (%rbx), %rbx
testq %rbx, %rbx
je 0x4ea3
movq 0x10(%rbx), %rdi
movq %r14, %rsi
callq 0x1100
testl %eax, %eax
je 0x4ea3
addq $0x8, %rbx
jmp 0x4e85
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/aquaxis[P]synverll/src/parser_ir_call.c
// Function: register_call_tree
int register_call_tree(char *call_name)
{
	CALL_TREE *now_call_tree		= NULL;
	CALL_TREE *old_call_tree		= NULL;

	if(!is_call_tree(call_name)){
		now_call_tree = call_tree_top;
		while(now_call_tree != NULL){
			old_call_tree = now_call_tree;
			now_call_tree = now_call_tree->next_ptr;
		}

		now_call_tree				= (CALL_TREE *)calloc(sizeof(CALL_TREE),1);
		now_call_tree->prev_ptr	= old_call_tree;
		now_call_tree->next_ptr	= NULL;

		if(call_tree_top == NULL){
			call_tree_top				= now_call_tree;
		}else{
			old_call_tree->next_ptr	= now_call_tree;
		}
		now_call_tree->signal_top_ptr = NULL;

		now_call_tree->call_name = calloc(strlen(call_name)+1,1);
		strcpy(now_call_tree->call_name, call_name);
	}else{
		// 既に生成されている
		return -1;
	}

	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x4e3d
testl %eax, %eax
je 0x4ec7
pushq $-0x1
popq %rax
jmp 0x4f34
leaq 0xe682(%rip), %rax      # 0x13550
xorl %ecx, %ecx
movq %rcx, %r12
movq (%rax), %rcx
leaq 0x8(%rcx), %rax
testq %rcx, %rcx
jne 0x4ed0
pushq $0x28
popq %rdi
pushq $0x1
popq %r14
movq %r14, %rsi
callq 0x10f0
movq %rax, %r15
movq %r12, (%rax)
addq $0x8, %r12
cmpq $0x0, 0xe650(%rip)      # 0x13550
leaq 0xe649(%rip), %rax      # 0x13550
cmoveq %rax, %r12
movq %r15, (%r12)
movq %rbx, %rdi
callq 0x1090
leaq 0x1(%rax), %rdi
movq %r14, %rsi
callq 0x10f0
movq %rax, 0x10(%r15)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x1060
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/aquaxis[P]synverll/src/parser_ir_call.c
// Function: register_call_signal_tree
int register_call_signal_tree(char *call_name, char *signal_name, int num, int size, int inout)
{
	CALL_TREE *now_call_tree;
	CALL_SIGNAL_TREE *now_call_signal_tree = NULL;
	CALL_SIGNAL_TREE *old_call_signal_tree = NULL;

	now_call_tree = search_call_tree(call_name);
	
	now_call_signal_tree = now_call_tree->signal_top_ptr;
	while(now_call_signal_tree != NULL){
		old_call_signal_tree = now_call_signal_tree;
		now_call_signal_tree = now_call_signal_tree->next_ptr;
	}

	now_call_signal_tree				= (CALL_SIGNAL_TREE *)calloc(sizeof(CALL_SIGNAL_TREE),1);
	now_call_signal_tree->prev_ptr	= old_call_signal_tree;
	now_call_signal_tree->next_ptr	= NULL;

	if(now_call_tree->signal_top_ptr == NULL){
		now_call_tree->signal_top_ptr				= now_call_signal_tree;
	}else{
		old_call_signal_tree->next_ptr	= now_call_signal_tree;
	}

	now_call_signal_tree->signal_name = calloc(strlen(signal_name)+1,1);
	strcpy(now_call_signal_tree->signal_name, signal_name);

	now_call_signal_tree->inout	= inout;
	now_call_signal_tree->num	= num;
	now_call_signal_tree->size	= size;

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, (%rsp)
movl %ecx, 0x4(%rsp)
movl %edx, %r14d
movq %rsi, %r15
callq 0x4e77
movq %rax, %r12
addq $0x20, %r12
xorl %eax, %eax
movq %r12, %rcx
movq %rax, %rbp
movq (%rcx), %rax
leaq 0x8(%rax), %rcx
testq %rax, %rax
jne 0x4f6a
pushq $0x30
popq %rdi
pushq $0x1
popq %r13
movq %r13, %rsi
callq 0x10f0
movq %rax, %rbx
movq %rbp, (%rax)
addq $0x8, %rbp
cmpq $0x0, (%r12)
cmoveq %r12, %rbp
movq %rax, (%rbp)
movq %r15, %rdi
callq 0x1090
leaq 0x1(%rax), %rdi
movq %r13, %rsi
callq 0x10f0
movq %rax, 0x10(%rbx)
movq %rax, %rdi
movq %r15, %rsi
callq 0x1060
movl (%rsp), %eax
movl %eax, 0x20(%rbx)
movl %r14d, 0x28(%rbx)
movl 0x4(%rsp), %eax
movl %eax, 0x24(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/aquaxis[P]synverll/src/parser_ir_call.c
// Function: print_call_signal_tree
int print_call_signal_tree(CALL_SIGNAL_TREE *now_call_signal_tree, char *call_name)
{
	printf("    [CALL Signal Tree List]\n");

    while(now_call_signal_tree != NULL){
		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")
		){
			printf("    __call_%s_%s\n", call_name, now_call_signal_tree->signal_name);
		}else{
			printf("    __call_%s_%s_%d\n", call_name, now_call_signal_tree->signal_name, now_call_signal_tree->num);
		}
        now_call_signal_tree = now_call_signal_tree->next_ptr;
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x8658(%rip), %rdi      # 0xd654
callq 0x1070
leaq 0x9cf5(%rip), %r15      # 0xecfd
leaq 0x85f8(%rip), %r12      # 0xd607
leaq 0x9cbc(%rip), %r13      # 0xecd2
testq %r14, %r14
je 0x5080
movq 0x10(%r14), %rbp
movq %rbp, %rdi
movq %r15, %rsi
callq 0x1100
testl %eax, %eax
je 0x506a
movq %rbp, %rdi
movq %r13, %rsi
callq 0x1100
testl %eax, %eax
je 0x506a
movq %rbp, %rdi
leaq 0x9c7f(%rip), %rsi      # 0xecc6
callq 0x1100
testl %eax, %eax
je 0x506a
movl 0x28(%r14), %ecx
leaq 0x85be(%rip), %rdi      # 0xd619
movq %rbx, %rsi
movq %rbp, %rdx
xorl %eax, %eax
callq 0x10b0
jmp 0x507a
movq %r12, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
xorl %eax, %eax
callq 0x10b0
movq 0x8(%r14), %r14
jmp 0x5016
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/aquaxis[P]synverll/src/parser_ir_call.c
// Function: print_call_tree
int print_call_tree(CALL_TREE *now_call_tree)
{
	printf("  [CALL Tree List]\n");

    while(now_call_tree != NULL){
		printf("  %s\n", now_call_tree->call_name);
		print_call_signal_tree(now_call_tree->signal_top_ptr, now_call_tree->call_name);
        now_call_tree = now_call_tree->next_ptr;
    }
    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x85d1(%rip), %rdi      # 0xd670
callq 0x1070
leaq 0x8458(%rip), %r14      # 0xd503
testq %rbx, %rbx
je 0x50d1
movq 0x10(%rbx), %rsi
movq %r14, %rdi
xorl %eax, %eax
callq 0x10b0
movq 0x10(%rbx), %rsi
movq 0x20(%rbx), %rdi
callq 0x4fe4
movq 0x8(%rbx), %rbx
jmp 0x50ab
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/aquaxis[P]synverll/src/parser_ir_memmap.c
// Function: clean_memmap_tree
int clean_memmap_tree()
{
	MEMMAP_TREE *now_memmap_tree;
	MEMMAP_TREE *new_memmap_tree;

    now_memmap_tree = memmap_tree_top;
    while(now_memmap_tree != NULL){
        new_memmap_tree = now_memmap_tree->next_ptr;
        if(now_memmap_tree->label != NULL)	free(now_memmap_tree->label);
        if(now_memmap_tree->module != NULL)	free(now_memmap_tree->module);
        free(now_memmap_tree);
        now_memmap_tree = new_memmap_tree;
    }
    memmap_tree_top = NULL;
    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0xe2f9(%rip), %rbx      # 0x13560
testq %rbx, %rbx
je 0x528f
movq 0x8(%rbx), %r14
movq 0x18(%rbx), %rdi
callq 0x1030
movq 0x10(%rbx), %rdi
callq 0x1030
movq %rbx, %rdi
callq 0x1030
movq %r14, %rbx
jmp 0x5267
andq $0x0, 0xe2c9(%rip)      # 0x13560
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/aquaxis[P]synverll/src/parser_ir_memmap.c
// Function: register_memmap_tree
int register_memmap_tree(char *module, char *label, int size)
{
	MEMMAP_TREE *now_memmap_tree		= NULL;
	MEMMAP_TREE *old_memmap_tree		= NULL;

	unsigned int new_adrs = 0;

	if(!is_memmap_tree(module, label)){
		// メモリマップに存在しなければ新規登録
		now_memmap_tree = memmap_tree_top;
		while(now_memmap_tree != NULL){
			old_memmap_tree = now_memmap_tree;
			now_memmap_tree = now_memmap_tree->next_ptr;
		}

		now_memmap_tree				= (MEMMAP_TREE *)calloc(sizeof(MEMMAP_TREE),1);
		now_memmap_tree->prev_ptr	= old_memmap_tree;
		now_memmap_tree->next_ptr	= NULL;

		if(memmap_tree_top == NULL){
			memmap_tree_top				= now_memmap_tree;
		}else{
			old_memmap_tree->next_ptr	= now_memmap_tree;
		}

		// 新しいアドレスの作成
		if(old_memmap_tree != NULL){
			// アドレスは4Byteアライメントに揃える
			new_adrs = (old_memmap_tree->adrs + old_memmap_tree->size + 3) & 0xFFFFFFC;
		}else{
			new_adrs = 0;
		}

		now_memmap_tree->label = calloc(strlen(label)+1,1);
		strcpy(now_memmap_tree->label, label);
		now_memmap_tree->module = calloc(strlen(module)+1,1);
		strcpy(now_memmap_tree->module, module);
		now_memmap_tree->adrs = new_adrs;		// アドレスの登録
		now_memmap_tree->size = size;			// サイズの登録
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r15
movq %rdi, %r14
callq 0x5385
testl %eax, %eax
jne 0x5370
leaq 0xe298(%rip), %rax      # 0x13560
xorl %ecx, %ecx
movq %rcx, %r13
movq (%rax), %rcx
leaq 0x8(%rcx), %rax
testq %rcx, %rcx
jne 0x52ca
pushq $0x28
popq %rdi
pushq $0x1
popq %rsi
callq 0x10f0
movq %rax, %r12
movq %r13, (%rax)
cmpq $0x0, 0xe26e(%rip)      # 0x13560
je 0x52fa
movq %r12, 0x8(%r13)
jmp 0x5306
movq %r12, 0xe25f(%rip)      # 0x13560
testq %r13, %r13
je 0x5381
movl 0x20(%r13), %eax
movl 0x24(%r13), %ecx
leal (%rax,%rcx), %ebp
addl $0x3, %ebp
andl $0xffffffc, %ebp        # imm = 0xFFFFFFC
movq %r15, %rdi
callq 0x1090
leaq 0x1(%rax), %rdi
pushq $0x1
popq %r13
movq %r13, %rsi
callq 0x10f0
movq %rax, 0x18(%r12)
movq %rax, %rdi
movq %r15, %rsi
callq 0x1060
movq %r14, %rdi
callq 0x1090
leaq 0x1(%rax), %rdi
movq %r13, %rsi
callq 0x10f0
movq %rax, 0x10(%r12)
movq %rax, %rdi
movq %r14, %rsi
callq 0x1060
movl %ebp, 0x20(%r12)
movl %ebx, 0x24(%r12)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebp, %ebp
jmp 0x531a
// File: /workspace/github_c_makefile_star2_O2/aquaxis[P]synverll/src/parser_ir_memmap.c
// Function: is_memmap_tree
int is_memmap_tree(char *module, char *label)
{
	MEMMAP_TREE *now_memmap_tree;

    now_memmap_tree = memmap_tree_top;
    while(now_memmap_tree != NULL){
		if(!strcmp(now_memmap_tree->module, module) && !strcmp(now_memmap_tree->label, label)){
			return 1;
		}
        now_memmap_tree = now_memmap_tree->next_ptr;
    }

    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %r15
leaq 0xe1c6(%rip), %r12      # 0x13560
pushq $0x1
popq %rbx
movq (%r12), %r12
testq %r12, %r12
je 0x53ce
movq 0x10(%r12), %rdi
movq %r15, %rsi
callq 0x1100
testl %eax, %eax
jne 0x53c8
movq 0x18(%r12), %rdi
movq %r14, %rsi
callq 0x1100
testl %eax, %eax
je 0x53d0
addq $0x8, %r12
jmp 0x539d
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/aquaxis[P]synverll/src/parser_ir_memmap.c
// Function: get_adrs_memmap
unsigned int get_adrs_memmap(char *module, char *label)
{
	MEMMAP_TREE *now_memmap_tree;

    now_memmap_tree = memmap_tree_top;
    while(now_memmap_tree != NULL){
		if(
			!strcmp(now_memmap_tree->module, module) &&
			!strcmp(now_memmap_tree->label, label) &&
			(now_memmap_tree->size > 0)
		){
			return now_memmap_tree->adrs;
		}
        now_memmap_tree = now_memmap_tree->next_ptr;
    }

    return -1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %r15
leaq 0xe16d(%rip), %r12      # 0x13560
pushq $-0x1
popq %rbx
movq (%r12), %r12
testq %r12, %r12
je 0x5434
movq 0x10(%r12), %rdi
movq %r15, %rsi
callq 0x1100
testl %eax, %eax
jne 0x5429
movq 0x18(%r12), %rdi
movq %r14, %rsi
callq 0x1100
testl %eax, %eax
jne 0x5429
cmpl $0x0, 0x24(%r12)
jne 0x542f
addq $0x8, %r12
jmp 0x53f6
movl 0x20(%r12), %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/aquaxis[P]synverll/src/parser_ir_memmap.c
// Function: get_size_memmap
unsigned int get_size_memmap(char *module, char *label)
{
	MEMMAP_TREE *now_memmap_tree;

    now_memmap_tree = memmap_tree_top;
    while(now_memmap_tree != NULL){
		if(!strcmp(now_memmap_tree->module, module) && !strcmp(now_memmap_tree->label, label)){
			return now_memmap_tree->size;
		}
        now_memmap_tree = now_memmap_tree->next_ptr;
    }

    return -1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %r15
leaq 0xe109(%rip), %r12      # 0x13560
pushq $-0x1
popq %rbx
movq (%r12), %r12
testq %r12, %r12
je 0x5490
movq 0x10(%r12), %rdi
movq %r15, %rsi
callq 0x1100
testl %eax, %eax
jne 0x5485
movq 0x18(%r12), %rdi
movq %r14, %rsi
callq 0x1100
testl %eax, %eax
je 0x548b
addq $0x8, %r12
jmp 0x545a
movl 0x24(%r12), %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/aquaxis[P]synverll/src/parser_ir_memmap.c
// Function: print_memmap_tree
int print_memmap_tree(FILE *fp)
{
	MEMMAP_TREE *now_memmap_tree;

	printf(" -> Output Memory Map\n");

	fprintf(fp, "======================================================================\n");
	fprintf(fp, "Memory Map\n");
	fprintf(fp, "======================================================================\n");
	fprintf(fp, "[GLOBAL/LOCAL]   [MEMORY NAME]                    [ADDRESS] [SIZE]\n");

    now_memmap_tree = memmap_tree_top;
    while(now_memmap_tree != NULL){
		if(now_memmap_tree->size > 0){
			fprintf(fp, "%-16s %-32s %08x  %8d\n", now_memmap_tree->module, now_memmap_tree->label, now_memmap_tree->adrs, now_memmap_tree->size);
		}
        now_memmap_tree = now_memmap_tree->next_ptr;
    }

	fprintf(fp, "======================================================================\n");

    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x8282(%rip), %rdi      # 0xd732
callq 0x1070
leaq 0x81c7(%rip), %r14      # 0xd683
pushq $0x47
popq %r15
pushq $0x1
popq %r12
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x11c0
leaq 0x81ef(%rip), %rdi      # 0xd6cb
pushq $0xb
popq %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x11c0
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x11c0
leaq 0x81d5(%rip), %rdi      # 0xd6d7
pushq $0x43
popq %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x11c0
leaq 0xe049(%rip), %r15      # 0x13560
leaq 0x81fd(%rip), %r14      # 0xd71b
movq (%r15), %r15
testq %r15, %r15
je 0x554e
movl 0x24(%r15), %r9d
testl %r9d, %r9d
je 0x5548
movq 0x10(%r15), %rdx
movq 0x18(%r15), %rcx
movl 0x20(%r15), %r8d
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x1110
addq $0x8, %r15
jmp 0x551e
leaq 0x812e(%rip), %rdi      # 0xd683
pushq $0x47
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x11c0
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/aquaxis[P]synverll/src/parser_ir_memory.c
// Function: clean_memory_tree
int clean_memory_tree(MEMORY_TREE *memory_tree_ptr)
{
	MEMORY_TREE *now_memory_tree;
	MEMORY_TREE *new_memory_tree;

    now_memory_tree = memory_tree_ptr;
    while(now_memory_tree != NULL){
        new_memory_tree = now_memory_tree->next_ptr;
        if(now_memory_tree->label != NULL)		free(now_memory_tree->label);
        if(now_memory_tree->verilog_args != NULL)	free(now_memory_tree->verilog_args);
        if(now_memory_tree->type != NULL)			free(now_memory_tree->type);
        free(now_memory_tree);
        now_memory_tree = new_memory_tree;
    }
    memory_tree_top = NULL;

	if(module_name != NULL){
		free(module_name);
		module_name = NULL;
	}

    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
testq %rbx, %rbx
je 0x55fa
movq 0x8(%rbx), %r14
movq 0x18(%rbx), %rdi
callq 0x1030
movq 0x28(%rbx), %rdi
callq 0x1030
movq 0x20(%rbx), %rdi
callq 0x1030
movq %rbx, %rdi
callq 0x1030
movq %r14, %rbx
jmp 0x55c9
andq $0x0, 0xdf66(%rip)      # 0x13568
leaq 0xdb3f(%rip), %rbx      # 0x13148
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x561a
callq 0x1030
andq $0x0, (%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/aquaxis[P]synverll/src/parser_ir_memory.c
// Function: print_memory_tree
int print_memory_tree(MEMORY_TREE *now_memory_tree)
{
//	MEMORY_TREE *now_memory_tree;

	printf("  [Memory Tree List]\n");

    while(now_memory_tree != NULL){
		printf("  %s: ", now_memory_tree->label);
		printf("  type = %s, ", now_memory_tree->type);
		printf("  flag = %d, ", now_memory_tree->flag);
		printf("\n");
        now_memory_tree = now_memory_tree->next_ptr;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
leaq 0x81f7(%rip), %rdi      # 0xd972
callq 0x1070
leaq 0x7ff0(%rip), %r14      # 0xd777
leaq 0x7ff0(%rip), %r15      # 0xd77e
leaq 0x7ff7(%rip), %r12      # 0xd78c
pushq $0xa
popq %rbp
testq %rbx, %rbx
je 0x57d3
movq 0x18(%rbx), %rsi
movq %r14, %rdi
xorl %eax, %eax
callq 0x10b0
movq 0x20(%rbx), %rsi
movq %r15, %rdi
xorl %eax, %eax
callq 0x10b0
movl 0x10(%rbx), %esi
movq %r12, %rdi
xorl %eax, %eax
callq 0x10b0
movl %ebp, %edi
callq 0x1040
movq 0x8(%rbx), %rbx
jmp 0x5798
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/aquaxis[P]synverll/src/parser_ir_memory.c
// Function: create_array_size
int create_array_size()
{
	MEMORY_TREE *now_memory_tree;
	int size = 0;

    now_memory_tree = memory_tree_top;
    while(now_memory_tree != NULL){
		size = get_memory_size(now_memory_tree->label, NULL, NULL);

		if(size <= 0){
			size = 0;
		}

		if(now_memory_tree->flag == MEMORY_FLAG_GLOBAL){
			// グローバルメモリ
			register_memmap_tree("GLOBAL", now_memory_tree->label, size);
		}else if(now_memory_tree->flag == MEMORY_FLAG_LOCAL){
			// ローカルメモリ
			register_memmap_tree(module_name, now_memory_tree->label, size);
		}else if(now_memory_tree->flag == MEMORY_FLAG_POINTER){
			// ポインタ
			register_memmap_tree(module_name, now_memory_tree->label, 0);
		}

        now_memory_tree = now_memory_tree->next_ptr;
    }
	if(now_memory_tree == NULL) return MEMORY_FLAG_UNKNWON;

	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
leaq 0xccc3(%rip), %r14      # 0x13568
xorl %r15d, %r15d
leaq 0xc899(%rip), %r12      # 0x13148
leaq 0x6eba(%rip), %rbx      # 0xd770
movq (%r14), %r14
testq %r14, %r14
je 0x690e
movq 0x18(%r14), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x6593
testl %eax, %eax
cmovlel %r15d, %eax
movl 0x10(%r14), %ecx
cmpl $0x3, %ecx
je 0x68f9
cmpl $0x2, %ecx
je 0x68ed
cmpl $0x1, %ecx
jne 0x6908
movq 0x18(%r14), %rsi
movq %rbx, %rdi
jmp 0x68f5
movq (%r12), %rdi
movq 0x18(%r14), %rsi
movl %eax, %edx
jmp 0x6903
movq (%r12), %rdi
movq 0x18(%r14), %rsi
xorl %edx, %edx
callq 0x52a1
addq $0x8, %r14
jmp 0x68b6
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/aquaxis[P]synverll/src/parser_ir_memory.c
// Function: clean_module_tree
int clean_module_tree()
{
	MODULE_TREE *now_module_tree;
	MODULE_TREE *new_module_tree;

    now_module_tree = module_tree_top;
    while(now_module_tree != NULL){
        new_module_tree = now_module_tree->next_ptr;
        if(now_module_tree->module_name != NULL) free(now_module_tree->module_name);
        if(now_module_tree->memory_tree_ptr != NULL) clean_memory_tree(now_module_tree->memory_tree_ptr);
        if(now_module_tree->call_tree_ptr != NULL) clean_call_tree(now_module_tree->memory_tree_ptr);
        free(now_module_tree);
        now_module_tree = new_module_tree;
    }
    module_tree_top = NULL;
    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0xcc49(%rip), %rbx      # 0x13570
testq %rbx, %rbx
je 0x6966
movq 0x8(%rbx), %r14
movq 0x10(%rbx), %rdi
callq 0x1030
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x6947
callq 0x55c2
cmpq $0x0, 0x20(%rbx)
je 0x6959
movq 0x18(%rbx), %rdi
xorl %eax, %eax
callq 0x4df8
movq %rbx, %rdi
callq 0x1030
movq %r14, %rbx
jmp 0x6927
andq $0x0, 0xcc02(%rip)      # 0x13570
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq