// File: cooljacket[P]Dormitory-distribution/./KMeans.h
// Function: KMeans<Student>::train_inc()
void train_inc() {
		for (size_t iter = 0; iter < MaxIters; ++iter) {
			for (size_t e = 0; e < size; ++e) {
				for (size_t c = 0; c < K; ++c) {
					double distance = elements[e].dist(centroids[c]);
					if (distance < dist[e]) {
						dist[e] = distance;
						my_centroids[e] = c;
					}
				}
				if (my_centroids[e] != my_centroids_map[e]) {
					size_t oldC = my_centroids_map[e], newC = my_centroids[e];
					// printf("hehe, change c=%d, for e=%d, oldC=%d\n", int(newC), int(e), int(oldC));

					my_centroids_map[e] = newC;
					my_points_map[oldC].erase(e);
					my_points_map[newC].insert(e);
					update_centroid(oldC);
					update_centroid(newC);
				}
			}

			printf("Iteration [%d], SSE=%lf\n", int(iter), SSE());
		}
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x50(%rbp)
movq $0x0, -0x10(%rbp)
movq -0x50(%rbp), %rcx
movq -0x10(%rbp), %rax
cmpq 0x10(%rcx), %rax
jae 0x6fc1
movq $0x0, -0x18(%rbp)
movq -0x50(%rbp), %rcx
movq -0x18(%rbp), %rax
cmpq 0x8(%rcx), %rax
jae 0x6f89
movq $0x0, -0x20(%rbp)
movq -0x50(%rbp), %rcx
movq -0x20(%rbp), %rax
cmpq (%rcx), %rax
jae 0x6e8c
movq -0x50(%rbp), %rdi
addq $0x18, %rdi
movq -0x18(%rbp), %rsi
callq 0x6930
movq -0x50(%rbp), %rdi
movq %rax, -0x60(%rbp)
addq $0x30, %rdi
movq -0x20(%rbp), %rsi
callq 0x6930
movq -0x60(%rbp), %rdi
movq %rax, %rsi
callq 0x14020
movq -0x50(%rbp), %rdi
movsd %xmm0, -0x28(%rbp)
movsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x58(%rbp)
addq $0x48, %rdi
movq -0x18(%rbp), %rsi
callq 0xd270
movsd -0x58(%rbp), %xmm1
movsd (%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x6e79
movq -0x50(%rbp), %rdi
movsd -0x28(%rbp), %xmm0
movsd %xmm0, -0x70(%rbp)
addq $0x48, %rdi
movq -0x18(%rbp), %rsi
callq 0xd270
movsd -0x70(%rbp), %xmm0
movq -0x50(%rbp), %rdi
movsd %xmm0, (%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x68(%rbp)
addq $0x60, %rdi
movq -0x18(%rbp), %rsi
callq 0x71e0
movq -0x68(%rbp), %rcx
movq %rcx, (%rax)
jmp 0x6e7b
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x6dc3
movq -0x50(%rbp), %rdi
addq $0x60, %rdi
movq -0x18(%rbp), %rsi
callq 0x71e0
movq -0x50(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x78(%rbp)
addq $0x78, %rdi
leaq -0x18(%rbp), %rsi
callq 0xd190
movq %rax, %rcx
movq -0x78(%rbp), %rax
cmpq (%rcx), %rax
je 0x6f76
movq -0x50(%rbp), %rdi
addq $0x78, %rdi
leaq -0x18(%rbp), %rsi
callq 0xd190
movq -0x50(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x30(%rbp)
addq $0x60, %rdi
movq -0x18(%rbp), %rsi
callq 0x71e0
movq -0x50(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x80(%rbp)
addq $0x78, %rdi
leaq -0x18(%rbp), %rsi
callq 0xd190
movq -0x80(%rbp), %rcx
movq -0x50(%rbp), %rdi
movq %rcx, (%rax)
addq $0xa8, %rdi
leaq -0x30(%rbp), %rsi
callq 0x103a0
movq %rax, %rdi
leaq -0x18(%rbp), %rsi
callq 0x10480
movq -0x50(%rbp), %rdi
addq $0xa8, %rdi
leaq -0x38(%rbp), %rsi
callq 0x103a0
movq %rax, %rdi
leaq -0x18(%rbp), %rsi
callq 0xd140
movq -0x50(%rbp), %rdi
movq %rax, -0x48(%rbp)
movb %dl, -0x40(%rbp)
movq -0x30(%rbp), %rsi
callq 0x104b0
movq -0x50(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x104b0
jmp 0x6f78
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x6da9
movq -0x50(%rbp), %rdi
movq -0x10(%rbp), %rax
movl %eax, -0x84(%rbp)
callq 0xd290
movl -0x84(%rbp), %esi
leaq 0x15235(%rip), %rdi     # 0x1c1de
movb $0x1, %al
callq 0x3050
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x6d8f
addq $0x90, %rsp
popq %rbp
retq
nopw (%rax,%rax)