// File: /workspace/github_cpp_makefile_star2_O2/daklqw[P]beepmania/core.cpp
// Function: gamecore::readbeatmap(_IO_FILE*)
void gamecore::readbeatmap(FILE * fin) {
	double tick, hi;
	fscanf(fin, "%lf%lf", &tick, &hi);
	tick /= 1000;
	kt.set(hi);
	static char buf[1024], opt[1024];
	double pre = 1;
	while (fscanf(fin, "%s", opt) == 1) {
		std::transform(opt, opt + strlen(opt), opt, ::toupper);
		if (strcmp(opt, "END") == 0) break;
		if (strcmp(opt, "SLEEP") == 0) {
			double tim;
			fscanf(fin, "%lf", &tim);
			pre += tim / 1000.;
			fgets(buf, 1024, fin);
			continue;
		}
		if (*opt == ';') { fgets(buf, 1024, fin); continue; }
		double tim, dta;
		fscanf(fin, "%lf%lf", &tim, &dta);
		tim *= tick;
		double hi = kt(*opt, dta);
		fgets(buf, 1024, fin);
		std::vector<std::vector<int> > vec;
		for (char * cur = buf; *cur; ++cur)
			if (*cur == '#') vec.push_back({});
			else if (isdigit(*cur))
				vec.back().push_back(*cur & 15);
		sd.push(pre * CLOCKS_PER_SEC, hi, tim);
		if (vec.empty()) {
			pre += tim;
		} else {
			double sm = tim / vec.size();
			for (auto t : vec) {
				for (auto c : t)
					tv[c - 1].push(note(pre * CLOCKS_PER_SEC));
				pre += sm;
			}
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x38dc(%rip), %rsi      # 0x607c
leaq 0x98(%rsp), %r15
leaq 0xa0(%rsp), %r12
movq %r14, %rdi
movq %r15, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x22f0
movsd (%r15), %xmm0
divsd 0x383b(%rip), %xmm0     # 0x6008
movsd %xmm0, (%r15)
leaq 0xa0(%rbx), %rdi
movsd (%r12), %xmm0
movq %rdi, 0x60(%rsp)
callq 0x4d16
movq %rbx, 0x80(%rsp)
leaq 0x40(%rbx), %rax
movq %rax, 0x58(%rsp)
movsd 0x380e(%rip), %xmm0     # 0x6010
movsd %xmm0, 0x8(%rsp)
leaq 0x8dd1(%rip), %r15      # 0xb5e0
leaq 0x40(%rsp), %r12
movq %r14, %rdi
leaq 0x3935(%rip), %rsi      # 0x6153
movq %r15, %rdx
xorl %eax, %eax
callq 0x22f0
cmpl $0x1, %eax
jne 0x2afc
movq %r15, %rdi
callq 0x20b0
movq %rax, %r13
xorl %ebx, %ebx
cmpq %rbx, %r13
je 0x2856
movsbl (%rbx,%r15), %edi
callq 0x2300
movb %al, (%rbx,%r15)
incq %rbx
jmp 0x283e
movl 0x8d84(%rip), %ebx      # 0xb5e0
cmpl $0x444e45, %ebx         # imm = 0x444E45
je 0x2afc
movq %r15, %rdi
leaq 0x3811(%rip), %rsi      # 0x6083
pushq $0x6
popq %rdx
callq 0x21a0
testl %eax, %eax
je 0x289c
cmpb $0x3b, %bl
jne 0x28d2
leaq 0x8956(%rip), %rdi      # 0xb1e0
movl $0x400, %esi            # imm = 0x400
movq %r14, %rdx
callq 0x2280
jmp 0x2814
movq %r14, %rdi
leaq 0x37d9(%rip), %rsi      # 0x607f
leaq 0x20(%rsp), %rdx
xorl %eax, %eax
callq 0x22f0
movsd 0x20(%rsp), %xmm0
divsd 0x3748(%rip), %xmm0     # 0x6008
movsd 0x8(%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
jmp 0x2883
movq %r14, %rdi
leaq 0x37a0(%rip), %rsi      # 0x607c
leaq 0x10(%rsp), %rdx
leaq 0x90(%rsp), %rcx
xorl %eax, %eax
callq 0x22f0
movsd 0x98(%rsp), %xmm0
mulsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movsbl 0x8cd4(%rip), %esi      # 0xb5e0
movsd 0x90(%rsp), %xmm0
movq 0x60(%rsp), %rdi
callq 0x4cdc
movsd %xmm0, 0x18(%rsp)
leaq 0x88b4(%rip), %r13      # 0xb1e0
movq %r13, %rdi
movl $0x400, %esi            # imm = 0x400
movq %r14, %rdx
callq 0x2280
xorpd %xmm0, %xmm0
movapd %xmm0, 0x20(%rsp)
andq $0x0, 0x30(%rsp)
movzbl (%r13), %eax
cmpl $0x23, %eax
je 0x297f
testl %eax, %eax
je 0x29a9
movsbl %al, %eax
leal -0x30(%rax), %ecx
cmpl $0x9, %ecx
ja 0x29a4
movq 0x28(%rsp), %rdi
addq $-0x18, %rdi
andl $0xf, %eax
movl %eax, 0x40(%rsp)
movq %r12, %rsi
callq 0x3734
jmp 0x29a4
xorpd %xmm0, %xmm0
movapd %xmm0, 0x40(%rsp)
andq $0x0, 0x50(%rsp)
leaq 0x20(%rsp), %rdi
movq %r12, %rsi
callq 0x34ee
movq %r12, %rdi
callq 0x3700
incq %r13
jmp 0x294c
movsd 0x8(%rsp), %xmm0
mulsd 0x3661(%rip), %xmm0     # 0x6018
cvttsd2si %xmm0, %esi
movsd 0x10(%rsp), %xmm1
movq 0x58(%rsp), %rdi
movsd 0x18(%rsp), %xmm0
callq 0x506a
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdi
movsd 0x10(%rsp), %xmm2
cmpq %rdi, %rsi
je 0x2add
movq %rdi, %rax
subq %rsi, %rax
cqto
pushq $0x18
popq %rcx
idivq %rcx
movq %rax, %xmm0
punpckldq 0x362b(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x3633(%rip), %xmm0     # 0x6040
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
divsd %xmm1, %xmm2
movsd %xmm2, 0x70(%rsp)
movq %r14, 0x78(%rsp)
movq %rdi, 0x68(%rsp)
cmpq %rdi, %rsi
je 0x2aed
movq %r12, %rdi
movq %rsi, 0x18(%rsp)
callq 0x3040
movq 0x40(%rsp), %rbx
movq 0x48(%rsp), %rbp
movsd 0x8(%rsp), %xmm0
mulsd 0x35bd(%rip), %xmm0     # 0x6018
cvttsd2si %xmm0, %r13d
cmpq %rbp, %rbx
je 0x2aa6
movslq (%rbx), %r12
movq 0x80(%rsp), %rax
movq 0x4c8(%rax), %r14
leaq 0x88(%rsp), %rdi
movl %r13d, %esi
callq 0x4f0a
imulq $0x68, %r12, %rax
leaq (%r14,%rax), %rdi
addq $-0x68, %rdi
movq 0x88(%rsp), %rsi
callq 0x58ae
addq $0x4, %rbx
jmp 0x2a60
movsd 0x8(%rsp), %xmm0
addsd 0x70(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
leaq 0x40(%rsp), %r12
movq %r12, %rdi
callq 0x3700
movq 0x18(%rsp), %rsi
addq $0x18, %rsi
movq 0x78(%rsp), %r14
movq 0x68(%rsp), %rdi
jmp 0x2a2d
movsd 0x8(%rsp), %xmm0
addsd %xmm2, %xmm0
movsd %xmm0, 0x8(%rsp)
leaq 0x20(%rsp), %rdi
callq 0x308e
jmp 0x2814
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2b12
jmp 0x2b12
movq %rax, %rbx
jmp 0x2b26
jmp 0x2b19
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x3700
leaq 0x20(%rsp), %rdi
callq 0x308e
movq %rbx, %rdi
callq 0x22e0