// File: jingdao[P]PointCloudApp/pcd.cpp
// Function: PCD::LoadFromBundler(char const*)
PCD* PCD::LoadFromBundler(const char* fileName) {
	FILE* f = fopen(fileName,"r");
	if (!f) {
		printf("Input file not found\n");
		return 0;
	}

	const int buffer_size = 1024;
	int num_cameras,num_points;
	char buf[buffer_size], *ptr;
	float focal_length,distortion1,distortion2;
	float rotation[9];
	float translation[3];
	float x,y,z;
	float rgb_f;
	int r,g,b,rgb;
	float* camera_positions, *camera_rotations;

	fgets(buf,buffer_size-1,f); //header
	fgets(buf,buffer_size-1,f); //num_cameras, num_points
	ptr=buf;
	num_cameras = strtol(ptr,&ptr,10);
	num_points = strtol(ptr,&ptr,10);
	camera_positions = new float[num_cameras * 3];
	camera_rotations = new float[num_cameras * 9];
	for (int i=0;i<num_cameras;i++) {
		fgets(buf,buffer_size-1,f); //read camera information
		if (!sscanf(buf, "%f %f %f",&focal_length,&distortion1,&distortion2) == 3) {
			printf("Error parsing %s\n",fileName);
			return NULL;
		}
		fgets(buf,buffer_size-1,f);
		if (!sscanf(buf, "%f %f %f",rotation,rotation+1,rotation+2) == 3) {
			printf("Error parsing %s\n",fileName);
			return NULL;
		}
		fgets(buf,buffer_size-1,f);
		if (!sscanf(buf, "%f %f %f",rotation+3,rotation+4,rotation+5) == 3) {
			printf("Error parsing %s\n",fileName);
			return NULL;
		}
		fgets(buf,buffer_size-1,f);
		if (!sscanf(buf, "%f %f %f",rotation+6,rotation+7,rotation+8) == 3) {
			printf("Error parsing %s\n",fileName);
			return NULL;
		}
		fgets(buf,buffer_size-1,f);
		if (!sscanf(buf, "%f %f %f",translation,translation+1,translation+2) == 3) {
			printf("Error parsing %s\n",fileName);
			return NULL;
		}
		memcpy(camera_positions + i * 3, translation, 3 * sizeof(float));
		memcpy(camera_rotations + i * 9, rotation, 9 * sizeof(float));
	}

	PCD* pointcloud = new PCD(num_points);
	float* data = pointcloud->float_data;
	std::vector<float> *lineInfo = new std::vector<float>[num_cameras];
	for (int i = 0; i < num_points; ++i) {
		fgets(buf,buffer_size-1,f); //read X,Y,Z position
		if (!sscanf(buf, "%f %f %f",&x,&y,&z) == 3) {
			printf("Error parsing %s\n",fileName);
			return NULL;
		}
		fgets(buf,buffer_size-1,f); //read R,G,B color
		if (!sscanf(buf, "%d %d %d",&r,&g,&b) == 3) {
			printf("Error parsing %s\n",fileName);
			return NULL;
		}
		rgb = ((r<<16)|(g<<8)|b);
		fgets(buf,buffer_size-1,f); //read view list
		ptr = buf;
		int numViews = strtol(ptr,&ptr,10);
		int cameraIndex;
//		int keyIndex;
//		float viewX,viewY;
		for (int i=0;i<numViews;i++) {
			cameraIndex = strtol(ptr,&ptr,10);
//			keyIndex = strtol(ptr,&ptr,10);
//			viewX = strtod(ptr,&ptr);
//			viewY = strtod(ptr,&ptr);
			strtol(ptr,&ptr,10);
			strtol(ptr,&ptr,10);
			strtol(ptr,&ptr,10);
			lineInfo[cameraIndex].push_back(x);
			lineInfo[cameraIndex].push_back(y);
			lineInfo[cameraIndex].push_back(z);
			lineInfo[cameraIndex].push_back(camera_positions[cameraIndex * 3]);
			lineInfo[cameraIndex].push_back(camera_positions[cameraIndex * 3 + 1]);
			lineInfo[cameraIndex].push_back(camera_positions[cameraIndex * 3 + 2]);
			lineInfo[cameraIndex].push_back(colormap(1.0*cameraIndex/num_cameras));
		}
		rgb_f = (float) rgb;
		*data++ = x;
		*data++ = y;
		*data++ = z;
		*data++ = rgb_f;
	}

	//draw lines from camera to keypoints on point cloud
	PCD lines(0);
	const float interval = 2;
	const int maxLines = 10;
	for (int j=0;j<num_cameras;j++) {
		int numLines = lineInfo[j].size() / 7;
		for (int i=0;i<numLines&&i<maxLines;i++) {
			lines.drawLine(
				lineInfo[j][i * 7],
				lineInfo[j][i * 7 + 1],
				lineInfo[j][i * 7 + 2],
				lineInfo[j][i * 7 + 3],
				lineInfo[j][i * 7 + 4],
				lineInfo[j][i * 7 + 5],
				lineInfo[j][i * 7 + 6],
				interval
			);
		}
	}
	lines.drawAxis(0,0,0,NULL,10,1);
	printf("Wrote %d points\n",lines.numPoints);
	lines.writeToPCD("p2.pcd");

	fclose(f);
	delete[] camera_positions;
	delete[] camera_rotations;
	delete[] lineInfo;
	return pointcloud;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x620, %rsp            # imm = 0x620
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
leaq 0xd7a2(%rip), %rsi      # 0x1378c
callq 0x2230
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x6015
leaq 0xd7be(%rip), %rdi      # 0x137bf
movb $0x0, %al
callq 0x2050
movq $0x0, -0x8(%rbp)
jmp 0x6ce6
movl $0x400, -0x1c(%rbp)     # imm = 0x400
leaq -0x430(%rbp), %rdi
movq -0x18(%rbp), %rdx
movl $0x3ff, %esi            # imm = 0x3FF
callq 0x2300
leaq -0x430(%rbp), %rdi
movq -0x18(%rbp), %rdx
movl $0x3ff, %esi            # imm = 0x3FF
callq 0x2300
leaq -0x430(%rbp), %rax
movq %rax, -0x438(%rbp)
movq -0x438(%rbp), %rdi
leaq -0x438(%rbp), %rsi
movl $0xa, %edx
callq 0x2270
movl %eax, -0x20(%rbp)
movq -0x438(%rbp), %rdi
leaq -0x438(%rbp), %rsi
movl $0xa, %edx
callq 0x2270
movl %eax, -0x24(%rbp)
imull $0x3, -0x20(%rbp), %eax
cltq
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x2040
movq %rax, -0x4a8(%rbp)
imull $0x9, -0x20(%rbp), %eax
cltq
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x2040
movq %rax, -0x4b0(%rbp)
movl $0x0, -0x4b4(%rbp)
movl -0x4b4(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x63b9
leaq -0x430(%rbp), %rdi
movq -0x18(%rbp), %rdx
movl $0x3ff, %esi            # imm = 0x3FF
callq 0x2300
leaq -0x430(%rbp), %rdi
leaq 0xd2c2(%rip), %rsi      # 0x133e4
leaq -0x43c(%rbp), %rdx
leaq -0x440(%rbp), %rcx
leaq -0x444(%rbp), %r8
movb $0x0, %al
callq 0x21e0
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x3, %eax
jne 0x616f
movq -0x10(%rbp), %rsi
leaq 0xd645(%rip), %rdi      # 0x137a0
movb $0x0, %al
callq 0x2050
movq $0x0, -0x8(%rbp)
jmp 0x6ce6
leaq -0x430(%rbp), %rdi
movq -0x18(%rbp), %rdx
movl $0x3ff, %esi            # imm = 0x3FF
callq 0x2300
leaq -0x430(%rbp), %rdi
leaq -0x470(%rbp), %rdx
leaq -0x470(%rbp), %rcx
addq $0x4, %rcx
leaq -0x470(%rbp), %r8
addq $0x8, %r8
leaq 0xd235(%rip), %rsi      # 0x133e4
movb $0x0, %al
callq 0x21e0
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x3, %eax
jne 0x61e7
movq -0x10(%rbp), %rsi
leaq 0xd5cd(%rip), %rdi      # 0x137a0
movb $0x0, %al
callq 0x2050
movq $0x0, -0x8(%rbp)
jmp 0x6ce6
leaq -0x430(%rbp), %rdi
movq -0x18(%rbp), %rdx
movl $0x3ff, %esi            # imm = 0x3FF
callq 0x2300
leaq -0x430(%rbp), %rdi
leaq -0x470(%rbp), %rdx
addq $0xc, %rdx
leaq -0x470(%rbp), %rcx
addq $0x10, %rcx
leaq -0x470(%rbp), %r8
addq $0x14, %r8
leaq 0xd1b9(%rip), %rsi      # 0x133e4
movb $0x0, %al
callq 0x21e0
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x3, %eax
jne 0x6263
movq -0x10(%rbp), %rsi
leaq 0xd551(%rip), %rdi      # 0x137a0
movb $0x0, %al
callq 0x2050
movq $0x0, -0x8(%rbp)
jmp 0x6ce6
leaq -0x430(%rbp), %rdi
movq -0x18(%rbp), %rdx
movl $0x3ff, %esi            # imm = 0x3FF
callq 0x2300
leaq -0x430(%rbp), %rdi
leaq -0x470(%rbp), %rdx
addq $0x18, %rdx
leaq -0x470(%rbp), %rcx
addq $0x1c, %rcx
leaq -0x470(%rbp), %r8
addq $0x20, %r8
leaq 0xd13d(%rip), %rsi      # 0x133e4
movb $0x0, %al
callq 0x21e0
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x3, %eax
jne 0x62df
movq -0x10(%rbp), %rsi
leaq 0xd4d5(%rip), %rdi      # 0x137a0
movb $0x0, %al
callq 0x2050
movq $0x0, -0x8(%rbp)
jmp 0x6ce6
leaq -0x430(%rbp), %rdi
movq -0x18(%rbp), %rdx
movl $0x3ff, %esi            # imm = 0x3FF
callq 0x2300
leaq -0x430(%rbp), %rdi
leaq -0x47c(%rbp), %rdx
leaq -0x47c(%rbp), %rcx
addq $0x4, %rcx
leaq -0x47c(%rbp), %r8
addq $0x8, %r8
leaq 0xd0c5(%rip), %rsi      # 0x133e4
movb $0x0, %al
callq 0x21e0
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x3, %eax
jne 0x6357
movq -0x10(%rbp), %rsi
leaq 0xd45d(%rip), %rdi      # 0x137a0
movb $0x0, %al
callq 0x2050
movq $0x0, -0x8(%rbp)
jmp 0x6ce6
movq -0x4a8(%rbp), %rax
imull $0x3, -0x4b4(%rbp), %ecx
movslq %ecx, %rcx
movq -0x47c(%rbp), %rdx
movq %rdx, (%rax,%rcx,4)
movl -0x474(%rbp), %edx
movl %edx, 0x8(%rax,%rcx,4)
movq -0x4b0(%rbp), %rdi
imull $0x9, -0x4b4(%rbp), %eax
cltq
shlq $0x2, %rax
addq %rax, %rdi
leaq -0x470(%rbp), %rsi
movl $0x24, %edx
callq 0x2180
movl -0x4b4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4b4(%rbp)
jmp 0x60f0
movl $0x78, %edi
callq 0x2200
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x590(%rbp)
movl -0x24(%rbp), %esi
callq 0x41e0
jmp 0x63da
movq -0x590(%rbp), %rax
movq %rax, -0x4c0(%rbp)
movq -0x4c0(%rbp), %rax
movq 0x58(%rax), %rax
movq %rax, -0x4d8(%rbp)
movslq -0x20(%rbp), %rax
movq %rax, -0x5a0(%rbp)
movl $0x18, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
addq $0x8, %rdi
setb %al
orb %al, %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x2040
movq %rax, %rcx
movq -0x5a0(%rbp), %rax
movq %rax, (%rcx)
addq $0x8, %rcx
movq %rcx, -0x598(%rbp)
cmpq $0x0, %rax
je 0x64a4
movq -0x598(%rbp), %rax
movq -0x5a0(%rbp), %rcx
imulq $0x18, %rcx, %rdx
movq %rax, %rcx
addq %rdx, %rcx
movq %rcx, -0x5b0(%rbp)
movq %rax, -0x5a8(%rbp)
movq -0x5a8(%rbp), %rdi
movq %rdi, -0x5b8(%rbp)
callq 0xab10
movq -0x5b8(%rbp), %rax
movq -0x5b0(%rbp), %rcx
addq $0x18, %rax
cmpq %rcx, %rax
movq %rax, -0x5a8(%rbp)
jne 0x6473
movq -0x598(%rbp), %rax
movq %rax, -0x4e0(%rbp)
movl $0x0, -0x4e4(%rbp)
movl -0x4e4(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x68cb
leaq -0x430(%rbp), %rdi
movq -0x18(%rbp), %rdx
movl $0x3ff, %esi            # imm = 0x3FF
callq 0x2300
leaq -0x430(%rbp), %rdi
leaq 0xcef6(%rip), %rsi      # 0x133e4
leaq -0x480(%rbp), %rdx
leaq -0x484(%rbp), %rcx
leaq -0x488(%rbp), %r8
movb $0x0, %al
callq 0x21e0
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x3, %eax
jne 0x6563
movq -0x10(%rbp), %rsi
leaq 0xd279(%rip), %rdi      # 0x137a0
movb $0x0, %al
callq 0x2050
movq $0x0, -0x8(%rbp)
jmp 0x6ce6
movq -0x590(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x4c8(%rbp)
movl %eax, -0x4cc(%rbp)
movl $0x78, %esi
callq 0x2210
jmp 0x6cf3
leaq -0x430(%rbp), %rdi
movq -0x18(%rbp), %rdx
movl $0x3ff, %esi            # imm = 0x3FF
callq 0x2300
leaq -0x430(%rbp), %rdi
leaq 0xd2be(%rip), %rsi      # 0x13844
leaq -0x490(%rbp), %rdx
leaq -0x494(%rbp), %rcx
leaq -0x498(%rbp), %r8
movb $0x0, %al
callq 0x21e0
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x3, %eax
jne 0x65d3
movq -0x10(%rbp), %rsi
leaq 0xd1e1(%rip), %rdi      # 0x137a0
movb $0x0, %al
callq 0x2050
movq $0x0, -0x8(%rbp)
jmp 0x6ce6
movl -0x490(%rbp), %eax
shll $0x10, %eax
movl -0x494(%rbp), %ecx
shll $0x8, %ecx
orl %ecx, %eax
orl -0x498(%rbp), %eax
movl %eax, -0x49c(%rbp)
leaq -0x430(%rbp), %rdi
movq -0x18(%rbp), %rdx
movl $0x3ff, %esi            # imm = 0x3FF
callq 0x2300
leaq -0x430(%rbp), %rax
movq %rax, -0x438(%rbp)
movq -0x438(%rbp), %rdi
leaq -0x438(%rbp), %rsi
movl $0xa, %edx
callq 0x2270
movl %eax, -0x4e8(%rbp)
movl $0x0, -0x4f0(%rbp)
movl -0x4f0(%rbp), %eax
cmpl -0x4e8(%rbp), %eax
jge 0x6823
movq -0x438(%rbp), %rdi
leaq -0x438(%rbp), %rsi
movl $0xa, %edx
callq 0x2270
movl %eax, -0x4ec(%rbp)
movq -0x438(%rbp), %rdi
leaq -0x438(%rbp), %rsi
movl $0xa, %edx
callq 0x2270
movq -0x438(%rbp), %rdi
leaq -0x438(%rbp), %rsi
movl $0xa, %edx
callq 0x2270
movq -0x438(%rbp), %rdi
leaq -0x438(%rbp), %rsi
movl $0xa, %edx
callq 0x2270
movq -0x4e0(%rbp), %rdi
movslq -0x4ec(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
leaq -0x480(%rbp), %rsi
callq 0xab30
movq -0x4e0(%rbp), %rdi
movslq -0x4ec(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
leaq -0x484(%rbp), %rsi
callq 0xab30
movq -0x4e0(%rbp), %rdi
movslq -0x4ec(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
leaq -0x488(%rbp), %rsi
callq 0xab30
movq -0x4e0(%rbp), %rdi
movslq -0x4ec(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
movq -0x4a8(%rbp), %rsi
imull $0x3, -0x4ec(%rbp), %eax
cltq
shlq $0x2, %rax
addq %rax, %rsi
callq 0xab30
movq -0x4e0(%rbp), %rdi
movslq -0x4ec(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
movq -0x4a8(%rbp), %rsi
imull $0x3, -0x4ec(%rbp), %eax
addl $0x1, %eax
cltq
shlq $0x2, %rax
addq %rax, %rsi
callq 0xab30
movq -0x4e0(%rbp), %rdi
movslq -0x4ec(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
movq -0x4a8(%rbp), %rsi
imull $0x3, -0x4ec(%rbp), %eax
addl $0x2, %eax
cltq
shlq $0x2, %rax
addq %rax, %rsi
callq 0xab30
movq -0x4e0(%rbp), %rax
movslq -0x4ec(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x5c0(%rbp)
cvtsi2sdl -0x4ec(%rbp), %xmm1
movsd 0xca7a(%rip), %xmm0     # 0x13258
mulsd %xmm1, %xmm0
cvtsi2sdl -0x20(%rbp), %xmm1
divsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
callq 0x4ab0
movq -0x5c0(%rbp), %rdi
movss %xmm0, -0x4f4(%rbp)
leaq -0x4f4(%rbp), %rsi
callq 0xac40
movl -0x4f0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4f0(%rbp)
jmp 0x663e
cvtsi2ssl -0x49c(%rbp), %xmm0
movss %xmm0, -0x48c(%rbp)
movss -0x480(%rbp), %xmm0
movq -0x4d8(%rbp), %rax
movq %rax, %rcx
addq $0x4, %rcx
movq %rcx, -0x4d8(%rbp)
movss %xmm0, (%rax)
movss -0x484(%rbp), %xmm0
movq -0x4d8(%rbp), %rax
movq %rax, %rcx
addq $0x4, %rcx
movq %rcx, -0x4d8(%rbp)
movss %xmm0, (%rax)
movss -0x488(%rbp), %xmm0
movq -0x4d8(%rbp), %rax
movq %rax, %rcx
addq $0x4, %rcx
movq %rcx, -0x4d8(%rbp)
movss %xmm0, (%rax)
movss -0x48c(%rbp), %xmm0
movq -0x4d8(%rbp), %rax
movq %rax, %rcx
addq $0x4, %rcx
movq %rcx, -0x4d8(%rbp)
movss %xmm0, (%rax)
movl -0x4e4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4e4(%rbp)
jmp 0x64bc
leaq -0x570(%rbp), %rdi
xorl %esi, %esi
callq 0x41e0
movss 0xca8b(%rip), %xmm0     # 0x1336c
movss %xmm0, -0x574(%rbp)
movl $0xa, -0x578(%rbp)
movl $0x0, -0x57c(%rbp)
movl -0x57c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x6b94
movq -0x4e0(%rbp), %rdi
movslq -0x57c(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
callq 0xaba0
movl $0x7, %ecx
xorl %edx, %edx
divq %rcx
movl %eax, -0x580(%rbp)
movl $0x0, -0x584(%rbp)
movl -0x584(%rbp), %ecx
xorl %eax, %eax
cmpl -0x580(%rbp), %ecx
movb %al, -0x5c1(%rbp)
jge 0x6966
cmpl $0xa, -0x584(%rbp)
setl %al
movb %al, -0x5c1(%rbp)
movb -0x5c1(%rbp), %al
testb $0x1, %al
jne 0x6975
jmp 0x6b7e
movq -0x4e0(%rbp), %rax
movslq -0x57c(%rbp), %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %rdi
movl -0x584(%rbp), %ecx
movl %ecx, %eax
shll $0x3, %eax
subl %ecx, %eax
movslq %eax, %rsi
callq 0xabc0
movss (%rax), %xmm0
movss %xmm0, -0x5dc(%rbp)
movq -0x4e0(%rbp), %rax
movslq -0x57c(%rbp), %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %rdi
movl -0x584(%rbp), %ecx
movl %ecx, %eax
shll $0x3, %eax
subl %ecx, %eax
incl %eax
movslq %eax, %rsi
callq 0xabc0
movss (%rax), %xmm0
movss %xmm0, -0x5d8(%rbp)
movq -0x4e0(%rbp), %rax
movslq -0x57c(%rbp), %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %rdi
movl -0x584(%rbp), %ecx
movl %ecx, %eax
shll $0x3, %eax
subl %ecx, %eax
addl $0x2, %eax
movslq %eax, %rsi
callq 0xabc0
movss (%rax), %xmm0
movss %xmm0, -0x5d4(%rbp)
movq -0x4e0(%rbp), %rax
movslq -0x57c(%rbp), %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %rdi
movl -0x584(%rbp), %ecx
movl %ecx, %eax
shll $0x3, %eax
subl %ecx, %eax
addl $0x3, %eax
movslq %eax, %rsi
callq 0xabc0
movss (%rax), %xmm0
movss %xmm0, -0x5d0(%rbp)
movq -0x4e0(%rbp), %rax
movslq -0x57c(%rbp), %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %rdi
movl -0x584(%rbp), %ecx
movl %ecx, %eax
shll $0x3, %eax
subl %ecx, %eax
addl $0x4, %eax
movslq %eax, %rsi
callq 0xabc0
movss (%rax), %xmm0
movss %xmm0, -0x5cc(%rbp)
movq -0x4e0(%rbp), %rax
movslq -0x57c(%rbp), %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %rdi
movl -0x584(%rbp), %ecx
movl %ecx, %eax
shll $0x3, %eax
subl %ecx, %eax
addl $0x5, %eax
movslq %eax, %rsi
callq 0xabc0
movss (%rax), %xmm0
movss %xmm0, -0x5c8(%rbp)
movq -0x4e0(%rbp), %rax
movslq -0x57c(%rbp), %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %rdi
movl -0x584(%rbp), %ecx
movl %ecx, %eax
shll $0x3, %eax
subl %ecx, %eax
addl $0x6, %eax
movslq %eax, %rsi
callq 0xabc0
movss -0x5dc(%rbp), %xmm0
movss -0x5d8(%rbp), %xmm1
movss -0x5d4(%rbp), %xmm2
movss -0x5d0(%rbp), %xmm3
movss -0x5cc(%rbp), %xmm4
movss -0x5c8(%rbp), %xmm5
movss (%rax), %xmm6
leaq -0x570(%rbp), %rdi
movss 0xc82e(%rip), %xmm7     # 0x1336c
callq 0x4410
jmp 0x6b45
jmp 0x6b47
movl -0x584(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x584(%rbp)
jmp 0x6940
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x4c8(%rbp)
movl %eax, -0x4cc(%rbp)
leaq -0x570(%rbp), %rdi
callq 0x4290
jmp 0x6cf3
jmp 0x6b80
movl -0x57c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x57c(%rbp)
jmp 0x68fd
xorl %eax, %eax
movl %eax, %esi
leaq -0x570(%rbp), %rdi
xorps %xmm2, %xmm2
movss 0xc7c6(%rip), %xmm3     # 0x13370
movss 0xc7ae(%rip), %xmm4     # 0x13360
movaps %xmm2, %xmm0
movaps %xmm2, %xmm1
callq 0x4640
jmp 0x6bbf
movl -0x510(%rbp), %esi
leaq 0xcc09(%rip), %rdi      # 0x137d5
xorl %eax, %eax
callq 0x2050
jmp 0x6bd5
leaq 0xcc0a(%rip), %rsi      # 0x137e6
leaq -0x570(%rbp), %rdi
callq 0x4c90
jmp 0x6bea
movq -0x18(%rbp), %rdi
callq 0x21f0
jmp 0x6bf5
movq -0x4a8(%rbp), %rax
movq %rax, -0x5e8(%rbp)
cmpq $0x0, %rax
je 0x6c15
movq -0x5e8(%rbp), %rdi
callq 0x2250
movq -0x4b0(%rbp), %rax
movq %rax, -0x5f0(%rbp)
cmpq $0x0, %rax
je 0x6c35
movq -0x5f0(%rbp), %rdi
callq 0x2250
movq -0x4e0(%rbp), %rax
movq %rax, -0x5f8(%rbp)
cmpq $0x0, %rax
je 0x6ccf
movq -0x5f8(%rbp), %rcx
movq %rcx, %rax
addq $-0x8, %rax
movq %rax, -0x610(%rbp)
movq -0x8(%rcx), %rax
movq %rax, -0x608(%rbp)
imulq $0x18, %rax, %rdx
movq %rcx, %rax
addq %rdx, %rax
cmpq %rax, %rcx
movq %rax, -0x600(%rbp)
je 0x6cb4
movq -0x600(%rbp), %rdi
addq $-0x18, %rdi
movq %rdi, -0x618(%rbp)
callq 0xabe0
movq -0x5f8(%rbp), %rcx
movq -0x618(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x600(%rbp)
jne 0x6c83
movq -0x610(%rbp), %rdi
movq -0x608(%rbp), %rax
imulq $0x18, %rax, %rsi
addq $0x8, %rsi
callq 0x23c0
movq -0x4c0(%rbp), %rax
movq %rax, -0x8(%rbp)
leaq -0x570(%rbp), %rdi
callq 0x4290
movq -0x8(%rbp), %rax
addq $0x620, %rsp            # imm = 0x620
popq %rbp
retq
movq -0x4c8(%rbp), %rdi
callq 0x2380
nop