int V_blendOnEntityDrv(int index, int etype, double *L, double mdrv[3]) {
  if (etype == 1) {
    if (index == 0)
      mdrv[0] = -0.5;
    else
      mdrv[0] = +0.5;
    return 1;
  } else if (etype == 2) {
    mdrv[0] = mdrv[1] = 0.0;
    if (index == 2)
      mdrv[0] = mdrv[1] = -1.0;
    else
      mdrv[index] = 1.0;
    return 1;
  } else if (etype == 4) {
    mdrv[0] = mdrv[1] = mdrv[2] = 0.0;
    if (index == 3)
      mdrv[0] = mdrv[1] = mdrv[2] = -1.0;
    else
      mdrv[index] = 1.0;
    return 1;
  } else
    return 0;
}


x86 assembly (clang, -O0):
<V_blendOnEntityDrv>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    1157 <V_blendOnEntityDrv+0x57>
cmpl   $0x0,-0x8(%rbp)
jne    113b <V_blendOnEntityDrv+0x3b>
mov    -0x20(%rbp),%rax
movsd  0xee6(%rip),%xmm0
movsd  %xmm0,(%rax)
jmp    114b <V_blendOnEntityDrv+0x4b>
mov    -0x20(%rbp),%rax
movsd  0xec9(%rip),%xmm0
movsd  %xmm0,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    125f <V_blendOnEntityDrv+0x15f>
cmpl   $0x2,-0xc(%rbp)
jne    11c9 <V_blendOnEntityDrv+0xc9>
mov    -0x20(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x20(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
cmpl   $0x2,-0x8(%rbp)
jne    11a8 <V_blendOnEntityDrv+0xa8>
mov    -0x20(%rbp),%rax
movsd  0xe7a(%rip),%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x20(%rbp),%rax
movsd  0xe69(%rip),%xmm0
movsd  %xmm0,(%rax)
jmp    11bd <V_blendOnEntityDrv+0xbd>
mov    -0x20(%rbp),%rax
movslq -0x8(%rbp),%rcx
movsd  0xe48(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x1,-0x4(%rbp)
jmp    125f <V_blendOnEntityDrv+0x15f>
cmpl   $0x4,-0xc(%rbp)
jne    1258 <V_blendOnEntityDrv+0x158>
mov    -0x20(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x10(%rax)
mov    -0x20(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x20(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
cmpl   $0x3,-0x8(%rbp)
jne    1237 <V_blendOnEntityDrv+0x137>
mov    -0x20(%rbp),%rax
movsd  0xdfc(%rip),%xmm0
movsd  %xmm0,0x10(%rax)
mov    -0x20(%rbp),%rax
movsd  0xdeb(%rip),%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x20(%rbp),%rax
movsd  0xdda(%rip),%xmm0
movsd  %xmm0,(%rax)
jmp    124c <V_blendOnEntityDrv+0x14c>
mov    -0x20(%rbp),%rax
movslq -0x8(%rbp),%rcx
movsd  0xdb9(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x1,-0x4(%rbp)
jmp    125f <V_blendOnEntityDrv+0x15f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<V_blendOnEntityDrv>:
cmp    $0x4,%esi
je     1137 <V_blendOnEntityDrv+0x37>
cmp    $0x2,%esi
je     112a <V_blendOnEntityDrv+0x2a>
xor    %eax,%eax
cmp    $0x1,%esi
jne    117a <V_blendOnEntityDrv+0x7a>
xor    %eax,%eax
test   %edi,%edi
sete   %al
lea    0xef1(%rip),%rdx
movsd  (%rdx,%rax,8),%xmm0
movsd  %xmm0,(%rcx)
jmp    1175 <V_blendOnEntityDrv+0x75>
xorps  %xmm0,%xmm0
movups %xmm0,(%rcx)
cmp    $0x2,%edi
je     1158 <V_blendOnEntityDrv+0x58>
jmp    1164 <V_blendOnEntityDrv+0x64>
xorps  %xmm0,%xmm0
movups %xmm0,(%rcx)
movq   $0x0,0x10(%rcx)
cmp    $0x3,%edi
jne    1164 <V_blendOnEntityDrv+0x64>
movabs $0xbff0000000000000,%rax
mov    %rax,0x10(%rcx)
movaps 0xea1(%rip),%xmm0
movups %xmm0,(%rcx)
jmp    1175 <V_blendOnEntityDrv+0x75>
movslq %edi,%rax
movabs $0x3ff0000000000000,%rdx
mov    %rdx,(%rcx,%rax,8)
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @V_blendOnEntityDrv(i32 %0, i32 %1, double* %2, double* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca double*
%9 = alloca double*
store i32 %0, i32* %6
store i32 %1, i32* %7
store double* %2, double** %8
store double* %3, double** %9
%10 = load i32, i32* %7
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %22
12: ; preds = %4
%13 = load i32, i32* %6
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = load double*, double** %9
%17 = getelementptr inbounds double, double* %16, i64 0
store double -5.000000e-01, double* %17
br label %21
18: ; preds = %12
%19 = load double*, double** %9
%20 = getelementptr inbounds double, double* %19, i64 0
store double 5.000000e-01, double* %20
br label %21
21: ; preds = %18, %15
store i32 1, i32* %5
br label %69
22: ; preds = %4
%23 = load i32, i32* %7
%24 = icmp eq i32 %23, 2
br i1 %24, label %25, label %43
25: ; preds = %22
%26 = load double*, double** %9
%27 = getelementptr inbounds double, double* %26, i64 1
store double 0.000000e+00, double* %27
%28 = load double*, double** %9
%29 = getelementptr inbounds double, double* %28, i64 0
store double 0.000000e+00, double* %29
%30 = load i32, i32* %6
%31 = icmp eq i32 %30, 2
br i1 %31, label %32, label %37
32: ; preds = %25
%33 = load double*, double** %9
%34 = getelementptr inbounds double, double* %33, i64 1
store double -1.000000e+00, double* %34
%35 = load double*, double** %9
%36 = getelementptr inbounds double, double* %35, i64 0
store double -1.000000e+00, double* %36
br label %42
37: ; preds = %25
%38 = load double*, double** %9
%39 = load i32, i32* %6
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds double, double* %38, i64 %40
store double 1.000000e+00, double* %41
br label %42
42: ; preds = %37, %32
store i32 1, i32* %5
br label %69
43: ; preds = %22
%44 = load i32, i32* %7
%45 = icmp eq i32 %44, 4
br i1 %45, label %46, label %68
46: ; preds = %43
%47 = load double*, double** %9
%48 = getelementptr inbounds double, double* %47, i64 2
store double 0.000000e+00, double* %48
%49 = load double*, double** %9
%50 = getelementptr inbounds double, double* %49, i64 1
store double 0.000000e+00, double* %50
%51 = load double*, double** %9
%52 = getelementptr inbounds double, double* %51, i64 0
store double 0.000000e+00, double* %52
%53 = load i32, i32* %6
%54 = icmp eq i32 %53, 3
br i1 %54, label %55, label %62
55: ; preds = %46
%56 = load double*, double** %9
%57 = getelementptr inbounds double, double* %56, i64 2
store double -1.000000e+00, double* %57
%58 = load double*, double** %9
%59 = getelementptr inbounds double, double* %58, i64 1
store double -1.000000e+00, double* %59
%60 = load double*, double** %9
%61 = getelementptr inbounds double, double* %60, i64 0
store double -1.000000e+00, double* %61
br label %67
62: ; preds = %46
%63 = load double*, double** %9
%64 = load i32, i32* %6
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds double, double* %63, i64 %65
store double 1.000000e+00, double* %66
br label %67
67: ; preds = %62, %55
store i32 1, i32* %5
br label %69
68: ; preds = %43
store i32 0, i32* %5
br label %69
69: ; preds = %68, %67, %42, %21
%70 = load i32, i32* %5
ret i32 %70
}

LLVM IR (-O2):
define i32 @V_blendOnEntityDrv(i32 %0, i32 %1, double* nocapture readnone %2, double* nocapture writeonly %3) {
switch i32 %1, label %25 [
i32 1, label %5
i32 2, label %8
i32 4, label %16
]
5: ; preds = %4
%6 = icmp eq i32 %0, 0
%7 = select i1 %6, double -5.000000e-01, double 5.000000e-01
store double %7, double* %3
br label %25
8: ; preds = %4
%9 = icmp eq i32 %0, 2
%10 = bitcast double* %3 to i8*
br i1 %9, label %11, label %13
11: ; preds = %8
%12 = bitcast double* %3 to <2 x double>*
store <2 x double> <double -1.000000e+00, double -1.000000e+00>, <2 x double>* %12
br label %25
13: ; preds = %8
%14 = sext i32 %0 to i64
%15 = getelementptr inbounds double, double* %3, i64 %14
store double 1.000000e+00, double* %15
br label %25
16: ; preds = %4
%17 = icmp eq i32 %0, 3
%18 = bitcast double* %3 to i8*
br i1 %17, label %19, label %22
19: ; preds = %16
%20 = getelementptr inbounds double, double* %3, i64 2
store double -1.000000e+00, double* %20
%21 = bitcast double* %3 to <2 x double>*
store <2 x double> <double -1.000000e+00, double -1.000000e+00>, <2 x double>* %21
br label %25
22: ; preds = %16
%23 = sext i32 %0 to i64
%24 = getelementptr inbounds double, double* %3, i64 %23
store double 1.000000e+00, double* %24
br label %25
25: ; preds = %4, %19, %22, %11, %13, %5
%26 = phi i32 [ 1, %5 ], [ 1, %13 ], [ 1, %11 ], [ 1, %22 ], [ 1, %19 ], [ 0, %4 ]
ret i32 %26
}