// File: /workspace/github_cpp_makefile_star2_O2/RC2K7[P]SDisk-FileSystem/filesystem.cpp
// Function: FileSystem::initRoot()
int FileSystem::initRoot()
{
	stringstream ssBuffer;

    // FileSystem Was Just Created
	if (this->getStatusCode() == 1) {
        // Setup Root With Default Values
		for (int i = 0; i < this->rootSize; i++)
			ssBuffer << "....." << this->delimiter << "00000" << this->delimiter;
	} else { // FileSystem Previously Existed
		string temp;
		this->getBlock(0, temp);
		ssBuffer << temp;
	}

	vector<string>vecRoot = block(ssBuffer.str(), this->getBlockSize());
	ssBuffer.str(vecRoot[0]);

	{ // Local Scope
		int i;
		string entry;
		for (i = 0; i  < (this->rootSize * 2) && getline(ssBuffer, entry,
			this->delimiter); i++)
		{
			if (i % 2 == 0)
				this->rootFileName.push_back(entry);
			else
				this->rootFirstBlock.push_back(std::stoi(entry, nullptr, 10));
		}
	}

	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1f8, %rsp            # imm = 0x1F8
movq %rdi, %rbx
leaq -0x218(%rbp), %rdi
callq 0x2130
movq %rbx, %rdi
callq 0x51be
cmpl $0x1, %eax
jne 0x3aa8
xorl %r14d, %r14d
leaq 0x2787(%rip), %r15      # 0x61e9
pushq $0x20
popq %r12
leaq 0x2782(%rip), %r13      # 0x61ef
cmpl 0x2c(%rbx), %r14d
jge 0x3adf
leaq -0x208(%rbp), %rdi
movq %r15, %rsi
callq 0x21d0
movq %rax, %rdi
movl %r12d, %esi
callq 0x2210
movq %rax, %rdi
movq %r13, %rsi
callq 0x21d0
movq %rax, %rdi
movl %r12d, %esi
callq 0x2210
incl %r14d
jmp 0x3a6d
leaq -0x40(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq -0x50(%rbp), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x4ff8
leaq -0x208(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x21a0
leaq -0x50(%rbp), %rdi
callq 0x20e0
leaq -0x200(%rbp), %r14
leaq -0x90(%rbp), %rdi
movq %r14, %rsi
callq 0x22f0
movq %rbx, %rdi
callq 0x51b4
leaq -0x70(%rbp), %rdi
leaq -0x90(%rbp), %rsi
movl %eax, %edx
callq 0x4216
leaq -0x90(%rbp), %rdi
callq 0x20e0
movq -0x70(%rbp), %rsi
movq %r14, %rdi
callq 0x22c0
leaq -0x40(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x50(%rbx), %rax
movq %rax, -0x58(%rbp)
leaq 0x38(%rbx), %r15
xorl %r14d, %r14d
leaq -0x50(%rbp), %r13
pushq $0x20
popq %r12
movl 0x2c(%rbx), %eax
addl %eax, %eax
cmpl %eax, %r14d
jge 0x3bad
leaq -0x218(%rbp), %rdi
movq %r13, %rsi
movl %r12d, %edx
callq 0x2350
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x3bad
testb $0x1, %r14b
jne 0x3b8b
movq %r15, %rdi
movq %r13, %rsi
callq 0x4ae6
jmp 0x3ba8
movq %r13, %rdi
xorl %esi, %esi
pushq $0xa
popq %rdx
callq 0x4b21
movl %eax, -0x2c(%rbp)
movq -0x58(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
callq 0x4d44
incl %r14d
jmp 0x3b4e
leaq -0x50(%rbp), %rdi
callq 0x20e0
leaq -0x70(%rbp), %rdi
callq 0x25fc
leaq -0x218(%rbp), %rdi
callq 0x2150
pushq $0x1
popq %rax
addq $0x1f8, %rsp            # imm = 0x1F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x3c11
jmp 0x3c1c
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
jmp 0x3bfc
jmp 0x3c1c
movq %rax, %rbx
leaq -0x90(%rbp), %rdi
callq 0x20e0
jmp 0x3c1f
jmp 0x3c05
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x20e0
leaq -0x70(%rbp), %rdi
callq 0x25fc
jmp 0x3c1f
movq %rax, %rbx
leaq -0x218(%rbp), %rdi
callq 0x2150
movq %rbx, %rdi
callq 0x2330
nop