// File: /workspace/github_cpp_makefile_star2_O1/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 0x380a(%rip), %rsi      # 0x607c
leaq 0x98(%rsp), %r15
leaq 0xa0(%rsp), %r12
movq %r14, %rdi
movq %r15, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x2310
movsd (%r15), %xmm0
divsd 0x3769(%rip), %xmm0     # 0x6008
movsd %xmm0, (%r15)
movq %rbx, 0x58(%rsp)
leaq 0xa0(%rbx), %rdi
movsd (%r12), %xmm0
movq %rdi, 0x68(%rsp)
callq 0x4d7c
leaq 0x388c(%rip), %rsi      # 0x6153
leaq 0x7d22(%rip), %r12      # 0xa5f0
movq %r14, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x2310
cmpl $0x1, %eax
jne 0x2c3f
movq 0x58(%rsp), %rax
addq $0x40, %rax
movq %rax, 0x60(%rsp)
movsd 0x3716(%rip), %xmm0     # 0x6010
movsd %xmm0, 0x8(%rsp)
leaq 0x10(%rsp), %r15
movq %r12, %rdi
callq 0x20c0
testq %rax, %rax
je 0x292d
movq %rax, %r13
xorl %ebx, %ebx
movsbl (%rbx,%r12), %edi
callq 0x2320
movb %al, (%rbx,%r12)
incq %rbx
cmpq %rbx, %r13
jne 0x2917
cmpl $0x444e45, 0x7cb9(%rip) # imm = 0x444E45
je 0x2c3f
movl 0x7cad(%rip), %eax      # 0xa5f0
movl $0x45454c53, %ecx       # imm = 0x45454C53
xorl %ecx, %eax
movzwl 0x7ca3(%rip), %ecx      # 0xa5f4
xorl $0x50, %ecx
orl %eax, %ecx
je 0x2997
cmpb $0x3b, 0x7c91(%rip)     # 0xa5f0
jne 0x29cd
leaq 0x7888(%rip), %rdi      # 0xa1f0
movl $0x400, %esi            # imm = 0x400
movq %r14, %rdx
callq 0x2290
movq %r14, %rdi
leaq 0x37d4(%rip), %rsi      # 0x6153
movq %r12, %rdx
xorl %eax, %eax
callq 0x2310
cmpl $0x1, %eax
je 0x2905
jmp 0x2c3f
movq %r14, %rdi
leaq 0x36de(%rip), %rsi      # 0x607f
leaq 0x40(%rsp), %rdx
xorl %eax, %eax
callq 0x2310
movsd 0x40(%rsp), %xmm0
divsd 0x364d(%rip), %xmm0     # 0x6008
movsd 0x8(%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
jmp 0x2961
movq %r14, %rdi
leaq 0x36a5(%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 0x7be9(%rip), %esi      # 0xa5f0
movsd 0x90(%rsp), %xmm0
movq 0x68(%rsp), %rdi
callq 0x4d3e
movsd %xmm0, 0x38(%rsp)
leaq 0x77c9(%rip), %r13      # 0xa1f0
movq %r13, %rdi
movl $0x400, %esi            # imm = 0x400
movq %r14, %rdx
callq 0x2290
xorpd %xmm0, %xmm0
movapd %xmm0, 0x40(%rsp)
movq $0x0, 0x50(%rsp)
movzbl (%r13), %eax
cmpl $0x23, %eax
je 0x2a85
testl %eax, %eax
je 0x2ad2
movsbl %al, %eax
leal -0x30(%rax), %ecx
cmpl $0x9, %ecx
ja 0x2aca
movq 0x48(%rsp), %rdi
andl $0xf, %eax
movl %eax, 0x10(%rsp)
movq -0x10(%rdi), %rsi
cmpq -0x8(%rdi), %rsi
je 0x2abe
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x10(%rdi)
jmp 0x2aca
xorpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
leaq 0x40(%rsp), %rdi
movq %r15, %rsi
callq 0x3614
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x2aca
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
jmp 0x2aca
addq $-0x18, %rdi
movq %r15, %rdx
callq 0x382c
incq %r13
jmp 0x2a4a
movsd 0x8(%rsp), %xmm0
mulsd 0x3538(%rip), %xmm0     # 0x6018
cvttsd2si %xmm0, %esi
movsd 0x30(%rsp), %xmm1
movq 0x60(%rsp), %rdi
movsd 0x38(%rsp), %xmm0
callq 0x5194
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
movsd 0x30(%rsp), %xmm2
cmpq %rdx, %rsi
je 0x2c20
movq %rdx, %rax
subq %rsi, %rax
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rax
movq %rax, %xmm0
punpckldq 0x34f8(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x3500(%rip), %xmm0     # 0x6040
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
divsd %xmm1, %xmm2
movsd %xmm2, 0x78(%rsp)
movq %r14, 0x80(%rsp)
movq %rdx, 0x70(%rsp)
movq %r15, %rdi
movq %rsi, 0x38(%rsp)
callq 0x3274
movq 0x10(%rsp), %rbx
movq 0x18(%rsp), %r15
cmpq %r15, %rbx
je 0x2bd1
movsd 0x8(%rsp), %xmm0
mulsd 0x348b(%rip), %xmm0     # 0x6018
cvttsd2si %xmm0, %ebp
movslq (%rbx), %r14
movq 0x58(%rsp), %rax
movq 0x4c8(%rax), %r13
leaq 0x88(%rsp), %rdi
movl %ebp, %esi
callq 0x500a
imulq $0x68, %r14, %rax
leaq (%rax,%r13), %rdi
addq $-0x68, %rdi
movq 0x88(%rsp), %rsi
callq 0x59ea
addq $0x4, %rbx
cmpq %r15, %rbx
jne 0x2b91
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x2be8
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
movsd 0x8(%rsp), %xmm0
addsd 0x78(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x38(%rsp), %rsi
addq $0x18, %rsi
movq 0x70(%rsp), %rdx
cmpq %rdx, %rsi
movq 0x80(%rsp), %r14
leaq 0x10(%rsp), %r15
jne 0x2b63
jmp 0x2c30
movsd 0x8(%rsp), %xmm0
addsd %xmm2, %xmm0
movsd %xmm0, 0x8(%rsp)
leaq 0x40(%rsp), %rdi
callq 0x32f4
jmp 0x2975
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2c55
jmp 0x2c55
movq %rax, %rbx
jmp 0x2c76
jmp 0x2c5c
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x2c76
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
leaq 0x40(%rsp), %rdi
callq 0x32f4
movq %rbx, %rdi
callq 0x2300