#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ dmat_mul_a2(double **, double **, double **, double **,
                               double **, double **, int, double **, double **);
int /*<<< orphan*/ dmat_mul_a3(double **, double **, double **, double **,
                               double **, double **, int, double **, double **,
                               int, int);
int /*<<< orphan*/ dmat_scale_add_1x2(double **, double **, double **,
                                      double **, double **, double **, double,
                                      int);
void add_u_v_term_2(int n_quad, int n_stokes, double **a11, double **a12,
                    double **b11, double **b12, double **b21, double **b22,
                    double **c11, double **c12, double **u11, double **u12,
                    double **v11, double **v12, double **w11, double **w12,
                    double **x11, double **x12, double c0, double c1, double c2,
                    double c3, int symmetric) {
  int n_quad_v;
  n_quad_v = n_quad * n_stokes;
  if (!symmetric)
    dmat_mul_a2(a11, a12, b11, b12, b21, b22, n_quad_v, c11, c12);
  else
    dmat_mul_a3(a11, a12, b11, b12, b21, b22, n_quad_v, c11, c12, -1., 1);
  if (c0 != 0.)
    dmat_scale_add_1x2(u11, u12, c11, c12, u11, u12, c0, n_quad_v);
  if (c1 != 0.)
    dmat_scale_add_1x2(v11, v12, c11, c12, v11, v12, c1, n_quad_v);
  if (c2 != 0.)
    dmat_scale_add_1x2(w11, w12, c11, c12, w11, w12, c2, n_quad_v);
  if (c3 != 0.)
    dmat_scale_add_1x2(x11, x12, c11, c12, x11, x12, c3, n_quad_v);
}


x86 assembly (clang, -O0):
<add_u_v_term_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    0x70(%rbp),%eax
mov    0x68(%rbp),%rax
mov    0x60(%rbp),%rax
mov    0x58(%rbp),%rax
mov    0x50(%rbp),%rax
mov    0x48(%rbp),%rax
mov    0x40(%rbp),%rax
mov    0x38(%rbp),%rax
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
movsd  %xmm0,-0x30(%rbp)
movsd  %xmm1,-0x38(%rbp)
movsd  %xmm2,-0x40(%rbp)
movsd  %xmm3,-0x48(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0x4c(%rbp)
cmpl   $0x0,0x70(%rbp)
jne    11e8 <add_u_v_term_2+0xb8>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    0x10(%rbp),%r8
mov    0x18(%rbp),%r9
mov    -0x4c(%rbp),%r11d
mov    0x20(%rbp),%r10
mov    0x28(%rbp),%rax
mov    %r11d,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1030 <dmat_mul_a2@plt>
jmp    122f <add_u_v_term_2+0xff>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    0x10(%rbp),%r8
mov    0x18(%rbp),%r9
mov    -0x4c(%rbp),%r11d
mov    0x20(%rbp),%r10
mov    0x28(%rbp),%rax
mov    %r11d,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
movl   $0xffffffff,0x18(%rsp)
ff
movl   $0x1,0x20(%rsp)
call   1050 <dmat_mul_a3@plt>
movsd  -0x30(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    124c <add_u_v_term_2+0x11c>
jp     124c <add_u_v_term_2+0x11c>
jmp    1274 <add_u_v_term_2+0x144>
mov    0x30(%rbp),%rdi
mov    0x38(%rbp),%rsi
mov    0x20(%rbp),%rdx
mov    0x28(%rbp),%rcx
mov    0x30(%rbp),%r8
mov    0x38(%rbp),%r9
movsd  -0x30(%rbp),%xmm0
mov    -0x4c(%rbp),%eax
mov    %eax,(%rsp)
call   1040 <dmat_scale_add_1x2@plt>
movsd  -0x38(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1291 <add_u_v_term_2+0x161>
jp     1291 <add_u_v_term_2+0x161>
jmp    12b9 <add_u_v_term_2+0x189>
mov    0x40(%rbp),%rdi
mov    0x48(%rbp),%rsi
mov    0x20(%rbp),%rdx
mov    0x28(%rbp),%rcx
mov    0x40(%rbp),%r8
mov    0x48(%rbp),%r9
movsd  -0x38(%rbp),%xmm0
mov    -0x4c(%rbp),%eax
mov    %eax,(%rsp)
call   1040 <dmat_scale_add_1x2@plt>
movsd  -0x40(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    12d6 <add_u_v_term_2+0x1a6>
jp     12d6 <add_u_v_term_2+0x1a6>
jmp    12fe <add_u_v_term_2+0x1ce>
mov    0x50(%rbp),%rdi
mov    0x58(%rbp),%rsi
mov    0x20(%rbp),%rdx
mov    0x28(%rbp),%rcx
mov    0x50(%rbp),%r8
mov    0x58(%rbp),%r9
movsd  -0x40(%rbp),%xmm0
mov    -0x4c(%rbp),%eax
mov    %eax,(%rsp)
call   1040 <dmat_scale_add_1x2@plt>
movsd  -0x48(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    131b <add_u_v_term_2+0x1eb>
jp     131b <add_u_v_term_2+0x1eb>
jmp    1343 <add_u_v_term_2+0x213>
mov    0x60(%rbp),%rdi
mov    0x68(%rbp),%rsi
mov    0x20(%rbp),%rdx
mov    0x28(%rbp),%rcx
mov    0x60(%rbp),%r8
mov    0x68(%rbp),%r9
movsd  -0x48(%rbp),%xmm0
mov    -0x4c(%rbp),%eax
mov    %eax,(%rsp)
call   1040 <dmat_scale_add_1x2@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_u_v_term_2>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
movsd  %xmm3,0x18(%rsp)
movsd  %xmm2,0x10(%rsp)
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,(%rsp)
mov    %r9,%r10
mov    %r8,%rax
mov    %edi,%ebx
mov    0x58(%rsp),%r14
mov    0x50(%rsp),%r15
mov    0x48(%rsp),%r9
mov    0x40(%rsp),%r8
imul   %esi,%ebx
cmpl   $0x0,0xa0(%rsp)
je     119d <add_u_v_term_2+0x6d>
sub    $0x8,%rsp
mov    %rdx,%rdi
mov    %rcx,%rsi
mov    %rax,%rdx
mov    %r10,%rcx
push   $0x1
push   $0xffffffffffffffff
push   %r14
push   %r15
push   %rbx
call   1050 <dmat_mul_a3@plt>
add    $0x30,%rsp
jmp    11bb <add_u_v_term_2+0x8b>
sub    $0x8,%rsp
mov    %rdx,%rdi
mov    %rcx,%rsi
mov    %rax,%rdx
mov    %r10,%rcx
push   %r14
push   %r15
push   %rbx
call   1030 <dmat_mul_a2@plt>
add    $0x20,%rsp
xorpd  %xmm1,%xmm1
movsd  (%rsp),%xmm0
ucomisd %xmm1,%xmm0
jne    11cc <add_u_v_term_2+0x9c>
jnp    11f4 <add_u_v_term_2+0xc4>
mov    0x68(%rsp),%rsi
mov    0x60(%rsp),%rdi
sub    $0x8,%rsp
mov    %r15,%rdx
mov    %r14,%rcx
mov    %rdi,%r8
mov    %rsi,%r9
push   %rbx
call   1040 <dmat_scale_add_1x2@plt>
xorpd  %xmm1,%xmm1
add    $0x10,%rsp
movsd  0x8(%rsp),%xmm0
ucomisd %xmm1,%xmm0
jne    1202 <add_u_v_term_2+0xd2>
jnp    1226 <add_u_v_term_2+0xf6>
mov    0x78(%rsp),%rsi
mov    0x70(%rsp),%rdi
sub    $0x8,%rsp
mov    %r15,%rdx
mov    %r14,%rcx
mov    %rdi,%r8
mov    %rsi,%r9
push   %rbx
call   1040 <dmat_scale_add_1x2@plt>
add    $0x10,%rsp
xorpd  %xmm1,%xmm1
movsd  0x10(%rsp),%xmm0
ucomisd %xmm1,%xmm0
jne    1238 <add_u_v_term_2+0x108>
jnp    1266 <add_u_v_term_2+0x136>
mov    0x88(%rsp),%rsi
mov    0x80(%rsp),%rdi
sub    $0x8,%rsp
mov    %r15,%rdx
mov    %r14,%rcx
mov    %rdi,%r8
mov    %rsi,%r9
push   %rbx
call   1040 <dmat_scale_add_1x2@plt>
xorpd  %xmm1,%xmm1
add    $0x10,%rsp
movsd  0x18(%rsp),%xmm0
ucomisd %xmm1,%xmm0
jne    1274 <add_u_v_term_2+0x144>
jnp    12a0 <add_u_v_term_2+0x170>
mov    0x98(%rsp),%rsi
mov    0x90(%rsp),%rdi
sub    $0x8,%rsp
mov    %r15,%rdx
mov    %r14,%rcx
mov    %rdi,%r8
mov    %rsi,%r9
push   %rbx
call   1040 <dmat_scale_add_1x2@plt>
add    $0x30,%rsp
jmp    12a4 <add_u_v_term_2+0x174>
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @add_u_v_term_2(i32 %0, i32 %1, double** %2, double** %3, double** %4, double** %5, double** %6, double** %7, double** %8, double** %9, double** %10, double** %11, double** %12, double** %13, double** %14, double** %15, double** %16, double** %17, double %18, double %19, double %20, double %21, i32 %22) {
%24 = alloca i32
%25 = alloca i32
%26 = alloca double**
%27 = alloca double**
%28 = alloca double**
%29 = alloca double**
%30 = alloca double**
%31 = alloca double**
%32 = alloca double**
%33 = alloca double**
%34 = alloca double**
%35 = alloca double**
%36 = alloca double**
%37 = alloca double**
%38 = alloca double**
%39 = alloca double**
%40 = alloca double**
%41 = alloca double**
%42 = alloca double
%43 = alloca double
%44 = alloca double
%45 = alloca double
%46 = alloca i32
%47 = alloca i32
store i32 %0, i32* %24
store i32 %1, i32* %25
store double** %2, double*** %26
store double** %3, double*** %27
store double** %4, double*** %28
store double** %5, double*** %29
store double** %6, double*** %30
store double** %7, double*** %31
store double** %8, double*** %32
store double** %9, double*** %33
store double** %10, double*** %34
store double** %11, double*** %35
store double** %12, double*** %36
store double** %13, double*** %37
store double** %14, double*** %38
store double** %15, double*** %39
store double** %16, double*** %40
store double** %17, double*** %41
store double %18, double* %42
store double %19, double* %43
store double %20, double* %44
store double %21, double* %45
store i32 %22, i32* %46
%48 = load i32, i32* %24
%49 = load i32, i32* %25
%50 = mul nsw i32 %48, %49
store i32 %50, i32* %47
%51 = load i32, i32* %46
%52 = icmp ne i32 %51, 0
br i1 %52, label %64, label %53
53: ; preds = %23
%54 = load double**, double*** %26
%55 = load double**, double*** %27
%56 = load double**, double*** %28
%57 = load double**, double*** %29
%58 = load double**, double*** %30
%59 = load double**, double*** %31
%60 = load i32, i32* %47
%61 = load double**, double*** %32
%62 = load double**, double*** %33
%63 = call i32 @dmat_mul_a2(double** %54, double** %55, double** %56, double** %57, double** %58, double** %59, i32 %60, double** %61, double** %62)
br label %75
64: ; preds = %23
%65 = load double**, double*** %26
%66 = load double**, double*** %27
%67 = load double**, double*** %28
%68 = load double**, double*** %29
%69 = load double**, double*** %30
%70 = load double**, double*** %31
%71 = load i32, i32* %47
%72 = load double**, double*** %32
%73 = load double**, double*** %33
%74 = call i32 @dmat_mul_a3(double** %65, double** %66, double** %67, double** %68, double** %69, double** %70, i32 %71, double** %72, double** %73, i32 -1, i32 1)
br label %75
75: ; preds = %64, %53
%76 = load double, double* %42
%77 = fcmp une double %76, 0.000000e+00
br i1 %77, label %78, label %88
78: ; preds = %75
%79 = load double**, double*** %34
%80 = load double**, double*** %35
%81 = load double**, double*** %32
%82 = load double**, double*** %33
%83 = load double**, double*** %34
%84 = load double**, double*** %35
%85 = load double, double* %42
%86 = load i32, i32* %47
%87 = call i32 @dmat_scale_add_1x2(double** %79, double** %80, double** %81, double** %82, double** %83, double** %84, double %85, i32 %86)
br label %88
88: ; preds = %78, %75
%89 = load double, double* %43
%90 = fcmp une double %89, 0.000000e+00
br i1 %90, label %91, label %101
91: ; preds = %88
%92 = load double**, double*** %36
%93 = load double**, double*** %37
%94 = load double**, double*** %32
%95 = load double**, double*** %33
%96 = load double**, double*** %36
%97 = load double**, double*** %37
%98 = load double, double* %43
%99 = load i32, i32* %47
%100 = call i32 @dmat_scale_add_1x2(double** %92, double** %93, double** %94, double** %95, double** %96, double** %97, double %98, i32 %99)
br label %101
101: ; preds = %91, %88
%102 = load double, double* %44
%103 = fcmp une double %102, 0.000000e+00
br i1 %103, label %104, label %114
104: ; preds = %101
%105 = load double**, double*** %38
%106 = load double**, double*** %39
%107 = load double**, double*** %32
%108 = load double**, double*** %33
%109 = load double**, double*** %38
%110 = load double**, double*** %39
%111 = load double, double* %44
%112 = load i32, i32* %47
%113 = call i32 @dmat_scale_add_1x2(double** %105, double** %106, double** %107, double** %108, double** %109, double** %110, double %111, i32 %112)
br label %114
114: ; preds = %104, %101
%115 = load double, double* %45
%116 = fcmp une double %115, 0.000000e+00
br i1 %116, label %117, label %127
117: ; preds = %114
%118 = load double**, double*** %40
%119 = load double**, double*** %41
%120 = load double**, double*** %32
%121 = load double**, double*** %33
%122 = load double**, double*** %40
%123 = load double**, double*** %41
%124 = load double, double* %45
%125 = load i32, i32* %47
%126 = call i32 @dmat_scale_add_1x2(double** %118, double** %119, double** %120, double** %121, double** %122, double** %123, double %124, i32 %125)
br label %127
127: ; preds = %117, %114
ret void
}

LLVM IR (-O2):
define void @add_u_v_term_2(i32 %0, i32 %1, double** %2, double** %3, double** %4, double** %5, double** %6, double** %7, double** %8, double** %9, double** %10, double** %11, double** %12, double** %13, double** %14, double** %15, double** %16, double** %17, double %18, double %19, double %20, double %21, i32 %22) {
%24 = mul nsw i32 %1, %0
%25 = icmp eq i32 %22, 0
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = tail call i32 @dmat_mul_a2(double** %2, double** %3, double** %4, double** %5, double** %6, double** %7, i32 %24, double** %8, double** %9)
br label %30
28: ; preds = %23
%29 = tail call i32 @dmat_mul_a3(double** %2, double** %3, double** %4, double** %5, double** %6, double** %7, i32 %24, double** %8, double** %9, i32 -1, i32 1)
br label %30
30: ; preds = %28, %26
%31 = fcmp une double %18, 0.000000e+00
br i1 %31, label %32, label %34
32: ; preds = %30
%33 = tail call i32 @dmat_scale_add_1x2(double** %10, double** %11, double** %8, double** %9, double** %10, double** %11, double %18, i32 %24)
br label %34
34: ; preds = %32, %30
%35 = fcmp une double %19, 0.000000e+00
br i1 %35, label %36, label %38
36: ; preds = %34
%37 = tail call i32 @dmat_scale_add_1x2(double** %12, double** %13, double** %8, double** %9, double** %12, double** %13, double %19, i32 %24)
br label %38
38: ; preds = %36, %34
%39 = fcmp une double %20, 0.000000e+00
br i1 %39, label %40, label %42
40: ; preds = %38
%41 = tail call i32 @dmat_scale_add_1x2(double** %14, double** %15, double** %8, double** %9, double** %14, double** %15, double %20, i32 %24)
br label %42
42: ; preds = %40, %38
%43 = fcmp une double %21, 0.000000e+00
br i1 %43, label %44, label %46
44: ; preds = %42
%45 = tail call i32 @dmat_scale_add_1x2(double** %16, double** %17, double** %8, double** %9, double** %16, double** %17, double %21, i32 %24)
br label %46
46: ; preds = %44, %42
ret void
}