#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 */
typedef scalar_t__ z;
typedef scalar_t__ y;
typedef scalar_t__ x;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
void matprod_trans1_k2(double *restrict x, double *restrict y,
                       double *restrict z, int n, int m) {
  assert(((uintptr_t)(x) & (1 - 1)) == 0);
  assert(((uintptr_t)(y) & (1 - 1)) == 0);
  assert(((uintptr_t)(z) & (1 - 1)) == 0);
  x = (x);
  y = (y);
  z = (z);
  {
    double *e = y + m + m;
    while (y < e) {
      double t0 = y[0];
      double t1 = y[1];
      double *p = x;
      int i = 0;
      while (i <= n - 2) {
        z[0] = p[0] * t0 + p[1] * t1;
        z[1] = p[2] * t0 + p[3] * t1;
        z += 2;
        p += 4;
        i += 2;
      }
      if (i < n) {
        z[0] = p[0] * t0 + p[1] * t1;
        z += 1;
      }
      y += 2;
    }
  }
}


x86 assembly (clang, -O0):
<matprod_trans1_k2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    -0x8(%rbp),%rax
and    $0x0,%rax
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rax
and    $0x0,%rax
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x18(%rbp),%rax
and    $0x0,%rax
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x28(%rbp),%rax
jae    12c7 <matprod_trans1_k2+0x1b7>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    -0x1c(%rbp),%ecx
sub    $0x2,%ecx
cmp    %ecx,%eax
jg     1273 <matprod_trans1_k2+0x163>
mov    -0x40(%rbp),%rax
movsd  (%rax),%xmm0
movsd  -0x30(%rbp),%xmm2
mov    -0x40(%rbp),%rax
movsd  0x8(%rax),%xmm1
mulsd  -0x38(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x40(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  -0x30(%rbp),%xmm2
mov    -0x40(%rbp),%rax
movsd  0x18(%rax),%xmm1
mulsd  -0x38(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x18(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x18(%rbp)
mov    -0x40(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x40(%rbp)
mov    -0x44(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x44(%rbp)
jmp    11e4 <matprod_trans1_k2+0xd4>
mov    -0x44(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    12b6 <matprod_trans1_k2+0x1a6>
mov    -0x40(%rbp),%rax
movsd  (%rax),%xmm0
movsd  -0x30(%rbp),%xmm2
mov    -0x40(%rbp),%rax
movsd  0x8(%rax),%xmm1
mulsd  -0x38(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x10(%rbp)
jmp    11ac <matprod_trans1_k2+0x9c>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<matprod_trans1_k2>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r8d,%ebx
mov    %ecx,%r14d
mov    %rdx,%rbp
mov    %rsi,%r15
mov    %rdi,%r13
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
movslq %ebx,%rax
lea    (%r15,%rax,8),%rcx
lea    (%rcx,%rax,8),%rax
cmp    %r15,%rax
jbe    1348 <matprod_trans1_k2+0x238>
lea    -0x2(%r14),%ecx
mov    %r14d,%edx
and    $0xfffffffe,%edx
mov    %ecx,%r10d
shr    %r10d
lea    (%r10,%r10,1),%rsi
add    $0x2,%rsi
mov    %rsi,0x20(%rsp)
mov    %r10,%rsi
shl    $0x5,%rsi
lea    (%rsi,%r13,1),%r9
add    $0x20,%r9
add    $0x1,%r10d
mov    %r10d,%r8d
and    $0xfffffffe,%r8d
lea    (%r8,%r8,1),%esi
mov    %esi,0xc(%rsp)
mov    %r8,%rsi
shl    $0x5,%rsi
add    %r13,%rsi
mov    %rsi,0x18(%rsp)
lea    (%r8,%r8,1),%rsi
mov    %rsi,0x10(%rsp)
jmp    11d0 <matprod_trans1_k2+0xc0>
nopl   0x0(%rax,%rax,1)
add    $0x10,%r15
mov    %rbx,%rbp
cmp    %rax,%r15
jae    1348 <matprod_trans1_k2+0x238>
movsd  (%r15),%xmm0
movsd  0x8(%r15),%xmm1
cmp    $0x2,%r14d
jge    11f0 <matprod_trans1_k2+0xe0>
mov    %rbp,%rbx
mov    %r13,%r12
xor    %esi,%esi
jmp    126f <matprod_trans1_k2+0x15f>
xchg   %ax,%ax
xor    %r11d,%r11d
cmp    $0x2,%ecx
jb     121a <matprod_trans1_k2+0x10a>
cmp    %r9,%rbp
jae    1296 <matprod_trans1_k2+0x186>
mov    0x20(%rsp),%rsi
lea    0x0(,%rsi,8),%rsi
add    %rbp,%rsi
cmp    %r13,%rsi
jbe    1296 <matprod_trans1_k2+0x186>
mov    %r13,%r12
mov    %rbp,%rbx
movsd  0x8(%r12),%xmm2
mulsd  %xmm1,%xmm2
movsd  (%r12),%xmm3
mulsd  %xmm0,%xmm3
addsd  %xmm2,%xmm3
movsd  %xmm3,(%rbx)
movsd  0x18(%r12),%xmm2
mulsd  %xmm1,%xmm2
movsd  0x10(%r12),%xmm3
mulsd  %xmm0,%xmm3
addsd  %xmm2,%xmm3
movsd  %xmm3,0x8(%rbx)
add    $0x10,%rbx
add    $0x20,%r12
add    $0x2,%r11d
cmp    %ecx,%r11d
jle    1220 <matprod_trans1_k2+0x110>
mov    %edx,%esi
cmp    %r14d,%esi
jge    11c0 <matprod_trans1_k2+0xb0>
mulsd  0x8(%r12),%xmm1
mulsd  (%r12),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rbx)
add    $0x8,%rbx
jmp    11c0 <matprod_trans1_k2+0xb0>
mov    0x10(%rsp),%rsi
lea    0x0(,%rsi,8),%rbx
add    %rbp,%rbx
movapd %xmm1,%xmm8
unpcklpd %xmm1,%xmm8
movapd %xmm0,%xmm3
unpcklpd %xmm0,%xmm3
mov    %r8,%rsi
xor    %edi,%edi
nopl   (%rax)
movupd 0x0(%r13,%rdi,2),%xmm2
movupd 0x10(%r13,%rdi,2),%xmm5
movupd 0x20(%r13,%rdi,2),%xmm6
movupd 0x30(%r13,%rdi,2),%xmm7
movapd %xmm2,%xmm4
unpcklpd %xmm6,%xmm4
unpckhpd %xmm6,%xmm2
movapd %xmm5,%xmm6
unpcklpd %xmm7,%xmm6
unpckhpd %xmm7,%xmm5
mulpd  %xmm8,%xmm2
mulpd  %xmm3,%xmm4
addpd  %xmm2,%xmm4
mulpd  %xmm8,%xmm5
mulpd  %xmm3,%xmm6
addpd  %xmm5,%xmm6
movapd %xmm4,%xmm2
unpcklpd %xmm6,%xmm2
movhlps %xmm4,%xmm6
movups %xmm6,0x10(%rbp,%rdi,1)
movupd %xmm2,0x0(%rbp,%rdi,1)
add    $0x20,%rdi
add    $0xfffffffffffffffe,%rsi
jne    12c0 <matprod_trans1_k2+0x1b0>
mov    0xc(%rsp),%r11d
mov    0x18(%rsp),%r12
mov    %edx,%esi
cmp    %r10,%r8
jne    1220 <matprod_trans1_k2+0x110>
jmp    126f <matprod_trans1_k2+0x15f>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @matprod_trans1_k2(double* noalias %0, double* noalias %1, double* noalias %2, i32 %3, i32 %4) {
%6 = alloca double*
%7 = alloca double*
%8 = alloca double*
%9 = alloca i32
%10 = alloca i32
%11 = alloca double*
%12 = alloca double
%13 = alloca double
%14 = alloca double*
%15 = alloca i32
store double* %0, double** %6
store double* %1, double** %7
store double* %2, double** %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%16 = load double*, double** %6
%17 = ptrtoint double* %16 to i64
%18 = and i64 %17, 0
%19 = icmp eq i64 %18, 0
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = load double*, double** %7
%23 = ptrtoint double* %22 to i64
%24 = and i64 %23, 0
%25 = icmp eq i64 %24, 0
%26 = zext i1 %25 to i32
%27 = call i32 @assert(i32 %26)
%28 = load double*, double** %8
%29 = ptrtoint double* %28 to i64
%30 = and i64 %29, 0
%31 = icmp eq i64 %30, 0
%32 = zext i1 %31 to i32
%33 = call i32 @assert(i32 %32)
%34 = load double*, double** %6
store double* %34, double** %6
%35 = load double*, double** %7
store double* %35, double** %7
%36 = load double*, double** %8
store double* %36, double** %8
%37 = load double*, double** %7
%38 = load i32, i32* %10
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds double, double* %37, i64 %39
%41 = load i32, i32* %10
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds double, double* %40, i64 %42
store double* %43, double** %11
br label %44
44: ; preds = %111, %5
%45 = load double*, double** %7
%46 = load double*, double** %11
%47 = icmp ult double* %45, %46
br i1 %47, label %48, label %114
48: ; preds = %44
%49 = load double*, double** %7
%50 = getelementptr inbounds double, double* %49, i64 0
%51 = load double, double* %50
store double %51, double* %12
%52 = load double*, double** %7
%53 = getelementptr inbounds double, double* %52, i64 1
%54 = load double, double* %53
store double %54, double* %13
%55 = load double*, double** %6
store double* %55, double** %14
store i32 0, i32* %15
br label %56
56: ; preds = %61, %48
%57 = load i32, i32* %15
%58 = load i32, i32* %9
%59 = sub nsw i32 %58, 2
%60 = icmp sle i32 %57, %59
br i1 %60, label %61, label %92
61: ; preds = %56
%62 = load double*, double** %14
%63 = getelementptr inbounds double, double* %62, i64 0
%64 = load double, double* %63
%65 = load double, double* %12
%66 = load double*, double** %14
%67 = getelementptr inbounds double, double* %66, i64 1
%68 = load double, double* %67
%69 = load double, double* %13
%70 = fmul double %68, %69
%71 = call double @llvm.fmuladd.f64(double %64, double %65, double %70)
%72 = load double*, double** %8
%73 = getelementptr inbounds double, double* %72, i64 0
store double %71, double* %73
%74 = load double*, double** %14
%75 = getelementptr inbounds double, double* %74, i64 2
%76 = load double, double* %75
%77 = load double, double* %12
%78 = load double*, double** %14
%79 = getelementptr inbounds double, double* %78, i64 3
%80 = load double, double* %79
%81 = load double, double* %13
%82 = fmul double %80, %81
%83 = call double @llvm.fmuladd.f64(double %76, double %77, double %82)
%84 = load double*, double** %8
%85 = getelementptr inbounds double, double* %84, i64 1
store double %83, double* %85
%86 = load double*, double** %8
%87 = getelementptr inbounds double, double* %86, i64 2
store double* %87, double** %8
%88 = load double*, double** %14
%89 = getelementptr inbounds double, double* %88, i64 4
store double* %89, double** %14
%90 = load i32, i32* %15
%91 = add nsw i32 %90, 2
store i32 %91, i32* %15
br label %56
92: ; preds = %56
%93 = load i32, i32* %15
%94 = load i32, i32* %9
%95 = icmp slt i32 %93, %94
br i1 %95, label %96, label %111
96: ; preds = %92
%97 = load double*, double** %14
%98 = getelementptr inbounds double, double* %97, i64 0
%99 = load double, double* %98
%100 = load double, double* %12
%101 = load double*, double** %14
%102 = getelementptr inbounds double, double* %101, i64 1
%103 = load double, double* %102
%104 = load double, double* %13
%105 = fmul double %103, %104
%106 = call double @llvm.fmuladd.f64(double %99, double %100, double %105)
%107 = load double*, double** %8
%108 = getelementptr inbounds double, double* %107, i64 0
store double %106, double* %108
%109 = load double*, double** %8
%110 = getelementptr inbounds double, double* %109, i64 1
store double* %110, double** %8
br label %111
111: ; preds = %96, %92
%112 = load double*, double** %7
%113 = getelementptr inbounds double, double* %112, i64 2
store double* %113, double** %7
br label %44
114: ; preds = %44
ret void
}

LLVM IR (-O2):
define void @matprod_trans1_k2(double* noalias nocapture %0, double* noalias %1, double* noalias nocapture writeonly %2, i32 %3, i32 %4) {
%6 = tail call i32 @assert(i32 1)
%7 = tail call i32 @assert(i32 1)
%8 = tail call i32 @assert(i32 1)
%9 = sext i32 %4 to i64
%10 = getelementptr inbounds double, double* %1, i64 %9
%11 = getelementptr inbounds double, double* %10, i64 %9
%12 = icmp ugt double* %11, %1
br i1 %12, label %13, label %114
13: ; preds = %5
%14 = add i32 %3, -2
%15 = icmp slt i32 %3, 2
%16 = and i32 %3, -2
%17 = lshr i32 %14, 1
%18 = zext i32 %17 to i64
%19 = shl nuw nsw i64 %18, 1
%20 = add nuw nsw i64 %19, 2
%21 = shl nuw nsw i64 %18, 2
%22 = add nuw nsw i64 %21, 4
%23 = getelementptr double, double* %0, i64 %22
%24 = lshr i32 %14, 1
%25 = add nuw i32 %24, 1
%26 = zext i32 %25 to i64
%27 = icmp ult i32 %14, 2
%28 = and i64 %26, 4294967294
%29 = trunc i64 %28 to i32
%30 = shl i32 %29, 1
%31 = shl nuw nsw i64 %28, 2
%32 = getelementptr double, double* %0, i64 %31
%33 = shl nuw nsw i64 %28, 1
%34 = icmp eq i64 %28, %26
br label %35
35: ; preds = %13, %110
%36 = phi double* [ %1, %13 ], [ %112, %110 ]
%37 = phi double* [ %2, %13 ], [ %111, %110 ]
%38 = load double, double* %36
%39 = getelementptr inbounds double, double* %36, i64 1
%40 = load double, double* %39
br i1 %15, label %98, label %41
41: ; preds = %35
br i1 %27, label %74, label %42
42: ; preds = %41
%43 = getelementptr double, double* %37, i64 %20
%44 = icmp ult double* %37, %23
%45 = icmp ugt double* %43, %0
%46 = and i1 %44, %45
br i1 %46, label %74, label %47
47: ; preds = %42
%48 = getelementptr double, double* %37, i64 %33
%49 = insertelement <2 x double> poison, double %40, i64 0
%50 = shufflevector <2 x double> %49, <2 x double> poison, <2 x i32> zeroinitializer
%51 = insertelement <2 x double> poison, double %38, i64 0
%52 = shufflevector <2 x double> %51, <2 x double> poison, <2 x i32> zeroinitializer
br label %53
53: ; preds = %53, %47
%54 = phi i64 [ 0, %47 ], [ %71, %53 ]
%55 = shl i64 %54, 2
%56 = getelementptr double, double* %0, i64 %55
%57 = shl i64 %54, 1
%58 = bitcast double* %56 to <8 x double>*
%59 = load <8 x double>, <8 x double>* %58
%60 = shufflevector <8 x double> %59, <8 x double> poison, <2 x i32> <i32 0, i32 4>
%61 = shufflevector <8 x double> %59, <8 x double> poison, <2 x i32> <i32 1, i32 5>
%62 = shufflevector <8 x double> %59, <8 x double> poison, <2 x i32> <i32 2, i32 6>
%63 = shufflevector <8 x double> %59, <8 x double> poison, <2 x i32> <i32 3, i32 7>
%64 = fmul <2 x double> %50, %61
%65 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %60, <2 x double> %52, <2 x double> %64)
%66 = fmul <2 x double> %50, %63
%67 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %62, <2 x double> %52, <2 x double> %66)
%68 = getelementptr inbounds double, double* %37, i64 %57
%69 = bitcast double* %68 to <4 x double>*
%70 = shufflevector <2 x double> %65, <2 x double> %67, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
store <4 x double> %70, <4 x double>* %69
%71 = add nuw i64 %54, 2
%72 = icmp eq i64 %71, %28
br i1 %72, label %73, label %53
73: ; preds = %53
br i1 %34, label %98, label %74
74: ; preds = %42, %41, %73
%75 = phi i32 [ 0, %42 ], [ 0, %41 ], [ %30, %73 ]
%76 = phi double* [ %0, %42 ], [ %0, %41 ], [ %32, %73 ]
%77 = phi double* [ %37, %42 ], [ %37, %41 ], [ %48, %73 ]
br label %78
78: ; preds = %74, %78
%79 = phi i32 [ %96, %78 ], [ %75, %74 ]
%80 = phi double* [ %95, %78 ], [ %76, %74 ]
%81 = phi double* [ %94, %78 ], [ %77, %74 ]
%82 = load double, double* %80
%83 = getelementptr inbounds double, double* %80, i64 1
%84 = load double, double* %83
%85 = fmul double %40, %84
%86 = tail call double @llvm.fmuladd.f64(double %82, double %38, double %85)
store double %86, double* %81
%87 = getelementptr inbounds double, double* %80, i64 2
%88 = load double, double* %87
%89 = getelementptr inbounds double, double* %80, i64 3
%90 = load double, double* %89
%91 = fmul double %40, %90
%92 = tail call double @llvm.fmuladd.f64(double %88, double %38, double %91)
%93 = getelementptr inbounds double, double* %81, i64 1
store double %92, double* %93
%94 = getelementptr inbounds double, double* %81, i64 2
%95 = getelementptr inbounds double, double* %80, i64 4
%96 = add nuw nsw i32 %79, 2
%97 = icmp sgt i32 %96, %14
br i1 %97, label %98, label %78
98: ; preds = %78, %73, %35
%99 = phi double* [ %37, %35 ], [ %48, %73 ], [ %94, %78 ]
%100 = phi double* [ %0, %35 ], [ %32, %73 ], [ %95, %78 ]
%101 = phi i32 [ 0, %35 ], [ %16, %73 ], [ %16, %78 ]
%102 = icmp slt i32 %101, %3
br i1 %102, label %103, label %110
103: ; preds = %98
%104 = load double, double* %100
%105 = getelementptr inbounds double, double* %100, i64 1
%106 = load double, double* %105
%107 = fmul double %40, %106
%108 = tail call double @llvm.fmuladd.f64(double %104, double %38, double %107)
store double %108, double* %99
%109 = getelementptr inbounds double, double* %99, i64 1
br label %110
110: ; preds = %103, %98
%111 = phi double* [ %109, %103 ], [ %99, %98 ]
%112 = getelementptr inbounds double, double* %36, i64 2
%113 = icmp ult double* %112, %11
br i1 %113, label %35, label %114
114: ; preds = %110, %5
ret void
}