#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 jac_jacobi_array(int, double const *, int, double *, double, double,
                     double *);
int jac_djacobi_array(int np, const double *x, int n, double *result_array,
                      double a, double b, double *ws) {
  int code = jac_jacobi_array(np, x, n - 1, result_array, a + 1.0, b + 1.0, ws);
  int i;
  if (code)
    return code;
  for (i = 0; i < np; ++i)
    result_array[i] *= 0.5 * (a + b + n + 1.0);
  return code;
}


x86 assembly (clang, -O0):
<jac_djacobi_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
movsd  %xmm0,-0x28(%rbp)
movsd  %xmm1,-0x30(%rbp)
mov    %r8,-0x38(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
mov    -0x20(%rbp),%rcx
movsd  0xeb3(%rip),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  0xea6(%rip),%xmm1
addsd  -0x30(%rbp),%xmm1
mov    -0x38(%rbp),%r8
call   1030 <jac_jacobi_array@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
je     1180 <jac_djacobi_array+0x70>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11e4 <jac_djacobi_array+0xd4>
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11de <jac_djacobi_array+0xce>
movsd  -0x28(%rbp),%xmm1
addsd  -0x30(%rbp),%xmm1
cvtsi2sdl -0x14(%rbp),%xmm0
addsd  %xmm0,%xmm1
movsd  0xe52(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xe4e(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movslq -0x40(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    1187 <jac_djacobi_array+0x77>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jac_djacobi_array>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
movapd %xmm1,%xmm2
mov    %rcx,%rbx
mov    %edx,%r14d
mov    %edi,%ebp
lea    -0x1(%r14),%edx
movsd  0xed0(%rip),%xmm1
movsd  %xmm0,0x8(%rsp)
addsd  %xmm1,%xmm0
movsd  %xmm2,(%rsp)
addsd  %xmm2,%xmm1
call   1030 <jac_jacobi_array@plt>
test   %eax,%eax
jne    1257 <jac_djacobi_array+0x147>
test   %ebp,%ebp
jle    1257 <jac_djacobi_array+0x147>
xorps  %xmm0,%xmm0
cvtsi2sd %r14d,%xmm0
movsd  0x8(%rsp),%xmm1
addsd  (%rsp),%xmm1
addsd  %xmm1,%xmm0
addsd  0xe89(%rip),%xmm0
mulsd  0xe89(%rip),%xmm0
mov    %ebp,%ecx
cmp    $0x4,%ebp
jae    118d <jac_djacobi_array+0x7d>
xor    %edx,%edx
jmp    1240 <jac_djacobi_array+0x130>
mov    %ecx,%edx
and    $0xfffffffc,%edx
movapd %xmm0,%xmm1
unpcklpd %xmm0,%xmm1
lea    -0x4(%rdx),%rsi
mov    %rsi,%rbp
shr    $0x2,%rbp
add    $0x1,%rbp
test   %rsi,%rsi
je     1260 <jac_djacobi_array+0x150>
mov    %rbp,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %esi,%esi
nopl   0x0(%rax,%rax,1)
movupd (%rbx,%rsi,8),%xmm2
movupd 0x10(%rbx,%rsi,8),%xmm3
movupd 0x20(%rbx,%rsi,8),%xmm4
movupd 0x30(%rbx,%rsi,8),%xmm5
mulpd  %xmm1,%xmm2
mulpd  %xmm1,%xmm3
movupd %xmm2,(%rbx,%rsi,8)
movupd %xmm3,0x10(%rbx,%rsi,8)
mulpd  %xmm1,%xmm4
mulpd  %xmm1,%xmm5
movupd %xmm4,0x20(%rbx,%rsi,8)
movupd %xmm5,0x30(%rbx,%rsi,8)
add    $0x8,%rsi
add    $0xfffffffffffffffe,%rdi
jne    11c0 <jac_djacobi_array+0xb0>
test   $0x1,%bpl
je     122c <jac_djacobi_array+0x11c>
movupd (%rbx,%rsi,8),%xmm2
movupd 0x10(%rbx,%rsi,8),%xmm3
mulpd  %xmm1,%xmm2
mulpd  %xmm1,%xmm3
movupd %xmm2,(%rbx,%rsi,8)
movupd %xmm3,0x10(%rbx,%rsi,8)
cmp    %rcx,%rdx
je     1257 <jac_djacobi_array+0x147>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  (%rbx,%rdx,8),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rbx,%rdx,8)
add    $0x1,%rdx
cmp    %rdx,%rcx
jne    1240 <jac_djacobi_array+0x130>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
xor    %esi,%esi
test   $0x1,%bpl
jne    120e <jac_djacobi_array+0xfe>
jmp    122c <jac_djacobi_array+0x11c>

LLVM IR (-O0):
define i32 @jac_djacobi_array(i32 %0, double* %1, i32 %2, double* %3, double %4, double %5, double* %6) {
%8 = alloca i32
%9 = alloca i32
%10 = alloca double*
%11 = alloca i32
%12 = alloca double*
%13 = alloca double
%14 = alloca double
%15 = alloca double*
%16 = alloca i32
%17 = alloca i32
store i32 %0, i32* %9
store double* %1, double** %10
store i32 %2, i32* %11
store double* %3, double** %12
store double %4, double* %13
store double %5, double* %14
store double* %6, double** %15
%18 = load i32, i32* %9
%19 = load double*, double** %10
%20 = load i32, i32* %11
%21 = sub nsw i32 %20, 1
%22 = load double*, double** %12
%23 = load double, double* %13
%24 = fadd double %23, 1.000000e+00
%25 = load double, double* %14
%26 = fadd double %25, 1.000000e+00
%27 = load double*, double** %15
%28 = call i32 @jac_jacobi_array(i32 %18, double* %19, i32 %21, double* %22, double %24, double %26, double* %27)
store i32 %28, i32* %16
%29 = load i32, i32* %16
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %7
%32 = load i32, i32* %16
store i32 %32, i32* %8
br label %58
33: ; preds = %7
store i32 0, i32* %17
br label %34
34: ; preds = %53, %33
%35 = load i32, i32* %17
%36 = load i32, i32* %9
%37 = icmp slt i32 %35, %36
br i1 %37, label %38, label %56
38: ; preds = %34
%39 = load double, double* %13
%40 = load double, double* %14
%41 = fadd double %39, %40
%42 = load i32, i32* %11
%43 = sitofp i32 %42 to double
%44 = fadd double %41, %43
%45 = fadd double %44, 1.000000e+00
%46 = fmul double 5.000000e-01, %45
%47 = load double*, double** %12
%48 = load i32, i32* %17
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds double, double* %47, i64 %49
%51 = load double, double* %50
%52 = fmul double %51, %46
store double %52, double* %50
br label %53
53: ; preds = %38
%54 = load i32, i32* %17
%55 = add nsw i32 %54, 1
store i32 %55, i32* %17
br label %34
56: ; preds = %34
%57 = load i32, i32* %16
store i32 %57, i32* %8
br label %58
58: ; preds = %56, %31
%59 = load i32, i32* %8
ret i32 %59
}

LLVM IR (-O2):
define i32 @jac_djacobi_array(i32 %0, double* %1, i32 %2, double* %3, double %4, double %5, double* %6) {
%8 = add nsw i32 %2, -1
%9 = fadd double %4, 1.000000e+00
%10 = fadd double %5, 1.000000e+00
%11 = tail call i32 @jac_jacobi_array(i32 %0, double* %1, i32 %8, double* %3, double %9, double %10, double* %6)
%12 = icmp eq i32 %11, 0
%13 = icmp sgt i32 %0, 0
%14 = and i1 %12, %13
br i1 %14, label %15, label %88
15: ; preds = %7
%16 = fadd double %4, %5
%17 = sitofp i32 %2 to double
%18 = fadd double %16, %17
%19 = fadd double %18, 1.000000e+00
%20 = fmul double %19, 5.000000e-01
%21 = zext i32 %0 to i64
%22 = icmp ult i32 %0, 4
br i1 %22, label %79, label %23
23: ; preds = %15
%24 = and i64 %21, 4294967292
%25 = insertelement <2 x double> poison, double %20, i64 0
%26 = shufflevector <2 x double> %25, <2 x double> poison, <2 x i32> zeroinitializer
%27 = insertelement <2 x double> poison, double %20, i64 0
%28 = shufflevector <2 x double> %27, <2 x double> poison, <2 x i32> zeroinitializer
%29 = add nsw i64 %24, -4
%30 = lshr exact i64 %29, 2
%31 = add nuw nsw i64 %30, 1
%32 = and i64 %31, 1
%33 = icmp eq i64 %29, 0
br i1 %33, label %63, label %34
34: ; preds = %23
%35 = and i64 %31, 9223372036854775806
br label %36
36: ; preds = %36, %34
%37 = phi i64 [ 0, %34 ], [ %60, %36 ]
%38 = phi i64 [ 0, %34 ], [ %61, %36 ]
%39 = getelementptr inbounds double, double* %3, i64 %37
%40 = bitcast double* %39 to <2 x double>*
%41 = load <2 x double>, <2 x double>* %40
%42 = getelementptr inbounds double, double* %39, i64 2
%43 = bitcast double* %42 to <2 x double>*
%44 = load <2 x double>, <2 x double>* %43
%45 = fmul <2 x double> %26, %41
%46 = fmul <2 x double> %28, %44
%47 = bitcast double* %39 to <2 x double>*
store <2 x double> %45, <2 x double>* %47
%48 = bitcast double* %42 to <2 x double>*
store <2 x double> %46, <2 x double>* %48
%49 = or i64 %37, 4
%50 = getelementptr inbounds double, double* %3, i64 %49
%51 = bitcast double* %50 to <2 x double>*
%52 = load <2 x double>, <2 x double>* %51
%53 = getelementptr inbounds double, double* %50, i64 2
%54 = bitcast double* %53 to <2 x double>*
%55 = load <2 x double>, <2 x double>* %54
%56 = fmul <2 x double> %26, %52
%57 = fmul <2 x double> %28, %55
%58 = bitcast double* %50 to <2 x double>*
store <2 x double> %56, <2 x double>* %58
%59 = bitcast double* %53 to <2 x double>*
store <2 x double> %57, <2 x double>* %59
%60 = add nuw i64 %37, 8
%61 = add i64 %38, 2
%62 = icmp eq i64 %61, %35
br i1 %62, label %63, label %36
63: ; preds = %36, %23
%64 = phi i64 [ 0, %23 ], [ %60, %36 ]
%65 = icmp eq i64 %32, 0
br i1 %65, label %77, label %66
66: ; preds = %63
%67 = getelementptr inbounds double, double* %3, i64 %64
%68 = bitcast double* %67 to <2 x double>*
%69 = load <2 x double>, <2 x double>* %68
%70 = getelementptr inbounds double, double* %67, i64 2
%71 = bitcast double* %70 to <2 x double>*
%72 = load <2 x double>, <2 x double>* %71
%73 = fmul <2 x double> %26, %69
%74 = fmul <2 x double> %28, %72
%75 = bitcast double* %67 to <2 x double>*
store <2 x double> %73, <2 x double>* %75
%76 = bitcast double* %70 to <2 x double>*
store <2 x double> %74, <2 x double>* %76
br label %77
77: ; preds = %63, %66
%78 = icmp eq i64 %24, %21
br i1 %78, label %88, label %79
79: ; preds = %15, %77
%80 = phi i64 [ 0, %15 ], [ %24, %77 ]
br label %81
81: ; preds = %79, %81
%82 = phi i64 [ %86, %81 ], [ %80, %79 ]
%83 = getelementptr inbounds double, double* %3, i64 %82
%84 = load double, double* %83
%85 = fmul double %20, %84
store double %85, double* %83
%86 = add nuw nsw i64 %82, 1
%87 = icmp eq i64 %86, %21
br i1 %87, label %88, label %81
88: ; preds = %81, %77, %7
ret i32 %11
}