// File: /workspace/github_cpp_makefile_star2_O2/JD557[P]Wolf/grammar.cpp
// Function: r(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
bool r(string& in) {
	if (in[0]=='R') {consume(in);}
	else {return false;}

	string rule=binaryString(in);
	if (rule.size()==0) {return false;}

	float range=log(rule.length())/log(2);
	if (range!=(int) range) {return false;}

	Interval interv=inter(in);
	if (interv.start<0 || interv.end<0) {return false;}

	vector <bool> newTape=systape;
	for (size_t i=interv.start;i<=interv.end;++i) {
		unsigned long long val=0;
		for (int j=-(range/2);j<=range/2;++j) {
			int pos=(int) i+j;
			if (pos<0) {pos=systape.size()+pos;}
			else if (pos>=systape.size()) {pos=(pos-systape.size());}
			val=val<<1;			
			val+=systape[pos];
		}
		newTape[i]=rule[rule.size()-1-val]-'0';
	}
	systape=newTape;
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq (%rdi), %rax
cmpb $0x52, (%rax)
jne 0x3119
movq %rdi, %rbx
callq 0x2d34
leaq -0x70(%rbp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2dac
movq 0x8(%r14), %rdi
testq %rdi, %rdi
je 0x310c
callq 0x3a81
divsd 0x271c(%rip), %xmm0     # 0x57f8
cvtsd2ss %xmm0, %xmm1
cvttps2dq %xmm1, %xmm0
cvtdq2ps %xmm0, %xmm0
ucomiss %xmm0, %xmm1
jne 0x310c
jp 0x310c
movaps %xmm1, -0x50(%rbp)
movq %rbx, %rdi
callq 0x2ebd
movq %rax, %rbx
movabsq $-0x7fffffff80000000, %rax # imm = 0x8000000080000000
testq %rax, %rbx
je 0x312c
xorl %ebx, %ebx
leaq -0x70(%rbp), %rdi
callq 0x2090
jmp 0x311b
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x502d(%rip), %rsi      # 0x8160
leaq -0x98(%rbp), %rdi
callq 0x3aac
movq %rbx, %r14
shrq $0x20, %rbx
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
movaps -0x50(%rbp), %xmm1
mulss 0x26a7(%rip), %xmm1     # 0x5800
movaps 0x26b0(%rip), %xmm0     # 0x5810
movaps %xmm1, -0x50(%rbp)
xorps %xmm1, %xmm0
cvttss2si %xmm0, %eax
movl %r14d, %r15d
movl %eax, -0x2c(%rbp)
addl %eax, %r15d
leaq 0x4fe5(%rip), %r12      # 0x8160
movq %rbx, -0x38(%rbp)
cmpq %rbx, %r14
ja 0x324e
movl %r15d, -0x30(%rbp)
xorl %r13d, %r13d
movl -0x2c(%rbp), %eax
movl %eax, %ebx
cvtsi2ss %ebx, %xmm0
movaps -0x50(%rbp), %xmm1
ucomiss %xmm0, %xmm1
jb 0x3209
testl %r15d, %r15d
js 0x31ce
leal (%rbx,%r14), %eax
movl %r15d, %edx
movq 0x4fbc(%rip), %rcx      # 0x8170
movl 0x4fbe(%rip), %esi      # 0x8178
subq 0x4f9f(%rip), %rcx      # 0x8160
leaq (%rsi,%rcx,8), %rcx
cmpq %rdx, %rcx
ja 0x31eb
subl %ecx, %eax
jmp 0x31eb
movl 0x4f9c(%rip), %eax      # 0x8170
shll $0x3, %eax
addl 0x4f9b(%rip), %eax      # 0x8178
movl 0x4f7d(%rip), %ecx      # 0x8160
shll $0x3, %ecx
subl %ecx, %eax
addl %r15d, %eax
movslq %eax, %rsi
movq %r12, %rdi
callq 0x39c6
xorl %ecx, %ecx
testq %rdx, (%rax)
setne %cl
leaq (%rcx,%r13,2), %r13
incl %ebx
incl %r15d
jmp 0x3194
notq %r13
movq -0x70(%rbp), %rax
addq -0x68(%rbp), %rax
movb (%r13,%rax), %bl
leaq -0x98(%rbp), %rdi
movq %r14, %rsi
callq 0x39c6
cmpb $0x30, %bl
movl -0x30(%rbp), %r15d
jne 0x3239
notq %rdx
andq (%rax), %rdx
jmp 0x323c
orq (%rax), %rdx
movq -0x38(%rbp), %rbx
movq %rdx, (%rax)
incq %r14
incl %r15d
jmp 0x317f
leaq 0x4f0b(%rip), %rdi      # 0x8160
leaq -0x98(%rbp), %rsi
callq 0x3b2a
leaq -0x98(%rbp), %rdi
callq 0x3930
movb $0x1, %bl
jmp 0x310e
jmp 0x327f
jmp 0x3278
movq %rax, %rbx
jmp 0x328e
jmp 0x327f
movq %rax, %rbx
leaq -0x98(%rbp), %rdi
callq 0x3930
leaq -0x70(%rbp), %rdi
callq 0x2090
movq %rbx, %rdi
callq 0x2240