// File: /workspace/github_cpp_makefile_star2_O3/Alcaro[P]bridges/arlib/stringconv-float.cpp
// Function: fromstring_float(cstring, double&, floatinf const*)
static bool fromstring_float(cstring s, double& out, const floatinf * fi)
{
	out = 0;
	
	const char * start = (const char*)s.bytes().ptr();
	const char * end = start + s.length();
	const char * digits_end = end;
	if (end-start > 10000) return false; // 0.(9999 zeroes)1e+10000 is technically equal to 1, but it's also stupid.
	// TODO: should allow it anyways
	
	bool neg = false;
	if (start < end && *start == '-')
	{
		neg = true;
		start++;
	}
	
	if (UNLIKELY(!isdigit(*start) || start==end))
	{
		if (s == "inf") { out = HUGE_VAL; return true; }
		if (s == "-inf") { out = -HUGE_VAL; return true; }
		if (s == "nan") { out = NAN; return true; }
		return false;
	}
	
	const char * iter = start;
	
	int exponent = INT_MAX;
	uint64_t significand = 0;
	uint64_t significand_sum = 0;
	int n_digits = 0;
	
	while (true)
	{
		if ((uint8_t)(*iter-'0') <= 9)
		{
			significand *= 10;
			significand += *iter-'0';
			significand_sum |= significand; // make it sticky, so input 2^64 doesn't overflow significand back to zero
			exponent--;
			n_digits++;
		}
		else if (*iter == '.')
		{
			if (exponent <= 0) return false;
			if (iter == end || !isdigit(iter[1])) return false;
			exponent = 0;
		}
		else if ((0x20|*iter) == 'e')
		{
			digits_end = iter;
			if (exponent > 0) exponent = 0;
			iter++;
			
			bool exp_neg = false;
			if (*iter == '-') { exp_neg = true; iter++; }
			else if (*iter == '+') iter++;
			
			uint32_t newexp = 0;
			uint32_t newexp_sum = 0;
			if (iter == end) return false;
			while (iter < end)
			{
				if (UNLIKELY((uint8_t)(*iter-'0') > 9)) return false;
				newexp = newexp*10 + *iter-'0';
				newexp_sum |= newexp; // another sticky
				iter++;
			}
			if (newexp_sum >= 16384)
			{
				// if the exponent is crazy, ignore the digits; it's either zero or infinite
				if (!exp_neg && significand_sum != 0) out = HUGE_VAL;
				if (neg) out = -out;
				if (out == 0) return true;
				return false;
			}
			if (exp_neg) exponent -= newexp;
			else exponent += newexp;
			break;
		}
		else return false;
		iter++;
		if (iter == end)
		{
			if (exponent > 0) exponent = 0;
			break;
		}
	}
	
	// for small numbers, the correct answer can be calculated with a multiplication or division of two float-representable integers
	// there are some numbers where the mul or div rounds to exactly halfway between two floats, but to my knowledge,
	//  they all have significand or exponent out of range for floats and need the slow path
	// same may happen on i386 if fpcw is set to float80 rather than float64; I did not investigate this either
	if (LIKELY(abs(exponent) <= fi->max_int_exp && significand <= fi->max_sig && n_digits < ilog10(UINT64_MAX)))
	{
		bool neg_exp = (exponent < 0);
		exponent = abs(exponent);
		
		double exp_adjust = 1;
		if (exponent & 1) exp_adjust *= 10.0;
		if (exponent & 2) exp_adjust *= 100.0;
		if (exponent & 4) exp_adjust *= 10000.0;
		if (exponent & 8) exp_adjust *= 100000000.0;
		if (exponent & 16) exp_adjust *= 10000000000000000.0;
		
		double ret;
		if (!neg_exp)
			ret = (double)significand * exp_adjust;
		else
			ret = (double)significand / exp_adjust;
		if (neg) out = -ret;
		else out = ret;
		return true;
	}
	
	// for large numbers, use a slower algorithm
	// some float parser implementations have three different algorithms with different speed and limitations, but two's enough for me
	
	if (significand_sum == 0) // 0e+999 will go here, as will 0.000000000000000000000000 (it exceeds n_digits)
	{
		if (neg) out = -out;
		return true;
	}
	// inputs:
	// - start .. digits_end - digits of the input. The dot, if any, should be ignored.
	//    Contains at least one nonzero digit. Contains nothing but digits and the dot.
	// - exponent - Number of steps to shift the given digits.
	// - n_digits - Number of digits, though some may be leading or trailing zeroes. Not useful anymore.
	// - neg - Whether the input is negative.
	// - fi - Information about the float format.
	// Other variables should be ignored or discarded.
	
	// the digits need to be multiplied or divided such that the exponent is zero, then take the leftmost bits
	// for subnormals, the number of digits to round to is variable
	
	iter = start;
	while (*iter <= '0') iter++; // the only possible non-digit, ., is 0x2E <= '0' (0x30), and there's known to be a nonzero digit
	
	uint32_t limbs[100] = {}; // the traditional implementation is u8[800], but that's just wasteful. better pack eight digits in a u32
	// 9 would fit, but 8 makes the math easier
	// I could count how many limbs I'm using, but that'd be a lot more complexity for no reasonable benefit
	
	int limb_at = 0;
	uint32_t tmp = 0;
	while (limb_at < 800 && iter < digits_end)
	{
		if (*iter == '.') { iter++; continue; }
		tmp = tmp*10 + *iter-'0';
		if (limb_at%8 == 7)
		{
			limbs[limb_at/8] = tmp;
			tmp = 0;
		}
		limb_at++;
		iter++;
	}
	exponent += limb_at;
	if (tmp)
	{
		if ((8-limb_at)&4) tmp *= 10000;
		if ((8-limb_at)&2) tmp *= 100;
		if ((8-limb_at)&1) tmp *= 10;
		limbs[limb_at/8] = tmp;
	}
	
	while (iter < digits_end)
	{
		if (*iter > '0') limbs[99] |= 1; // some algorithms maintain an 'is truncated' bit, but it's easier to round up
		iter++;
		if (*iter != '.') exponent++;
	}
	
	// at the end of this process, I need
	// - limbs[0] concat limbs[1] concat limbs[2]/1000000 to be the output bits of the double
	// - limbs[0] >= 20000000
	// - every limb <= 99999999
	// - bin_exponent to tell how many bits it was shifted
	// min     4503599627370496
	// max 18446744073709551616
	// if output is 10.0, the limbs must be 10 << n such that 10<<n >= 200000000000000000, <= 999999999999999999
	// there two allowed limb values are
	// n=56 72057594 03792793 60+000000
	// n=55 36028797 01896396 80+000000
	// same limbs for 5, 20, 40, 80, 160, etc, just different bin_exponent
	
	int bin_exponent = 0;
	
	exponent -= 18; // need 18 decimal digits of mantissa
	if (exponent & 7)
	{
		// first limb is known >= 10000000, so multiplying by any power of ten will make it overflow and require shifting the limbs
		
		uint64_t mul = 1;
		if (exponent&4) mul *= 10000;
		if (exponent&2) mul *= 100;
		if (exponent&1) mul *= 10;
		exponent &= ~7;
		exponent += 8;
		
		uint64_t carry = 0;
		for (int i=0;i<100;i++)
		{
			uint64_t cur = carry + limbs[i]*mul;
			limbs[i] = cur/100000000;
			carry = cur%100000000*100000000;
		}
		if (carry) limbs[99] |= 1; // sticky overflow
	}
	
	// the top limb must be nonzero at all times
	while (true)
	{
		if (exponent > 0)
		{
			// divide by the smallest power of 2 that zeroes the top limb, and multiply by 1e8 (shift the limbs one step)
			int shift_bits = ilog2(limbs[0])+1;
			bin_exponent += shift_bits;
			exponent -= 8;
			
			uint32_t carry_mask = (1<<shift_bits)-1;
			
			// 64bit multiplication and division everywhere... sucks for 32bit cpus
			// I could change it to uint16[200], but not much point. 32bit is on its way out
			uint64_t carry = limbs[0]; // carry is NOT divided by shift_bits
			for (int i=1;i<100;i++)
			{
				uint64_t cur = (uint64_t)limbs[i] + carry*100000000;
				limbs[i-1] = cur >> shift_bits;
				carry = cur & carry_mask;
			}
			limbs[99] = carry; // this is too much, but it won't affect the result
		}
		else if (exponent < 0 && limbs[0] >= 2)
		{
			// multiply by 1<<26, and divide by 1e8
			int shift_bits = 26;
			bin_exponent -= shift_bits;
			exponent += 8;
			
			uint64_t cur = ((uint64_t)limbs[99] << shift_bits);
			
			uint64_t carry = cur/100000000 | (cur%100000000 ? 1 : 0);
			for (int i=98;i>=0;i--)
			{
				uint64_t cur = ((uint64_t)limbs[i] << shift_bits) + carry;
				limbs[i+1] = cur%100000000;
				carry = cur/100000000;
			}
			limbs[0] = carry;
		}
		else if (limbs[0] < 20000000)
		{
			// multiply by a low power of 2 so the top limb goes a bit higher
			int shift_bits = 25-ilog2(limbs[0]);
			bin_exponent -= shift_bits;
			
			uint64_t carry = 0;
			for (int i=99;i>=0;i--)
			{
				uint64_t cur = ((uint64_t)limbs[i] << shift_bits) + carry;
				limbs[i] = cur%100000000;
				carry = cur/100000000;
			}
		}
		else break;
	}
	
	bool ret = true;
	
	uint64_t mantissa = (uint64_t)limbs[0]*10000000000 + (uint64_t)limbs[1]*100 + limbs[2]/1000000;
	if (mantissa == 0)
		goto done;
	
	{
		int error = 60-ilog2(mantissa);
		mantissa <<= error;
		bin_exponent -= error;
	}
	
	if (bin_exponent+1023+60-1 <= -60) // too small, round to zero
		goto done;
	
	{
		uint64_t prev_mantissa = mantissa;
		int shift = 0;
		if (bin_exponent+1023+60-1 < 0)
		{
			shift = -(bin_exponent+1023+60-1);
		}
		if (fi->bits_mantissa != 52)
		{
			if (bin_exponent+209 <= 23)
				shift = 52-(bin_exponent+209);
			else
				shift = 52-23;
		}
		
		mantissa >>= shift;
		bin_exponent += shift;
		
		if (mantissa << shift != prev_mantissa)
			mantissa |= 1;
	}
	
	// if it's at least halfway to next number,
	if (mantissa & 0x80)
	{
		// and if bottom bit of output mantissa is set, any bit below half-mantissa is set,
		// or if any bit in the limbs outside the mantissa is set,
		// then round up (bits below that will be discarded)
		if ((mantissa & 0x017F) || limbs[2]%1000000)
		{
			mantissa += 0x80;
		}
		else
		{
			for (int i=3;i<100;i++)
			{
				if (limbs[i])
				{
					mantissa += 0x80;
					break;
				}
			}
		}
	}
	
	{
		int error = 61-ilog2(mantissa); // it's probably same power of two as last time, but not guaranteed; must renormalize
		mantissa <<= error;
		bin_exponent -= error;
	}
	
	if (bin_exponent+1023+61 <= 0) // subnormal (or rounded to zero)
	{
		mantissa >>= -(bin_exponent+1023+61);
		out = reinterpret<double>(mantissa>>10);
	}
	else if (bin_exponent >= fi->max_bin_exp) // infinite
	{
		out = HUGE_VAL;
		ret = false;
	}
	else // normal (or subnormal float - the double/float cast will handle that)
	{
		out = reinterpret<double>(((uint64_t)(bin_exponent+1023+61)<<52) | (mantissa<<3>>12));
	}
	
done:
	if (neg) out = -out;
	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
movq %rdx, %rbx
movq %rdi, 0x10(%rsp)
movq %rsi, 0x18(%rsp)
andq $0x0, (%rdx)
movq %rcx, %r14
movq %rsi, %rax
shrq $0x38, %rax
testq %rsi, %rsi
js 0x4020
movl %eax, %ecx
xorb $0xf, %cl
movzbl %cl, %esi
leaq (%rsp,%rsi), %rdx
addq $0x10, %rdx
leaq 0x10(%rsp), %rbp
jmp 0x4034
cmpl $0x2710, %esi           # imm = 0x2710
ja 0x4661
movl %esi, %edx
addq %rdi, %rdx
movq %rdi, %rbp
xorl %r15d, %r15d
testl %esi, %esi
je 0x4046
cmpb $0x2d, (%rbp)
sete %r15b
addq %r15, %rbp
movzbl (%rbp), %ecx
leaq 0x2bcff(%rip), %r9      # 0x2fd50
testb $0x40, (%r9,%rcx)
je 0x42fe
cmpq %rdx, %rbp
je 0x42fe
leaq 0x1(%rbp), %r8
movl $0x7fffffff, %r10d      # imm = 0x7FFFFFFF
xorl %edi, %edi
xorl %esi, %esi
xorl %ecx, %ecx
movsbl -0x1(%r8), %eax
movslq %eax, %r11
addq $-0x30, %r11
movl %r11d, %r12d
andl $0xfe, %r12d
cmpl $0x9, %r12d
ja 0x40a2
imulq $0xa, %rcx, %rcx
addq %r11, %rcx
orq %rcx, %rsi
decl %r10d
incl %edi
jmp 0x40c7
cmpb $0x2e, %al
jne 0x4193
xorl %eax, %eax
testl %r10d, %r10d
jle 0x4663
movzbl (%r8), %r10d
testb $0x40, (%r9,%r10)
je 0x4663
xorl %r10d, %r10d
leaq 0x1(%r8), %rax
cmpq %rdx, %r8
movq %rax, %r8
jne 0x4075
movl %r10d, %r12d
sarl $0x1f, %r12d
andl %r10d, %r12d
movq %rdx, %r13
movl %r12d, %eax
negl %eax
cmovsl %r12d, %eax
movzbl 0x8(%r14), %edx
cmpl %edx, %eax
ja 0x4275
cmpq (%r14), %rcx
ja 0x4275
cmpl $0x12, %edi
jg 0x4275
xorl %edx, %edx
testb $0x1, %al
sete %dl
leaq 0x2bd7a(%rip), %rsi     # 0x2fe90
movsd (%rsi,%rdx,8), %xmm0
testb $0x2, %al
je 0x4127
mulsd 0x2bd31(%rip), %xmm0    # 0x2fe58
testb $0x4, %al
je 0x4133
mulsd 0x2bd2d(%rip), %xmm0    # 0x2fe60
testb $0x8, %al
je 0x413f
mulsd 0x2bd29(%rip), %xmm0    # 0x2fe68
testb $0x10, %al
je 0x414b
mulsd 0x2bd25(%rip), %xmm0    # 0x2fe70
movq %rcx, %xmm2
punpckldq 0x2bd48(%rip), %xmm2 # xmm2 = xmm2[0],mem[0],xmm2[1],mem[1]
subpd 0x2bd50(%rip), %xmm2    # 0x2feb0
movapd %xmm2, %xmm1
unpckhpd %xmm2, %xmm1            # xmm1 = xmm1[1],xmm2[1]
addsd %xmm2, %xmm1
testl %r12d, %r12d
js 0x4177
mulsd %xmm0, %xmm1
jmp 0x417b
divsd %xmm0, %xmm1
testb %r15b, %r15b
je 0x4188
xorpd 0x2bcf8(%rip), %xmm1    # 0x2fe80
movsd %xmm1, (%rbx)
movb $0x1, %al
jmp 0x4663
andl $-0x21, %eax
cmpl $0x45, %eax
jne 0x4661
leaq -0x1(%r8), %r13
movl %r10d, %r9d
sarl $0x1f, %r9d
andl %r10d, %r9d
movb (%r8), %r10b
leaq 0x1(%r8), %rax
cmpb $0x2b, %r10b
cmoveq %rax, %r8
cmpb $0x2d, %r10b
cmoveq %rax, %r8
xorl %eax, %eax
cmpq %rdx, %r8
je 0x4663
jae 0x425f
movq %r13, 0x8(%rsp)
xorl %eax, %eax
xorl %r11d, %r11d
movzbl (%r8), %r12d
leal -0x3a(%r12), %r13d
cmpb $-0xa, %r13b
jb 0x4661
imull $0xa, %eax, %eax
addl %r12d, %eax
addl $-0x30, %eax
orl %eax, %r11d
incq %r8
cmpq %rdx, %r8
jne 0x41df
cmpl $0x4000, %r11d          # imm = 0x4000
movq 0x8(%rsp), %r13
jb 0x425f
xorpd %xmm0, %xmm0
cmpb $0x2d, %r10b
je 0x4238
testq %rsi, %rsi
je 0x4238
movabsq $0x7ff0000000000000, %rax # imm = 0x7FF0000000000000
movq %rax, (%rbx)
movsd 0x2bc18(%rip), %xmm0    # 0x2fe50
testb %r15b, %r15b
je 0x4249
xorpd 0x2bc3b(%rip), %xmm0    # 0x2fe80
movlpd %xmm0, (%rbx)
xorpd %xmm1, %xmm1
cmpeqsd %xmm0, %xmm1
movq %xmm1, %rax
andl $0x1, %eax
jmp 0x4663
movl %eax, %r12d
negl %r12d
cmpb $0x2d, %r10b
cmovnel %eax, %r12d
addl %r9d, %r12d
jmp 0x40e0
testq %rsi, %rsi
je 0x4341
decq %rbp
cmpb $0x31, 0x1(%rbp)
leaq 0x1(%rbp), %rbp
jl 0x4281
leaq 0x20(%rsp), %rdi
movl $0x190, %edx            # imm = 0x190
xorl %esi, %esi
callq 0x3170
cmpq %r13, %rbp
jae 0x435e
xorl %edx, %edx
xorl %r8d, %r8d
movq %rbp, %rcx
movsbl (%rcx), %eax
cmpl $0x2e, %eax
jne 0x42c2
incq %rcx
cmpq %r13, %rcx
jb 0x42ad
jmp 0x4363
imull $0xa, %r8d, %esi
leal (%rsi,%rax), %r8d
addl $-0x30, %r8d
movl %edx, %eax
notl %eax
testb $0x7, %al
jne 0x42e3
movl %edx, %eax
shrl $0x3, %eax
movl %r8d, 0x20(%rsp,%rax,4)
xorl %r8d, %r8d
leal 0x1(%rdx), %eax
cmpl $0x31e, %edx            # imm = 0x31E
ja 0x42f9
leaq 0x1(%rcx), %rbp
movl %eax, %edx
cmpq %r13, %rbp
jb 0x42aa
incq %rcx
jmp 0x4365
movl %edi, %ecx
shrl $0x10, %ecx
cmpb $0xb, %al
je 0x4634
movzbl %al, %edx
cmpl $0xc, %edx
jne 0x4661
movl %edi, %edx
xorl $0x6e69, %edx           # imm = 0x6E69
movl %ecx, %esi
xorb $0x66, %sil
movzbl %sil, %esi
orw %dx, %si
jne 0x464b
movabsq $0x7ff0000000000000, %rax # imm = 0x7FF0000000000000
jmp 0x46e8
movb $0x1, %al
testb %r15b, %r15b
je 0x4663
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
movq %rcx, (%rbx)
jmp 0x4663
movq %rbp, %rcx
jmp 0x43a1
movl %edx, %eax
addl %eax, %r12d
testl %r8d, %r8d
je 0x43a1
pushq $0x8
popq %rsi
movl %esi, %edx
subl %eax, %edx
imull $0x2710, %r8d, %edi     # imm = 0x2710
testb $0x4, %dl
cmovel %r8d, %edi
imull $0x64, %edi, %r8d
testb $0x2, %dl
cmovel %edi, %r8d
imull $0xa, %r8d, %edi
testb $0x1, %dl
cmovel %r8d, %edi
cltd
idivl %esi
cltq
movl %edi, 0x20(%rsp,%rax,4)
cmpq %r13, %rcx
jae 0x43df
movl 0x1ac(%rsp), %eax
subq %rcx, %r13
movb (%rcx), %sil
xorl %edx, %edx
cmpb $0x31, %sil
jl 0x43c5
orl $0x1, %eax
movl %eax, 0x1ac(%rsp)
movb 0x1(%rcx,%rdx), %sil
xorl %edi, %edi
cmpb $0x2e, %sil
setne %dil
addl %edi, %r12d
incq %rdx
cmpq %rdx, %r13
jne 0x43b5
leal -0x12(%r12), %esi
pushq $0x1
popq %r8
testb $0x7, %sil
je 0x4455
testb $0x4, %sil
movl $0x2710, %eax           # imm = 0x2710
cmoveq %r8, %rax
imulq $0x64, %rax, %rdx
testb $0x2, %sil
cmoveq %rax, %rdx
imulq $0xa, %rdx, %rcx
testb $0x1, %r12b
cmoveq %rdx, %rcx
andl $-0x8, %esi
xorl %edi, %edi
movl $0x5f5e100, %r9d        # imm = 0x5F5E100
xorl %r10d, %r10d
movl 0x20(%rsp,%rdi,4), %eax
imulq %rcx, %rax
addq %r10, %rax
xorl %edx, %edx
divq %r9
movl %eax, 0x20(%rsp,%rdi,4)
imulq $0x5f5e100, %rdx, %r10  # imm = 0x5F5E100
incq %rdi
cmpq $0x64, %rdi
jne 0x4421
addl $0x8, %esi
testq %rdx, %rdx
je 0x4455
orb $0x1, 0x1ac(%rsp)
xorl %edi, %edi
pushq $-0x1
popq %r9
movl $0x5f5e100, %r10d       # imm = 0x5F5E100
pushq $0x63
popq %r11
testl %esi, %esi
jg 0x44be
setne %cl
movl 0x20(%rsp), %eax
cmpl $0x2, %eax
setae %dl
andb %cl, %dl
cmpb $0x1, %dl
je 0x4514
movl %eax, %ecx
cmpl $0x1312cff, %ecx        # imm = 0x1312CFF
ja 0x4566
bsrl %ecx, %ecx
notl %ecx
addl $0x1a, %ecx
movq %r11, %r12
xorl %eax, %eax
movl 0x20(%rsp,%r12,4), %edx
shlq %cl, %rdx
addq %rax, %rdx
movq %rdx, %rax
xorl %edx, %edx
divq %r10
movl %edx, 0x20(%rsp,%r12,4)
addq $-0x1, %r12
jb 0x449c
subl %ecx, %edi
jmp 0x4465
movl 0x20(%rsp), %eax
bsrl %eax, %ecx
xorl $0x1f, %ecx
movb $0x20, %bpl
subb %cl, %bpl
negb %cl
movl %r9d, %edx
shll %cl, %edx
movzbl %bpl, %ecx
addl %ecx, %edi
notl %edx
movq %r8, %r12
movl 0x20(%rsp,%r12,4), %r13d
imulq $0x5f5e100, %rax, %rax  # imm = 0x5F5E100
addq %r13, %rax
movq %rax, %r13
shrq %cl, %r13
movl %r13d, 0x1c(%rsp,%r12,4)
andl %edx, %eax
incq %r12
cmpq $0x64, %r12
jne 0x44e0
addl $-0x8, %esi
movl %eax, 0x1ac(%rsp)
jmp 0x4465
movl 0x1ac(%rsp), %eax
shlq $0x1a, %rax
xorl %edx, %edx
divq %r10
movq %rax, %rcx
addl $-0x1a, %edi
xorl %eax, %eax
testq %rdx, %rdx
setne %al
orq %rcx, %rax
movl $0x18c, %r12d           # imm = 0x18C
movl 0x1c(%rsp,%r12), %ecx
shlq $0x1a, %rcx
addq %rax, %rcx
movq %rcx, %rax
xorl %edx, %edx
divq %r10
movl %edx, 0x20(%rsp,%r12)
addq $-0x4, %r12
jne 0x453b
addl $0x8, %esi
movl %eax, 0x20(%rsp)
jmp 0x4465
movl 0x24(%rsp), %r8d
movl 0x28(%rsp), %eax
movl $0xf4240, %esi          # imm = 0xF4240
xorl %edx, %edx
divl %esi
movl %eax, %esi
movabsq $0x2540be400, %rax      # imm = 0x2540BE400
imulq %rax, %rcx
imulq $0x64, %r8, %r8
addq %rcx, %r8
movb $0x1, %al
pxor %xmm0, %xmm0
addq %r8, %rsi
je 0x4707
bsrq %rsi, %rcx
notl %ecx
addl $0x3d, %ecx
subl %ecx, %edi
cmpl $0xfffffb8b, %edi       # imm = 0xFFFFFB8B
jl 0x4707
leal 0x43a(%rdi), %r8d
negl %r8d
xorl %r9d, %r9d
cmpl $0xfffffbc6, %edi       # imm = 0xFFFFFBC6
cmovll %r8d, %r9d
shlq %cl, %rsi
movl $0xffffff63, %r8d       # imm = 0xFFFFFF63
subl %edi, %r8d
cmpl $0xffffff47, %edi       # imm = 0xFFFFFF47
pushq $0x1d
popq %rcx
cmovll %r8d, %ecx
cmpb $0x34, 0x9(%r14)
cmovel %r9d, %ecx
movq %rsi, %r9
shrq %cl, %r9
movl %ecx, %r8d
addl %edi, %r8d
movq %r9, %r10
shlq %cl, %r10
xorl %edi, %edi
cmpq %rsi, %r10
setne %dil
orq %r9, %rdi
testb %r9b, %r9b
jns 0x4679
testl %edx, %edx
jne 0x4675
movl %edi, %ecx
andl $0x17f, %ecx            # imm = 0x17F
jne 0x4675
pushq $0x3
popq %rcx
cmpl $0x0, 0x20(%rsp,%rcx,4)
jne 0x4675
incq %rcx
cmpq $0x64, %rcx
jne 0x4622
jmp 0x4679
cmpl $0x666e692d, %edi       # imm = 0x666E692D
jne 0x464b
movabsq $-0x10000000000000, %rax # imm = 0xFFF0000000000000
jmp 0x46e8
cmpl $0xc, %eax
jne 0x4661
xorl $0x616e, %edi           # imm = 0x616E
xorb $0x6e, %cl
movzbl %cl, %eax
orw %di, %ax
je 0x46de
xorl %eax, %eax
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
subq $-0x80, %rdi
bsrq %rdi, %rcx
movl %ecx, %edx
notb %cl
addb $0x3e, %cl
shlq %cl, %rdi
xorl $0x3f, %edx
subl %edx, %r8d
leal 0x2(%r8), %ecx
cmpl $0xfffffbc4, %ecx       # imm = 0xFFFFFBC4
jg 0x46af
movb $-0x3e, %cl
subb %r8b, %cl
shrq %cl, %rdi
shrq $0xa, %rdi
movq %rdi, (%rbx)
movq %rdi, %xmm0
jmp 0x4707
cmpl 0xc(%r14), %ecx
jge 0x46f0
addl $0x43e, %r8d            # imm = 0x43E
shlq $0x34, %r8
shrq $0x9, %rdi
movabsq $0xfffffffffffff, %rcx  # imm = 0xFFFFFFFFFFFFF
andq %rdi, %rcx
orq %r8, %rcx
movq %rcx, (%rbx)
movq %rcx, %xmm0
jmp 0x4707
movabsq $0x7ff8000000000000, %rax # imm = 0x7FF8000000000000
movq %rax, (%rbx)
jmp 0x418c
movabsq $0x7ff0000000000000, %rax # imm = 0x7FF0000000000000
movq %rax, (%rbx)
movq 0x2b74b(%rip), %xmm0    # 0x2fe50
xorl %eax, %eax
testb %r15b, %r15b
je 0x4663
pxor 0x2b768(%rip), %xmm0    # 0x2fe80
movq %xmm0, (%rbx)
jmp 0x4663