// File: /workspace/github_cpp_makefile_star2_O1/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 0x58(%rsp), %r15
movq %r15, -0x10(%r15)
xorl %eax, %eax
movq %rax, -0x8(%r15)
movb %al, (%r15)
leaq 0x38(%rsp), %r12
movq %r12, -0x10(%r12)
movq %rax, -0x8(%r12)
movb %al, (%r12)
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x3622(%rip), %rsi      # 0x806c
leaq 0x3630(%rip), %rdx      # 0x8081
leaq 0x8(%rsp), %rdi
callq 0x50f4
testl %ebx, %ebx
jle 0x4a7c
leaq 0x361c(%rip), %r15      # 0x8082
leaq 0x28(%rsp), %r12
movl %ebx, %ebp
movq %r12, %rdi
movq %r15, %rsi
callq 0x23f0
decl %ebp
jne 0x4a6d
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x20f0
leaq 0x48(%rsp), %rdi
movq 0x8(%rdi), %rsi
shrq %rsi
movq 0x8(%rsp), %rcx
movq 0x10(%rsp), %rdx
movq %rdx, %rax
shrq %rax
subq %rax, %rsi
movq %rdx, %r8
callq 0x2230
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq 0x6510(%rip), %r15      # 0xafd0
movq %r15, %rdi
callq 0x2240
cmpl $0x0, 0x30(%r14)
jle 0x4be1
xorl %r12d, %r12d
leaq 0x35d0(%rip), %r13      # 0x80ad
leaq 0x35ce(%rip), %rbp      # 0x80b2
movl %r12d, %eax
cltd
idivl %ebx
testl %edx, %edx
jne 0x4b15
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq %r15, %rdi
callq 0x2050
movq %rax, %rdi
callq 0x2120
movl $0x6, %edx
movq %r15, %rdi
leaq 0x356a(%rip), %rsi      # 0x808e
callq 0x2240
movq (%r15), %rax
movq -0x18(%rax), %rax
movq $0x4, 0x10(%r15,%rax)
movq %r15, %rdi
movl %r12d, %esi
callq 0x2390
movl $0x1, %edx
movq %rax, %rdi
leaq 0x36a6(%rip), %rsi      # 0x81f9
callq 0x2240
movq 0x38(%r14), %rax
movl (%rax,%r12,4), %eax
cmpl $0xfffe, %eax           # imm = 0xFFFE
leaq 0x3539(%rip), %rsi      # 0x80a5
leaq 0x352a(%rip), %rcx      # 0x809d
cmovgeq %rcx, %rsi
testl %eax, %eax
leaq 0x3515(%rip), %rax      # 0x8095
cmoveq %rax, %rsi
movl $0x7, %edx
movq %r15, %rdi
callq 0x2240
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 0x2390
movl $0x4, %edx
movq %r15, %rdi
movq %r13, %rsi
callq 0x2240
movl $0x1, %edx
movq %r15, %rdi
movq %rbp, %rsi
callq 0x2240
incq %r12
movslq 0x30(%r14), %rax
cmpq %rax, %r12
jl 0x4ae4
movq (%r15), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq 0x63d1(%rip), %rdi      # 0xafd0
callq 0x2050
movq %rax, %rdi
callq 0x2120
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2050
movq %rax, %rdi
callq 0x2120
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
leaq 0x58(%rsp), %rbx
leaq 0x38(%rsp), %r14
je 0x4c5c
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x4c73
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x48(%rsp), %rdi
cmpq %rbx, %rdi
je 0x4c8a
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x21f0
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x4ccb
jmp 0x4ca2
jmp 0x4ca2
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
leaq 0x58(%rsp), %r15
leaq 0x38(%rsp), %r12
je 0x4ccb
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x4ce2
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x4cf9
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x21f0
movq %rbx, %rdi
callq 0x23b0
nop