// File: /workspace/github_cpp_makefile_star2_O3/emr4378[P]FAT-File-System/Shell.cpp
// Function: Shell::createFileSystem(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
int Shell::createFileSystem(string name) {
	int ret = -1;
	int num;
	bool condMet;
	string input;
	int fileSize;
	int clusterSize;

	do {
		condMet = true;
		cout << "Are you sure you want to create a new file system[Y]? ";
		getline(cin, input);
		if (input != "" && input[0] != 'Y' && input[0] != 'N') {
			condMet = false;
			cout << "Please enter Y or N" << endl;
		}
	} while (!condMet && !cin.eof());

	if (input[0] == 'N') {
		ret = -1;
	} else {
		do {
			condMet = true;
			cout << "Enter the maximum size for this file system in MB [10]: ";
			getline(cin, input);
			if (input == "") {
				num = 10;
			} else {
				num = atoi(input.c_str());
				if (num > MAX_FILE_SIZE || num < MIN_FILE_SIZE) {
					condMet = false;
					cout << "Please enter integer between " << MIN_FILE_SIZE;
					cout << " and " << MAX_FILE_SIZE << endl;
				}
			}
		} while (!condMet && !cin.eof());

		fileSize = num;

		do {
			condMet = true;
			cout << "Enter the cluster size for this file system in KB [8]:";
			getline(cin, input);
			if (input == "") {
				num = 8;
			} else {
				num = atoi(input.c_str());
				if (num > MAX_CLUSTER_SIZE || num < MIN_CLUSTER_SIZE) {
					condMet = false;
					cout << "Please enter integer between " << MIN_CLUSTER_SIZE;
					cout << " and " << MAX_CLUSTER_SIZE << endl;
				}
			}
		} while (!condMet && !cin.eof());

		clusterSize = num;

		ret = fileSystem->createFileSys(name, fileSize, clusterSize);
	}

	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, 0x30(%rsp)
movq %rdi, 0x28(%rsp)
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x56cd(%rip), %rbx      # 0xafd0
leaq 0x2812(%rip), %r14      # 0x811c
movq 0x56cf(%rip), %r15      # 0xafe0
leaq 0x8(%rsp), %r12
leaq 0x28eb(%rip), %r13      # 0x8208
leaq 0x282f(%rip), %rbp      # 0x8153
movl $0x36, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2240
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x23e0
movq %r12, %rdi
movq %r13, %rsi
callq 0x2070
movq 0x8(%rsp), %rcx
testl %eax, %eax
je 0x59c6
movzbl (%rcx), %eax
cmpl $0x4e, %eax
je 0x59c8
cmpl $0x59, %eax
je 0x59c8
movl $0x13, %edx
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x2240
movq (%rbx), %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 (%r15), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x20(%r15,%rax)
je 0x5924
movq 0x8(%rsp), %rcx
movb (%rcx), %al
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpb $0x4e, %al
je 0x5c1e
movq 0x55f4(%rip), %r12      # 0xafd0
leaq 0x8(%rsp), %r14
leaq 0x2820(%rip), %rbx      # 0x8208
movl $0x38, %edx
movq %r12, %rdi
leaq 0x2770(%rip), %rsi      # 0x8167
callq 0x2240
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %edx
movq %r15, %rdi
movq %r14, %rsi
callq 0x23e0
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2070
testl %eax, %eax
je 0x5aca
movq 0x8(%rsp), %rdi
callq 0x2340
movl %eax, %ebp
addl $-0x33, %eax
cmpl $-0x2f, %eax
ja 0x5acf
movl $0x1d, %edx
movq %r12, %rdi
leaq 0x2748(%rip), %rsi      # 0x81a0
callq 0x2240
movq %r12, %rdi
movl $0x5, %esi
callq 0x2390
movl $0x5, %edx
movq %r12, %rdi
leaq 0x2745(%rip), %rsi      # 0x81be
callq 0x2240
movq %r12, %rdi
movl $0x32, %esi
callq 0x2390
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq %r13, %rdi
callq 0x2050
movq %rax, %rdi
callq 0x2120
movq (%r15), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x20(%r15,%rax)
je 0x59e8
jmp 0x5acf
movl $0xa, %ebp
movq 0x54fa(%rip), %r12      # 0xafd0
leaq 0x8(%rsp), %r14
movl $0x36, %edx
movq %r12, %rdi
leaq 0x26da(%rip), %rsi      # 0x81c4
callq 0x2240
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %edx
movq %r15, %rdi
movq %r14, %rsi
callq 0x23e0
movq %r14, %rdi
leaq 0x26ed(%rip), %rsi      # 0x8208
callq 0x2070
testl %eax, %eax
je 0x5bc2
movq 0x8(%rsp), %rdi
callq 0x2340
movl %eax, %r13d
addl $-0x11, %eax
cmpl $-0xa, %eax
ja 0x5bc8
movl $0x1d, %edx
movq %r12, %rdi
leaq 0x2650(%rip), %rsi      # 0x81a0
callq 0x2240
movq %r12, %rdi
movl $0x8, %esi
callq 0x2390
movl $0x5, %edx
movq %r12, %rdi
leaq 0x264d(%rip), %rsi      # 0x81be
callq 0x2240
movq %r12, %rdi
movl $0x10, %esi
callq 0x2390
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 (%r15), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x20(%r15,%rax)
je 0x5adb
jmp 0x5bc8
movl $0x8, %r13d
movq 0x28(%rsp), %rax
movq 0x18(%rax), %rbx
leaq 0x48(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x30(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x38(%rsp), %rdi
callq 0x4e42
leaq 0x38(%rsp), %rsi
movq %rbx, %rdi
movl %ebp, %edx
movl %r13d, %ecx
callq 0x28b4
movl %eax, %ebx
movq 0x38(%rsp), %rdi
cmpq %r14, %rdi
je 0x5c1e
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x5c3a
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
movl %ebx, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x38(%rsp), %rdi
cmpq %r14, %rdi
je 0x5c70
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x21f0
jmp 0x5c70
jmp 0x5c6d
jmp 0x5c6d
jmp 0x5c6d
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq 0x8(%rsp), %rdi
cmpq %rax, %rdi
je 0x5c8c
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
movq %rbx, %rdi
callq 0x23b0