#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 */
double exp(int);
int fabs(double);
int /*<<< orphan*/ identity(double *, int);
int /*<<< orphan*/ printf(char *, double);
int PMatK80(double P[], double t, double kappa) {
  int i, j;
  double e1, e2;
  if (t < -0.01)
    printf("\nt = %.5f in PMatK80", t);
  if (t < 1e-100) {
    identity(P, 4);
    return (0);
  }
  e1 = exp(-4 * t / (kappa + 2));
  if (fabs(kappa - 1) < 1e-5) {
    for (i = 0; i < 4; i++)
      for (j = 0; j < 4; j++)
        if (i == j)
          P[i * 4 + j] = (1 + 3 * e1) / 4;
        else
          P[i * 4 + j] = (1 - e1) / 4;
  } else {
    e2 = exp(-2 * t * (kappa + 1) / (kappa + 2));
    for (i = 0; i < 4; i++)
      P[i * 4 + i] = (1 + e1 + 2 * e2) / 4;
    P[0 * 4 + 1] = P[1 * 4 + 0] = P[2 * 4 + 3] = P[3 * 4 + 2] =
        (1 + e1 - 2 * e2) / 4;
    P[0 * 4 + 2] = P[0 * 4 + 3] = P[2 * 4 + 0] = P[3 * 4 + 0] = P[1 * 4 + 2] =
        P[1 * 4 + 3] = P[2 * 4 + 1] = P[3 * 4 + 1] = (1 - e1) / 4;
  }
  return (0);
}


x86 assembly (clang, -O0):
<PMatK80>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
movsd  0xea2(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    117a <PMatK80+0x3a>
movsd  -0x18(%rbp),%xmm0
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
movsd  0xe86(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    11a7 <PMatK80+0x67>
mov    -0x10(%rbp),%rdi
mov    $0x4,%esi
call   1050 <identity@plt>
movl   $0x0,-0x4(%rbp)
jmp    1417 <PMatK80+0x2d7>
movsd  0xe79(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  0xe64(%rip),%xmm1
addsd  -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1060 <exp@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xe38(%rip),%xmm1
subsd  %xmm1,%xmm0
call   1040 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xe1b(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    12c9 <PMatK80+0x189>
movl   $0x0,-0x24(%rbp)
cmpl   $0x4,-0x24(%rbp)
jge    12c4 <PMatK80+0x184>
movl   $0x0,-0x28(%rbp)
cmpl   $0x4,-0x28(%rbp)
jge    12b1 <PMatK80+0x171>
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
jne    1270 <PMatK80+0x130>
movsd  -0x30(%rbp),%xmm0
movsd  0xe06(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdd2(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xde6(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x2,%ecx
add    -0x28(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    129e <PMatK80+0x15e>
movsd  0xda0(%rip),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  0xdb3(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x2,%ecx
add    -0x28(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    12a3 <PMatK80+0x163>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1217 <PMatK80+0xd7>
jmp    12b6 <PMatK80+0x176>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1206 <PMatK80+0xc6>
jmp    1410 <PMatK80+0x2d0>
movsd  0xd5f(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  0xd3a(%rip),%xmm1
addsd  -0x20(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd31(%rip),%xmm1
addsd  -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1060 <exp@plt>
movsd  %xmm0,-0x38(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x4,-0x24(%rbp)
jge    1360 <PMatK80+0x220>
movsd  0xcf9(%rip),%xmm1
addsd  -0x30(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm0
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xcff(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
shl    $0x2,%ecx
add    -0x24(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    130d <PMatK80+0x1cd>
movsd  0xcb0(%rip),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
addsd  %xmm1,%xmm1
subsd  %xmm1,%xmm0
movsd  0xcb6(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x70(%rax)
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x58(%rax)
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x20(%rax)
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  0xc66(%rip),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  0xc79(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x68(%rax)
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x48(%rax)
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x38(%rax)
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x30(%rax)
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x60(%rax)
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x40(%rax)
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x18(%rax)
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PMatK80>:
push   %rbx
sub    $0x30,%rsp
mov    %rdi,%rbx
movsd  0xeb0(%rip),%xmm2
ucomisd %xmm0,%xmm2
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
jbe    117a <PMatK80+0x3a>
lea    0xf07(%rip),%rdi
call   1030 <printf@plt>
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
movsd  0xe86(%rip),%xmm2
ucomisd %xmm0,%xmm2
jbe    119a <PMatK80+0x5a>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1050 <identity@plt>
jmp    1303 <PMatK80+0x1c3>
movsd  0xe6e(%rip),%xmm2
mulsd  %xmm0,%xmm2
movsd  0xe6a(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x18(%rsp)
divsd  %xmm0,%xmm2
cvttsd2si %xmm2,%edi
call   1060 <exp@plt>
movapd %xmm0,0x20(%rsp)
movsd  0xe4d(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
call   1040 <fabs@plt>
test   %eax,%eax
jle    129d <PMatK80+0x15d>
movsd  0x10(%rsp),%xmm0
mulsd  0xe34(%rip),%xmm0
movsd  0x8(%rsp),%xmm2
addsd  0xe2e(%rip),%xmm2
mulsd  %xmm0,%xmm2
divsd  0x18(%rsp),%xmm2
cvttsd2si %xmm2,%edi
call   1060 <exp@plt>
movapd 0x20(%rsp),%xmm2
movapd %xmm2,%xmm1
movsd  0xe09(%rip),%xmm3
addsd  %xmm3,%xmm1
unpcklpd %xmm0,%xmm0
mulpd  0xe19(%rip),%xmm0
unpcklpd %xmm1,%xmm1
addpd  %xmm1,%xmm0
mulpd  0xe19(%rip),%xmm0
movapd %xmm0,%xmm1
shufpd $0x1,%xmm0,%xmm1
movupd %xmm1,0x70(%rbx)
movupd %xmm0,0x50(%rbx)
movupd %xmm1,0x20(%rbx)
movupd %xmm0,(%rbx)
movapd %xmm3,%xmm0
subsd  %xmm2,%xmm0
mulsd  0xdc5(%rip),%xmm0
movsd  %xmm0,0x68(%rbx)
movsd  %xmm0,0x48(%rbx)
movsd  %xmm0,0x38(%rbx)
movsd  %xmm0,0x30(%rbx)
movsd  %xmm0,0x60(%rbx)
movsd  %xmm0,0x40(%rbx)
movsd  %xmm0,0x18(%rbx)
movsd  %xmm0,0x10(%rbx)
jmp    1303 <PMatK80+0x1c3>
movsd  0xd8b(%rip),%xmm0
movapd %xmm0,%xmm1
movapd 0x20(%rsp),%xmm2
subsd  %xmm2,%xmm1
mulsd  0xd85(%rip),%xmm2
addsd  %xmm0,%xmm2
unpcklpd %xmm1,%xmm2
mulpd  0xd95(%rip),%xmm2
movupd %xmm2,(%rbx)
movapd %xmm2,%xmm0
unpckhpd %xmm2,%xmm0
movupd %xmm0,0x10(%rbx)
movapd %xmm2,%xmm1
shufpd $0x1,%xmm2,%xmm1
movupd %xmm1,0x20(%rbx)
movupd %xmm0,0x30(%rbx)
movupd %xmm0,0x40(%rbx)
movupd %xmm2,0x50(%rbx)
movupd %xmm0,0x60(%rbx)
movupd %xmm1,0x70(%rbx)
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"\0At = %.5f in PMatK80\00"
define i32 @PMatK80(double* %0, double %1, double %2) {
%4 = alloca i32
%5 = alloca double*
%6 = alloca double
%7 = alloca double
%8 = alloca i32
%9 = alloca i32
%10 = alloca double
%11 = alloca double
store double* %0, double** %5
store double %1, double* %6
store double %2, double* %7
%12 = load double, double* %6
%13 = fcmp olt double %12, -1.000000e-02
br i1 %13, label %14, label %17
14: ; preds = %3
%15 = load double, double* %6
%16 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), double %15)
br label %17
17: ; preds = %14, %3
%18 = load double, double* %6
%19 = fcmp olt double %18, 1.000000e-100
br i1 %19, label %20, label %23
20: ; preds = %17
%21 = load double*, double** %5
%22 = call i32 @identity(double* %21, i32 4)
store i32 0, i32* %4
br label %143
23: ; preds = %17
%24 = load double, double* %6
%25 = fmul double -4.000000e+00, %24
%26 = load double, double* %7
%27 = fadd double %26, 2.000000e+00
%28 = fdiv double %25, %27
%29 = fptosi double %28 to i32
%30 = call double @exp(i32 %29)
store double %30, double* %10
%31 = load double, double* %7
%32 = fsub double %31, 1.000000e+00
%33 = call i32 @fabs(double %32)
%34 = sitofp i32 %33 to double
%35 = fcmp olt double %34, 1.000000e-05
br i1 %35, label %36, label %79
36: ; preds = %23
store i32 0, i32* %8
br label %37
37: ; preds = %75, %36
%38 = load i32, i32* %8
%39 = icmp slt i32 %38, 4
br i1 %39, label %40, label %78
40: ; preds = %37
store i32 0, i32* %9
br label %41
41: ; preds = %71, %40
%42 = load i32, i32* %9
%43 = icmp slt i32 %42, 4
br i1 %43, label %44, label %74
44: ; preds = %41
%45 = load i32, i32* %8
%46 = load i32, i32* %9
%47 = icmp eq i32 %45, %46
br i1 %47, label %48, label %59
48: ; preds = %44
%49 = load double, double* %10
%50 = call double @llvm.fmuladd.f64(double 3.000000e+00, double %49, double 1.000000e+00)
%51 = fdiv double %50, 4.000000e+00
%52 = load double*, double** %5
%53 = load i32, i32* %8
%54 = mul nsw i32 %53, 4
%55 = load i32, i32* %9
%56 = add nsw i32 %54, %55
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds double, double* %52, i64 %57
store double %51, double* %58
br label %70
59: ; preds = %44
%60 = load double, double* %10
%61 = fsub double 1.000000e+00, %60
%62 = fdiv double %61, 4.000000e+00
%63 = load double*, double** %5
%64 = load i32, i32* %8
%65 = mul nsw i32 %64, 4
%66 = load i32, i32* %9
%67 = add nsw i32 %65, %66
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds double, double* %63, i64 %68
store double %62, double* %69
br label %70
70: ; preds = %59, %48
br label %71
71: ; preds = %70
%72 = load i32, i32* %9
%73 = add nsw i32 %72, 1
store i32 %73, i32* %9
br label %41
74: ; preds = %41
br label %75
75: ; preds = %74
%76 = load i32, i32* %8
%77 = add nsw i32 %76, 1
store i32 %77, i32* %8
br label %37
78: ; preds = %37
br label %142
79: ; preds = %23
%80 = load double, double* %6
%81 = fmul double -2.000000e+00, %80
%82 = load double, double* %7
%83 = fadd double %82, 1.000000e+00
%84 = fmul double %81, %83
%85 = load double, double* %7
%86 = fadd double %85, 2.000000e+00
%87 = fdiv double %84, %86
%88 = fptosi double %87 to i32
%89 = call double @exp(i32 %88)
store double %89, double* %11
store i32 0, i32* %8
br label %90
90: ; preds = %106, %79
%91 = load i32, i32* %8
%92 = icmp slt i32 %91, 4
br i1 %92, label %93, label %109
93: ; preds = %90
%94 = load double, double* %10
%95 = fadd double 1.000000e+00, %94
%96 = load double, double* %11
%97 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %96, double %95)
%98 = fdiv double %97, 4.000000e+00
%99 = load double*, double** %5
%100 = load i32, i32* %8
%101 = mul nsw i32 %100, 4
%102 = load i32, i32* %8
%103 = add nsw i32 %101, %102
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds double, double* %99, i64 %104
store double %98, double* %105
br label %106
106: ; preds = %93
%107 = load i32, i32* %8
%108 = add nsw i32 %107, 1
store i32 %108, i32* %8
br label %90
109: ; preds = %90
%110 = load double, double* %10
%111 = fadd double 1.000000e+00, %110
%112 = load double, double* %11
%113 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %112, double %111)
%114 = fdiv double %113, 4.000000e+00
%115 = load double*, double** %5
%116 = getelementptr inbounds double, double* %115, i64 14
store double %114, double* %116
%117 = load double*, double** %5
%118 = getelementptr inbounds double, double* %117, i64 11
store double %114, double* %118
%119 = load double*, double** %5
%120 = getelementptr inbounds double, double* %119, i64 4
store double %114, double* %120
%121 = load double*, double** %5
%122 = getelementptr inbounds double, double* %121, i64 1
store double %114, double* %122
%123 = load double, double* %10
%124 = fsub double 1.000000e+00, %123
%125 = fdiv double %124, 4.000000e+00
%126 = load double*, double** %5
%127 = getelementptr inbounds double, double* %126, i64 13
store double %125, double* %127
%128 = load double*, double** %5
%129 = getelementptr inbounds double, double* %128, i64 9
store double %125, double* %129
%130 = load double*, double** %5
%131 = getelementptr inbounds double, double* %130, i64 7
store double %125, double* %131
%132 = load double*, double** %5
%133 = getelementptr inbounds double, double* %132, i64 6
store double %125, double* %133
%134 = load double*, double** %5
%135 = getelementptr inbounds double, double* %134, i64 12
store double %125, double* %135
%136 = load double*, double** %5
%137 = getelementptr inbounds double, double* %136, i64 8
store double %125, double* %137
%138 = load double*, double** %5
%139 = getelementptr inbounds double, double* %138, i64 3
store double %125, double* %139
%140 = load double*, double** %5
%141 = getelementptr inbounds double, double* %140, i64 2
store double %125, double* %141
br label %142
142: ; preds = %109, %78
store i32 0, i32* %4
br label %143
143: ; preds = %142, %20
%144 = load i32, i32* %4
ret i32 %144
}

LLVM IR (-O2):
@.str = [21 x i8] c"\0At = %.5f in PMatK80\00"
define i32 @PMatK80(double* %0, double %1, double %2) {
%4 = fcmp olt double %1, -1.000000e-02
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), double %1)
br label %7
7: ; preds = %5, %3
%8 = fcmp olt double %1, 1.000000e-100
br i1 %8, label %9, label %11
9: ; preds = %7
%10 = tail call i32 @identity(double* %0, i32 4)
br label %75
11: ; preds = %7
%12 = fmul double %1, -4.000000e+00
%13 = fadd double %2, 2.000000e+00
%14 = fdiv double %12, %13
%15 = fptosi double %14 to i32
%16 = tail call double @exp(i32 %15)
%17 = fadd double %2, -1.000000e+00
%18 = tail call i32 @fabs(double %17)
%19 = icmp slt i32 %18, 1
br i1 %19, label %20, label %43
20: ; preds = %11
%21 = fsub double 1.000000e+00, %16
%22 = tail call double @llvm.fmuladd.f64(double %16, double 3.000000e+00, double 1.000000e+00)
%23 = insertelement <2 x double> poison, double %22, i64 0
%24 = insertelement <2 x double> %23, double %21, i64 1
%25 = fmul <2 x double> %24, <double 2.500000e-01, double 2.500000e-01>
%26 = bitcast double* %0 to <2 x double>*
store <2 x double> %25, <2 x double>* %26
%27 = getelementptr inbounds double, double* %0, i64 2
%28 = shufflevector <2 x double> %25, <2 x double> undef, <2 x i32> <i32 1, i32 1>
%29 = bitcast double* %27 to <2 x double>*
store <2 x double> %28, <2 x double>* %29
%30 = getelementptr inbounds double, double* %0, i64 4
%31 = shufflevector <2 x double> %25, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%32 = bitcast double* %30 to <2 x double>*
store <2 x double> %31, <2 x double>* %32
%33 = getelementptr inbounds double, double* %0, i64 6
%34 = bitcast double* %33 to <2 x double>*
store <2 x double> %28, <2 x double>* %34
%35 = getelementptr inbounds double, double* %0, i64 8
%36 = bitcast double* %35 to <2 x double>*
store <2 x double> %28, <2 x double>* %36
%37 = getelementptr inbounds double, double* %0, i64 10
%38 = bitcast double* %37 to <2 x double>*
store <2 x double> %25, <2 x double>* %38
%39 = getelementptr inbounds double, double* %0, i64 12
%40 = bitcast double* %39 to <2 x double>*
store <2 x double> %28, <2 x double>* %40
%41 = getelementptr inbounds double, double* %0, i64 14
%42 = bitcast double* %41 to <2 x double>*
store <2 x double> %31, <2 x double>* %42
br label %75
43: ; preds = %11
%44 = fmul double %1, -2.000000e+00
%45 = fadd double %2, 1.000000e+00
%46 = fmul double %44, %45
%47 = fdiv double %46, %13
%48 = fptosi double %47 to i32
%49 = tail call double @exp(i32 %48)
%50 = fadd double %16, 1.000000e+00
%51 = insertelement <2 x double> poison, double %49, i64 0
%52 = shufflevector <2 x double> %51, <2 x double> poison, <2 x i32> zeroinitializer
%53 = insertelement <2 x double> poison, double %50, i64 0
%54 = shufflevector <2 x double> %53, <2 x double> poison, <2 x i32> zeroinitializer
%55 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %52, <2 x double> <double 2.000000e+00, double -2.000000e+00>, <2 x double> %54)
%56 = fmul <2 x double> %55, <double 2.500000e-01, double 2.500000e-01>
%57 = getelementptr inbounds double, double* %0, i64 10
%58 = getelementptr inbounds double, double* %0, i64 14
%59 = shufflevector <2 x double> %56, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%60 = bitcast double* %58 to <2 x double>*
store <2 x double> %59, <2 x double>* %60
%61 = bitcast double* %57 to <2 x double>*
store <2 x double> %56, <2 x double>* %61
%62 = getelementptr inbounds double, double* %0, i64 4
%63 = bitcast double* %62 to <2 x double>*
store <2 x double> %59, <2 x double>* %63
%64 = bitcast double* %0 to <2 x double>*
store <2 x double> %56, <2 x double>* %64
%65 = fsub double 1.000000e+00, %16
%66 = fmul double %65, 2.500000e-01
%67 = getelementptr inbounds double, double* %0, i64 13
store double %66, double* %67
%68 = getelementptr inbounds double, double* %0, i64 9
store double %66, double* %68
%69 = getelementptr inbounds double, double* %0, i64 7
store double %66, double* %69
%70 = getelementptr inbounds double, double* %0, i64 6
store double %66, double* %70
%71 = getelementptr inbounds double, double* %0, i64 12
store double %66, double* %71
%72 = getelementptr inbounds double, double* %0, i64 8
store double %66, double* %72
%73 = getelementptr inbounds double, double* %0, i64 3
store double %66, double* %73
%74 = getelementptr inbounds double, double* %0, i64 2
store double %66, double* %74
br label %75
75: ; preds = %20, %43, %9
ret i32 0
}