// File: /workspace/github_c_makefile_star2_O2/veltzer[P]xmeltdown/src/draw.c
// Function: DrawSkel
void DrawSkel(SkeletonPtr s, GC gc, Window where)
{
	int xhip, yhip, xneck, yneck, xshoulder, yshoulder;
	int xhead, yhead;
	int x, y;

	double rsumt, lsumt;
	XPoint mypoints[7];

	x=s->waistx;
	y=s->waisty;

	s->rthigh.anchor=&torsoup;
	s->lthigh.anchor=&torsoup;
	s->rshin.anchor=&(s->rthigh);
	s->lshin.anchor=&(s->lthigh);
	s->rfoot.anchor=&(s->rshin);
	s->lfoot.anchor=&(s->lshin);
	s->rtricep.anchor=&(s->rbicep);
	s->ltricep.anchor=&(s->lbicep);
	s->rbicep.anchor=&torsodown;
	s->lbicep.anchor=&torsodown;

/*
** Get control points along the torso
*/
	xhip=(int) (0.5*s->torso.r*cos(s->torso.t));
	yhip=(int) (0.5*s->torso.r*sin(s->torso.t));
	xneck=-xhip;
	yneck=-yhip;
	xshoulder=(int) (0.75*xneck);
	yshoulder=(int) (0.75*yneck);

	xhead=(int) -((s->headradius+(0.5*s->torso.r))*cos(s->torso.t));
	yhead=(int) -((s->headradius+(0.5*s->torso.r))*sin(s->torso.t));

	xhip+=x;
	yhip+=y;
	xneck+=x;
	yneck+=y;
	xhead+=x;
	yhead+=y;
	xshoulder+=x;
	yshoulder+=y;

	waist.x=x;
	waist.y=y;
	waist.anchor=NULL;

	s->torso.anchor=&waist;
	s->torso.x=xhip;
	s->torso.y=yhip;

/*
** A ray from the hips pointing upwards, used as the anchor for the legs.
*/
	torsoup.x=xhip;
	torsoup.y=yhip;
	torsoup.t=s->torso.t;

/*
** A ray from the shoulders pointing downwards, the anchor for the arms.
*/
	torsodown.x=xshoulder;
	torsodown.y=yshoulder;
	torsodown.t=s->torso.t;

	mypoints[0].x=xhip;
	mypoints[0].y=yhip;
	mypoints[1].x=xneck;
	mypoints[1].y=yneck;

	DrawLines(mypoints, 2, gc, where);

/*
** Draw head
*/
	XDrawArc (dpy, where, gc,
		xhead-s->headradius, yhead-s->headradius,
		2*s->headradius,
		2*s->headradius,
		0, 360*64);

/*
** Get control points for arms
*/
	rsumt=s->torso.t;
	lsumt=s->torso.t;
	EndPoint(&(s->rbicep), rsumt);
	EndPoint(&(s->lbicep), lsumt);

	rsumt+=s->rbicep.t;
	lsumt+=s->lbicep.t;
	EndPoint(&(s->rtricep), rsumt);
	EndPoint(&(s->ltricep), lsumt);

	mypoints[0].x=s->rtricep.x;
	mypoints[0].y=s->rtricep.y;
	mypoints[1].x=s->rbicep.x;
	mypoints[1].y=s->rbicep.y;
	mypoints[2].x=xshoulder;
	mypoints[2].y=yshoulder;
	mypoints[3].x=s->lbicep.x;
	mypoints[3].y=s->lbicep.y;
	mypoints[4].x=s->ltricep.x;
	mypoints[4].y=s->ltricep.y;

	DrawLines(mypoints, 5, gc, where);

/*
** Get control points for legs
*/

	rsumt=s->torso.t;
	lsumt=s->torso.t;
	EndPoint(&(s->rthigh), rsumt);
	EndPoint(&(s->lthigh), lsumt);

	rsumt+=s->rthigh.t;
	lsumt+=s->lthigh.t;
	EndPoint(&(s->rshin), rsumt);
	EndPoint(&(s->lshin), lsumt);

	rsumt+=s->rshin.t;
	lsumt+=s->lshin.t;
	EndPoint(&(s->rfoot), rsumt);
	EndPoint(&(s->lfoot), lsumt);

	mypoints[0].x=s->rfoot.x;
	mypoints[0].y=s->rfoot.y;
	mypoints[1].x=s->rshin.x;
	mypoints[1].y=s->rshin.y;
	mypoints[2].x=s->rthigh.x;
	mypoints[2].y=s->rthigh.y;
	mypoints[3].x=xhip;
	mypoints[3].y=yhip;
	mypoints[4].x=s->lthigh.x;
	mypoints[4].y=s->lthigh.y;
	mypoints[5].x=s->lshin.x;
	mypoints[5].y=s->lshin.y;
	mypoints[6].x=s->lfoot.x;
	mypoints[6].y=s->lfoot.y;

	DrawLines(mypoints, 7, gc, where);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rdx, 0x38(%rsp)
movq %rsi, %r13
movq %rdi, %r15
leaq 0x30(%rdi), %rcx
movq %rcx, 0x60(%rsp)
leaq 0x37ba(%rip), %rax      # 0x5120
movq %rax, 0x48(%rdi)
leaq 0xd0(%rdi), %rsi
movq %rsi, 0x68(%rsp)
movq %rax, 0xe8(%rdi)
leaq 0x50(%rdi), %rdx
movq %rdx, 0x70(%rsp)
movq %rcx, 0x68(%rdi)
leaq 0xf0(%rdi), %rcx
movq %rcx, 0x78(%rsp)
movq %rsi, 0x108(%rdi)
leaq 0x70(%rdi), %rax
movq %rax, 0x80(%rsp)
movq %rdx, 0x88(%rdi)
leaq 0x110(%rdi), %rax
movq %rax, 0x88(%rsp)
movq %rcx, 0x128(%rdi)
leaq 0x90(%rdi), %rcx
movq %rcx, 0x40(%rsp)
leaq 0xb0(%rdi), %rax
movq %rax, 0x50(%rsp)
movq %rcx, 0xc8(%rdi)
leaq 0x130(%rdi), %rcx
movq %rcx, 0x48(%rsp)
leaq 0x150(%rdi), %rax
movq %rax, 0x58(%rsp)
movq %rcx, 0x168(%rdi)
leaq 0x3735(%rip), %rax      # 0x5140
movq %rax, 0xa8(%rdi)
movq %rax, 0x148(%rdi)
movsd 0x18(%rdi), %xmm0
movq 0x4(%rdi), %rbp
movq %rbp, %xmm1
movdqa %xmm1, (%rsp)
movss 0x10(%rdi), %xmm1
movaps %xmm1, 0x10(%rsp)
callq 0x10b0
movss 0x10(%r15), %xmm1
movaps 0x10(%rsp), %xmm2
unpcklps %xmm1, %xmm2            # xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
cvtdq2pd %xmm2, %xmm1
movaps %xmm0, 0x20(%rsp)
mulpd 0x1636(%rip), %xmm1     # 0x3090
movapd %xmm1, 0x10(%rsp)
movsd 0x18(%r15), %xmm0
callq 0x11a0
movapd 0x20(%rsp), %xmm1
unpcklpd %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
mulpd 0x10(%rsp), %xmm1
cvttpd2dq %xmm1, %xmm1
movapd %xmm1, 0x90(%rsp)
xorpd %xmm0, %xmm0
psubd %xmm1, %xmm0
cvtdq2pd %xmm0, %xmm0
mulpd 0x1604(%rip), %xmm0     # 0x30a0
cvttpd2dq %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
cvtsi2sdl (%r15), %xmm0
cvtsi2sdl 0x10(%r15), %xmm1
mulsd 0x1607(%rip), %xmm1     # 0x30c0
addsd %xmm0, %xmm1
movapd %xmm1, 0x20(%rsp)
movsd 0x18(%r15), %xmm0
callq 0x10b0
movapd 0x20(%rsp), %xmm2
xorpd 0x15d4(%rip), %xmm2     # 0x30b0
mulsd %xmm0, %xmm2
cvttsd2si %xmm2, %ebx
cvtsi2sdl (%r15), %xmm0
cvtsi2sdl 0x10(%r15), %xmm1
mulsd 0x15c9(%rip), %xmm1     # 0x30c0
addsd %xmm0, %xmm1
movapd %xmm1, 0x20(%rsp)
movsd 0x18(%r15), %xmm0
callq 0x11a0
movapd 0x20(%rsp), %xmm1
xorpd 0x1596(%rip), %xmm1     # 0x30b0
mulsd %xmm0, %xmm1
cvttsd2si %xmm1, %eax
movdqa (%rsp), %xmm2
movdqa %xmm2, %xmm0
movdqa 0x90(%rsp), %xmm5
paddd %xmm5, %xmm0
movd %xmm0, %ecx
movl %ecx, 0x20(%rsp)
pshufd $0x55, %xmm2, %xmm1     # xmm1 = xmm2[1,1,1,1]
movdqa %xmm2, %xmm4
movd %xmm1, %r14d
addl %eax, %r14d
pshufd $0x55, %xmm0, %xmm2     # xmm2 = xmm0[1,1,1,1]
movd %xmm2, %edx
movl %edx, 0x34(%rsp)
addl %ebp, %ebx
movdqa 0x10(%rsp), %xmm3
paddd %xmm4, %xmm3
movdqa %xmm3, 0x10(%rsp)
movl %ebp, 0x35fa(%rip)      # 0x5170
movd %xmm1, 0x35f6(%rip)     # 0x5174
andq $0x0, 0x35f2(%rip)      # 0x5178
leaq 0x35d3(%rip), %rax      # 0x5160
movq %rax, 0x28(%r15)
movd %xmm0, 0x20(%r15)
movd %xmm2, 0x24(%r15)
movd %xmm0, 0x358b(%rip)     # 0x5130
movd %xmm2, 0x3587(%rip)     # 0x5134
movsd 0x18(%r15), %xmm0
movsd %xmm0, 0x356d(%rip)     # 0x5128
movq %xmm3, 0x358d(%rip)     # 0x5150
movsd %xmm0, 0x357d(%rip)     # 0x5148
leaq 0xa0(%rsp), %rbp
movw %cx, (%rbp)
movw %dx, 0x2(%rbp)
psubd %xmm5, %xmm4
pshuflw $0xe8, %xmm4, %xmm0     # xmm0 = xmm4[0,2,2,3,4,5,6,7]
movd %xmm0, 0x4(%rbp)
pushq $0x2
popq %rsi
movq %rbp, %rdi
movq %r13, %rdx
movq 0x38(%rsp), %r12
movq %r12, %rcx
callq 0x1e3a
movq 0x357a(%rip), %rdi      # 0x5180
movl (%r15), %r9d
subl %r9d, %ebx
subl %r9d, %r14d
addl %r9d, %r9d
subq $0x8, %rsp
movq %r12, %rsi
movq %r13, %rdx
movl %ebx, %ecx
movl %r14d, %r8d
pushq $0x5a00                 # imm = 0x5A00
pushq $0x0
pushq %r9
callq 0x1160
addq $0x20, %rsp
movsd 0x18(%r15), %xmm0
movsd %xmm0, (%rsp)
movq 0x40(%rsp), %rdi
callq 0x1e55
movq 0x48(%rsp), %rdi
movsd (%rsp), %xmm0
callq 0x1e55
movsd 0x98(%r15), %xmm0
movsd (%rsp), %xmm1
addsd %xmm1, %xmm0
addsd 0x138(%r15), %xmm1
movsd %xmm1, (%rsp)
movq 0x50(%rsp), %rdi
callq 0x1e55
movq 0x58(%rsp), %rdi
movsd (%rsp), %xmm0
callq 0x1e55
movq 0xc0(%r15), %xmm0
pshuflw $0xe8, %xmm0, %xmm0     # xmm0 = xmm0[0,2,2,3,4,5,6,7]
movd %xmm0, (%rbp)
movq 0xa0(%r15), %xmm0
pshuflw $0xe8, %xmm0, %xmm0     # xmm0 = xmm0[0,2,2,3,4,5,6,7]
movd %xmm0, 0x4(%rbp)
pshuflw $0xe8, 0x10(%rsp), %xmm0 # xmm0 = mem[0,2,2,3,4,5,6,7]
movd %xmm0, 0x8(%rbp)
movq 0x140(%r15), %xmm0
pshuflw $0xe8, %xmm0, %xmm0     # xmm0 = xmm0[0,2,2,3,4,5,6,7]
movd %xmm0, 0xc(%rbp)
movq 0x160(%r15), %xmm0
pshuflw $0xe8, %xmm0, %xmm0     # xmm0 = xmm0[0,2,2,3,4,5,6,7]
movd %xmm0, 0x10(%rbp)
pushq $0x5
popq %rsi
movq %rbp, %rdi
movq %r13, %rdx
movq %r12, %rcx
callq 0x1e3a
movsd 0x18(%r15), %xmm0
movsd %xmm0, (%rsp)
movq 0x60(%rsp), %rdi
callq 0x1e55
movq 0x68(%rsp), %rdi
movsd (%rsp), %xmm0
callq 0x1e55
movsd 0x38(%r15), %xmm0
movsd (%rsp), %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
addsd 0xd8(%r15), %xmm1
movsd %xmm1, (%rsp)
movq 0x70(%rsp), %rdi
callq 0x1e55
movq 0x78(%rsp), %rdi
movsd (%rsp), %xmm0
callq 0x1e55
movsd 0x10(%rsp), %xmm1
addsd 0x58(%r15), %xmm1
movsd (%rsp), %xmm0
addsd 0xf8(%r15), %xmm0
movsd %xmm0, (%rsp)
movq 0x80(%rsp), %rdi
movapd %xmm1, %xmm0
callq 0x1e55
movq 0x88(%rsp), %rdi
movsd (%rsp), %xmm0
callq 0x1e55
movq 0x80(%r15), %xmm0
pshuflw $0xe8, %xmm0, %xmm0     # xmm0 = xmm0[0,2,2,3,4,5,6,7]
movd %xmm0, (%rbp)
movq 0x60(%r15), %xmm0
pshuflw $0xe8, %xmm0, %xmm0     # xmm0 = xmm0[0,2,2,3,4,5,6,7]
movd %xmm0, 0x4(%rbp)
movq 0x40(%r15), %xmm0
pshuflw $0xe8, %xmm0, %xmm0     # xmm0 = xmm0[0,2,2,3,4,5,6,7]
movd %xmm0, 0x8(%rbp)
movl 0x20(%rsp), %eax
movw %ax, 0xc(%rbp)
movl 0x34(%rsp), %eax
movw %ax, 0xe(%rbp)
movq 0xe0(%r15), %xmm0
pshuflw $0xe8, %xmm0, %xmm0     # xmm0 = xmm0[0,2,2,3,4,5,6,7]
movd %xmm0, 0x10(%rbp)
movq 0x100(%r15), %xmm0
pshuflw $0xe8, %xmm0, %xmm0     # xmm0 = xmm0[0,2,2,3,4,5,6,7]
movd %xmm0, 0x14(%rbp)
movq 0x120(%r15), %xmm0
pshuflw $0xe8, %xmm0, %xmm0     # xmm0 = xmm0[0,2,2,3,4,5,6,7]
movd %xmm0, 0x18(%rbp)
pushq $0x7
popq %rsi
movq %rbp, %rdi
movq %r13, %rdx
movq %r12, %rcx
callq 0x1e3a
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq