// File: /workspace/github_cpp_makefile_star2_O1/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 0x569f(%rip), %rbx      # 0xafd0
leaq 0x27e4(%rip), %r14      # 0x811c
movq 0x56a1(%rip), %r15      # 0xafe0
leaq 0x8(%rsp), %r12
leaq 0x28bd(%rip), %r13      # 0x8208
leaq 0x2801(%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
testl %eax, %eax
je 0x59ef
movq 0x8(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x4e, %eax
je 0x59ef
cmpl $0x59, %eax
je 0x59ef
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 0x5952
movq 0x8(%rsp), %rax
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpb $0x4e, (%rax)
je 0x5c56
movq 0x55c7(%rip), %r12      # 0xafd0
leaq 0x8(%rsp), %r14
leaq 0x27f3(%rip), %rbx      # 0x8208
movl $0x38, %edx
movq %r12, %rdi
leaq 0x2743(%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
movb $0x1, %r13b
testl %eax, %eax
je 0x5ae6
movq 0x8(%rsp), %rdi
callq 0x2340
movl %eax, %ebp
addl $-0x33, %eax
cmpl $-0x2f, %eax
ja 0x5aeb
movl $0x1d, %edx
movq %r12, %rdi
leaq 0x271c(%rip), %rsi      # 0x81a0
callq 0x2240
movq %r12, %rdi
movl $0x5, %esi
callq 0x2390
movl $0x5, %edx
movq %r12, %rdi
leaq 0x2719(%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
xorl %r13d, %r13d
jmp 0x5aeb
movl $0xa, %ebp
testb %r13b, %r13b
jne 0x5b03
movq (%r15), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x20(%r15,%rax)
je 0x5a15
movq 0x54c6(%rip), %r12      # 0xafd0
leaq 0x8(%rsp), %r14
movl $0x36, %edx
movq %r12, %rdi
leaq 0x26a6(%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 0x26b9(%rip), %rsi      # 0x8208
callq 0x2070
movb $0x1, %bl
testl %eax, %eax
je 0x5be3
movq 0x8(%rsp), %rdi
callq 0x2340
movl %eax, %r13d
addl $-0x11, %eax
cmpl $-0xa, %eax
ja 0x5be9
movl $0x1d, %edx
movq %r12, %rdi
leaq 0x261e(%rip), %rsi      # 0x81a0
callq 0x2240
movq %r12, %rdi
movl $0x8, %esi
callq 0x2390
movl $0x5, %edx
movq %r12, %rdi
leaq 0x261b(%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
xorl %ebx, %ebx
jmp 0x5be9
movl $0x8, %r13d
testb %bl, %bl
jne 0x5c00
movq (%r15), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x20(%r15,%rax)
je 0x5b0f
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 0x4e76
leaq 0x38(%rsp), %rsi
movq %rbx, %rdi
movl %ebp, %edx
movl %r13d, %ecx
callq 0x28bc
movl %eax, %ebx
movq 0x38(%rsp), %rdi
cmpq %r14, %rdi
je 0x5c56
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x21f0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x5c72
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 0x5ca8
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x21f0
jmp 0x5ca8
jmp 0x5ca5
jmp 0x5ca5
jmp 0x5ca5
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq 0x8(%rsp), %rdi
cmpq %rax, %rdi
je 0x5cc4
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21f0
movq %rbx, %rdi
callq 0x23b0