void ContactHessian(CH, q, qdot) double CH[6];
double q[2];
double qdot[2];
{
  double t1;
  double t10;
  double t11;
  double t12;
  double t13;
  double t14;
  double t18;
  double t2;
  double t20;
  double t22;
  double t23;
  double t3;
  double t4;
  double t5;
  double t6;
  double t7;
  double t8;
  {
    CH[0] = 0.0;
    t1 = q[0];
    t2 = cos(t1);
    t3 = qdot[0];
    t4 = t3 * t3;
    t5 = t2 * t4;
    t6 = q[1];
    t7 = cos(t6);
    t8 = t7 + 1.0;
    t10 = sin(t1);
    t11 = t10 * t3;
    t12 = sin(t6);
    t13 = qdot[1];
    t14 = t12 * t13;
    t18 = t13 * t13;
    t20 = t10 * t4;
    t22 = t2 * t3;
    t23 = t7 * t13;
    CH[1] = -t5 * t8 + 2.0 * t11 * t14 - t2 * t7 * t18 + t20 * t12 -
            2.0 * t22 * t23 + t10 * t12 * t18;
    CH[2] = 0.0;
    CH[3] = -t20 * t8 - 2.0 * t22 * t14 - t10 * t7 * t18 - t5 * t12 -
            2.0 * t11 * t23 - t2 * t12 * t18;
    CH[4] = 0.0;
    CH[5] = 0.0;
    return;
  }
}


x86 assembly (clang, -O0):
<ContactHessian>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x58(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x58(%rbp),%xmm0
mulsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
call   1040 <cos@plt>
movsd  %xmm0,-0x98(%rbp)
ff
movsd  0xe4e(%rip),%xmm0
addsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x20(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x90(%rbp),%xmm0
ff
call   1030 <sin@plt>
movsd  %xmm0,-0x38(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x58(%rbp),%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x98(%rbp),%xmm0
ff
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x88(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0xa0(%rbp),%xmm2
ff
movsd  0xd7b(%rip),%xmm1
mulsd  -0x30(%rbp),%xmm1
mulsd  -0x48(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x58(%rbp),%xmm1
mulsd  -0x98(%rbp),%xmm1
ff
movsd  -0x50(%rbp),%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xd1e(%rip),%xmm1
mulsd  -0x68(%rbp),%xmm1
movsd  -0x70(%rbp),%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x10(%rax)
movsd  -0x60(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0xa0(%rbp),%xmm2
ff
movsd  0xc9d(%rip),%xmm1
mulsd  -0x68(%rbp),%xmm1
mulsd  -0x48(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x28(%rbp),%xmm1
mulsd  -0x98(%rbp),%xmm1
ff
movsd  -0x50(%rbp),%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x38(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xc0f(%rip),%xmm1
mulsd  -0x30(%rbp),%xmm1
movsd  -0x70(%rbp),%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x18(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x20(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x28(%rax)
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ContactHessian>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rdi,%r14
movq   $0x0,(%rdi)
movsd  (%rsi),%xmm0
movsd  %xmm0,0x8(%rsp)
call   1040 <cos@plt>
movaps %xmm0,0x40(%rsp)
movsd  (%r15),%xmm0
movsd  %xmm0,0x10(%rsp)
mulsd  %xmm0,%xmm0
movsd  %xmm0,0x30(%rsp)
movsd  0x8(%rbx),%xmm0
movsd  %xmm0,0x20(%rsp)
call   1040 <cos@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0xe80(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x38(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x10(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x20(%rsp),%xmm0
call   1030 <sin@plt>
movsd  0x8(%r15),%xmm1
movapd %xmm0,%xmm11
mulsd  %xmm1,%xmm11
movsd  0x30(%rsp),%xmm6
movapd %xmm6,%xmm4
movsd  0x18(%rsp),%xmm14
mulsd  %xmm14,%xmm4
movapd 0x40(%rsp),%xmm8
movsd  0x10(%rsp),%xmm5
mulsd  %xmm8,%xmm5
movsd  0x28(%rsp),%xmm3
movapd %xmm3,%xmm10
mulsd  %xmm1,%xmm10
mulsd  %xmm1,%xmm1
movapd 0xe06(%rip),%xmm2
xorpd  %xmm8,%xmm2
mulsd  %xmm6,%xmm2
movsd  0x8(%rsp),%xmm7
addsd  %xmm7,%xmm7
movapd %xmm7,%xmm6
movapd %xmm7,%xmm9
mulsd  %xmm11,%xmm6
movapd %xmm2,%xmm7
movsd  0x38(%rsp),%xmm12
mulsd  %xmm12,%xmm7
addsd  %xmm6,%xmm7
movapd %xmm3,%xmm6
movapd %xmm3,%xmm13
mulsd  %xmm8,%xmm6
mulsd  %xmm1,%xmm6
subsd  %xmm6,%xmm7
movapd %xmm4,%xmm6
mulsd  %xmm0,%xmm6
movapd %xmm5,%xmm3
mulsd  0xd9f(%rip),%xmm3
addsd  %xmm7,%xmm6
movapd %xmm3,%xmm7
mulsd  %xmm10,%xmm7
addsd  %xmm6,%xmm7
movapd %xmm14,%xmm5
mulsd  %xmm14,%xmm13
mulsd  %xmm0,%xmm5
mulsd  %xmm1,%xmm5
addsd  %xmm7,%xmm5
movsd  %xmm5,0x8(%r14)
movq   $0x0,0x10(%r14)
movapd %xmm3,%xmm6
mulsd  %xmm11,%xmm6
mulsd  %xmm12,%xmm4
subsd  %xmm4,%xmm6
movapd %xmm13,%xmm4
mulsd  %xmm1,%xmm4
subsd  %xmm4,%xmm6
mulsd  %xmm0,%xmm2
addsd  %xmm6,%xmm2
mulsd  %xmm10,%xmm9
subsd  %xmm9,%xmm2
mulsd  %xmm8,%xmm0
mulsd  %xmm1,%xmm0
subsd  %xmm0,%xmm2
movsd  %xmm2,0x18(%r14)
xorpd  %xmm0,%xmm0
movupd %xmm0,0x20(%r14)
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @ContactHessian(double* %0, double* %1, double* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
%24 = load double*, double** %4
%25 = getelementptr inbounds double, double* %24, i64 0
store double 0.000000e+00, double* %25
%26 = load double*, double** %5
%27 = getelementptr inbounds double, double* %26, i64 0
%28 = load double, double* %27
store double %28, double* %7
%29 = load double, double* %7
%30 = call double @cos(double %29)
store double %30, double* %14
%31 = load double*, double** %6
%32 = getelementptr inbounds double, double* %31, i64 0
%33 = load double, double* %32
store double %33, double* %18
%34 = load double, double* %18
%35 = load double, double* %18
%36 = fmul double %34, %35
store double %36, double* %19
%37 = load double, double* %14
%38 = load double, double* %19
%39 = fmul double %37, %38
store double %39, double* %20
%40 = load double*, double** %5
%41 = getelementptr inbounds double, double* %40, i64 1
%42 = load double, double* %41
store double %42, double* %21
%43 = load double, double* %21
%44 = call double @cos(double %43)
store double %44, double* %22
%45 = load double, double* %22
%46 = fadd double %45, 1.000000e+00
store double %46, double* %23
%47 = load double, double* %7
%48 = call double @sin(double %47)
store double %48, double* %8
%49 = load double, double* %8
%50 = load double, double* %18
%51 = fmul double %49, %50
store double %51, double* %9
%52 = load double, double* %21
%53 = call double @sin(double %52)
store double %53, double* %10
%54 = load double*, double** %6
%55 = getelementptr inbounds double, double* %54, i64 1
%56 = load double, double* %55
store double %56, double* %11
%57 = load double, double* %10
%58 = load double, double* %11
%59 = fmul double %57, %58
store double %59, double* %12
%60 = load double, double* %11
%61 = load double, double* %11
%62 = fmul double %60, %61
store double %62, double* %13
%63 = load double, double* %8
%64 = load double, double* %19
%65 = fmul double %63, %64
store double %65, double* %15
%66 = load double, double* %14
%67 = load double, double* %18
%68 = fmul double %66, %67
store double %68, double* %16
%69 = load double, double* %22
%70 = load double, double* %11
%71 = fmul double %69, %70
store double %71, double* %17
%72 = load double, double* %20
%73 = fneg double %72
%74 = load double, double* %23
%75 = load double, double* %9
%76 = fmul double 2.000000e+00, %75
%77 = load double, double* %12
%78 = fmul double %76, %77
%79 = call double @llvm.fmuladd.f64(double %73, double %74, double %78)
%80 = load double, double* %14
%81 = load double, double* %22
%82 = fmul double %80, %81
%83 = load double, double* %13
%84 = fneg double %82
%85 = call double @llvm.fmuladd.f64(double %84, double %83, double %79)
%86 = load double, double* %15
%87 = load double, double* %10
%88 = call double @llvm.fmuladd.f64(double %86, double %87, double %85)
%89 = load double, double* %16
%90 = fmul double 2.000000e+00, %89
%91 = load double, double* %17
%92 = fneg double %90
%93 = call double @llvm.fmuladd.f64(double %92, double %91, double %88)
%94 = load double, double* %8
%95 = load double, double* %10
%96 = fmul double %94, %95
%97 = load double, double* %13
%98 = call double @llvm.fmuladd.f64(double %96, double %97, double %93)
%99 = load double*, double** %4
%100 = getelementptr inbounds double, double* %99, i64 1
store double %98, double* %100
%101 = load double*, double** %4
%102 = getelementptr inbounds double, double* %101, i64 2
store double 0.000000e+00, double* %102
%103 = load double, double* %15
%104 = fneg double %103
%105 = load double, double* %23
%106 = load double, double* %16
%107 = fmul double 2.000000e+00, %106
%108 = load double, double* %12
%109 = fmul double %107, %108
%110 = fneg double %109
%111 = call double @llvm.fmuladd.f64(double %104, double %105, double %110)
%112 = load double, double* %8
%113 = load double, double* %22
%114 = fmul double %112, %113
%115 = load double, double* %13
%116 = fneg double %114
%117 = call double @llvm.fmuladd.f64(double %116, double %115, double %111)
%118 = load double, double* %20
%119 = load double, double* %10
%120 = fneg double %118
%121 = call double @llvm.fmuladd.f64(double %120, double %119, double %117)
%122 = load double, double* %9
%123 = fmul double 2.000000e+00, %122
%124 = load double, double* %17
%125 = fneg double %123
%126 = call double @llvm.fmuladd.f64(double %125, double %124, double %121)
%127 = load double, double* %14
%128 = load double, double* %10
%129 = fmul double %127, %128
%130 = load double, double* %13
%131 = fneg double %129
%132 = call double @llvm.fmuladd.f64(double %131, double %130, double %126)
%133 = load double*, double** %4
%134 = getelementptr inbounds double, double* %133, i64 3
store double %132, double* %134
%135 = load double*, double** %4
%136 = getelementptr inbounds double, double* %135, i64 4
store double 0.000000e+00, double* %136
%137 = load double*, double** %4
%138 = getelementptr inbounds double, double* %137, i64 5
store double 0.000000e+00, double* %138
ret void
}

LLVM IR (-O2):
define void @ContactHessian(double* nocapture writeonly %0, double* nocapture %1, double* nocapture %2) {
store double 0.000000e+00, double* %0
%4 = load double, double* %1
%5 = tail call double @cos(double %4)
%6 = load double, double* %2
%7 = fmul double %6, %6
%8 = getelementptr inbounds double, double* %1, i64 1
%9 = load double, double* %8
%10 = tail call double @cos(double %9)
%11 = fadd double %10, 1.000000e+00
%12 = tail call double @sin(double %4)
%13 = fmul double %6, %12
%14 = tail call double @sin(double %9)
%15 = getelementptr inbounds double, double* %2, i64 1
%16 = load double, double* %15
%17 = fmul double %14, %16
%18 = fmul double %16, %16
%19 = fmul double %7, %12
%20 = fmul double %5, %6
%21 = fmul double %10, %16
%22 = fneg double %5
%23 = fmul double %7, %22
%24 = fmul double %13, 2.000000e+00
%25 = fmul double %24, %17
%26 = tail call double @llvm.fmuladd.f64(double %23, double %11, double %25)
%27 = fmul double %10, %22
%28 = tail call double @llvm.fmuladd.f64(double %27, double %18, double %26)
%29 = tail call double @llvm.fmuladd.f64(double %19, double %14, double %28)
%30 = fmul double %20, -2.000000e+00
%31 = tail call double @llvm.fmuladd.f64(double %30, double %21, double %29)
%32 = fmul double %12, %14
%33 = tail call double @llvm.fmuladd.f64(double %32, double %18, double %31)
%34 = getelementptr inbounds double, double* %0, i64 1
store double %33, double* %34
%35 = getelementptr inbounds double, double* %0, i64 2
store double 0.000000e+00, double* %35
%36 = fneg double %19
%37 = fmul double %30, %17
%38 = tail call double @llvm.fmuladd.f64(double %36, double %11, double %37)
%39 = fneg double %12
%40 = fmul double %10, %39
%41 = tail call double @llvm.fmuladd.f64(double %40, double %18, double %38)
%42 = tail call double @llvm.fmuladd.f64(double %23, double %14, double %41)
%43 = fneg double %24
%44 = tail call double @llvm.fmuladd.f64(double %43, double %21, double %42)
%45 = fmul double %14, %22
%46 = tail call double @llvm.fmuladd.f64(double %45, double %18, double %44)
%47 = getelementptr inbounds double, double* %0, i64 3
store double %46, double* %47
%48 = getelementptr inbounds double, double* %0, i64 4
%49 = bitcast double* %48 to i8*
ret void
}