// File: wwdatabase[P]database/./smmana/sm.h
// Function: SM_Manager::SM_Manager()
SM_Manager(){ //init the database
		record_manager = RecordManager::getInstance();
		DIR* nowdir = opendir(".");
		dirent* nowf;
		vector<string> dbs;
		while((nowf = readdir(nowdir))!= NULL)
		{
			string fileName(nowf->d_name);
			if(nowf->d_type == DT_DIR)
			{
				if(fileName == ".."||fileName == ".")
					continue;
				DB db;
				strcpy(db.dbname,fileName.c_str());
				databases.push_back(db);
			}
		}
		closedir(nowdir);
		for(int i = 0;i < databases.size();i++)
		{
			nowdir = opendir(databases[i].dbname);
		//	printf("rua: %s\n",databases[i].dbname);
			while((nowf = readdir(nowdir))!= NULL)
			{
				char c[255];
				strcpy(c,nowf->d_name);
				if(strcmp(c,".") == 0 || strcmp(c,"..")==0)
					continue;
				int len = strlen(c);
				for(int j = len-1;j >= 0;j--)
				{
					if(c[j] == '.')
					{
						if(strcmp(c+j+1,"www") == 0)// got table info
						{
				//			cout << databases[i].dbname << endl;;
							string path_(databases[i].dbname);
							path_ =path_+ "/"+c;
							FILE* in;
							in = fopen(path_.c_str(),"r");
							if(in == NULL)
								cout << "cannot open the .www file" << endl;
							table_entry tb;
							char temp_attr_name[255];
							int temp_type;
							int temp_attrlen;
							int temp_isnull;
							char temp_name[255];
							fscanf(in,"%s%d%d%d",tb.tablename,&tb.attrNum,&tb.prikeyNum,&tb.recordSize);

								for(int k = 0;k < tb.attrNum;k++)
								{
									fscanf(in,"%s%d%d%d",temp_attr_name,&temp_type,&temp_attrlen,&temp_isnull);
									tb.attrName.push_back(temp_attr_name);
									tb.attrType.push_back(temp_type);
									tb.attrLength.push_back(temp_attrlen);
									tb.isNull.push_back(temp_isnull);
								}
							databases[i].table.push_back(tb);
							fclose(in);
						}
					}
				}

			}
			closedir(nowdir);


		}

	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x6d0, %rsp            # imm = 0x6D0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x630(%rbp)
movq %rdi, %rax
movq %rax, -0x638(%rbp)
callq 0x92c0
movq -0x630(%rbp), %rax
movl $0x0, 0x18(%rax)
callq 0x92e0
movq %rax, -0x628(%rbp)
jmp 0x71a5
movq -0x638(%rbp), %rax
movq -0x628(%rbp), %rcx
movq %rcx, 0x20(%rax)
leaq 0x825a(%rip), %rdi      # 0xf418
callq 0x2350
movq %rax, -0x640(%rbp)
jmp 0x71cc
movq -0x640(%rbp), %rax
movq %rax, -0x20(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x6730
movq -0x20(%rbp), %rdi
callq 0x2360
movq %rax, -0x648(%rbp)
jmp 0x71f2
movq -0x648(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
je 0x7395
movq -0x28(%rbp), %rax
addq $0x13, %rax
movq %rax, -0x658(%rbp)
leaq -0x61(%rbp), %rdi
movq %rdi, -0x650(%rbp)
callq 0x23d0
movq -0x658(%rbp), %rsi
movq -0x650(%rbp), %rdx
leaq -0x60(%rbp), %rdi
callq 0x61e0
jmp 0x723f
leaq -0x61(%rbp), %rdi
callq 0x2260
movq -0x28(%rbp), %rax
movzbl 0x12(%rax), %eax
cmpl $0x4, %eax
jne 0x7364
leaq 0x81b7(%rip), %rsi      # 0xf417
leaq -0x60(%rbp), %rdi
callq 0x9350
movb %al, -0x659(%rbp)
jmp 0x7271
movb -0x659(%rbp), %al
testb $0x1, %al
jne 0x72a1
jmp 0x727d
leaq 0x8194(%rip), %rsi      # 0xf418
leaq -0x60(%rbp), %rdi
callq 0x9350
movb %al, -0x65a(%rbp)
jmp 0x7295
movb -0x65a(%rbp), %al
testb $0x1, %al
jne 0x72a1
jmp 0x72fa
movl $0x2, -0x68(%rbp)
jmp 0x736b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0x78c2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0x78b9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
leaq -0x61(%rbp), %rdi
callq 0x2260
jmp 0x78b9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0x7387
leaq -0x180(%rbp), %rdi
callq 0x9380
jmp 0x7308
leaq -0x60(%rbp), %rdi
callq 0x20b0
movq %rax, %rsi
leaq -0x180(%rbp), %rdi
movq %rdi, -0x668(%rbp)
callq 0x21f0
movq -0x638(%rbp), %rdi
movq -0x668(%rbp), %rsi
callq 0x69d0
jmp 0x733c
leaq -0x180(%rbp), %rdi
callq 0x6a40
jmp 0x7364
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
leaq -0x180(%rbp), %rdi
callq 0x6a40
jmp 0x7387
movl $0x0, -0x68(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x2130
movl -0x68(%rbp), %eax
testl %eax, %eax
je 0x7382
jmp 0x737d
jmp 0x71e0
jmp 0x71e0
leaq -0x60(%rbp), %rdi
callq 0x2130
jmp 0x78b9
movq -0x20(%rbp), %rdi
callq 0x2380
jmp 0x73a0
movl $0x0, -0x184(%rbp)
movq -0x638(%rbp), %rdi
movslq -0x184(%rbp), %rax
movq %rax, -0x670(%rbp)
callq 0x6c20
movq %rax, %rcx
movq -0x670(%rbp), %rax
cmpq %rcx, %rax
jae 0x78a7
movq -0x638(%rbp), %rdi
movslq -0x184(%rbp), %rsi
callq 0x6c50
movq %rax, %rdi
callq 0x2350
movq %rax, -0x678(%rbp)
jmp 0x73fb
movq -0x678(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x2360
movq %rax, -0x680(%rbp)
jmp 0x7418
movq -0x680(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
je 0x7886
leaq -0x290(%rbp), %rdi
movq -0x28(%rbp), %rsi
addq $0x13, %rsi
callq 0x21f0
leaq -0x290(%rbp), %rdi
leaq 0x7fc9(%rip), %rsi      # 0xf418
callq 0x2300
cmpl $0x0, %eax
je 0x7471
leaq -0x290(%rbp), %rdi
leaq 0x7fb0(%rip), %rsi      # 0xf417
callq 0x2300
cmpl $0x0, %eax
jne 0x7473
jmp 0x7406
leaq -0x290(%rbp), %rdi
callq 0x20d0
movl %eax, -0x294(%rbp)
movl -0x294(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x298(%rbp)
cmpl $0x0, -0x298(%rbp)
jl 0x7881
movslq -0x298(%rbp), %rax
movsbl -0x290(%rbp,%rax), %eax
cmpl $0x2e, %eax
jne 0x786b
leaq -0x290(%rbp), %rdi
movslq -0x298(%rbp), %rax
addq %rax, %rdi
addq $0x1, %rdi
leaq 0x7dff(%rip), %rsi      # 0xf2d4
callq 0x2300
cmpl $0x0, %eax
jne 0x7869
movq -0x638(%rbp), %rdi
movslq -0x184(%rbp), %rsi
callq 0x6c50
movq %rax, -0x690(%rbp)
leaq -0x2b9(%rbp), %rdi
movq %rdi, -0x688(%rbp)
callq 0x23d0
movq -0x690(%rbp), %rsi
movq -0x688(%rbp), %rdx
leaq -0x2b8(%rbp), %rdi
callq 0x61e0
jmp 0x752c
leaq -0x2b9(%rbp), %rdi
callq 0x2260
leaq 0x7d92(%rip), %rdx      # 0xf2d1
leaq -0x300(%rbp), %rdi
leaq -0x2b8(%rbp), %rsi
callq 0x6e50
jmp 0x7554
leaq -0x2e0(%rbp), %rdi
leaq -0x300(%rbp), %rsi
leaq -0x290(%rbp), %rdx
callq 0x6e00
jmp 0x7570
leaq -0x2b8(%rbp), %rdi
movq %rdi, -0x6a0(%rbp)
leaq -0x2e0(%rbp), %rsi
movq %rsi, -0x6a8(%rbp)
callq 0x22b0
movq -0x6a8(%rbp), %rdi
callq 0x2130
leaq -0x300(%rbp), %rdi
callq 0x2130
movq -0x6a0(%rbp), %rdi
callq 0x20b0
movq %rax, %rdi
leaq 0x7e5b(%rip), %rsi      # 0xf41a
callq 0x22a0
movq %rax, -0x698(%rbp)
jmp 0x75cd
movq -0x698(%rbp), %rax
movq %rax, -0x308(%rbp)
cmpq $0x0, -0x308(%rbp)
jne 0x7663
movq 0xe9ec(%rip), %rdi      # 0x15fd8
leaq 0x7e29(%rip), %rsi      # 0xf41c
callq 0x2200
movq %rax, -0x6b0(%rbp)
jmp 0x7601
movq -0x6b0(%rbp), %rdi
movq 0xe9b9(%rip), %rsi      # 0x15fc8
callq 0x2240
jmp 0x7616
jmp 0x7663
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
leaq -0x2b9(%rbp), %rdi
callq 0x2260
jmp 0x78b9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0x785b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
leaq -0x300(%rbp), %rdi
callq 0x2130
jmp 0x785b
leaq -0x3d8(%rbp), %rdi
movq %rdi, -0x6b8(%rbp)
callq 0x6cc0
movq -0x6b8(%rbp), %rdx
movq -0x308(%rbp), %rdi
leaq -0x370(%rbp), %rcx
leaq -0x36c(%rbp), %r8
leaq -0x374(%rbp), %r9
leaq 0x7d96(%rip), %rsi      # 0xf436
xorl %eax, %eax
callq 0x2410
jmp 0x76a9
movl $0x0, -0x5f4(%rbp)
movl -0x5f4(%rbp), %eax
cmpl -0x370(%rbp), %eax
jge 0x77fc
movq -0x308(%rbp), %rdi
leaq 0x7d63(%rip), %rsi      # 0xf436
xorl %eax, %eax
leaq -0x4e0(%rbp), %rdx
leaq -0x4e4(%rbp), %rcx
leaq -0x4e8(%rbp), %r8
leaq -0x4ec(%rbp), %r9
callq 0x2410
jmp 0x76f8
leaq -0x368(%rbp), %rax
movq %rax, -0x6c8(%rbp)
leaq -0x619(%rbp), %rdi
movq %rdi, -0x6c0(%rbp)
callq 0x23d0
movq -0x6c0(%rbp), %rdx
leaq -0x618(%rbp), %rdi
leaq -0x4e0(%rbp), %rsi
callq 0x61e0
jmp 0x7735
movq -0x6c8(%rbp), %rdi
leaq -0x618(%rbp), %rsi
callq 0x93b0
jmp 0x774a
leaq -0x618(%rbp), %rdi
callq 0x2130
leaq -0x619(%rbp), %rdi
callq 0x2260
leaq -0x350(%rbp), %rdi
leaq -0x4e4(%rbp), %rsi
callq 0x6d20
jmp 0x7777
leaq -0x338(%rbp), %rdi
leaq -0x4e8(%rbp), %rsi
callq 0x6d20
jmp 0x778c
leaq -0x320(%rbp), %rdi
leaq -0x4ec(%rbp), %rsi
callq 0x6d20
jmp 0x77a1
jmp 0x77a3
movl -0x5f4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5f4(%rbp)
jmp 0x76b3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0x784f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0x77ee
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
leaq -0x618(%rbp), %rdi
callq 0x2130
leaq -0x619(%rbp), %rdi
callq 0x2260
jmp 0x784f
movq -0x638(%rbp), %rdi
movslq -0x184(%rbp), %rsi
callq 0x6c50
movq %rax, %rdi
addq $0x100, %rdi            # imm = 0x100
leaq -0x3d8(%rbp), %rsi
callq 0x6d90
jmp 0x7827
movq -0x308(%rbp), %rdi
callq 0x2210
jmp 0x7835
leaq -0x3d8(%rbp), %rdi
callq 0x6fe0
leaq -0x2b8(%rbp), %rdi
callq 0x2130
jmp 0x7869
leaq -0x3d8(%rbp), %rdi
callq 0x6fe0
leaq -0x2b8(%rbp), %rdi
callq 0x2130
jmp 0x78b9
jmp 0x786b
jmp 0x786d
movl -0x298(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x298(%rbp)
jmp 0x7494
jmp 0x7406
movq -0x20(%rbp), %rdi
callq 0x2380
jmp 0x7891
jmp 0x7893
movl -0x184(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x184(%rbp)
jmp 0x73aa
leaq -0x40(%rbp), %rdi
callq 0x6850
addq $0x6d0, %rsp            # imm = 0x6D0
popq %rbp
retq
leaq -0x40(%rbp), %rdi
callq 0x6850
movq -0x630(%rbp), %rdi
callq 0x93e0
movq -0x10(%rbp), %rdi
callq 0x23c0
nopw (%rax,%rax)