// File: rossy[P]crossc/SPIRV-Cross/spirv_glsl.cpp
// Function: spirv_cross::CompilerGLSL::constant_op_expression[abi:cxx11](spirv_cross::SPIRConstantOp const&)
string CompilerGLSL::constant_op_expression(const SPIRConstantOp &cop)
{
	auto &type = get<SPIRType>(cop.basetype);
	bool binary = false;
	bool unary = false;
	string op;

	if (is_legacy() && is_unsigned_opcode(cop.opcode))
		SPIRV_CROSS_THROW("Unsigned integers are not supported on legacy targets.");

	// TODO: Find a clean way to reuse emit_instruction.
	switch (cop.opcode)
	{
	case OpSConvert:
	case OpUConvert:
	case OpFConvert:
		op = type_to_glsl_constructor(type);
		break;

#define GLSL_BOP(opname, x) \
	case Op##opname:        \
		binary = true;      \
		op = x;             \
		break

#define GLSL_UOP(opname, x) \
	case Op##opname:        \
		unary = true;       \
		op = x;             \
		break

		GLSL_UOP(SNegate, "-");
		GLSL_UOP(Not, "~");
		GLSL_BOP(IAdd, "+");
		GLSL_BOP(ISub, "-");
		GLSL_BOP(IMul, "*");
		GLSL_BOP(SDiv, "/");
		GLSL_BOP(UDiv, "/");
		GLSL_BOP(UMod, "%");
		GLSL_BOP(SMod, "%");
		GLSL_BOP(ShiftRightLogical, ">>");
		GLSL_BOP(ShiftRightArithmetic, ">>");
		GLSL_BOP(ShiftLeftLogical, "<<");
		GLSL_BOP(BitwiseOr, "|");
		GLSL_BOP(BitwiseXor, "^");
		GLSL_BOP(BitwiseAnd, "&");
		GLSL_BOP(LogicalOr, "||");
		GLSL_BOP(LogicalAnd, "&&");
		GLSL_UOP(LogicalNot, "!");
		GLSL_BOP(LogicalEqual, "==");
		GLSL_BOP(LogicalNotEqual, "!=");
		GLSL_BOP(IEqual, "==");
		GLSL_BOP(INotEqual, "!=");
		GLSL_BOP(ULessThan, "<");
		GLSL_BOP(SLessThan, "<");
		GLSL_BOP(ULessThanEqual, "<=");
		GLSL_BOP(SLessThanEqual, "<=");
		GLSL_BOP(UGreaterThan, ">");
		GLSL_BOP(SGreaterThan, ">");
		GLSL_BOP(UGreaterThanEqual, ">=");
		GLSL_BOP(SGreaterThanEqual, ">=");

	case OpSelect:
	{
		if (cop.arguments.size() < 3)
			SPIRV_CROSS_THROW("Not enough arguments to OpSpecConstantOp.");

		// This one is pretty annoying. It's triggered from
		// uint(bool), int(bool) from spec constants.
		// In order to preserve its compile-time constness in Vulkan GLSL,
		// we need to reduce the OpSelect expression back to this simplified model.
		// If we cannot, fail.
		if (to_trivial_mix_op(type, op, cop.arguments[2], cop.arguments[1], cop.arguments[0]))
		{
			// Implement as a simple cast down below.
		}
		else
		{
			// Implement a ternary and pray the compiler understands it :)
			return to_ternary_expression(type, cop.arguments[0], cop.arguments[1], cop.arguments[2]);
		}
		break;
	}

	case OpVectorShuffle:
	{
		string expr = type_to_glsl_constructor(type);
		expr += "(";

		uint32_t left_components = expression_type(cop.arguments[0]).vecsize;
		string left_arg = to_enclosed_expression(cop.arguments[0]);
		string right_arg = to_enclosed_expression(cop.arguments[1]);

		for (uint32_t i = 2; i < uint32_t(cop.arguments.size()); i++)
		{
			uint32_t index = cop.arguments[i];
			if (index >= left_components)
				expr += right_arg + "." + "xyzw"[index - left_components];
			else
				expr += left_arg + "." + "xyzw"[index];

			if (i + 1 < uint32_t(cop.arguments.size()))
				expr += ", ";
		}

		expr += ")";
		return expr;
	}

	case OpCompositeExtract:
	{
		auto expr =
		    access_chain_internal(cop.arguments[0], &cop.arguments[1], uint32_t(cop.arguments.size() - 1), true, false);
		return expr;
	}

	case OpCompositeInsert:
		SPIRV_CROSS_THROW("OpCompositeInsert spec constant op is not supported.");

	default:
		// Some opcodes are unimplemented here, these are currently not possible to test from glslang.
		SPIRV_CROSS_THROW("Unimplemented spec constant op.");
	}

	SPIRType::BaseType input_type;
	bool skip_cast_if_equal_type = glsl_opcode_is_sign_invariant(cop.opcode);

	switch (cop.opcode)
	{
	case OpIEqual:
	case OpINotEqual:
		input_type = SPIRType::Int;
		break;

	default:
		input_type = type.basetype;
		break;
	}

#undef GLSL_BOP
#undef GLSL_UOP
	if (binary)
	{
		if (cop.arguments.size() < 2)
			SPIRV_CROSS_THROW("Not enough arguments to OpSpecConstantOp.");

		string cast_op0;
		string cast_op1;
		auto expected_type = binary_op_bitcast_helper(cast_op0, cast_op1, input_type, cop.arguments[0],
		                                              cop.arguments[1], skip_cast_if_equal_type);

		if (type.basetype != input_type && type.basetype != SPIRType::Boolean)
		{
			expected_type.basetype = input_type;
			auto expr = bitcast_glsl_op(type, expected_type);
			expr += '(';
			expr += join(cast_op0, " ", op, " ", cast_op1);
			expr += ')';
			return expr;
		}
		else
			return join("(", cast_op0, " ", op, " ", cast_op1, ")");
	}
	else if (unary)
	{
		if (cop.arguments.size() < 1)
			SPIRV_CROSS_THROW("Not enough arguments to OpSpecConstantOp.");

		// Auto-bitcast to result type as needed.
		// Works around various casting scenarios in glslang as there is no OpBitcast for specialization constants.
		return join("(", op, bitcast_glsl(type, cop.arguments[0]), ")");
	}
	else
	{
		if (cop.arguments.size() < 1)
			SPIRV_CROSS_THROW("Not enough arguments to OpSpecConstantOp.");
		return join(op, "(", to_expression(cop.arguments[0]), ")");
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x520, %rsp            # imm = 0x520
movq %rdi, -0x410(%rbp)
movq %rdi, %rax
movq %rax, -0x408(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x400(%rbp)
movq -0x18(%rbp), %rax
movl 0x28(%rax), %esi
callq 0xea90
movq %rax, -0x20(%rbp)
movb $0x0, -0x21(%rbp)
movb $0x0, -0x22(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x7530
movq -0x400(%rbp), %rdi
callq 0x9f610
movb %al, -0x3f1(%rbp)
jmp 0x63578
movb -0x3f1(%rbp), %al
testb $0x1, %al
jne 0x63587
jmp 0x63673
movq -0x18(%rbp), %rax
movl 0xc(%rax), %edi
callq 0x72bb0
movb %al, -0x411(%rbp)
jmp 0x6359b
movb -0x411(%rbp), %al
testb $0x1, %al
jne 0x635aa
jmp 0x63673
movb $0x1, -0x7a(%rbp)
movl $0x10, %edi
callq 0x71a0
movq %rax, -0x428(%rbp)
leaq -0x79(%rbp), %rdi
movq %rdi, -0x420(%rbp)
callq 0x7650
movq -0x420(%rbp), %rdx
leaq 0xdefb1(%rip), %rsi     # 0x14258e
leaq -0x78(%rbp), %rdi
callq 0x7520
jmp 0x635e8
movq -0x428(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x9c50
jmp 0x635fa
movq -0x428(%rbp), %rdi
movb $0x0, -0x7a(%rbp)
leaq 0x14a7cc(%rip), %rsi    # 0x1addd8
leaq -0x59983(%rip), %rdx    # 0x9c90
callq 0x7610
jmp 0x648d4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x648c2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x63651
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x7708
leaq -0x79(%rbp), %rdi
callq 0x73d0
testb $0x1, -0x7a(%rbp)
jne 0x63662
jmp 0x6366e
movq -0x428(%rbp), %rdi
callq 0x72c0
jmp 0x648c2
movq -0x18(%rbp), %rax
movl 0xc(%rax), %eax
addl $-0x4f, %eax
movl %eax, %ecx
movq %rcx, -0x430(%rbp)
subl $0x79, %eax
ja 0x64123
movq -0x430(%rbp), %rax
leaq 0xdc943(%rip), %rcx     # 0x13ffe0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x400(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq -0xa0(%rbp), %rdi
callq 0x72bf0
jmp 0x636bf
leaq -0x48(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x7430
leaq -0xa0(%rbp), %rdi
callq 0x7708
jmp 0x641f3
movb $0x1, -0x22(%rbp)
leaq 0xe0c71(%rip), %rsi     # 0x14435c
leaq -0x48(%rbp), %rdi
callq 0x7510
jmp 0x636f6
jmp 0x641f3
movb $0x1, -0x22(%rbp)
leaq 0xdeebf(%rip), %rsi     # 0x1425c5
leaq -0x48(%rbp), %rdi
callq 0x7510
jmp 0x63711
jmp 0x641f3
movb $0x1, -0x21(%rbp)
leaq 0xdeea6(%rip), %rsi     # 0x1425c7
leaq -0x48(%rbp), %rdi
callq 0x7510
jmp 0x6372c
jmp 0x641f3
movb $0x1, -0x21(%rbp)
leaq 0xe0c20(%rip), %rsi     # 0x14435c
leaq -0x48(%rbp), %rdi
callq 0x7510
jmp 0x63747
jmp 0x641f3
movb $0x1, -0x21(%rbp)
leaq 0xdae23(%rip), %rsi     # 0x13e57a
leaq -0x48(%rbp), %rdi
callq 0x7510
jmp 0x63762
jmp 0x641f3
movb $0x1, -0x21(%rbp)
leaq 0xdee57(%rip), %rsi     # 0x1425c9
leaq -0x48(%rbp), %rdi
callq 0x7510
jmp 0x6377d
jmp 0x641f3
movb $0x1, -0x21(%rbp)
leaq 0xdee3c(%rip), %rsi     # 0x1425c9
leaq -0x48(%rbp), %rdi
callq 0x7510
jmp 0x63798
jmp 0x641f3
movb $0x1, -0x21(%rbp)
leaq 0xdee23(%rip), %rsi     # 0x1425cb
leaq -0x48(%rbp), %rdi
callq 0x7510
jmp 0x637b3
jmp 0x641f3
movb $0x1, -0x21(%rbp)
leaq 0xdee08(%rip), %rsi     # 0x1425cb
leaq -0x48(%rbp), %rdi
callq 0x7510
jmp 0x637ce
jmp 0x641f3
movb $0x1, -0x21(%rbp)
leaq 0xdedef(%rip), %rsi     # 0x1425cd
leaq -0x48(%rbp), %rdi
callq 0x7510
jmp 0x637e9
jmp 0x641f3
movb $0x1, -0x21(%rbp)
leaq 0xdedd4(%rip), %rsi     # 0x1425cd
leaq -0x48(%rbp), %rdi
callq 0x7510
jmp 0x63804
jmp 0x641f3
movb $0x1, -0x21(%rbp)
leaq 0xdedbc(%rip), %rsi     # 0x1425d0
leaq -0x48(%rbp), %rdi
callq 0x7510
jmp 0x6381f
jmp 0x641f3
movb $0x1, -0x21(%rbp)
leaq 0xdeda5(%rip), %rsi     # 0x1425d4
leaq -0x48(%rbp), %rdi
callq 0x7510
jmp 0x6383a
jmp 0x641f3
movb $0x1, -0x21(%rbp)
leaq 0xe08f8(%rip), %rsi     # 0x144142
leaq -0x48(%rbp), %rdi
callq 0x7510
jmp 0x63855
jmp 0x641f3
movb $0x1, -0x21(%rbp)
leaq 0xe9564(%rip), %rsi     # 0x14cdc9
leaq -0x48(%rbp), %rdi
callq 0x7510
jmp 0x63870
jmp 0x641f3
movb $0x1, -0x21(%rbp)
leaq 0xded53(%rip), %rsi     # 0x1425d3
leaq -0x48(%rbp), %rdi
callq 0x7510
jmp 0x6388b
jmp 0x641f3
movb $0x1, -0x21(%rbp)
leaq 0xded3b(%rip), %rsi     # 0x1425d6
leaq -0x48(%rbp), %rdi
callq 0x7510
jmp 0x638a6
jmp 0x641f3
movb $0x1, -0x22(%rbp)
leaq 0xe951c(%rip), %rsi     # 0x14cdd2
leaq -0x48(%rbp), %rdi
callq 0x7510
jmp 0x638c1
jmp 0x641f3
movb $0x1, -0x21(%rbp)
leaq 0xded08(%rip), %rsi     # 0x1425d9
leaq -0x48(%rbp), %rdi
callq 0x7510
jmp 0x638dc
jmp 0x641f3
movb $0x1, -0x21(%rbp)
leaq 0xdecf0(%rip), %rsi     # 0x1425dc
leaq -0x48(%rbp), %rdi
callq 0x7510
jmp 0x638f7
jmp 0x641f3
movb $0x1, -0x21(%rbp)
leaq 0xdecd2(%rip), %rsi     # 0x1425d9
leaq -0x48(%rbp), %rdi
callq 0x7510
jmp 0x63912
jmp 0x641f3
movb $0x1, -0x21(%rbp)
leaq 0xdecba(%rip), %rsi     # 0x1425dc
leaq -0x48(%rbp), %rdi
callq 0x7510
jmp 0x6392d
jmp 0x641f3
movb $0x1, -0x21(%rbp)
leaq 0xdec94(%rip), %rsi     # 0x1425d1
leaq -0x48(%rbp), %rdi
callq 0x7510
jmp 0x63948
jmp 0x641f3
movb $0x1, -0x21(%rbp)
leaq 0xdec79(%rip), %rsi     # 0x1425d1
leaq -0x48(%rbp), %rdi
callq 0x7510
jmp 0x63963
jmp 0x641f3
movb $0x1, -0x21(%rbp)
leaq 0xdec6c(%rip), %rsi     # 0x1425df
leaq -0x48(%rbp), %rdi
callq 0x7510
jmp 0x6397e
jmp 0x641f3
movb $0x1, -0x21(%rbp)
leaq 0xdec51(%rip), %rsi     # 0x1425df
leaq -0x48(%rbp), %rdi
callq 0x7510
jmp 0x63999
jmp 0x641f3
movb $0x1, -0x21(%rbp)
leaq 0xda842(%rip), %rsi     # 0x13e1eb
leaq -0x48(%rbp), %rdi
callq 0x7510
jmp 0x639b4
jmp 0x641f3
movb $0x1, -0x21(%rbp)
leaq 0xda827(%rip), %rsi     # 0x13e1eb
leaq -0x48(%rbp), %rdi
callq 0x7510
jmp 0x639cf
jmp 0x641f3
movb $0x1, -0x21(%rbp)
leaq 0xdec03(%rip), %rsi     # 0x1425e2
leaq -0x48(%rbp), %rdi
callq 0x7510
jmp 0x639ea
jmp 0x641f3
movb $0x1, -0x21(%rbp)
leaq 0xdebe8(%rip), %rsi     # 0x1425e2
leaq -0x48(%rbp), %rdi
callq 0x7510
jmp 0x63a05
jmp 0x641f3
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
callq 0x8650
cmpq $0x3, %rax
jae 0x63af1
movb $0x1, -0xc2(%rbp)
movl $0x10, %edi
callq 0x71a0
movq %rax, -0x440(%rbp)
leaq -0xc1(%rbp), %rdi
movq %rdi, -0x438(%rbp)
callq 0x7650
movq -0x438(%rbp), %rdx
leaq 0xdeb8b(%rip), %rsi     # 0x1425e5
leaq -0xc0(%rbp), %rdi
callq 0x7520
jmp 0x63a68
movq -0x440(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x9c50
jmp 0x63a7d
movq -0x440(%rbp), %rdi
movb $0x0, -0xc2(%rbp)
leaq 0x14a346(%rip), %rsi    # 0x1addd8
leaq -0x59e09(%rip), %rdx    # 0x9c90
callq 0x7610
jmp 0x648d4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x63ac9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x7708
leaq -0xc1(%rbp), %rdi
callq 0x73d0
testb $0x1, -0xc2(%rbp)
jne 0x63ae0
jmp 0x63aec
movq -0x440(%rbp), %rdi
callq 0x72c0
jmp 0x648c2
movq -0x20(%rbp), %rax
movq %rax, -0x458(%rbp)
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
movl $0x2, %esi
callq 0x8570
movl (%rax), %eax
movl %eax, -0x44c(%rbp)
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
movl $0x1, %esi
callq 0x8570
movl (%rax), %eax
movl %eax, -0x448(%rbp)
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x8570
movq -0x400(%rbp), %rdi
movq -0x458(%rbp), %rsi
movl -0x44c(%rbp), %ecx
movl -0x448(%rbp), %r8d
movl (%rax), %r9d
leaq -0x48(%rbp), %rdx
callq 0x72f90
movb %al, -0x441(%rbp)
jmp 0x63b70
movb -0x441(%rbp), %al
testb $0x1, %al
jne 0x63b7c
jmp 0x63b81
jmp 0x63c0c
movq -0x20(%rbp), %rax
movq %rax, -0x468(%rbp)
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x8570
movl (%rax), %eax
movl %eax, -0x460(%rbp)
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
movl $0x1, %esi
callq 0x8570
movl (%rax), %eax
movl %eax, -0x45c(%rbp)
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
movl $0x2, %esi
callq 0x8570
movq -0x410(%rbp), %rdi
movq -0x400(%rbp), %rsi
movq -0x468(%rbp), %rdx
movl -0x460(%rbp), %ecx
movl -0x45c(%rbp), %r8d
movl (%rax), %r9d
callq 0x73240
jmp 0x63bfd
movl $0x1, -0xc8(%rbp)
jmp 0x648a9
jmp 0x641f3
movq -0x400(%rbp), %rsi
movq -0x410(%rbp), %rdi
movb $0x0, -0xc9(%rbp)
movq -0x20(%rbp), %rdx
callq 0x72bf0
jmp 0x63c31
movq -0x410(%rbp), %rdi
leaq 0xe96ee(%rip), %rsi     # 0x14d32d
callq 0x7340
jmp 0x63c46
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x8570
movq -0x400(%rbp), %rdi
movl (%rax), %esi
callq 0x1f760
movq %rax, -0x470(%rbp)
jmp 0x63c6e
movq -0x470(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0xd0(%rbp)
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x8570
movq -0x400(%rbp), %rsi
movl (%rax), %edx
leaq -0xf0(%rbp), %rdi
callq 0x72630
jmp 0x63ca6
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
movl $0x1, %esi
callq 0x8570
movq -0x400(%rbp), %rsi
movl (%rax), %edx
leaq -0x110(%rbp), %rdi
callq 0x72630
jmp 0x63ccf
movl $0x2, -0x114(%rbp)
movl -0x114(%rbp), %eax
movl %eax, -0x474(%rbp)
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
callq 0x8650
movq %rax, %rcx
movl -0x474(%rbp), %eax
cmpl %ecx, %eax
jae 0x63f16
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
movl -0x114(%rbp), %eax
movl %eax, %esi
callq 0x8570
movl (%rax), %eax
movl %eax, -0x118(%rbp)
movl -0x118(%rbp), %eax
cmpl -0xd0(%rbp), %eax
jb 0x63e18
leaq 0xe0ff4(%rip), %rdx     # 0x144d2d
leaq -0x158(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x2f8c0
jmp 0x63d4e
movl -0x118(%rbp), %eax
movl -0xd0(%rbp), %ecx
subl %ecx, %eax
leaq 0xde8ac(%rip), %rcx     # 0x14260f
movsbl (%rax,%rcx), %edx
leaq -0x138(%rbp), %rdi
leaq -0x158(%rbp), %rsi
callq 0xa15c0
jmp 0x63d7c
movq -0x410(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0x7470
jmp 0x63d91
leaq -0x138(%rbp), %rdi
callq 0x7708
leaq -0x158(%rbp), %rdi
callq 0x7708
jmp 0x63ec0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x63f8a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x63f6b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x63f5f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x63e07
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x7708
leaq -0x158(%rbp), %rdi
callq 0x7708
jmp 0x63f5f
leaq 0xe0f0e(%rip), %rdx     # 0x144d2d
leaq -0x198(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x2f8c0
jmp 0x63e34
movl -0x118(%rbp), %eax
leaq 0xde7ce(%rip), %rcx     # 0x14260f
movsbl (%rax,%rcx), %edx
leaq -0x178(%rbp), %rdi
leaq -0x198(%rbp), %rsi
callq 0xa15c0
jmp 0x63e5a
movq -0x410(%rbp), %rdi
leaq -0x178(%rbp), %rsi
callq 0x7470
jmp 0x63e6f
leaq -0x178(%rbp), %rdi
callq 0x7708
leaq -0x198(%rbp), %rdi
callq 0x7708
jmp 0x63ec0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x63eaf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x178(%rbp), %rdi
callq 0x7708
leaq -0x198(%rbp), %rdi
callq 0x7708
jmp 0x63f5f
movl -0x114(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x478(%rbp)
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
callq 0x8650
movq %rax, %rcx
movl -0x478(%rbp), %eax
cmpl %ecx, %eax
jae 0x63f00
movq -0x410(%rbp), %rdi
leaq 0xe0698(%rip), %rsi     # 0x14458f
callq 0x7340
jmp 0x63efe
jmp 0x63f00
jmp 0x63f02
movl -0x114(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x114(%rbp)
jmp 0x63cd9
movq -0x410(%rbp), %rdi
leaq 0xe0fd5(%rip), %rsi     # 0x144ef9
callq 0x7340
jmp 0x63f2b
movb $0x1, -0xc9(%rbp)
movl $0x1, -0xc8(%rbp)
leaq -0x110(%rbp), %rdi
callq 0x7708
leaq -0xf0(%rbp), %rdi
callq 0x7708
testb $0x1, -0xc9(%rbp)
jne 0x63f85
jmp 0x63f79
leaq -0x110(%rbp), %rdi
callq 0x7708
leaq -0xf0(%rbp), %rdi
callq 0x7708
jmp 0x63f8a
movq -0x410(%rbp), %rdi
callq 0x7708
jmp 0x648a9
movq -0x410(%rbp), %rdi
callq 0x7708
jmp 0x648c2
movb $0x0, -0x199(%rbp)
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x8570
movl (%rax), %eax
movl %eax, -0x484(%rbp)
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
movl $0x1, %esi
callq 0x8570
movq %rax, -0x480(%rbp)
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
callq 0x8650
movq -0x410(%rbp), %rdi
movq -0x400(%rbp), %rsi
movl -0x484(%rbp), %edx
movq -0x480(%rbp), %rcx
movl %eax, %r8d
decl %r8d
movq %rsp, %rax
movq $0x0, 0x10(%rax)
movq $0x0, 0x8(%rax)
movl $0x0, (%rax)
movl $0x1, %r9d
callq 0x73610
jmp 0x64028
movb $0x1, -0x199(%rbp)
movl $0x1, -0xc8(%rbp)
testb $0x1, -0x199(%rbp)
jne 0x6404e
movq -0x410(%rbp), %rdi
callq 0x7708
jmp 0x648a9
movb $0x1, -0x1c2(%rbp)
movl $0x10, %edi
callq 0x71a0
movq %rax, -0x498(%rbp)
leaq -0x1c1(%rbp), %rdi
movq %rdi, -0x490(%rbp)
callq 0x7650
movq -0x490(%rbp), %rdx
leaq 0xde588(%rip), %rsi     # 0x142614
leaq -0x1c0(%rbp), %rdi
callq 0x7520
jmp 0x6409a
movq -0x498(%rbp), %rdi
leaq -0x1c0(%rbp), %rsi
callq 0x9c50
jmp 0x640af
movq -0x498(%rbp), %rdi
movb $0x0, -0x1c2(%rbp)
leaq 0x149d14(%rip), %rsi    # 0x1addd8
leaq -0x5a43b(%rip), %rdx    # 0x9c90
callq 0x7610
jmp 0x648d4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x640fb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x1c0(%rbp), %rdi
callq 0x7708
leaq -0x1c1(%rbp), %rdi
callq 0x73d0
testb $0x1, -0x1c2(%rbp)
jne 0x64112
jmp 0x6411e
movq -0x498(%rbp), %rdi
callq 0x72c0
jmp 0x648c2
movb $0x1, -0x1ea(%rbp)
movl $0x10, %edi
callq 0x71a0
movq %rax, -0x4a8(%rbp)
leaq -0x1e9(%rbp), %rdi
movq %rdi, -0x4a0(%rbp)
callq 0x7650
movq -0x4a0(%rbp), %rdx
leaq 0xde4ed(%rip), %rsi     # 0x142649
leaq -0x1e8(%rbp), %rdi
callq 0x7520
jmp 0x6416a
movq -0x4a8(%rbp), %rdi
leaq -0x1e8(%rbp), %rsi
callq 0x9c50
jmp 0x6417f
movq -0x4a8(%rbp), %rdi
movb $0x0, -0x1ea(%rbp)
leaq 0x149c44(%rip), %rsi    # 0x1addd8
leaq -0x5a50b(%rip), %rdx    # 0x9c90
callq 0x7610
jmp 0x648d4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x641cb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x1e8(%rbp), %rdi
callq 0x7708
leaq -0x1e9(%rbp), %rdi
callq 0x73d0
testb $0x1, -0x1ea(%rbp)
jne 0x641e2
jmp 0x641ee
movq -0x4a8(%rbp), %rdi
callq 0x72c0
jmp 0x648c2
movq -0x18(%rbp), %rax
movl 0xc(%rax), %edi
callq 0x74760
movb %al, -0x4a9(%rbp)
jmp 0x64207
movb -0x4a9(%rbp), %al
andb $0x1, %al
movb %al, -0x1f1(%rbp)
movq -0x18(%rbp), %rax
movl 0xc(%rax), %eax
addl $0xffffff56, %eax       # imm = 0xFFFFFF56
subl $0x1, %eax
ja 0x64234
jmp 0x64228
movl $0x4, -0x1f0(%rbp)
jmp 0x64241
movq -0x20(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, -0x1f0(%rbp)
testb $0x1, -0x21(%rbp)
je 0x645b7
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
callq 0x8650
cmpq $0x2, %rax
jae 0x64332
movb $0x1, -0x21a(%rbp)
movl $0x10, %edi
callq 0x71a0
movq %rax, -0x4c0(%rbp)
leaq -0x219(%rbp), %rdi
movq %rdi, -0x4b8(%rbp)
callq 0x7650
movq -0x4b8(%rbp), %rdx
leaq 0xde34a(%rip), %rsi     # 0x1425e5
leaq -0x218(%rbp), %rdi
callq 0x7520
jmp 0x642a9
movq -0x4c0(%rbp), %rdi
leaq -0x218(%rbp), %rsi
callq 0x9c50
jmp 0x642be
movq -0x4c0(%rbp), %rdi
movb $0x0, -0x21a(%rbp)
leaq 0x149b05(%rip), %rsi    # 0x1addd8
leaq -0x5a64a(%rip), %rdx    # 0x9c90
callq 0x7610
jmp 0x648d4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x6430a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x218(%rbp), %rdi
callq 0x7708
leaq -0x219(%rbp), %rdi
callq 0x73d0
testb $0x1, -0x21a(%rbp)
jne 0x64321
jmp 0x6432d
movq -0x4c0(%rbp), %rdi
callq 0x72c0
jmp 0x648c2
leaq -0x240(%rbp), %rdi
movq %rdi, -0x4d8(%rbp)
callq 0x7530
leaq -0x260(%rbp), %rdi
movq %rdi, -0x4d0(%rbp)
callq 0x7530
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x8570
movl (%rax), %eax
movl %eax, -0x4c4(%rbp)
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
movl $0x1, %esi
callq 0x8570
movq -0x400(%rbp), %rsi
movq -0x4d8(%rbp), %rdx
movq -0x4d0(%rbp), %rcx
movl -0x4c4(%rbp), %r9d
movl (%rax), %edi
movzbl -0x1f1(%rbp), %r8d
andl $0x1, %r8d
movq %rsp, %rax
movl %r8d, 0x8(%rax)
movl %edi, (%rax)
leaq -0x338(%rbp), %rdi
leaq -0x1f0(%rbp), %r8
callq 0x747a0
jmp 0x643cb
movq -0x20(%rbp), %rax
movl 0xc(%rax), %eax
cmpl -0x1f0(%rbp), %eax
je 0x64519
movq -0x20(%rbp), %rax
cmpl $0x2, 0xc(%rax)
je 0x64519
movq -0x400(%rbp), %rsi
movq -0x410(%rbp), %rdi
movl -0x1f0(%rbp), %eax
movl %eax, -0x32c(%rbp)
movb $0x0, -0x339(%rbp)
movq -0x20(%rbp), %rdx
movq (%rsi), %rax
movq 0x168(%rax), %rax
leaq -0x338(%rbp), %rcx
callq *%rax
jmp 0x64426
movq -0x410(%rbp), %rdi
movl $0x28, %esi
callq 0x7220
jmp 0x64439
leaq 0xda45d(%rip), %r8      # 0x13e89d
leaq -0x360(%rbp), %rdi
leaq -0x240(%rbp), %rsi
leaq -0x48(%rbp), %rcx
leaq -0x260(%rbp), %r9
movq %r8, %rdx
callq 0xa1610
jmp 0x64463
movq -0x410(%rbp), %rdi
leaq -0x360(%rbp), %rsi
callq 0x7470
jmp 0x64478
leaq -0x360(%rbp), %rdi
callq 0x7708
movq -0x410(%rbp), %rdi
movl $0x29, %esi
callq 0x7220
jmp 0x64497
movb $0x1, -0x339(%rbp)
movl $0x1, -0xc8(%rbp)
testb $0x1, -0x339(%rbp)
jne 0x64509
jmp 0x644fd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x6459a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x6458e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x6450b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x360(%rbp), %rdi
callq 0x7708
jmp 0x6450b
movq -0x410(%rbp), %rdi
callq 0x7708
jmp 0x64565
movq -0x410(%rbp), %rdi
callq 0x7708
jmp 0x6458e
movq -0x410(%rbp), %rdi
leaq 0xe09d2(%rip), %rcx     # 0x144ef9
movq %rsp, %rax
movq %rcx, 0x8(%rax)
leaq -0x260(%rbp), %rcx
movq %rcx, (%rax)
leaq 0xe8dee(%rip), %rsi     # 0x14d32d
leaq 0xda357(%rip), %r9      # 0x13e89d
leaq -0x240(%rbp), %rdx
leaq -0x48(%rbp), %r8
movq %r9, %rcx
callq 0xa16e0
jmp 0x6455b
movl $0x1, -0xc8(%rbp)
leaq -0x338(%rbp), %rdi
callq 0x314e0
leaq -0x260(%rbp), %rdi
callq 0x7708
leaq -0x240(%rbp), %rdi
callq 0x7708
jmp 0x648a9
leaq -0x338(%rbp), %rdi
callq 0x314e0
leaq -0x260(%rbp), %rdi
callq 0x7708
leaq -0x240(%rbp), %rdi
callq 0x7708
jmp 0x648c2
testb $0x1, -0x22(%rbp)
je 0x64741
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
callq 0x8650
cmpq $0x1, %rax
jae 0x646a8
movb $0x1, -0x382(%rbp)
movl $0x10, %edi
callq 0x71a0
movq %rax, -0x4e8(%rbp)
leaq -0x381(%rbp), %rdi
movq %rdi, -0x4e0(%rbp)
callq 0x7650
movq -0x4e0(%rbp), %rdx
leaq 0xddfd4(%rip), %rsi     # 0x1425e5
leaq -0x380(%rbp), %rdi
callq 0x7520
jmp 0x6461f
movq -0x4e8(%rbp), %rdi
leaq -0x380(%rbp), %rsi
callq 0x9c50
jmp 0x64634
movq -0x4e8(%rbp), %rdi
movb $0x0, -0x382(%rbp)
leaq 0x14978f(%rip), %rsi    # 0x1addd8
leaq -0x5a9c0(%rip), %rdx    # 0x9c90
callq 0x7610
jmp 0x648d4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x64680
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x380(%rbp), %rdi
callq 0x7708
leaq -0x381(%rbp), %rdi
callq 0x73d0
testb $0x1, -0x382(%rbp)
jne 0x64697
jmp 0x646a3
movq -0x4e8(%rbp), %rdi
callq 0x72c0
jmp 0x648c2
movq -0x20(%rbp), %rax
movq %rax, -0x4f0(%rbp)
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x8570
movq -0x400(%rbp), %rsi
movq -0x4f0(%rbp), %rdx
movl (%rax), %ecx
leaq -0x3a8(%rbp), %rdi
callq 0x749f0
jmp 0x646e2
movq -0x410(%rbp), %rdi
leaq 0xe8c3d(%rip), %rsi     # 0x14d32d
leaq 0xe0802(%rip), %r8      # 0x144ef9
leaq -0x48(%rbp), %rdx
leaq -0x3a8(%rbp), %rcx
callq 0xa17c0
jmp 0x64709
leaq -0x3a8(%rbp), %rdi
callq 0x7708
movl $0x1, -0xc8(%rbp)
jmp 0x648a9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x3a8(%rbp), %rdi
callq 0x7708
jmp 0x648c2
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
callq 0x8650
cmpq $0x1, %rax
jae 0x64828
movb $0x1, -0x3ca(%rbp)
movl $0x10, %edi
callq 0x71a0
movq %rax, -0x500(%rbp)
leaq -0x3c9(%rbp), %rdi
movq %rdi, -0x4f8(%rbp)
callq 0x7650
movq -0x4f8(%rbp), %rdx
leaq 0xdde54(%rip), %rsi     # 0x1425e5
leaq -0x3c8(%rbp), %rdi
callq 0x7520
jmp 0x6479f
movq -0x500(%rbp), %rdi
leaq -0x3c8(%rbp), %rsi
callq 0x9c50
jmp 0x647b4
movq -0x500(%rbp), %rdi
movb $0x0, -0x3ca(%rbp)
leaq 0x14960f(%rip), %rsi    # 0x1addd8
leaq -0x5ab40(%rip), %rdx    # 0x9c90
callq 0x7610
jmp 0x648d4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x64800
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x3c8(%rbp), %rdi
callq 0x7708
leaq -0x3c9(%rbp), %rdi
callq 0x73d0
testb $0x1, -0x3ca(%rbp)
jne 0x64817
jmp 0x64823
movq -0x500(%rbp), %rdi
callq 0x72c0
jmp 0x648c2
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x8570
movq -0x400(%rbp), %rsi
movl (%rax), %edx
leaq -0x3f0(%rbp), %rdi
callq 0x71b50
jmp 0x64850
movq -0x410(%rbp), %rdi
leaq 0xe8acf(%rip), %rdx     # 0x14d32d
leaq 0xe0694(%rip), %r8      # 0x144ef9
leaq -0x48(%rbp), %rsi
leaq -0x3f0(%rbp), %rcx
callq 0xa1880
jmp 0x64877
leaq -0x3f0(%rbp), %rdi
callq 0x7708
movl $0x1, -0xc8(%rbp)
jmp 0x648a9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x3f0(%rbp), %rdi
callq 0x7708
jmp 0x648c2
leaq -0x48(%rbp), %rdi
callq 0x7708
movq -0x408(%rbp), %rax
addq $0x520, %rsp            # imm = 0x520
popq %rbp
retq
leaq -0x48(%rbp), %rdi
callq 0x7708
movq -0x50(%rbp), %rdi
callq 0x7640
nopw %cs:(%rax,%rax)