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

	//Write Root To SDisk
	for (int i = 0; i < this->rootSize; i++)
		ssBuffer << this->rootFileName[i] << this->delimiter << setw(5) <<
			setfill('0') << this->rootFirstBlock[i] << this->delimiter;
	vector<string> vecRoot = block(ssBuffer.str(), this->getBlockSize());
	this->putBlock(0, vecRoot[0]);

	ssBuffer.str("");

	//Write fat To SDisk
	for (int i = 0; i < this->fat.size(); i++)
		ssBuffer << setw(5) << setfill('0') << fat[i] << this->delimiter;
	vector<string> vecFAT = block(ssBuffer.str(), this->getBlockSize());
	for (int i = 0; i < vecFAT.size(); i++)
		this->putBlock((1 + i), vecFAT[i]);

	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x248, %rsp            # imm = 0x248
movq %rdi, %rbx
leaq -0x268(%rbp), %rdi
callq 0x2110
cmpl $0x0, 0x2c(%rbx)
jle 0x4fc1
movl $0x8, %r14d
xorl %r15d, %r15d
movq 0x38(%rbx), %rax
movq -0x8(%rax,%r14), %rsi
movq (%rax,%r14), %rdx
leaq -0x258(%rbp), %rdi
callq 0x21f0
movb $0x20, -0x48(%rbp)
movl $0x1, %edx
movq %rax, %rdi
leaq -0x48(%rbp), %rsi
callq 0x21f0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rcx
movq $0x5, 0x10(%r12,%rcx)
movq -0x18(%rax), %rax
movq %r12, %r13
addq %rax, %r13
cmpb $0x0, 0xe1(%r12,%rax)
jne 0x4f80
movq %r13, %rdi
movl $0x20, %esi
callq 0x21a0
movb %al, 0xe0(%r13)
movb $0x1, 0xe1(%r13)
movb $0x30, 0xe0(%r13)
movq 0x50(%rbx), %rax
movl (%rax,%r15,4), %esi
movq %r12, %rdi
callq 0x22f0
movb $0x20, -0x48(%rbp)
movl $0x1, %edx
movq %rax, %rdi
leaq -0x48(%rbp), %rsi
callq 0x21f0
incq %r15
movslq 0x2c(%rbx), %rax
addq $0x20, %r14
cmpq %rax, %r15
jl 0x4f0e
leaq -0x250(%rbp), %r15
leaq -0xc8(%rbp), %rdi
movq %r15, %rsi
callq 0x22c0
movq %rbx, %rdi
callq 0x660e
leaq -0xe0(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
movl %eax, %edx
callq 0x5342
leaq -0xb8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5013
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0xe0(%rbp), %rax
leaq -0x78(%rbp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0x88(%rbp), %rdi
callq 0x41ce
leaq -0x88(%rbp), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x6518
movq -0x88(%rbp), %rdi
cmpq %r14, %rdi
je 0x5061
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq -0x38(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x204c(%rip), %rdx      # 0x70bc
leaq -0x48(%rbp), %rdi
movq %rdx, %rsi
callq 0x2644
leaq -0x48(%rbp), %rsi
movq %r15, %rdi
callq 0x2290
movq -0x48(%rbp), %rdi
cmpq %r14, %rdi
je 0x509d
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x21c0
movq 0x70(%rbx), %rax
cmpq 0x68(%rbx), %rax
je 0x5142
leaq -0x258(%rbp), %r15
xorl %r14d, %r14d
leaq -0x48(%rbp), %r12
movq -0x258(%rbp), %rax
movq -0x18(%rax), %rcx
movq $0x5, -0x248(%rbp,%rcx)
movq -0x18(%rax), %rax
leaq (%r15,%rax), %r13
cmpb $0x0, -0x177(%rbp,%rax)
jne 0x50fe
movq %r13, %rdi
movl $0x20, %esi
callq 0x21a0
movb %al, 0xe0(%r13)
movb $0x1, 0xe1(%r13)
movb $0x30, 0xe0(%r13)
movq 0x68(%rbx), %rax
movl (%rax,%r14,4), %esi
movq %r15, %rdi
callq 0x22f0
movb $0x20, -0x48(%rbp)
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x21f0
incq %r14
movq 0x70(%rbx), %rax
subq 0x68(%rbx), %rax
sarq $0x2, %rax
cmpq %r14, %rax
ja 0x50b9
leaq -0xa8(%rbp), %rdi
leaq -0x250(%rbp), %rsi
callq 0x22c0
movq %rbx, %rdi
callq 0x660e
leaq -0x48(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
movl %eax, %edx
callq 0x5342
leaq -0x98(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x518e
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x21c0
movq -0x48(%rbp), %rax
cmpq %rax, -0x40(%rbp)
je 0x5200
movl $0x8, %r12d
leaq -0x58(%rbp), %r15
xorl %r13d, %r13d
leaq -0x68(%rbp), %r14
movq %r15, -0x68(%rbp)
movq -0x8(%rax,%r12), %rsi
movq (%rax,%r12), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x41ce
leal 0x1(%r13), %esi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x6518
movq -0x68(%rbp), %rdi
cmpq %r15, %rdi
je 0x51e5
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x21c0
incq %r13
movq -0x48(%rbp), %rax
movq -0x40(%rbp), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
addq $0x20, %r12
cmpq %r13, %rcx
ja 0x51a9
leaq -0x48(%rbp), %rdi
callq 0x25da
leaq -0xe0(%rbp), %rdi
callq 0x25da
movq 0x4d9c(%rip), %rsi      # 0x9fb8
leaq -0x268(%rbp), %rdi
callq 0x2130
leaq -0x1e8(%rbp), %rdi
callq 0x20a0
movl $0x1, %eax
addq $0x248, %rsp            # imm = 0x248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x52fb
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r14, %rdi
je 0x52fe
movq -0x38(%rbp), %rsi
jmp 0x52a5
jmp 0x52fb
movq %rax, %rbx
movq -0x88(%rbp), %rdi
cmpq %r14, %rdi
je 0x52fe
movq -0x78(%rbp), %rsi
jmp 0x52a5
jmp 0x52fb
jmp 0x530c
movq %rax, %rbx
leaq -0x98(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x52fe
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x21c0
jmp 0x52fe
movq %rax, %rbx
leaq -0xb8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x530f
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x21c0
jmp 0x530f
movq %rax, %rbx
jmp 0x52f0
movq %rax, %rbx
movq -0x68(%rbp), %rdi
cmpq %r15, %rdi
je 0x52f0
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x21c0
leaq -0x48(%rbp), %rdi
callq 0x25da
jmp 0x52fe
movq %rax, %rbx
leaq -0xe0(%rbp), %rdi
callq 0x25da
jmp 0x530f
movq %rax, %rbx
movq 0x4ca2(%rip), %rsi      # 0x9fb8
leaq -0x268(%rbp), %rdi
callq 0x2130
leaq -0x1e8(%rbp), %rdi
callq 0x20a0
movq %rbx, %rdi
callq 0x2300