#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*/ daxpy_seq(int, double, double *, double *, int);
int /*<<< orphan*/ dcopy_seq(int, double *, double *);
int /*<<< orphan*/ dgemv_seq(int, int, double, double *, double *, double,
                             double *, int);
int /*<<< orphan*/ dnrm2_seq(int, double *, double *, int);
int /*<<< orphan*/ omp_set_num_threads(int);
double __jaciter_kernel_parallel(double *A, double *b, double *R, double *C,
                                 double *Dinv, double *xk, double *xkp1,
                                 double *xconv, int n, int p) {
  double e = 1.0;
  int i;
  omp_set_num_threads(p);
  dgemv_seq(n, n, 1.0, R, xk, 0.0, xkp1, p);
#pragma omp parallel for schedule(static) private(i) shared(xkp1, Dinv, C, n)
  for (i = 0; i < n; i++) {
    xkp1[i] *= -Dinv[i];
    xkp1[i] += C[i];
  }
  dcopy_seq(n, xkp1, xk);
  dgemv_seq(n, n, 1.0, A, xk, 0.0, xconv, p);
  daxpy_seq(n, -1.0, b, xconv, p);
  dnrm2_seq(n, xconv, &e, p);
  return e;
}


x86 assembly (clang, -O0):
<__jaciter_kernel_parallel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movsd  0xe7a(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    0x28(%rbp),%edi
call   1050 <omp_set_num_threads@plt>
mov    0x20(%rbp),%edi
mov    0x20(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    0x10(%rbp),%r8
mov    0x28(%rbp),%r9d
movsd  0xe4f(%rip),%xmm0
xorps  %xmm1,%xmm1
call   1070 <dgemv_seq@plt>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    0x20(%rbp),%eax
jge    122f <__jaciter_kernel_parallel+0xdf>
mov    -0x28(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11c0 <__jaciter_kernel_parallel+0x70>
mov    0x20(%rbp),%edi
mov    0x10(%rbp),%rsi
mov    -0x30(%rbp),%rdx
call   1040 <dcopy_seq@plt>
mov    0x20(%rbp),%edi
mov    0x20(%rbp),%esi
mov    -0x8(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    0x18(%rbp),%r8
mov    0x28(%rbp),%r9d
movsd  0xda3(%rip),%xmm0
xorps  %xmm1,%xmm1
call   1070 <dgemv_seq@plt>
mov    0x20(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    0x18(%rbp),%rdx
mov    0x28(%rbp),%ecx
movsd  0xd8d(%rip),%xmm0
call   1060 <daxpy_seq@plt>
mov    0x20(%rbp),%edi
mov    0x18(%rbp),%rsi
mov    0x28(%rbp),%ecx
lea    -0x38(%rbp),%rdx
call   1030 <dnrm2_seq@plt>
movsd  -0x38(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__jaciter_kernel_parallel>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r9,0x10(%rsp)
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdx,%rbp
mov    %rsi,0x20(%rsp)
mov    %rdi,0x18(%rsp)
mov    0x78(%rsp),%ebx
mov    0x70(%rsp),%r12d
mov    0x60(%rsp),%r13
movabs $0x3ff0000000000000,%rax
mov    %rax,0x8(%rsp)
mov    %ebx,%edi
call   1050 <omp_set_num_threads@plt>
movsd  0xe5e(%rip),%xmm0
xorpd  %xmm1,%xmm1
mov    %r12d,%edi
mov    %r12d,%esi
mov    %rbp,%rdx
mov    0x10(%rsp),%rbp
mov    %rbp,%rcx
mov    %r13,%r8
mov    %ebx,%r9d
call   1070 <dgemv_seq@plt>
test   %r12d,%r12d
jle    13a6 <__jaciter_kernel_parallel+0x256>
mov    %r12d,%eax
cmp    $0x1,%r12d
jne    128a <__jaciter_kernel_parallel+0x13a>
xor    %ecx,%ecx
mov    %rcx,%rdx
not    %rdx
test   $0x1,%al
je     1211 <__jaciter_kernel_parallel+0xc1>
movsd  (%r14,%rcx,8),%xmm0
xorpd  0xe1e(%rip),%xmm0
mulsd  0x0(%r13,%rcx,8),%xmm0
movsd  %xmm0,0x0(%r13,%rcx,8)
addsd  (%r15,%rcx,8),%xmm0
movsd  %xmm0,0x0(%r13,%rcx,8)
or     $0x1,%rcx
add    %rax,%rdx
je     13a6 <__jaciter_kernel_parallel+0x256>
movapd 0xdee(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%r14,%rcx,8),%xmm1
xorpd  %xmm0,%xmm1
mulsd  0x0(%r13,%rcx,8),%xmm1
movsd  %xmm1,0x0(%r13,%rcx,8)
addsd  (%r15,%rcx,8),%xmm1
movsd  %xmm1,0x0(%r13,%rcx,8)
movsd  0x8(%r14,%rcx,8),%xmm1
xorpd  %xmm0,%xmm1
mulsd  0x8(%r13,%rcx,8),%xmm1
movsd  %xmm1,0x8(%r13,%rcx,8)
addsd  0x8(%r15,%rcx,8),%xmm1
movsd  %xmm1,0x8(%r13,%rcx,8)
add    $0x2,%rcx
cmp    %rcx,%rax
jne    1230 <__jaciter_kernel_parallel+0xe0>
jmp    13a6 <__jaciter_kernel_parallel+0x256>
lea    0x0(,%rax,8),%rcx
add    %r13,%rcx
lea    (%r14,%rax,8),%rdx
cmp    %r13,%rdx
seta   %dil
lea    (%r15,%rax,8),%rdx
cmp    %r14,%rcx
seta   %bl
cmp    %r13,%rdx
seta   %dl
cmp    %r15,%rcx
seta   %sil
xor    %ecx,%ecx
test   %bl,%dil
jne    11da <__jaciter_kernel_parallel+0x8a>
and    %sil,%dl
jne    11da <__jaciter_kernel_parallel+0x8a>
mov    %eax,%ecx
and    $0xfffffffe,%ecx
lea    -0x2(%rcx),%rdx
mov    %rdx,%rsi
shr    %rsi
add    $0x1,%rsi
test   %rdx,%rdx
je     1423 <__jaciter_kernel_parallel+0x2d3>
mov    %rsi,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %edx,%edx
movapd 0xd18(%rip),%xmm0
nopl   0x0(%rax,%rax,1)
movupd (%r14,%rdx,8),%xmm1
xorpd  %xmm0,%xmm1
movupd 0x0(%r13,%rdx,8),%xmm2
mulpd  %xmm1,%xmm2
movupd 0x10(%r13,%rdx,8),%xmm1
movupd %xmm2,0x0(%r13,%rdx,8)
movupd (%r15,%rdx,8),%xmm3
addpd  %xmm2,%xmm3
movupd %xmm3,0x0(%r13,%rdx,8)
movupd 0x10(%r14,%rdx,8),%xmm2
xorpd  %xmm0,%xmm2
mulpd  %xmm1,%xmm2
movupd %xmm2,0x10(%r13,%rdx,8)
movupd 0x10(%r15,%rdx,8),%xmm1
addpd  %xmm2,%xmm1
movupd %xmm1,0x10(%r13,%rdx,8)
add    $0x4,%rdx
add    $0xfffffffffffffffe,%rdi
jne    1300 <__jaciter_kernel_parallel+0x1b0>
test   $0x1,%sil
je     139d <__jaciter_kernel_parallel+0x24d>
movupd (%r14,%rdx,8),%xmm0
xorpd  0xc96(%rip),%xmm0
movupd 0x0(%r13,%rdx,8),%xmm1
mulpd  %xmm0,%xmm1
movupd %xmm1,0x0(%r13,%rdx,8)
movupd (%r15,%rdx,8),%xmm0
addpd  %xmm1,%xmm0
movupd %xmm0,0x0(%r13,%rdx,8)
cmp    %rax,%rcx
jne    11da <__jaciter_kernel_parallel+0x8a>
mov    %r12d,%edi
mov    %r13,%rsi
mov    %rbp,%rdx
call   1040 <dcopy_seq@plt>
movsd  0xc44(%rip),%xmm0
xorpd  %xmm1,%xmm1
mov    %r12d,%edi
mov    %r12d,%esi
mov    0x18(%rsp),%rdx
mov    %rbp,%rcx
mov    0x68(%rsp),%rbp
mov    %rbp,%r8
mov    0x78(%rsp),%ebx
mov    %ebx,%r9d
call   1070 <dgemv_seq@plt>
movsd  0xc1e(%rip),%xmm0
mov    %r12d,%edi
mov    0x20(%rsp),%rsi
mov    %rbp,%rdx
mov    %ebx,%ecx
call   1060 <daxpy_seq@plt>
lea    0x8(%rsp),%rdx
mov    %r12d,%edi
mov    %rbp,%rsi
mov    %ebx,%ecx
call   1030 <dnrm2_seq@plt>
movsd  0x8(%rsp),%xmm0
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %edx,%edx
test   $0x1,%sil
jne    136c <__jaciter_kernel_parallel+0x21c>
jmp    139d <__jaciter_kernel_parallel+0x24d>

LLVM IR (-O0):
define double @__jaciter_kernel_parallel(double* %0, double* %1, double* %2, double* %3, double* %4, double* %5, double* %6, double* %7, i32 %8, i32 %9) {
%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 i32
%20 = alloca i32
%21 = alloca double
%22 = alloca i32
store double* %0, double** %11
store double* %1, double** %12
store double* %2, double** %13
store double* %3, double** %14
store double* %4, double** %15
store double* %5, double** %16
store double* %6, double** %17
store double* %7, double** %18
store i32 %8, i32* %19
store i32 %9, i32* %20
store double 1.000000e+00, double* %21
%23 = load i32, i32* %20
%24 = call i32 @omp_set_num_threads(i32 %23)
%25 = load i32, i32* %19
%26 = load i32, i32* %19
%27 = load double*, double** %13
%28 = load double*, double** %16
%29 = load double*, double** %17
%30 = load i32, i32* %20
%31 = call i32 @dgemv_seq(i32 %25, i32 %26, double 1.000000e+00, double* %27, double* %28, double 0.000000e+00, double* %29, i32 %30)
store i32 0, i32* %22
br label %32
32: ; preds = %60, %10
%33 = load i32, i32* %22
%34 = load i32, i32* %19
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %63
36: ; preds = %32
%37 = load double*, double** %15
%38 = load i32, i32* %22
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds double, double* %37, i64 %39
%41 = load double, double* %40
%42 = fneg double %41
%43 = load double*, double** %17
%44 = load i32, i32* %22
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds double, double* %43, i64 %45
%47 = load double, double* %46
%48 = fmul double %47, %42
store double %48, double* %46
%49 = load double*, double** %14
%50 = load i32, i32* %22
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds double, double* %49, i64 %51
%53 = load double, double* %52
%54 = load double*, double** %17
%55 = load i32, i32* %22
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds double, double* %54, i64 %56
%58 = load double, double* %57
%59 = fadd double %58, %53
store double %59, double* %57
br label %60
60: ; preds = %36
%61 = load i32, i32* %22
%62 = add nsw i32 %61, 1
store i32 %62, i32* %22
br label %32
63: ; preds = %32
%64 = load i32, i32* %19
%65 = load double*, double** %17
%66 = load double*, double** %16
%67 = call i32 @dcopy_seq(i32 %64, double* %65, double* %66)
%68 = load i32, i32* %19
%69 = load i32, i32* %19
%70 = load double*, double** %11
%71 = load double*, double** %16
%72 = load double*, double** %18
%73 = load i32, i32* %20
%74 = call i32 @dgemv_seq(i32 %68, i32 %69, double 1.000000e+00, double* %70, double* %71, double 0.000000e+00, double* %72, i32 %73)
%75 = load i32, i32* %19
%76 = load double*, double** %12
%77 = load double*, double** %18
%78 = load i32, i32* %20
%79 = call i32 @daxpy_seq(i32 %75, double -1.000000e+00, double* %76, double* %77, i32 %78)
%80 = load i32, i32* %19
%81 = load double*, double** %18
%82 = load i32, i32* %20
%83 = call i32 @dnrm2_seq(i32 %80, double* %81, double* %21, i32 %82)
%84 = load double, double* %21
ret double %84
}

LLVM IR (-O2):
define double @__jaciter_kernel_parallel(double* %0, double* %1, double* %2, double* nocapture %3, double* nocapture %4, double* %5, double* %6, double* %7, i32 %8, i32 %9) {
%11 = alloca double
%12 = bitcast double* %11 to i8*
store double 1.000000e+00, double* %11
%13 = tail call i32 @omp_set_num_threads(i32 %9)
%14 = tail call i32 @dgemv_seq(i32 %8, i32 %8, double 1.000000e+00, double* %2, double* %5, double 0.000000e+00, double* %6, i32 %9)
%15 = icmp sgt i32 %8, 0
br i1 %15, label %16, label %137
16: ; preds = %10
%17 = zext i32 %8 to i64
%18 = icmp eq i32 %8, 1
br i1 %18, label %94, label %19
19: ; preds = %16
%20 = getelementptr double, double* %6, i64 %17
%21 = getelementptr double, double* %4, i64 %17
%22 = getelementptr double, double* %3, i64 %17
%23 = icmp ugt double* %21, %6
%24 = icmp ugt double* %20, %4
%25 = and i1 %23, %24
%26 = icmp ugt double* %22, %6
%27 = icmp ugt double* %20, %3
%28 = and i1 %26, %27
%29 = or i1 %25, %28
br i1 %29, label %94, label %30
30: ; preds = %19
%31 = and i64 %17, 4294967294
%32 = add nsw i64 %31, -2
%33 = lshr exact i64 %32, 1
%34 = add nuw i64 %33, 1
%35 = and i64 %34, 1
%36 = icmp eq i64 %32, 0
br i1 %36, label %74, label %37
37: ; preds = %30
%38 = and i64 %34, -2
br label %39
39: ; preds = %39, %37
%40 = phi i64 [ 0, %37 ], [ %71, %39 ]
%41 = phi i64 [ 0, %37 ], [ %72, %39 ]
%42 = getelementptr inbounds double, double* %4, i64 %40
%43 = bitcast double* %42 to <2 x double>*
%44 = load <2 x double>, <2 x double>* %43
%45 = fneg <2 x double> %44
%46 = getelementptr inbounds double, double* %6, i64 %40
%47 = bitcast double* %46 to <2 x double>*
%48 = load <2 x double>, <2 x double>* %47
%49 = fmul <2 x double> %48, %45
%50 = bitcast double* %46 to <2 x double>*
store <2 x double> %49, <2 x double>* %50
%51 = getelementptr inbounds double, double* %3, i64 %40
%52 = bitcast double* %51 to <2 x double>*
%53 = load <2 x double>, <2 x double>* %52
%54 = fadd <2 x double> %49, %53
%55 = bitcast double* %46 to <2 x double>*
store <2 x double> %54, <2 x double>* %55
%56 = or i64 %40, 2
%57 = getelementptr inbounds double, double* %4, i64 %56
%58 = bitcast double* %57 to <2 x double>*
%59 = load <2 x double>, <2 x double>* %58
%60 = fneg <2 x double> %59
%61 = getelementptr inbounds double, double* %6, i64 %56
%62 = bitcast double* %61 to <2 x double>*
%63 = load <2 x double>, <2 x double>* %62
%64 = fmul <2 x double> %63, %60
%65 = bitcast double* %61 to <2 x double>*
store <2 x double> %64, <2 x double>* %65
%66 = getelementptr inbounds double, double* %3, i64 %56
%67 = bitcast double* %66 to <2 x double>*
%68 = load <2 x double>, <2 x double>* %67
%69 = fadd <2 x double> %64, %68
%70 = bitcast double* %61 to <2 x double>*
store <2 x double> %69, <2 x double>* %70
%71 = add nuw i64 %40, 4
%72 = add nuw i64 %41, 2
%73 = icmp eq i64 %72, %38
br i1 %73, label %74, label %39
74: ; preds = %39, %30
%75 = phi i64 [ 0, %30 ], [ %71, %39 ]
%76 = icmp eq i64 %35, 0
br i1 %76, label %92, label %77
77: ; preds = %74
%78 = getelementptr inbounds double, double* %4, i64 %75
%79 = bitcast double* %78 to <2 x double>*
%80 = load <2 x double>, <2 x double>* %79
%81 = fneg <2 x double> %80
%82 = getelementptr inbounds double, double* %6, i64 %75
%83 = bitcast double* %82 to <2 x double>*
%84 = load <2 x double>, <2 x double>* %83
%85 = fmul <2 x double> %84, %81
%86 = bitcast double* %82 to <2 x double>*
store <2 x double> %85, <2 x double>* %86
%87 = getelementptr inbounds double, double* %3, i64 %75
%88 = bitcast double* %87 to <2 x double>*
%89 = load <2 x double>, <2 x double>* %88
%90 = fadd <2 x double> %85, %89
%91 = bitcast double* %82 to <2 x double>*
store <2 x double> %90, <2 x double>* %91
br label %92
92: ; preds = %74, %77
%93 = icmp eq i64 %31, %17
br i1 %93, label %137, label %94
94: ; preds = %19, %16, %92
%95 = phi i64 [ 0, %19 ], [ 0, %16 ], [ %31, %92 ]
%96 = xor i64 %95, -1
%97 = and i64 %17, 1
%98 = icmp eq i64 %97, 0
br i1 %98, label %110, label %99
99: ; preds = %94
%100 = getelementptr inbounds double, double* %4, i64 %95
%101 = load double, double* %100
%102 = fneg double %101
%103 = getelementptr inbounds double, double* %6, i64 %95
%104 = load double, double* %103
%105 = fmul double %104, %102
store double %105, double* %103
%106 = getelementptr inbounds double, double* %3, i64 %95
%107 = load double, double* %106
%108 = fadd double %105, %107
store double %108, double* %103
%109 = or i64 %95, 1
br label %110
110: ; preds = %99, %94
%111 = phi i64 [ %95, %94 ], [ %109, %99 ]
%112 = sub nsw i64 0, %17
%113 = icmp eq i64 %96, %112
br i1 %113, label %137, label %114
114: ; preds = %110, %114
%115 = phi i64 [ %135, %114 ], [ %111, %110 ]
%116 = getelementptr inbounds double, double* %4, i64 %115
%117 = load double, double* %116
%118 = fneg double %117
%119 = getelementptr inbounds double, double* %6, i64 %115
%120 = load double, double* %119
%121 = fmul double %120, %118
store double %121, double* %119
%122 = getelementptr inbounds double, double* %3, i64 %115
%123 = load double, double* %122
%124 = fadd double %121, %123
store double %124, double* %119
%125 = add nuw nsw i64 %115, 1
%126 = getelementptr inbounds double, double* %4, i64 %125
%127 = load double, double* %126
%128 = fneg double %127
%129 = getelementptr inbounds double, double* %6, i64 %125
%130 = load double, double* %129
%131 = fmul double %130, %128
store double %131, double* %129
%132 = getelementptr inbounds double, double* %3, i64 %125
%133 = load double, double* %132
%134 = fadd double %131, %133
store double %134, double* %129
%135 = add nuw nsw i64 %115, 2
%136 = icmp eq i64 %135, %17
br i1 %136, label %137, label %114
137: ; preds = %110, %114, %92, %10
%138 = tail call i32 @dcopy_seq(i32 %8, double* %6, double* %5)
%139 = tail call i32 @dgemv_seq(i32 %8, i32 %8, double 1.000000e+00, double* %0, double* %5, double 0.000000e+00, double* %7, i32 %9)
%140 = tail call i32 @daxpy_seq(i32 %8, double -1.000000e+00, double* %1, double* %7, i32 %9)
%141 = call i32 @dnrm2_seq(i32 %8, double* %7, double* %11, i32 %9)
%142 = load double, double* %11
ret double %142
}