// File: /workspace/github_cpp_makefile_star2_O3/iZhangHui[P]CppPrimer/CH03_StringsVectorsAndArrays/examples/arrayScores.cc
// Function: main
int main ()
{
	vector<unsigned> grades;
	// count the number of grades by clusters of ten: 
	// 0--9, 10--19, . . . 90--99, 100
	unsigned scores[11] = {};  // 11 buckets, all value initialized to 0
	unsigned grade;
	while (cin >> grade) {
		if (grade <= 100)
			// increment the counter for the current cluster
			++scores[grade/10]; 
		grades.push_back(grade);
	}
	cout << "grades.size = " << grades.size() << endl;

	for (auto g : grades)  // for every element in grades
		cout << g << " " ;
	cout << endl;

	for (auto i : scores)       // for each counter in scores
		cout << i << " ";       // print the value of that counter
	cout << endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
xorps %xmm0, %xmm0
leaq -0x40(%rbp), %rbx
movaps %xmm0, (%rbx)
movq $0x0, 0x10(%rbx)
movups %xmm0, -0x54(%rbp)
movaps %xmm0, -0x60(%rbp)
movaps %xmm0, -0x70(%rbp)
movq 0x2d3e(%rip), %r14      # 0x3fe0
leaq -0x44(%rbp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x1100
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x12fa
movl -0x44(%rbp), %eax
cmpl $0x64, %eax
ja 0x12d7
movzbl %al, %ecx
imull $0xcd, %ecx, %ecx
shrl $0xb, %ecx
incl -0x70(%rbp,%rcx,4)
movq -0x38(%rbp), %rsi
cmpq -0x30(%rbp), %rsi
je 0x12ed
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x38(%rbp)
jmp 0x12a6
movq %rbx, %rdi
movq %r15, %rdx
callq 0x1472
jmp 0x12a6
movq 0x2ccf(%rip), %rdi      # 0x3fd0
leaq 0xcfc(%rip), %rsi       # 0x2004
movl $0xe, %edx
callq 0x10d0
movq -0x38(%rbp), %rsi
subq -0x40(%rbp), %rsi
sarq $0x2, %rsi
movq 0x2cab(%rip), %rbx      # 0x3fd0
movq %rbx, %rdi
callq 0x1060
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x10a0
movsbl %al, %esi
movq %r14, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1070
movq -0x40(%rbp), %r12
movq -0x38(%rbp), %r13
cmpq %r13, %r12
je 0x1397
movq 0x2c65(%rip), %r14      # 0x3fd0
leaq 0xc9f(%rip), %r15       # 0x2011
movl (%r12), %esi
movq %r14, %rdi
callq 0x1060
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x10d0
addq $0x4, %r12
cmpq %r13, %r12
jne 0x1372
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x10a0
movsbl %al, %esi
movq 0x2c1b(%rip), %rdi      # 0x3fd0
callq 0x1030
movq %rax, %rdi
callq 0x1070
xorl %r15d, %r15d
movq 0x2c04(%rip), %rbx      # 0x3fd0
leaq 0xc3e(%rip), %r14       # 0x2011
movl -0x70(%rbp,%r15), %esi
movq %rbx, %rdi
callq 0x1060
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x10d0
addq $0x4, %r15
cmpq $0x2c, %r15
jne 0x13d3
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x10a0
movsbl %al, %esi
movq 0x2bb8(%rip), %rdi      # 0x3fd0
callq 0x1030
movq %rax, %rdi
callq 0x1070
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x143a
movq -0x30(%rbp), %rsi
subq %rdi, %rsi
callq 0x10c0
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1451
jmp 0x1451
jmp 0x1451
movq %rax, %rbx
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x1469
movq -0x30(%rbp), %rsi
subq %rdi, %rsi
callq 0x10c0
movq %rbx, %rdi
callq 0x1110
nop