#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);
int /*<<< orphan*/ matprod_mat_vec_sub_xrows(double *, double *, double *, int,
                                             int, int, int);
void matprod_mat_vec_sub_xrows0(double *restrict x, double *restrict y,
                                double *restrict z, int n, int k, int xrows,
                                int add) {
  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);
  assert(n >= 4);
  assert(k >= 2);
  if (xrows > (1024 + 512) && k > 2) {
    while (xrows >= 2 * (1024 + 512)) {
      matprod_mat_vec_sub_xrows(x, y, z, n, k, (1024 + 512), add);
      x += (1024 + 512);
      z += (1024 + 512);
      xrows -= (1024 + 512);
    }
    if (xrows > (1024 + 512)) {
      int nr = (((xrows + 3) >> 1) & ~3);
      matprod_mat_vec_sub_xrows(x, y, z, n, k, nr, add);
      x += nr;
      z += nr;
      xrows -= nr;
    }
  }
  matprod_mat_vec_sub_xrows(x, y, z, n, k, xrows, add);
}


x86 assembly (clang, -O0):
<matprod_mat_vec_sub_xrows0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
mov    -0x8(%rbp),%rax
and    $0x0,%rax
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x10(%rbp),%rax
and    $0x0,%rax
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x18(%rbp),%rax
and    $0x0,%rax
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <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)
cmpl   $0x4,-0x1c(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
cmpl   $0x2,-0x20(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
cmpl   $0x600,-0x24(%rbp)
jle    12b8 <matprod_mat_vec_sub_xrows0+0x198>
cmpl   $0x2,-0x20(%rbp)
jle    12b8 <matprod_mat_vec_sub_xrows0+0x198>
jmp    11e3 <matprod_mat_vec_sub_xrows0+0xc3>
cmpl   $0xc00,-0x24(%rbp)
jl     1240 <matprod_mat_vec_sub_xrows0+0x120>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    0x10(%rbp),%eax
mov    $0x600,%r9d
mov    %eax,(%rsp)
call   1030 <matprod_mat_vec_sub_xrows@plt>
mov    -0x8(%rbp),%rax
add    $0x3000,%rax
mov    %rax,-0x8(%rbp)
mov    -0x18(%rbp),%rax
add    $0x3000,%rax
mov    %rax,-0x18(%rbp)
mov    -0x24(%rbp),%eax
sub    $0x600,%eax
mov    %eax,-0x24(%rbp)
jmp    11e3 <matprod_mat_vec_sub_xrows0+0xc3>
cmpl   $0x600,-0x24(%rbp)
jle    12b3 <matprod_mat_vec_sub_xrows0+0x193>
mov    -0x24(%rbp),%eax
add    $0x3,%eax
sar    $0x1,%eax
and    $0xfffffffc,%eax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    -0x28(%rbp),%r9d
mov    0x10(%rbp),%eax
mov    %eax,(%rsp)
call   1030 <matprod_mat_vec_sub_xrows@plt>
mov    -0x28(%rbp),%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x28(%rbp),%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x28(%rbp),%ecx
mov    -0x24(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x24(%rbp)
jmp    12b8 <matprod_mat_vec_sub_xrows0+0x198>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    -0x24(%rbp),%r9d
mov    0x10(%rbp),%eax
mov    %eax,(%rsp)
call   1030 <matprod_mat_vec_sub_xrows@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<matprod_mat_vec_sub_xrows0>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9d,%ebp
mov    %r8d,%r12d
mov    %ecx,%r14d
mov    %rdx,%r13
mov    %rsi,0x8(%rsp)
mov    %rdi,%rbx
mov    0x50(%rsp),%r15d
mov    $0x1,%edi
call   1040 <assert@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
xor    %edi,%edi
cmp    $0x4,%r14d
setge  %dil
call   1040 <assert@plt>
xor    %edi,%edi
cmp    $0x2,%r12d
setge  %dil
call   1040 <assert@plt>
cmp    $0x3,%r12d
jl     1258 <matprod_mat_vec_sub_xrows0+0x138>
cmp    $0x601,%ebp
jl     1258 <matprod_mat_vec_sub_xrows0+0x138>
cmp    $0xc00,%ebp
jb     1218 <matprod_mat_vec_sub_xrows0+0xf8>
mov    %r12d,0x14(%rsp)
mov    %r15d,%r12d
mov    %r14d,%r15d
mov    0x8(%rsp),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r12d,(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r13,%rdx
mov    %r15d,%ecx
mov    0x14(%rsp),%r8d
mov    $0x600,%r9d
call   1030 <matprod_mat_vec_sub_xrows@plt>
add    $0x3000,%rbx
add    $0x3000,%r13
add    $0xfffffa00,%ebp
cmp    $0xbff,%ebp
ja     11c0 <matprod_mat_vec_sub_xrows0+0xa0>
mov    $0x600,%r9d
cmp    $0x601,%ebp
mov    %r14,%rsi
mov    %r15d,%r14d
mov    %r12d,%r15d
mov    0x14(%rsp),%r12d
jb     1260 <matprod_mat_vec_sub_xrows0+0x140>
mov    %r15d,%eax
lea    0x3(%rbp),%r15d
shr    %r15d
and    $0xfffffffc,%r15d
mov    %eax,(%rsp)
mov    %rbx,%rdi
mov    0x8(%rsp),%rsi
mov    %r13,%rdx
mov    %r14d,%ecx
mov    %r12d,%r8d
mov    %r15d,%r9d
call   1030 <matprod_mat_vec_sub_xrows@plt>
mov    0x8(%rsp),%rsi
lea    (%rbx,%r15,8),%rbx
lea    0x0(%r13,%r15,8),%r13
sub    %r15d,%ebp
mov    %ebp,%r9d
jmp    1260 <matprod_mat_vec_sub_xrows0+0x140>
mov    %ebp,%r9d
mov    0x8(%rsp),%rsi
mov    %rbx,%rdi
mov    %r13,%rdx
mov    %r14d,%ecx
mov    %r12d,%r8d
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <matprod_mat_vec_sub_xrows@plt>

LLVM IR (-O0):
define void @matprod_mat_vec_sub_xrows0(double* noalias %0, double* noalias %1, double* noalias %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = alloca double*
%9 = alloca double*
%10 = alloca double*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store double* %0, double** %8
store double* %1, double** %9
store double* %2, double** %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
store i32 %6, i32* %14
%16 = load double*, double** %8
%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** %9
%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** %10
%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** %8
store double* %34, double** %8
%35 = load double*, double** %9
store double* %35, double** %9
%36 = load double*, double** %10
store double* %36, double** %10
%37 = load i32, i32* %11
%38 = icmp sge i32 %37, 4
%39 = zext i1 %38 to i32
%40 = call i32 @assert(i32 %39)
%41 = load i32, i32* %12
%42 = icmp sge i32 %41, 2
%43 = zext i1 %42 to i32
%44 = call i32 @assert(i32 %43)
%45 = load i32, i32* %13
%46 = icmp sgt i32 %45, 1536
br i1 %46, label %47, label %96
47: ; preds = %7
%48 = load i32, i32* %12
%49 = icmp sgt i32 %48, 2
br i1 %49, label %50, label %96
50: ; preds = %47
br label %51
51: ; preds = %54, %50
%52 = load i32, i32* %13
%53 = icmp sge i32 %52, 3072
br i1 %53, label %54, label %68
54: ; preds = %51
%55 = load double*, double** %8
%56 = load double*, double** %9
%57 = load double*, double** %10
%58 = load i32, i32* %11
%59 = load i32, i32* %12
%60 = load i32, i32* %14
%61 = call i32 @matprod_mat_vec_sub_xrows(double* %55, double* %56, double* %57, i32 %58, i32 %59, i32 1536, i32 %60)
%62 = load double*, double** %8
%63 = getelementptr inbounds double, double* %62, i64 1536
store double* %63, double** %8
%64 = load double*, double** %10
%65 = getelementptr inbounds double, double* %64, i64 1536
store double* %65, double** %10
%66 = load i32, i32* %13
%67 = sub nsw i32 %66, 1536
store i32 %67, i32* %13
br label %51
68: ; preds = %51
%69 = load i32, i32* %13
%70 = icmp sgt i32 %69, 1536
br i1 %70, label %71, label %95
71: ; preds = %68
%72 = load i32, i32* %13
%73 = add nsw i32 %72, 3
%74 = ashr i32 %73, 1
%75 = and i32 %74, -4
store i32 %75, i32* %15
%76 = load double*, double** %8
%77 = load double*, double** %9
%78 = load double*, double** %10
%79 = load i32, i32* %11
%80 = load i32, i32* %12
%81 = load i32, i32* %15
%82 = load i32, i32* %14
%83 = call i32 @matprod_mat_vec_sub_xrows(double* %76, double* %77, double* %78, i32 %79, i32 %80, i32 %81, i32 %82)
%84 = load i32, i32* %15
%85 = load double*, double** %8
%86 = sext i32 %84 to i64
%87 = getelementptr inbounds double, double* %85, i64 %86
store double* %87, double** %8
%88 = load i32, i32* %15
%89 = load double*, double** %10
%90 = sext i32 %88 to i64
%91 = getelementptr inbounds double, double* %89, i64 %90
store double* %91, double** %10
%92 = load i32, i32* %15
%93 = load i32, i32* %13
%94 = sub nsw i32 %93, %92
store i32 %94, i32* %13
br label %95
95: ; preds = %71, %68
br label %96
96: ; preds = %95, %47, %7
%97 = load double*, double** %8
%98 = load double*, double** %9
%99 = load double*, double** %10
%100 = load i32, i32* %11
%101 = load i32, i32* %12
%102 = load i32, i32* %13
%103 = load i32, i32* %14
%104 = call i32 @matprod_mat_vec_sub_xrows(double* %97, double* %98, double* %99, i32 %100, i32 %101, i32 %102, i32 %103)
ret void
}

LLVM IR (-O2):
define void @matprod_mat_vec_sub_xrows0(double* noalias %0, double* noalias %1, double* noalias %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = tail call i32 @assert(i32 1)
%9 = tail call i32 @assert(i32 1)
%10 = tail call i32 @assert(i32 1)
%11 = icmp sgt i32 %3, 3
%12 = zext i1 %11 to i32
%13 = tail call i32 @assert(i32 %12)
%14 = icmp sgt i32 %4, 1
%15 = zext i1 %14 to i32
%16 = tail call i32 @assert(i32 %15)
%17 = icmp sgt i32 %5, 1536
%18 = icmp sgt i32 %4, 2
%19 = and i1 %18, %17
br i1 %19, label %20, label %45
20: ; preds = %7
%21 = icmp ugt i32 %5, 3071
br i1 %21, label %22, label %33
22: ; preds = %20, %22
%23 = phi double* [ %27, %22 ], [ %0, %20 ]
%24 = phi i32 [ %29, %22 ], [ %5, %20 ]
%25 = phi double* [ %28, %22 ], [ %2, %20 ]
%26 = tail call i32 @matprod_mat_vec_sub_xrows(double* %23, double* %1, double* %25, i32 %3, i32 %4, i32 1536, i32 %6)
%27 = getelementptr inbounds double, double* %23, i64 1536
%28 = getelementptr inbounds double, double* %25, i64 1536
%29 = add nsw i32 %24, -1536
%30 = icmp ugt i32 %29, 3071
br i1 %30, label %22, label %31
31: ; preds = %22
%32 = icmp ugt i32 %29, 1536
br i1 %32, label %33, label %45
33: ; preds = %20, %31
%34 = phi double* [ %27, %31 ], [ %0, %20 ]
%35 = phi i32 [ %29, %31 ], [ %5, %20 ]
%36 = phi double* [ %28, %31 ], [ %2, %20 ]
%37 = add nuw nsw i32 %35, 3
%38 = lshr i32 %37, 1
%39 = and i32 %38, 2147483644
%40 = tail call i32 @matprod_mat_vec_sub_xrows(double* %34, double* %1, double* %36, i32 %3, i32 %4, i32 %39, i32 %6)
%41 = zext i32 %39 to i64
%42 = getelementptr inbounds double, double* %34, i64 %41
%43 = getelementptr inbounds double, double* %36, i64 %41
%44 = sub nuw nsw i32 %35, %39
br label %45
45: ; preds = %31, %33, %7
%46 = phi double* [ %43, %33 ], [ %28, %31 ], [ %2, %7 ]
%47 = phi i32 [ %44, %33 ], [ 1536, %31 ], [ %5, %7 ]
%48 = phi double* [ %42, %33 ], [ %27, %31 ], [ %0, %7 ]
%49 = tail call i32 @matprod_mat_vec_sub_xrows(double* %48, double* %1, double* %46, i32 %3, i32 %4, i32 %47, i32 %6)
ret void
}