// File: /workspace/github_cpp_makefile_star2_O2/iZhangHui[P]CppPrimer/CH05_Statements/examples/ifgrades.cc
// Function: main
int main()
{
	// read a set of scores from the input
	unsigned grade;
	while (cin >> grade) 
		grades.push_back(grade);

	// now process those grades
	for (auto it : grades) {   // for each grade we read
		cout << it << " " ;    // print the grade
		string lettergrade;    // hold coresponding letter grade
		// if failing grade, no need to check for a plus or minus
		if (it < 60)
			lettergrade = scores[0];
		else {
			lettergrade = scores[(it - 50)/10];  // fetch the letter grade
			if (it != 100)  // add plus or minus only if not already an A++
				if (it % 10 > 7)
					lettergrade += '+';   // grades ending in 8 or 9 get a +
				else if (it % 10 < 3)
					lettergrade += '-';   // grades ending in 0, 1, or 2 get a -
		}
		cout << lettergrade << endl;
		if (it > 59 && it !=100) {
			cout << "alternative versions: " << it << " ";
			// start over with just the basic grade, no + or -
			lettergrade = scores[(it - 50)/10];
			cout << goodVers(lettergrade, it) << " ";
			cout << badVers(lettergrade, it) << " ";
			cout << rightVers(lettergrade, it) << " ";
			cout << endl;
		}
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq 0x2a90(%rip), %rbx      # 0x4fe0
leaq -0x54(%rbp), %r14
leaq 0x2bbd(%rip), %r15      # 0x5118
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2190
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x2581
movq %r15, %rdi
movq %r14, %rsi
callq 0x28c0
jmp 0x255b
movq 0x2b90(%rip), %r14      # 0x5118
movq 0x2b91(%rip), %rax      # 0x5120
movq %rax, -0x50(%rbp)
leaq -0xd8(%rbp), %r12
cmpq -0x50(%rbp), %r14
je 0x27cf
movl (%r14), %r13d
movq 0x2a22(%rip), %rdi      # 0x4fd0
movq %r13, %rsi
callq 0x20b0
movq %rax, %rdi
leaq 0xa67(%rip), %rsi       # 0x3027
callq 0x2100
andq $0x0, -0x40(%rbp)
leaq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
movb $0x0, -0x38(%rbp)
cmpq $0x3b, %r13
ja 0x25ee
movq 0x2b1d(%rip), %rsi      # 0x5100
leaq -0x48(%rbp), %rdi
callq 0x20a0
jmp 0x263a
leal -0x32(%r13), %eax
xorl %edx, %edx
pushq $0xa
popq %rcx
divl %ecx
shlq $0x5, %rax
addq 0x2afc(%rip), %rax      # 0x5100
leaq -0x48(%rbp), %rdi
movq %rax, %rsi
callq 0x20a0
cmpl $0x64, %r13d
je 0x263a
movl %r13d, %eax
xorl %edx, %edx
pushq $0xa
popq %rcx
divl %ecx
movb $0x2b, %al
cmpl $0x7, %edx
ja 0x262e
movb $0x2d, %al
cmpl $0x2, %edx
ja 0x263a
movzbl %al, %esi
leaq -0x48(%rbp), %rdi
callq 0x20d0
movq 0x298f(%rip), %rdi      # 0x4fd0
leaq -0x48(%rbp), %rsi
callq 0x20f0
movq %rax, %rdi
callq 0x2080
cmpl $0x3c, %r13d
setb %al
cmpq $0x64, %r13
sete %cl
orb %al, %cl
jne 0x27bd
movq 0x2961(%rip), %rdi      # 0x4fd0
leaq 0x99c(%rip), %rsi       # 0x3012
callq 0x2100
movq %rax, %rdi
movq %r13, %rsi
callq 0x20b0
movq %rax, %rdi
leaq 0x997(%rip), %rsi       # 0x3027
callq 0x2100
leal -0x32(%r13), %eax
xorl %edx, %edx
pushq $0xa
popq %rcx
divl %ecx
shlq $0x5, %rax
addq 0x2a55(%rip), %rax      # 0x5100
leaq -0x48(%rbp), %rdi
movq %rax, %rsi
callq 0x20a0
movq %r12, %rbx
movq %r12, %rdi
leaq -0x48(%rbp), %rsi
callq 0x2140
leaq -0x78(%rbp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movl %r13d, %edx
callq 0x246c
movq 0x28f1(%rip), %rdi      # 0x4fd0
movq %r15, %rsi
callq 0x20f0
movq %rax, %rdi
leaq 0x936(%rip), %rsi       # 0x3027
callq 0x2100
leaq -0x78(%rbp), %rbx
movq %rbx, %rdi
callq 0x2070
movq %r12, %rdi
callq 0x2070
leaq -0xb8(%rbp), %r15
movq %r15, %rdi
leaq -0x48(%rbp), %rsi
callq 0x2140
movq %rbx, %rdi
movq %r15, %rsi
movl %r13d, %edx
callq 0x24ae
movq 0x289e(%rip), %rdi      # 0x4fd0
movq %rbx, %rsi
callq 0x20f0
movq %rax, %rdi
leaq 0x8e3(%rip), %rsi       # 0x3027
callq 0x2100
movq %rbx, %rdi
callq 0x2070
leaq -0xb8(%rbp), %rdi
callq 0x2070
leaq -0x98(%rbp), %r15
movq %r15, %rdi
leaq -0x48(%rbp), %rsi
callq 0x2140
movq %rbx, %rdi
movq %r15, %rsi
movl %r13d, %edx
callq 0x24f3
movq 0x284b(%rip), %rdi      # 0x4fd0
movq %rbx, %rsi
callq 0x20f0
movq %rax, %rdi
leaq 0x890(%rip), %rsi       # 0x3027
callq 0x2100
leaq -0x78(%rbp), %rdi
callq 0x2070
leaq -0x98(%rbp), %rdi
callq 0x2070
movq 0x2818(%rip), %rdi      # 0x4fd0
callq 0x2080
leaq -0x48(%rbp), %rdi
callq 0x2070
addq $0x4, %r14
jmp 0x259a
xorl %eax, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x282e
movq %rax, %rbx
jmp 0x2804
jmp 0x283c
jmp 0x283c
jmp 0x283c
movq %rax, %rbx
jmp 0x2819
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x2070
leaq -0x98(%rbp), %rdi
jmp 0x2835
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x2070
leaq -0xd8(%rbp), %rdi
jmp 0x2835
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x2070
leaq -0xb8(%rbp), %rdi
callq 0x2070
jmp 0x283f
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x2070
movq %rbx, %rdi
callq 0x21a0