// File: /workspace/github_cpp_makefile_star2_O3/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, %r12
leaq 0x380a(%rip), %rsi      # 0x607c
leaq 0x98(%rsp), %rbx
leaq 0xa0(%rsp), %r15
movq %r14, %rdi
movq %rbx, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x2310
movsd (%rbx), %xmm0
divsd 0x376a(%rip), %xmm0     # 0x6008
movsd %xmm0, (%rbx)
movq %r12, 0x58(%rsp)
leaq 0xa0(%r12), %r13
movsd (%r15), %xmm0
movq %r13, %rdi
callq 0x4d8c
leaq 0x3890(%rip), %rsi      # 0x6153
leaq 0x7d26(%rip), %r12      # 0xa5f0
movq %r14, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x2310
cmpl $0x1, %eax
jne 0x2c48
movq 0x58(%rsp), %rax
leaq 0x40(%rax), %rbp
movsd 0x371f(%rip), %xmm0     # 0x6010
movsd %xmm0, 0x8(%rsp)
movq %r12, %rdi
callq 0x20c0
testq %rax, %rax
je 0x2920
movq %rax, %rbx
xorl %r15d, %r15d
movsbl (%r15,%r12), %edi
callq 0x2320
movb %al, (%r15,%r12)
incq %r15
cmpq %r15, %rbx
jne 0x290a
movl 0x7cca(%rip), %eax      # 0xa5f0
cmpl $0x444e45, %eax         # imm = 0x444E45
je 0x2c48
movl 0x7cb9(%rip), %ecx      # 0xa5f0
movl $0x45454c53, %edx       # imm = 0x45454C53
xorl %edx, %ecx
movzwl 0x7caf(%rip), %edx      # 0xa5f4
xorl $0x50, %edx
orl %ecx, %edx
je 0x2986
cmpb $0x3b, %al
jne 0x29bc
leaq 0x7899(%rip), %rdi      # 0xa1f0
movl $0x400, %esi            # imm = 0x400
movq %r14, %rdx
callq 0x2290
movq %r14, %rdi
leaq 0x37e5(%rip), %rsi      # 0x6153
movq %r12, %rdx
xorl %eax, %eax
callq 0x2310
cmpl $0x1, %eax
je 0x28f7
jmp 0x2c48
movq %r14, %rdi
leaq 0x36ef(%rip), %rsi      # 0x607f
leaq 0x40(%rsp), %rdx
xorl %eax, %eax
callq 0x2310
movsd 0x40(%rsp), %xmm0
divsd 0x365e(%rip), %xmm0     # 0x6008
movsd 0x8(%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
jmp 0x2950
movq %r14, %rdi
leaq 0x36b6(%rip), %rsi      # 0x607c
leaq 0x30(%rsp), %rdx
leaq 0x90(%rsp), %rcx
xorl %eax, %eax
callq 0x2310
movsd 0x98(%rsp), %xmm0
mulsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x30(%rsp)
movsbl 0x7bfa(%rip), %esi      # 0xa5f0
movsd 0x90(%rsp), %xmm0
movq %r13, %rdi
callq 0x4d4e
movsd %xmm0, 0x38(%rsp)
leaq 0x77dc(%rip), %rbx      # 0xa1f0
movq %rbx, %rdi
movl $0x400, %esi            # imm = 0x400
movq %r14, %rdx
callq 0x2290
xorpd %xmm0, %xmm0
movapd %xmm0, 0x40(%rsp)
movq $0x0, 0x50(%rsp)
leaq 0x10(%rsp), %r15
movzbl (%rbx), %eax
cmpl $0x23, %eax
je 0x2a75
testl %eax, %eax
je 0x2ac2
movsbl %al, %eax
leal -0x30(%rax), %ecx
cmpl $0x9, %ecx
ja 0x2aba
movq 0x48(%rsp), %rdi
andl $0xf, %eax
movl %eax, 0x10(%rsp)
movq -0x10(%rdi), %rsi
cmpq -0x8(%rdi), %rsi
je 0x2aae
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x10(%rdi)
jmp 0x2aba
xorpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
leaq 0x40(%rsp), %rdi
movq %r15, %rsi
callq 0x361a
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x2aba
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
jmp 0x2aba
addq $-0x18, %rdi
movq %r15, %rdx
callq 0x381a
incq %rbx
jmp 0x2a3c
movsd 0x8(%rsp), %xmm0
mulsd 0x3548(%rip), %xmm0     # 0x6018
cvttsd2si %xmm0, %esi
movsd 0x30(%rsp), %xmm1
movq %rbp, %rdi
movsd 0x38(%rsp), %xmm0
callq 0x51ac
movq %rbp, 0x60(%rsp)
movq %r13, 0x68(%rsp)
movq %r14, 0x70(%rsp)
movq 0x40(%rsp), %rbx
movq 0x48(%rsp), %r14
movsd 0x30(%rsp), %xmm2
cmpq %r14, %rbx
je 0x2c1a
movq %r14, %rax
subq %rbx, %rax
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rax
movq %rax, %xmm0
punpckldq 0x34fb(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x3503(%rip), %xmm0     # 0x6040
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
divsd %xmm1, %xmm2
movsd %xmm2, 0x80(%rsp)
movq %r14, 0x78(%rsp)
movq %r15, %rdi
movq %rbx, %rsi
callq 0x3274
movq 0x10(%rsp), %rbp
movq 0x18(%rsp), %r15
cmpq %r15, %rbp
je 0x2bdc
movq %rbx, 0x38(%rsp)
movsd 0x8(%rsp), %xmm0
mulsd 0x3490(%rip), %xmm0     # 0x6018
cvttsd2si %xmm0, %ebx
movslq (%rbp), %r14
movq 0x58(%rsp), %rax
movq 0x4c8(%rax), %r13
leaq 0x88(%rsp), %rdi
movl %ebx, %esi
callq 0x501a
imulq $0x68, %r14, %rax
leaq (%rax,%r13), %rdi
addq $-0x68, %rdi
movq 0x88(%rsp), %rsi
callq 0x5a12
addq $0x4, %rbp
cmpq %r15, %rbp
jne 0x2b8c
movq 0x10(%rsp), %rbp
movq 0x38(%rsp), %rbx
movq 0x78(%rsp), %r14
testq %rbp, %rbp
leaq 0x10(%rsp), %r15
je 0x2bf6
movq 0x20(%rsp), %rsi
subq %rbp, %rsi
movq %rbp, %rdi
callq 0x21a0
movsd 0x8(%rsp), %xmm0
addsd 0x80(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
addq $0x18, %rbx
cmpq %r14, %rbx
jne 0x2b5b
jmp 0x2c2a
movsd 0x8(%rsp), %xmm0
addsd %xmm2, %xmm0
movsd %xmm0, 0x8(%rsp)
leaq 0x40(%rsp), %rdi
callq 0x32f4
movq 0x70(%rsp), %r14
movq 0x68(%rsp), %r13
movq 0x60(%rsp), %rbp
jmp 0x2964
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2c5e
jmp 0x2c5e
movq %rax, %rbx
jmp 0x2c7f
jmp 0x2c65
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x2c7f
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
leaq 0x40(%rsp), %rdi
callq 0x32f4
movq %rbx, %rdi
callq 0x2300
nop