// File: /workspace/github_c_makefile_star2_O0/Alessandro-Barbieri[P]SpaceLib/src/SPACELIB.c
// Function: velacctoWH2
int velacctoWH2(int jtype, int a, real qp, real qpp, MAT4 W, MAT4 H)
{
	int x, y, z;

	if (a<X || a>Z)
	{
		fprintf(stderr,"Error (velacctoWH2) : illegal axis");
		return (NOTOK);
	}
	if (jtype != Rev && jtype != Pri)
	{
		fprintf(stderr,"Error (velacctoWH2) : illegal joint type");
		return (NOTOK);
	}

	x=(a+1) % 3; y=(a+2) % 3; z=a;

	clear4(W);  clear4(H);

	if (jtype == Pri)                      /* Prismatic joint */
	{
		W[z][U] = qp;                  /* W[a][U] = qp;  ric 4.11.93*/
		H[z][U] = qpp;                 /* H[a][U] = qpp; ric 4.11.93*/
	}
	else                                   /* Revolute joint */
	{
		W[x][y] = -(W[y][x] = qp);
		H[x][y] = -(H[y][x] = qpp); H[x][x] = H[y][y] = -qp*qp;
	}
	return(OK);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl %edi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movsd %xmm0, -0x18(%rbp)
movsd %xmm1, -0x20(%rbp)
movq %rdx, -0x28(%rbp)
movq %rcx, -0x30(%rbp)
cmpl $0x0, -0xc(%rbp)
jl 0xbb2c
cmpl $0x2, -0xc(%rbp)
jle 0xbb50
movq 0x64c5(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
leaq 0x3924(%rip), %rsi      # 0xf461
movb $0x0, %al
callq 0x21b0
movl $0x0, -0x4(%rbp)
jmp 0xbcf5
cmpl $0x0, -0x8(%rbp)
je 0xbb80
cmpl $0x1, -0x8(%rbp)
je 0xbb80
movq 0x6495(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
leaq 0x3917(%rip), %rsi      # 0xf484
movb $0x0, %al
callq 0x21b0
movl $0x0, -0x4(%rbp)
jmp 0xbcf5
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl $0x3, %ecx
cltd
idivl %ecx
movl %edx, -0x34(%rbp)
movl -0xc(%rbp), %eax
addl $0x2, %eax
movl $0x3, %ecx
cltd
idivl %ecx
movl %edx, -0x38(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x3c(%rbp)
movq -0x28(%rbp), %rdi
movl $0x4, %edx
movl %edx, %esi
callq 0x2410
movq -0x30(%rbp), %rdi
movl $0x4, %edx
movl %edx, %esi
callq 0x2410
cmpl $0x1, -0x8(%rbp)
jne 0xbc05
movsd -0x18(%rbp), %xmm0
movq -0x28(%rbp), %rax
movslq -0x3c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movsd %xmm0, 0x18(%rax)
movsd -0x20(%rbp), %xmm0
movq -0x30(%rbp), %rax
movslq -0x3c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movsd %xmm0, 0x18(%rax)
jmp 0xbcee
movsd -0x18(%rbp), %xmm0
movq -0x28(%rbp), %rax
movslq -0x38(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movslq -0x34(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movq -0x28(%rbp), %rax
movslq -0x34(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movslq -0x38(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd -0x20(%rbp), %xmm0
movq -0x30(%rbp), %rax
movslq -0x38(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movslq -0x34(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movq -0x30(%rbp), %rax
movslq -0x34(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movslq -0x38(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd -0x18(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
mulsd -0x18(%rbp), %xmm0
movq -0x30(%rbp), %rax
movslq -0x38(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movslq -0x38(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0x30(%rbp), %rax
movslq -0x34(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movslq -0x34(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nop