// File: /workspace/github_cpp_makefile_star2_O3/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 $0x88, %rsp
movq (%rdi), %rax
cmpb $0x52, (%rax)
jne 0x37ea
movq %rdi, %rbx
callq 0x32d4
leaq -0x88(%rbp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3374
movq 0x8(%r14), %rax
testq %rax, %rax
je 0x37cd
movq %rax, %xmm1
punpckldq 0x2087(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x208f(%rip), %xmm1     # 0x5810
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
callq 0x20f0
divsd 0x20a6(%rip), %xmm0     # 0x5840
xorps %xmm1, %xmm1
cvtsd2ss %xmm0, %xmm1
cvttps2dq %xmm1, %xmm0
cvtdq2ps %xmm0, %xmm0
ucomiss %xmm0, %xmm1
jne 0x37cd
jp 0x37cd
movaps %xmm1, -0x40(%rbp)
movq %rbx, %rdi
callq 0x34e5
movq %rax, %rbx
movabsq $-0x7fffffff80000000, %rax # imm = 0x8000000080000000
testq %rax, %rbx
je 0x3800
xorl %ebx, %ebx
leaq -0x78(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x37ec
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x2150
jmp 0x37ec
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4939(%rip), %rsi      # 0x8140
leaq -0xb0(%rbp), %rdi
callq 0x43ce
movq %rbx, %r8
shrq $0x20, %r8
movl %ebx, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpq %r8, %rcx
ja 0x39a4
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movaps -0x40(%rbp), %xmm1
mulss 0x2007(%rip), %xmm1     # 0x5848
movaps 0x1fd8(%rip), %xmm0     # 0x5820
movaps %xmm1, %xmm2
xorps %xmm1, %xmm0
cvttss2si %xmm0, %edx
cvttps2dq %xmm0, %xmm0
cvtdq2ps %xmm0, %xmm0
movq 0x48e0(%rip), %rdi      # 0x8140
movq -0x88(%rbp), %r9
movq -0xb0(%rbp), %r10
andl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
addl %edx, %ebx
movq %rdx, -0x58(%rbp)
incl %edx
movl %edx, -0x2c(%rbp)
leaq 0x3f(%rax), %r14
movq %r8, -0x60(%rbp)
movq %r9, -0x50(%rbp)
movq %r10, -0x48(%rbp)
movabsq $-0x8000000000000000, %r13 # imm = 0x8000000000000000
movq $-0x1, %r15
ucomiss %xmm0, %xmm2
jb 0x3964
movq 0x48a0(%rip), %r12      # 0x8150
movl 0x48a2(%rip), %eax      # 0x8158
subq 0x4883(%rip), %r12      # 0x8140
movq %rax, -0x40(%rbp)
leaq (%rax,%r12,8), %r10
shll $0x3, %r12d
movl -0x2c(%rbp), %esi
movq %rbx, -0x68(%rbp)
movl %ebx, %r9d
movq -0x58(%rbp), %rax
xorl %r15d, %r15d
testl %r9d, %r9d
js 0x38f9
movl %r9d, %r8d
cmpq %r8, %r10
movl %r10d, %r11d
movl $0x0, %edx
cmoval %edx, %r11d
movl %r9d, %r8d
subl %r11d, %r8d
jmp 0x3904
leal (%rax,%rcx), %r8d
addl -0x40(%rbp), %r8d
addl %r12d, %r8d
movslq %r8d, %rbx
leal 0x3f(%rbx), %r11d
testl %ebx, %ebx
cmovnsl %ebx, %r11d
sarl $0x6, %r11d
movslq %r11d, %r11
leaq (%rdi,%r11,8), %r11
movq %rbx, %r8
andq %r14, %r8
xorl %edx, %edx
cmpq %r13, %r8
setbe %dl
movq -0x8(%r11,%rdx,8), %rdx
xorl %r8d, %r8d
btq %rbx, %rdx
setb %r8b
leaq (%r8,%r15,2), %r15
incl %eax
xorps %xmm1, %xmm1
cvtsi2ss %esi, %xmm1
incl %r9d
incl %esi
ucomiss %xmm1, %xmm2
jae 0x38da
notq %r15
movq -0x68(%rbp), %rbx
movq -0x60(%rbp), %r8
movq -0x50(%rbp), %r9
movq -0x48(%rbp), %r10
movq -0x80(%rbp), %rdx
addq %r9, %rdx
movl $0x1, %eax
shlq %cl, %rax
movq %rcx, %rsi
shrq $0x6, %rsi
cmpb $0x30, (%r15,%rdx)
jne 0x398a
notq %rax
andq (%r10,%rsi,8), %rax
jmp 0x398e
orq (%r10,%rsi,8), %rax
movq %rax, (%r10,%rsi,8)
leaq 0x1(%rcx), %rax
incl %ebx
cmpq %r8, %rcx
movq %rax, %rcx
jne 0x3899
leaq 0x4795(%rip), %rdi      # 0x8140
leaq -0xb0(%rbp), %rsi
callq 0x446c
movq -0xb0(%rbp), %rdi
testq %rdi, %rdi
je 0x39d2
movq -0x90(%rbp), %rsi
subq %rdi, %rsi
callq 0x2150
movb $0x1, %bl
jmp 0x37cf
movq %rax, %rbx
movq -0xb0(%rbp), %rsi
testq %rsi, %rsi
je 0x39fb
leaq -0xb0(%rbp), %rdi
callq 0x2254
jmp 0x39fb
jmp 0x39f8
movq %rax, %rbx
leaq -0x78(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3a14
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x2150
movq %rbx, %rdi
callq 0x21f0