// File: rossy[P]crossc/SPIRV-Cross/spirv_hlsl.cpp
// Function: spirv_cross::CompilerHLSL::read_access_chain[abi:cxx11](spirv_cross::SPIRAccessChain const&)
string CompilerHLSL::read_access_chain(const SPIRAccessChain &chain)
{
	auto &type = get<SPIRType>(chain.basetype);

	SPIRType target_type;
	target_type.basetype = SPIRType::UInt;
	target_type.vecsize = type.vecsize;
	target_type.columns = type.columns;

	if (type.basetype == SPIRType::Struct)
		SPIRV_CROSS_THROW("Reading structs from ByteAddressBuffer not yet supported.");

	if (type.width != 32)
		SPIRV_CROSS_THROW("Reading types other than 32-bit from ByteAddressBuffer not yet supported.");

	if (!type.array.empty())
		SPIRV_CROSS_THROW("Reading arrays from ByteAddressBuffer not yet supported.");

	string load_expr;

	// Load a vector or scalar.
	if (type.columns == 1 && !chain.row_major_matrix)
	{
		const char *load_op = nullptr;
		switch (type.vecsize)
		{
		case 1:
			load_op = "Load";
			break;
		case 2:
			load_op = "Load2";
			break;
		case 3:
			load_op = "Load3";
			break;
		case 4:
			load_op = "Load4";
			break;
		default:
			SPIRV_CROSS_THROW("Unknown vector size.");
		}

		load_expr = join(chain.base, ".", load_op, "(", chain.dynamic_index, chain.static_index, ")");
	}
	else if (type.columns == 1)
	{
		// Strided load since we are loading a column from a row-major matrix.
		if (type.vecsize > 1)
		{
			load_expr = type_to_glsl(target_type);
			load_expr += "(";
		}

		for (uint32_t r = 0; r < type.vecsize; r++)
		{
			load_expr +=
			    join(chain.base, ".Load(", chain.dynamic_index, chain.static_index + r * chain.matrix_stride, ")");
			if (r + 1 < type.vecsize)
				load_expr += ", ";
		}

		if (type.vecsize > 1)
			load_expr += ")";
	}
	else if (!chain.row_major_matrix)
	{
		// Load a matrix, column-major, the easy case.
		const char *load_op = nullptr;
		switch (type.vecsize)
		{
		case 1:
			load_op = "Load";
			break;
		case 2:
			load_op = "Load2";
			break;
		case 3:
			load_op = "Load3";
			break;
		case 4:
			load_op = "Load4";
			break;
		default:
			SPIRV_CROSS_THROW("Unknown vector size.");
		}

		// Note, this loading style in HLSL is *actually* row-major, but we always treat matrices as transposed in this backend,
		// so row-major is technically column-major ...
		load_expr = type_to_glsl(target_type);
		load_expr += "(";
		for (uint32_t c = 0; c < type.columns; c++)
		{
			load_expr += join(chain.base, ".", load_op, "(", chain.dynamic_index,
			                  chain.static_index + c * chain.matrix_stride, ")");
			if (c + 1 < type.columns)
				load_expr += ", ";
		}
		load_expr += ")";
	}
	else
	{
		// Pick out elements one by one ... Hopefully compilers are smart enough to recognize this pattern
		// considering HLSL is "row-major decl", but "column-major" memory layout (basically implicit transpose model, ugh) ...

		load_expr = type_to_glsl(target_type);
		load_expr += "(";
		for (uint32_t c = 0; c < type.columns; c++)
		{
			for (uint32_t r = 0; r < type.vecsize; r++)
			{
				load_expr += join(chain.base, ".Load(", chain.dynamic_index,
				                  chain.static_index + c * (type.width / 8) + r * chain.matrix_stride, ")");

				if ((r + 1 < type.vecsize) || (c + 1 < type.columns))
					load_expr += ", ";
			}
		}
		load_expr += ")";
	}

	auto bitcast_op = bitcast_glsl_op(type, target_type);
	if (!bitcast_op.empty())
		load_expr = join(bitcast_op, "(", load_expr, ")");

	return load_expr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3d0, %rsp            # imm = 0x3D0
movq %rdi, -0x348(%rbp)
movq %rdi, %rax
movq %rax, -0x340(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x338(%rbp)
movq -0x18(%rbp), %rax
movl 0xc(%rax), %esi
callq 0xea90
movq %rax, -0x20(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x31440
movl $0x5, -0xec(%rbp)
movq -0x20(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0xe4(%rbp)
movq -0x20(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0xe0(%rbp)
movq -0x20(%rbp), %rax
cmpl $0xc, 0xc(%rax)
jne 0xc9efd
movb $0x1, -0x12d(%rbp)
movl $0x10, %edi
callq 0x71a0
movq %rax, -0x358(%rbp)
leaq -0x119(%rbp), %rdi
movq %rdi, -0x350(%rbp)
callq 0x7650
movq -0x350(%rbp), %rdx
leaq 0x7e9ec(%rip), %rsi     # 0x148846
leaq -0x118(%rbp), %rdi
callq 0x7520
jmp 0xc9e68
movq -0x358(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0x9c50
jmp 0xc9e7d
movq -0x358(%rbp), %rdi
movb $0x0, -0x12d(%rbp)
leaq 0xe3f46(%rip), %rsi     # 0x1addd8
leaq -0xc0209(%rip), %rdx    # 0x9c90
callq 0x7610
jmp 0xcaa31
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
jmp 0xc9ed5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
leaq -0x118(%rbp), %rdi
callq 0x7708
leaq -0x119(%rbp), %rdi
callq 0x73d0
testb $0x1, -0x12d(%rbp)
jne 0xc9eec
jmp 0xc9ef8
movq -0x358(%rbp), %rdi
callq 0x72c0
jmp 0xcaa19
movq -0x20(%rbp), %rax
cmpl $0x20, 0x10(%rax)
je 0xc9fe7
movb $0x1, -0x152(%rbp)
movl $0x10, %edi
callq 0x71a0
movq %rax, -0x368(%rbp)
leaq -0x151(%rbp), %rdi
movq %rdi, -0x360(%rbp)
callq 0x7650
movq -0x360(%rbp), %rdx
leaq 0x7e93c(%rip), %rsi     # 0x148880
leaq -0x150(%rbp), %rdi
callq 0x7520
jmp 0xc9f52
movq -0x368(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0x9c50
jmp 0xc9f67
movq -0x368(%rbp), %rdi
movb $0x0, -0x152(%rbp)
leaq 0xe3e5c(%rip), %rsi     # 0x1addd8
leaq -0xc02f3(%rip), %rdx    # 0x9c90
callq 0x7610
jmp 0xcaa31
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
jmp 0xc9fbf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
leaq -0x150(%rbp), %rdi
callq 0x7708
leaq -0x151(%rbp), %rdi
callq 0x73d0
testb $0x1, -0x152(%rbp)
jne 0xc9fd6
jmp 0xc9fe2
movq -0x368(%rbp), %rdi
callq 0x72c0
jmp 0xcaa19
movq -0x20(%rbp), %rdi
addq $0x20, %rdi
callq 0x8690
testb $0x1, %al
jne 0xca0d8
movb $0x1, -0x17a(%rbp)
movl $0x10, %edi
callq 0x71a0
movq %rax, -0x378(%rbp)
leaq -0x179(%rbp), %rdi
movq %rdi, -0x370(%rbp)
callq 0x7650
movq -0x370(%rbp), %rdx
leaq 0x7e895(%rip), %rsi     # 0x1488ca
leaq -0x178(%rbp), %rdi
callq 0x7520
jmp 0xca043
movq -0x378(%rbp), %rdi
leaq -0x178(%rbp), %rsi
callq 0x9c50
jmp 0xca058
movq -0x378(%rbp), %rdi
movb $0x0, -0x17a(%rbp)
leaq 0xe3d6b(%rip), %rsi     # 0x1addd8
leaq -0xc03e4(%rip), %rdx    # 0x9c90
callq 0x7610
jmp 0xcaa31
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
jmp 0xca0b0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
leaq -0x178(%rbp), %rdi
callq 0x7708
leaq -0x179(%rbp), %rdi
callq 0x73d0
testb $0x1, -0x17a(%rbp)
jne 0xca0c7
jmp 0xca0d3
movq -0x378(%rbp), %rdi
callq 0x72c0
jmp 0xcaa19
movq -0x348(%rbp), %rdi
movb $0x0, -0x17b(%rbp)
callq 0x7530
movq -0x20(%rbp), %rax
cmpl $0x1, 0x18(%rax)
jne 0xca2ed
movq -0x18(%rbp), %rax
testb $0x1, 0x64(%rax)
jne 0xca2ed
movq $0x0, -0x188(%rbp)
movq -0x20(%rbp), %rax
movl 0x14(%rax), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x380(%rbp)
subl $0x3, %eax
ja 0xca18c
movq -0x380(%rbp), %rax
leaq 0x7b6f5(%rip), %rcx     # 0x14582c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x7e132(%rip), %rax     # 0x148279
movq %rax, -0x188(%rbp)
jmp 0xca268
leaq 0x7e7a9(%rip), %rax     # 0x148903
movq %rax, -0x188(%rbp)
jmp 0xca268
leaq 0x7e79c(%rip), %rax     # 0x148909
movq %rax, -0x188(%rbp)
jmp 0xca268
leaq 0x7e78f(%rip), %rax     # 0x14890f
movq %rax, -0x188(%rbp)
jmp 0xca268
movb $0x1, -0x1aa(%rbp)
movl $0x10, %edi
callq 0x71a0
movq %rax, -0x390(%rbp)
leaq -0x1a9(%rbp), %rdi
movq %rdi, -0x388(%rbp)
callq 0x7650
movq -0x388(%rbp), %rdx
leaq 0x7e750(%rip), %rsi     # 0x148915
leaq -0x1a8(%rbp), %rdi
callq 0x7520
jmp 0xca1d3
movq -0x390(%rbp), %rdi
leaq -0x1a8(%rbp), %rsi
callq 0x9c50
jmp 0xca1e8
movq -0x390(%rbp), %rdi
movb $0x0, -0x1aa(%rbp)
leaq 0xe3bdb(%rip), %rsi     # 0x1addd8
leaq -0xc0574(%rip), %rdx    # 0x9c90
callq 0x7610
jmp 0xcaa31
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
jmp 0xca240
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
leaq -0x1a8(%rbp), %rdi
callq 0x7708
leaq -0x1a9(%rbp), %rdi
callq 0x73d0
testb $0x1, -0x1aa(%rbp)
jne 0xca257
jmp 0xca263
movq -0x390(%rbp), %rdi
callq 0x72c0
jmp 0xcaa0d
movq -0x18(%rbp), %rcx
movq %rcx, %rsi
addq $0x18, %rsi
movq %rcx, %r9
addq $0x38, %r9
addq $0x58, %rcx
leaq 0x7ac74(%rip), %rdx     # 0x144ef9
movq %rsp, %rax
movq %rdx, 0x8(%rax)
movq %rcx, (%rax)
leaq 0x7aa97(%rip), %rdx     # 0x144d2d
leaq 0x83090(%rip), %r8      # 0x14d32d
leaq -0x1d0(%rbp), %rdi
leaq -0x188(%rbp), %rcx
callq 0xdd130
jmp 0xca2b2
movq -0x348(%rbp), %rdi
leaq -0x1d0(%rbp), %rsi
callq 0x7430
leaq -0x1d0(%rbp), %rdi
callq 0x7708
jmp 0xca927
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
jmp 0xcaa0d
movq -0x20(%rbp), %rax
cmpl $0x1, 0x18(%rax)
jne 0xca479
movq -0x20(%rbp), %rax
cmpl $0x1, 0x14(%rax)
jbe 0xca367
movq -0x338(%rbp), %rsi
movq (%rsi), %rax
movq 0x98(%rax), %rax
leaq -0x1f0(%rbp), %rdi
leaq -0xf8(%rbp), %rdx
xorl %ecx, %ecx
callq *%rax
jmp 0xca32a
movq -0x348(%rbp), %rdi
leaq -0x1f0(%rbp), %rsi
movq %rsi, -0x398(%rbp)
callq 0x7430
movq -0x398(%rbp), %rdi
callq 0x7708
movq -0x348(%rbp), %rdi
leaq 0x82fcf(%rip), %rsi     # 0x14d32d
callq 0x7340
jmp 0xca365
jmp 0xca367
movl $0x0, -0x1f4(%rbp)
movl -0x1f4(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x14(%rcx), %eax
jae 0xca453
movq -0x18(%rbp), %rdi
movq %rdi, %rsi
addq $0x18, %rsi
movq %rdi, %rcx
addq $0x38, %rcx
movl -0x1f4(%rbp), %edx
movl 0x58(%rdi), %eax
movl 0x60(%rdi), %edi
imull %edi, %edx
addl %edx, %eax
movl %eax, -0x21c(%rbp)
leaq 0x7e576(%rip), %rdx     # 0x14892a
leaq 0x7ab3e(%rip), %r9      # 0x144ef9
leaq -0x218(%rbp), %rdi
leaq -0x21c(%rbp), %r8
callq 0xdd210
jmp 0xca3d0
movq -0x348(%rbp), %rdi
leaq -0x218(%rbp), %rsi
callq 0x7470
jmp 0xca3e5
leaq -0x218(%rbp), %rdi
callq 0x7708
movl -0x1f4(%rbp), %eax
addl $0x1, %eax
movq -0x20(%rbp), %rcx
cmpl 0x14(%rcx), %eax
jae 0xca43d
movq -0x348(%rbp), %rdi
leaq 0x7a17e(%rip), %rsi     # 0x14458f
callq 0x7340
jmp 0xca418
jmp 0xca43d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
leaq -0x218(%rbp), %rdi
callq 0x7708
jmp 0xcaa0d
jmp 0xca43f
movl -0x1f4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1f4(%rbp)
jmp 0xca371
movq -0x20(%rbp), %rax
cmpl $0x1, 0x14(%rax)
jbe 0xca474
movq -0x348(%rbp), %rdi
leaq 0x7aa8e(%rip), %rsi     # 0x144ef9
callq 0x7340
jmp 0xca472
jmp 0xca474
jmp 0xca925
movq -0x18(%rbp), %rax
testb $0x1, 0x64(%rax)
jne 0xca766
movq $0x0, -0x228(%rbp)
movq -0x20(%rbp), %rax
movl 0x14(%rax), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x3a0(%rbp)
subl $0x3, %eax
ja 0xca50c
movq -0x3a0(%rbp), %rax
leaq 0x7b385(%rip), %rcx     # 0x14583c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x7ddb2(%rip), %rax     # 0x148279
movq %rax, -0x228(%rbp)
jmp 0xca5e8
leaq 0x7e429(%rip), %rax     # 0x148903
movq %rax, -0x228(%rbp)
jmp 0xca5e8
leaq 0x7e41c(%rip), %rax     # 0x148909
movq %rax, -0x228(%rbp)
jmp 0xca5e8
leaq 0x7e40f(%rip), %rax     # 0x14890f
movq %rax, -0x228(%rbp)
jmp 0xca5e8
movb $0x1, -0x24a(%rbp)
movl $0x10, %edi
callq 0x71a0
movq %rax, -0x3b0(%rbp)
leaq -0x249(%rbp), %rdi
movq %rdi, -0x3a8(%rbp)
callq 0x7650
movq -0x3a8(%rbp), %rdx
leaq 0x7e3d0(%rip), %rsi     # 0x148915
leaq -0x248(%rbp), %rdi
callq 0x7520
jmp 0xca553
movq -0x3b0(%rbp), %rdi
leaq -0x248(%rbp), %rsi
callq 0x9c50
jmp 0xca568
movq -0x3b0(%rbp), %rdi
movb $0x0, -0x24a(%rbp)
leaq 0xe385b(%rip), %rsi     # 0x1addd8
leaq -0xc08f4(%rip), %rdx    # 0x9c90
callq 0x7610
jmp 0xcaa31
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
jmp 0xca5c0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
leaq -0x248(%rbp), %rdi
callq 0x7708
leaq -0x249(%rbp), %rdi
callq 0x73d0
testb $0x1, -0x24a(%rbp)
jne 0xca5d7
jmp 0xca5e3
movq -0x3b0(%rbp), %rdi
callq 0x72c0
jmp 0xcaa0d
movq -0x338(%rbp), %rsi
movq (%rsi), %rax
movq 0x98(%rax), %rax
leaq -0x270(%rbp), %rdi
leaq -0xf8(%rbp), %rdx
xorl %ecx, %ecx
callq *%rax
jmp 0xca60d
movq -0x348(%rbp), %rdi
leaq -0x270(%rbp), %rsi
movq %rsi, -0x3b8(%rbp)
callq 0x7430
movq -0x3b8(%rbp), %rdi
callq 0x7708
movq -0x348(%rbp), %rdi
leaq 0x82cec(%rip), %rsi     # 0x14d32d
callq 0x7340
jmp 0xca648
movl $0x0, -0x274(%rbp)
movl -0x274(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x18(%rcx), %eax
jae 0xca74c
movq -0x18(%rbp), %rdx
movq %rdx, %rsi
addq $0x18, %rsi
movq %rdx, %r9
addq $0x38, %r9
movl -0x274(%rbp), %ecx
movl 0x58(%rdx), %eax
movl 0x60(%rdx), %edx
imull %edx, %ecx
addl %ecx, %eax
movl %eax, -0x29c(%rbp)
leaq 0x7a864(%rip), %rcx     # 0x144ef9
movq %rsp, %rax
movq %rcx, 0x8(%rax)
leaq -0x29c(%rbp), %rcx
movq %rcx, (%rax)
leaq 0x7a680(%rip), %rdx     # 0x144d2d
leaq 0x82c79(%rip), %r8      # 0x14d32d
leaq -0x298(%rbp), %rdi
leaq -0x228(%rbp), %rcx
callq 0xdd2e0
jmp 0xca6c9
movq -0x348(%rbp), %rdi
leaq -0x298(%rbp), %rsi
callq 0x7470
jmp 0xca6de
leaq -0x298(%rbp), %rdi
callq 0x7708
movl -0x274(%rbp), %eax
addl $0x1, %eax
movq -0x20(%rbp), %rcx
cmpl 0x18(%rcx), %eax
jae 0xca736
movq -0x348(%rbp), %rdi
leaq 0x79e85(%rip), %rsi     # 0x14458f
callq 0x7340
jmp 0xca711
jmp 0xca736
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
leaq -0x298(%rbp), %rdi
callq 0x7708
jmp 0xcaa0d
jmp 0xca738
movl -0x274(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x274(%rbp)
jmp 0xca652
movq -0x348(%rbp), %rdi
leaq 0x7a79f(%rip), %rsi     # 0x144ef9
callq 0x7340
jmp 0xca761
jmp 0xca923
movq -0x338(%rbp), %rsi
movq (%rsi), %rax
movq 0x98(%rax), %rax
leaq -0x2c0(%rbp), %rdi
leaq -0xf8(%rbp), %rdx
xorl %ecx, %ecx
callq *%rax
jmp 0xca78b
movq -0x348(%rbp), %rdi
leaq -0x2c0(%rbp), %rsi
movq %rsi, -0x3c0(%rbp)
callq 0x7430
movq -0x3c0(%rbp), %rdi
callq 0x7708
movq -0x348(%rbp), %rdi
leaq 0x82b6e(%rip), %rsi     # 0x14d32d
callq 0x7340
jmp 0xca7c6
movl $0x0, -0x2c4(%rbp)
movl -0x2c4(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x18(%rcx), %eax
jae 0xca90c
movl $0x0, -0x2c8(%rbp)
movl -0x2c8(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x14(%rcx), %eax
jae 0xca8f6
movq -0x18(%rbp), %rdi
movq %rdi, %rsi
addq $0x18, %rsi
movq %rdi, %rcx
addq $0x38, %rcx
movl -0x2c4(%rbp), %edx
movq -0x20(%rbp), %rax
movl 0x10(%rax), %eax
shrl $0x3, %eax
imull %eax, %edx
movl 0x58(%rdi), %eax
movl 0x60(%rdi), %edi
addl %edx, %eax
movl -0x2c8(%rbp), %edx
imull %edi, %edx
addl %edx, %eax
movl %eax, -0x2ec(%rbp)
leaq 0x7e0e5(%rip), %rdx     # 0x14892a
leaq 0x7a6ad(%rip), %r9      # 0x144ef9
leaq -0x2e8(%rbp), %rdi
leaq -0x2ec(%rbp), %r8
callq 0xdd210
jmp 0xca861
movq -0x348(%rbp), %rdi
leaq -0x2e8(%rbp), %rsi
callq 0x7470
jmp 0xca876
leaq -0x2e8(%rbp), %rdi
callq 0x7708
movl -0x2c8(%rbp), %eax
addl $0x1, %eax
movq -0x20(%rbp), %rcx
cmpl 0x14(%rcx), %eax
jb 0xca8a6
movl -0x2c4(%rbp), %eax
addl $0x1, %eax
movq -0x20(%rbp), %rcx
cmpl 0x18(%rcx), %eax
jae 0xca8e0
movq -0x348(%rbp), %rdi
leaq 0x79cdb(%rip), %rsi     # 0x14458f
callq 0x7340
jmp 0xca8bb
jmp 0xca8e0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
leaq -0x2e8(%rbp), %rdi
callq 0x7708
jmp 0xcaa0d
jmp 0xca8e2
movl -0x2c8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c8(%rbp)
jmp 0xca7ed
jmp 0xca8f8
movl -0x2c4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c4(%rbp)
jmp 0xca7d0
movq -0x348(%rbp), %rdi
leaq 0x7a5df(%rip), %rsi     # 0x144ef9
callq 0x7340
jmp 0xca921
jmp 0xca923
jmp 0xca925
jmp 0xca927
movq -0x338(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq (%rsi), %rax
movq 0x168(%rax), %rax
leaq -0x310(%rbp), %rdi
leaq -0xf8(%rbp), %rcx
callq *%rax
jmp 0xca94e
leaq -0x310(%rbp), %rdi
callq 0x75f0
testb $0x1, %al
jne 0xca9c9
movq -0x348(%rbp), %rcx
leaq 0x829c1(%rip), %rdx     # 0x14d32d
leaq 0x7a586(%rip), %r8      # 0x144ef9
leaq -0x330(%rbp), %rdi
leaq -0x310(%rbp), %rsi
callq 0xdd3c0
jmp 0xca988
movq -0x348(%rbp), %rdi
leaq -0x330(%rbp), %rsi
callq 0x7430
leaq -0x330(%rbp), %rdi
callq 0x7708
jmp 0xca9c9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
leaq -0x310(%rbp), %rdi
callq 0x7708
jmp 0xcaa0d
movb $0x1, -0x17b(%rbp)
leaq -0x310(%rbp), %rdi
callq 0x7708
testb $0x1, -0x17b(%rbp)
jne 0xca9f1
movq -0x348(%rbp), %rdi
callq 0x7708
leaq -0xf8(%rbp), %rdi
callq 0x314e0
movq -0x340(%rbp), %rax
addq $0x3d0, %rsp            # imm = 0x3D0
popq %rbp
retq
movq -0x348(%rbp), %rdi
callq 0x7708
leaq -0xf8(%rbp), %rdi
callq 0x314e0
movq -0x128(%rbp), %rdi
callq 0x7640
nopw %cs:(%rax,%rax)