// File: /workspace/github_cpp_makefile_star2_O1/hyp1231[P]FMSS/filesystem.cpp
// Function: FileSystem::FileSystem()
FileSystem::FileSystem() : D(), BLKsize(1024) {
	cout << "Welcome to use our system!" << endl;
	cout << "If you need help, just type \"help\", and hit [enter]." << endl;
	cout << "Input \"exit\" to exit the ststem." << endl;
	cout << "Hope you enjoy yourself~ (´▽｀)" << endl;

    // set BLK_No. of root directory to 0 
    // (the implementation of diskdata has done this work)

    // get super block
    char buf[BLKsize];
    D.Getblk(buf, 0);

    // get root path inodeNum and cur dir inodeNum
    root_dir_inodeNum = cur_dir_inodeNum = buf[2];

    // get inode bitmap
    for(int i = 3; i <= 12; ++i) {
        inode_bitmap[i - 3] = buf[i];
    }

    // get data block bitmap
    for(int i = 13; i <= 92; ++i) {
        data_block_bitmap[i - 13] = buf[i];
    }

    cur_path.push_back("/");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdi, %r15
movl $0x400, (%rdi)          # imm = 0x400
leaq 0x8(%rdi), %rbx
movq %rbx, %rdi
callq 0x258c
leaq 0x38(%r15), %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%r15)
movq $0x0, 0x48(%r15)
movq 0xa16d(%rip), %r12      # 0xcfd0
leaq 0x6260(%rip), %rsi      # 0x90ca
movl $0x1a, %edx
movq %r12, %rdi
callq 0x2240
movq (%r12), %rax
addq -0x18(%rax), %r12
movq %r12, %rdi
movl $0xa, %esi
callq 0x21e0
movsbl %al, %esi
movq 0xa13a(%rip), %rdi      # 0xcfd0
callq 0x2030
movq %rax, %rdi
callq 0x2120
movq 0xa126(%rip), %r12      # 0xcfd0
leaq 0x6234(%rip), %rsi      # 0x90e5
movl $0x34, %edx
movq %r12, %rdi
callq 0x2240
movq (%r12), %rax
addq -0x18(%rax), %r12
movq %r12, %rdi
movl $0xa, %esi
callq 0x21e0
movsbl %al, %esi
movq 0xa0f3(%rip), %rdi      # 0xcfd0
callq 0x2030
movq %rax, %rdi
callq 0x2120
movq 0xa0df(%rip), %r12      # 0xcfd0
leaq 0x6222(%rip), %rsi      # 0x911a
movl $0x20, %edx
movq %r12, %rdi
callq 0x2240
movq (%r12), %rax
addq -0x18(%rax), %r12
movq %r12, %rdi
movl $0xa, %esi
callq 0x21e0
movsbl %al, %esi
movq 0xa0ac(%rip), %rdi      # 0xcfd0
callq 0x2030
movq %rax, %rdi
callq 0x2120
movq 0xa098(%rip), %r12      # 0xcfd0
leaq 0x61fc(%rip), %rsi      # 0x913b
movl $0x23, %edx
movq %r12, %rdi
callq 0x2240
movq (%r12), %rax
addq -0x18(%rax), %r12
movq %r12, %rdi
movl $0xa, %esi
callq 0x21e0
movsbl %al, %esi
movq 0xa065(%rip), %rdi      # 0xcfd0
callq 0x2030
movq %rax, %rdi
callq 0x2120
movl (%r15), %eax
movq %rsp, %r12
addq $0xf, %rax
andq $-0x10, %rax
subq %rax, %r12
movq %r12, %rsp
movq %rbx, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x26d0
movsbl 0x2(%r12), %eax
movl %eax, 0x34(%r15)
movl %eax, 0x30(%r15)
movq 0x3(%r12), %rax
movq %rax, 0x50(%r15)
movzwl 0xb(%r12), %eax
movw %ax, 0x58(%r15)
addq $0x5a, %r15
addq $0xd, %r12
movl $0x50, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x2190
leaq -0x30(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x60cb(%rip), %rsi      # 0x90ae
leaq 0x60c5(%rip), %rdx      # 0x90af
leaq -0x40(%rbp), %rdi
callq 0x2910
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x6d2e
movq -0x40(%rbp), %rdi
cmpq %r12, %rdi
je 0x3014
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x2200
leaq -0x20(%rbp), %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r15
movq -0x40(%rbp), %rdi
cmpq %r12, %rdi
je 0x3040
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x2200
jmp 0x3040
jmp 0x303d
movq %rax, %r15
movq %r14, %rdi
callq 0x6abe
movq %rbx, %rdi
callq 0x26b4
movq %r15, %rdi
callq 0x2350