// File: /workspace/github_cpp_makefile_star2_O2/emr4378[P]FAT-File-System/FileSys.cpp
// Function: FileSys::printFAT(int)
void FileSys::printFAT(int width) {
	int i;
	string titleRow;
	string rowDivide;
	string title = "File Allocation Table";
	for (i = 0; i < width; i++) {
		rowDivide += "-----------";
	}
	titleRow = rowDivide;
	
	cout << titleRow.replace(titleRow.length()/2-title.length()/2, 
							title.length(), title);
	for (i = 0; i < numClusters; i++) {
		if (i % width == 0) {
			cout << endl;
		}
		cout << "\033[1;1m" << setw(4) << i << ":";
		if (fileAllocationTable[i] == 0x0000) {
			cout << "\033[0;32m";
		} else if (fileAllocationTable[i] >= 0xFFFE) {
			cout << "\033[0;31m";
		} else {
			cout << "\033[0;34m";
		}
		cout << setw(5) << fileAllocationTable[i];
		cout << "\033[0m" << "|";

	}
	cout << endl << endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %esi, %ebx
movq %rdi, %r14
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %ebp, %ebp
movb %bpl, (%rax)
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %bpl, (%rax)
leaq 0x1f7c(%rip), %rsi      # 0x606c
leaq 0x48(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x4444
testl %ebx, %ebx
cmovgl %ebx, %ebp
leaq 0x1f77(%rip), %r15      # 0x6082
leaq 0x8(%rsp), %r12
subl $0x1, %ebp
jb 0x4122
movq %r12, %rdi
movq %r15, %rsi
callq 0x2400
jmp 0x4110
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x2140
leaq 0x28(%rsp), %rdi
movq 0x8(%rdi), %rsi
shrq %rsi
leaq 0x48(%rsp), %rcx
movq 0x8(%rcx), %rdx
movq %rdx, %rax
shrq %rax
subq %rax, %rsi
callq 0x20b0
movq 0x4e75(%rip), %r15      # 0x8fd0
movq %r15, %rdi
movq %rax, %rsi
callq 0x21b0
xorl %r12d, %r12d
leaq 0x1f3d(%rip), %r13      # 0x60ad
leaq 0x1f3b(%rip), %rbp      # 0x60b2
movslq 0x30(%r14), %rax
cmpq %rax, %r12
jge 0x4241
movl %r12d, %eax
cltd
idivl %ebx
testl %edx, %edx
jne 0x4196
movq %r15, %rdi
callq 0x2110
movq %r15, %rdi
leaq 0x1eee(%rip), %rsi      # 0x608e
callq 0x2210
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movq $0x4, 0x10(%rax,%rcx)
movq %rax, %rdi
movl %r12d, %esi
callq 0x23c0
movq %rax, %rdi
leaq 0x202f(%rip), %rsi      # 0x61f9
callq 0x2210
movq 0x38(%r14), %rax
movl (%rax,%r12,4), %eax
cmpl $0xfffe, %eax           # imm = 0xFFFE
leaq 0x1ec2(%rip), %rsi      # 0x60a5
leaq 0x1eb3(%rip), %rcx      # 0x609d
cmovgeq %rcx, %rsi
testl %eax, %eax
leaq 0x1e9e(%rip), %rax      # 0x6095
cmoveq %rax, %rsi
movq %r15, %rdi
callq 0x2210
movq (%r15), %rax
movq -0x18(%rax), %rax
movq $0x5, 0x10(%r15,%rax)
movq 0x38(%r14), %rax
movl (%rax,%r12,4), %esi
movq %r15, %rdi
callq 0x23c0
movq %r15, %rdi
movq %r13, %rsi
callq 0x2210
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2210
incq %r12
jmp 0x4177
movq 0x4d88(%rip), %rdi      # 0x8fd0
callq 0x2110
movq %rax, %rdi
callq 0x2110
leaq 0x48(%rsp), %rdi
callq 0x2100
leaq 0x8(%rsp), %rdi
callq 0x2100
leaq 0x28(%rsp), %rdi
callq 0x2100
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x4298
jmp 0x428b
jmp 0x428b
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x2100
leaq 0x8(%rsp), %rdi
callq 0x2100
leaq 0x28(%rsp), %rdi
callq 0x2100
movq %rbx, %rdi
callq 0x23d0