// File: /workspace/github_cpp_makefile_star2_O3/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 0xa16f(%rip), %r12      # 0xcfd0
leaq 0x62f3(%rip), %rsi      # 0x915b
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 0xa13c(%rip), %rdi      # 0xcfd0
callq 0x2030
movq %rax, %rdi
callq 0x2120
movq 0xa128(%rip), %r12      # 0xcfd0
leaq 0x62c7(%rip), %rsi      # 0x9176
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 0xa0f5(%rip), %rdi      # 0xcfd0
callq 0x2030
movq %rax, %rdi
callq 0x2120
movq 0xa0e1(%rip), %r12      # 0xcfd0
leaq 0x62b5(%rip), %rsi      # 0x91ab
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 0xa0ae(%rip), %rdi      # 0xcfd0
callq 0x2030
movq %rax, %rdi
callq 0x2120
movq 0xa09a(%rip), %r12      # 0xcfd0
leaq 0x628f(%rip), %rsi      # 0x91cc
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 0xa067(%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 0x26e0
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 0x615e(%rip), %rsi      # 0x913f
leaq 0x6158(%rip), %rdx      # 0x9140
leaq -0x40(%rbp), %rdi
callq 0x2920
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x72fe
movq -0x40(%rbp), %rdi
cmpq %r12, %rdi
je 0x3012
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 0x303e
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x2200
jmp 0x303e
jmp 0x303b
movq %rax, %r15
movq %r14, %rdi
callq 0x7068
movq %rbx, %rdi
callq 0x26c4
movq %r15, %rdi
callq 0x2350