#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 *calloc(int, int);
int /*<<< orphan*/ free(double *);
int /*<<< orphan*/ memcpy(double *, double *, int);
int /*<<< orphan*/ memset(double *, int /*<<< orphan*/, int);
int cheleg(int kind, int m, int n, double coeffm[], double coeffn[]) {
  int N = (m > n) ? m : n;
  double *coeff[3];
  coeff[0] = calloc(3 * (N + 1), sizeof(double));
  coeff[1] = coeff[0] + (N + 1);
  coeff[2] = coeff[1] + (N + 1);
  for (int j = 0; j <= N; j++) {
    int j0 = j % 3;
    if (j == 0) {
      coeff[0][0] = 1.0;
    } else if (j == 1) {
      coeff[1][1] = 1.0;
    } else {
      int j1 = (j - 1) % 3;
      int j2 = (j - 2) % 3;
      memset(coeff[j0], 0, (N + 1) * sizeof(double));
      double d = (double)j;
      for (int k = 0; k < N; k++) {
        if (kind == 1) {
          coeff[j0][k + 1] = 2.0 * coeff[j1][k];
          coeff[j0][k] -= coeff[j2][k];
        } else if (kind == 2) {
          coeff[j0][k + 1] = ((2.0 * d - 1.0) * coeff[j1][k]) / d;
          coeff[j0][k] -= ((d - 1.0) * coeff[j2][k]) / d;
        }
      }
    }
    if (j == m)
      memcpy(coeffm, coeff[j0], (m + 1) * sizeof(double));
    if (j == n)
      memcpy(coeffn, coeff[j0], (n + 1) * sizeof(double));
  }
  free(coeff[0]);
  return 0;
}


x86 assembly (clang, -O0):
<cheleg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1170 <cheleg+0x30>
mov    -0x8(%rbp),%eax
mov    %eax,-0x60(%rbp)
jmp    1176 <cheleg+0x36>
mov    -0xc(%rbp),%eax
mov    %eax,-0x60(%rbp)
mov    -0x60(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
imul   $0x3,%eax,%edi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x24(%rbp),%eax
jg     140a <cheleg+0x2ca>
mov    -0x44(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %edx,-0x48(%rbp)
cmpl   $0x0,-0x44(%rbp)
jne    1203 <cheleg+0xc3>
mov    -0x40(%rbp),%rax
movsd  0xe06(%rip),%xmm0
movsd  %xmm0,(%rax)
jmp    139f <cheleg+0x25f>
cmpl   $0x1,-0x44(%rbp)
jne    1223 <cheleg+0xe3>
mov    -0x38(%rbp),%rax
movsd  0xde7(%rip),%xmm0
movsd  %xmm0,0x8(%rax)
jmp    139a <cheleg+0x25a>
mov    -0x44(%rbp),%eax
sub    $0x1,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4c(%rbp)
mov    -0x44(%rbp),%eax
sub    $0x2,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %edx,-0x50(%rbp)
movslq -0x48(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rdi
mov    -0x24(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edx
xor    %esi,%esi
call   1040 <memset@plt>
cvtsi2sdl -0x44(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movl   $0x0,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1395 <cheleg+0x255>
cmpl   $0x1,-0x4(%rbp)
jne    12ed <cheleg+0x1ad>
movslq -0x4c(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rax
movslq -0x5c(%rbp),%rcx
movsd  0xd71(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
movslq -0x48(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rax
mov    -0x5c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movslq -0x50(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rax
movslq -0x5c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movslq -0x48(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rax
movslq -0x5c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    1382 <cheleg+0x242>
cmpl   $0x2,-0x4(%rbp)
jne    137d <cheleg+0x23d>
movsd  -0x58(%rbp),%xmm0
addsd  %xmm0,%xmm0
movsd  0xd00(%rip),%xmm1
addsd  %xmm1,%xmm0
movslq -0x4c(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rax
movslq -0x5c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
divsd  -0x58(%rbp),%xmm0
movslq -0x48(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rax
mov    -0x5c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x58(%rbp),%xmm1
movsd  0xcb9(%rip),%xmm0
subsd  %xmm0,%xmm1
movslq -0x50(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rax
movslq -0x5c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm1
divsd  -0x58(%rbp),%xmm1
movslq -0x48(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rax
movslq -0x5c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    1382 <cheleg+0x242>
jmp    1387 <cheleg+0x247>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    1274 <cheleg+0x134>
jmp    139a <cheleg+0x25a>
jmp    139f <cheleg+0x25f>
mov    -0x44(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    13cb <cheleg+0x28b>
mov    -0x18(%rbp),%rdi
movslq -0x48(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rsi
mov    -0x8(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edx
call   1060 <memcpy@plt>
mov    -0x44(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    13f7 <cheleg+0x2b7>
mov    -0x20(%rbp),%rdi
movslq -0x48(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rsi
mov    -0xc(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edx
call   1060 <memcpy@plt>
jmp    13fc <cheleg+0x2bc>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11ca <cheleg+0x8a>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cheleg>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %r8,0x50(%rsp)
mov    %rcx,0x48(%rsp)
mov    %edi,%ebp
cmp    %edx,%esi
mov    %rdx,0x38(%rsp)
mov    %edx,%r12d
mov    %rsi,0x30(%rsp)
cmovg  %esi,%r12d
lea    0x1(%r12),%ebx
lea    (%rbx,%rbx,2),%edi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,0x10(%rsp)
mov    %rbx,(%rsp)
movslq %ebx,%rcx
mov    %rax,0x40(%rsp)
lea    (%rax,%rcx,8),%rax
mov    %rax,0x18(%rsp)
mov    %rax,0x28(%rsp)
lea    (%rax,%rcx,8),%rax
mov    %rax,0x20(%rsp)
test   %r12d,%r12d
js     138d <cheleg+0x24d>
addq   $0x8,0x28(%rsp)
mov    (%rsp),%rax
shl    $0x3,%eax
mov    %rax,(%rsp)
mov    0x30(%rsp),%rax
lea    0x8(,%rax,8),%eax
mov    %eax,0xc(%rsp)
mov    0x38(%rsp),%rax
lea    0x8(,%rax,8),%eax
mov    %eax,0x8(%rsp)
mov    %r12d,%r13d
xor    %ebx,%ebx
jmp    11fe <cheleg+0xbe>
nopl   0x0(%rax,%rax,1)
lea    0x1(%rbx),%eax
cmp    %r12d,%ebx
mov    %eax,%ebx
je     138d <cheleg+0x24d>
mov    %ebx,%eax
mov    $0xaaaaaaab,%ecx
imul   %rcx,%rax
shr    $0x21,%rax
lea    (%rax,%rax,2),%eax
mov    %ebx,%r14d
sub    %eax,%r14d
mov    0x40(%rsp),%rax
test   %ebx,%ebx
je     1229 <cheleg+0xe9>
mov    0x28(%rsp),%rax
cmp    $0x1,%ebx
jne    1270 <cheleg+0x130>
movabs $0x3ff0000000000000,%rcx
mov    %rcx,(%rax)
cmp    0x30(%rsp),%ebx
jne    1252 <cheleg+0x112>
mov    %r14d,%eax
mov    0x10(%rsp,%rax,8),%rsi
mov    0x48(%rsp),%rdi
mov    0xc(%rsp),%edx
call   1060 <memcpy@plt>
cmp    0x38(%rsp),%ebx
jne    11f0 <cheleg+0xb0>
mov    %r14d,%eax
mov    0x10(%rsp,%rax,8),%rsi
mov    0x50(%rsp),%rdi
mov    0x8(%rsp),%edx
call   1060 <memcpy@plt>
jmp    11f0 <cheleg+0xb0>
mov    %r14d,%eax
mov    0x10(%rsp,%rax,8),%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    (%rsp),%rdx
call   1040 <memset@plt>
test   %r12d,%r12d
je     1236 <cheleg+0xf6>
cvtsi2sd %ebx,%xmm0
lea    -0x2(%rbx),%eax
cltq
imul   $0x55555556,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
add    %ecx,%eax
lea    (%rax,%rax,2),%eax
neg    %eax
lea    (%rbx,%rax,1),%ecx
add    $0xfffffffe,%ecx
lea    -0x1(%rbx),%eax
cltq
imul   $0x55555556,%rax,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rax
add    %edx,%eax
lea    (%rax,%rax,2),%eax
neg    %eax
add    %ebx,%eax
add    $0xffffffff,%eax
movapd %xmm0,%xmm1
addsd  %xmm0,%xmm1
movsd  0xd1a(%rip),%xmm3
addsd  %xmm3,%xmm1
cltq
movapd %xmm0,%xmm2
addsd  %xmm3,%xmm2
movslq %ecx,%rcx
xor    %edx,%edx
jmp    1348 <cheleg+0x208>
nopl   0x0(%rax,%rax,1)
mov    0x10(%rsp,%rax,8),%rsi
movsd  (%rsi,%rdx,8),%xmm3
mulsd  %xmm1,%xmm3
divsd  %xmm0,%xmm3
movsd  %xmm3,0x8(%r15,%rdx,8)
mov    0x10(%rsp,%rcx,8),%rsi
movsd  (%rsi,%rdx,8),%xmm3
mulsd  %xmm2,%xmm3
divsd  %xmm0,%xmm3
movsd  (%r15,%rdx,8),%xmm4
subsd  %xmm3,%xmm4
movsd  %xmm4,(%r15,%rdx,8)
add    $0x1,%rdx
cmp    %r13,%rdx
je     1236 <cheleg+0xf6>
cmp    $0x1,%ebp
je     1360 <cheleg+0x220>
cmp    $0x2,%ebp
je     1300 <cheleg+0x1c0>
add    $0x1,%rdx
jmp    133f <cheleg+0x1ff>
nopl   0x0(%rax,%rax,1)
mov    0x10(%rsp,%rax,8),%rsi
movsd  (%rsi,%rdx,8),%xmm3
addsd  %xmm3,%xmm3
movsd  %xmm3,0x8(%r15,%rdx,8)
mov    0x10(%rsp,%rcx,8),%rsi
movsd  (%r15,%rdx,8),%xmm3
subsd  (%rsi,%rdx,8),%xmm3
movsd  %xmm3,(%r15,%rdx,8)
jmp    133b <cheleg+0x1fb>
mov    0x40(%rsp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @cheleg(i32 %0, i32 %1, i32 %2, double* %3, double* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca double*
%10 = alloca double*
%11 = alloca i32
%12 = alloca [3 x double*]
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca double
%18 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store double* %3, double** %9
store double* %4, double** %10
%19 = load i32, i32* %7
%20 = load i32, i32* %8
%21 = icmp sgt i32 %19, %20
br i1 %21, label %22, label %24
22: ; preds = %5
%23 = load i32, i32* %7
br label %26
24: ; preds = %5
%25 = load i32, i32* %8
br label %26
26: ; preds = %24, %22
%27 = phi i32 [ %23, %22 ], [ %25, %24 ]
store i32 %27, i32* %11
%28 = load i32, i32* %11
%29 = add nsw i32 %28, 1
%30 = mul nsw i32 3, %29
%31 = call double* @calloc(i32 %30, i32 8)
%32 = getelementptr inbounds [3 x double*], [3 x double*]* %12, i64 0, i64 0
store double* %31, double** %32
%33 = getelementptr inbounds [3 x double*], [3 x double*]* %12, i64 0, i64 0
%34 = load double*, double** %33
%35 = load i32, i32* %11
%36 = add nsw i32 %35, 1
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds double, double* %34, i64 %37
%39 = getelementptr inbounds [3 x double*], [3 x double*]* %12, i64 0, i64 1
store double* %38, double** %39
%40 = getelementptr inbounds [3 x double*], [3 x double*]* %12, i64 0, i64 1
%41 = load double*, double** %40
%42 = load i32, i32* %11
%43 = add nsw i32 %42, 1
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds double, double* %41, i64 %44
%46 = getelementptr inbounds [3 x double*], [3 x double*]* %12, i64 0, i64 2
store double* %45, double** %46
store i32 0, i32* %13
br label %47
47: ; preds = %215, %26
%48 = load i32, i32* %13
%49 = load i32, i32* %11
%50 = icmp sle i32 %48, %49
br i1 %50, label %51, label %218
51: ; preds = %47
%52 = load i32, i32* %13
%53 = srem i32 %52, 3
store i32 %53, i32* %14
%54 = load i32, i32* %13
%55 = icmp eq i32 %54, 0
br i1 %55, label %56, label %60
56: ; preds = %51
%57 = getelementptr inbounds [3 x double*], [3 x double*]* %12, i64 0, i64 0
%58 = load double*, double** %57
%59 = getelementptr inbounds double, double* %58, i64 0
store double 1.000000e+00, double* %59
br label %182
60: ; preds = %51
%61 = load i32, i32* %13
%62 = icmp eq i32 %61, 1
br i1 %62, label %63, label %67
63: ; preds = %60
%64 = getelementptr inbounds [3 x double*], [3 x double*]* %12, i64 0, i64 1
%65 = load double*, double** %64
%66 = getelementptr inbounds double, double* %65, i64 1
store double 1.000000e+00, double* %66
br label %181
67: ; preds = %60
%68 = load i32, i32* %13
%69 = sub nsw i32 %68, 1
%70 = srem i32 %69, 3
store i32 %70, i32* %15
%71 = load i32, i32* %13
%72 = sub nsw i32 %71, 2
%73 = srem i32 %72, 3
store i32 %73, i32* %16
%74 = load i32, i32* %14
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds [3 x double*], [3 x double*]* %12, i64 0, i64 %75
%77 = load double*, double** %76
%78 = load i32, i32* %11
%79 = add nsw i32 %78, 1
%80 = sext i32 %79 to i64
%81 = mul i64 %80, 8
%82 = trunc i64 %81 to i32
%83 = call i32 @memset(double* %77, i32 0, i32 %82)
%84 = load i32, i32* %13
%85 = sitofp i32 %84 to double
store double %85, double* %17
store i32 0, i32* %18
br label %86
86: ; preds = %177, %67
%87 = load i32, i32* %18
%88 = load i32, i32* %11
%89 = icmp slt i32 %87, %88
br i1 %89, label %90, label %180
90: ; preds = %86
%91 = load i32, i32* %6
%92 = icmp eq i32 %91, 1
br i1 %92, label %93, label %128
93: ; preds = %90
%94 = load i32, i32* %15
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds [3 x double*], [3 x double*]* %12, i64 0, i64 %95
%97 = load double*, double** %96
%98 = load i32, i32* %18
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds double, double* %97, i64 %99
%101 = load double, double* %100
%102 = fmul double 2.000000e+00, %101
%103 = load i32, i32* %14
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds [3 x double*], [3 x double*]* %12, i64 0, i64 %104
%106 = load double*, double** %105
%107 = load i32, i32* %18
%108 = add nsw i32 %107, 1
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds double, double* %106, i64 %109
store double %102, double* %110
%111 = load i32, i32* %16
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds [3 x double*], [3 x double*]* %12, i64 0, i64 %112
%114 = load double*, double** %113
%115 = load i32, i32* %18
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds double, double* %114, i64 %116
%118 = load double, double* %117
%119 = load i32, i32* %14
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds [3 x double*], [3 x double*]* %12, i64 0, i64 %120
%122 = load double*, double** %121
%123 = load i32, i32* %18
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds double, double* %122, i64 %124
%126 = load double, double* %125
%127 = fsub double %126, %118
store double %127, double* %125
br label %176
128: ; preds = %90
%129 = load i32, i32* %6
%130 = icmp eq i32 %129, 2
br i1 %130, label %131, label %175
131: ; preds = %128
%132 = load double, double* %17
%133 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %132, double -1.000000e+00)
%134 = load i32, i32* %15
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds [3 x double*], [3 x double*]* %12, i64 0, i64 %135
%137 = load double*, double** %136
%138 = load i32, i32* %18
%139 = sext i32 %138 to i64
%140 = getelementptr inbounds double, double* %137, i64 %139
%141 = load double, double* %140
%142 = fmul double %133, %141
%143 = load double, double* %17
%144 = fdiv double %142, %143
%145 = load i32, i32* %14
%146 = sext i32 %145 to i64
%147 = getelementptr inbounds [3 x double*], [3 x double*]* %12, i64 0, i64 %146
%148 = load double*, double** %147
%149 = load i32, i32* %18
%150 = add nsw i32 %149, 1
%151 = sext i32 %150 to i64
%152 = getelementptr inbounds double, double* %148, i64 %151
store double %144, double* %152
%153 = load double, double* %17
%154 = fsub double %153, 1.000000e+00
%155 = load i32, i32* %16
%156 = sext i32 %155 to i64
%157 = getelementptr inbounds [3 x double*], [3 x double*]* %12, i64 0, i64 %156
%158 = load double*, double** %157
%159 = load i32, i32* %18
%160 = sext i32 %159 to i64
%161 = getelementptr inbounds double, double* %158, i64 %160
%162 = load double, double* %161
%163 = fmul double %154, %162
%164 = load double, double* %17
%165 = fdiv double %163, %164
%166 = load i32, i32* %14
%167 = sext i32 %166 to i64
%168 = getelementptr inbounds [3 x double*], [3 x double*]* %12, i64 0, i64 %167
%169 = load double*, double** %168
%170 = load i32, i32* %18
%171 = sext i32 %170 to i64
%172 = getelementptr inbounds double, double* %169, i64 %171
%173 = load double, double* %172
%174 = fsub double %173, %165
store double %174, double* %172
br label %175
175: ; preds = %131, %128
br label %176
176: ; preds = %175, %93
br label %177
177: ; preds = %176
%178 = load i32, i32* %18
%179 = add nsw i32 %178, 1
store i32 %179, i32* %18
br label %86
180: ; preds = %86
br label %181
181: ; preds = %180, %63
br label %182
182: ; preds = %181, %56
%183 = load i32, i32* %13
%184 = load i32, i32* %7
%185 = icmp eq i32 %183, %184
br i1 %185, label %186, label %198
186: ; preds = %182
%187 = load double*, double** %9
%188 = load i32, i32* %14
%189 = sext i32 %188 to i64
%190 = getelementptr inbounds [3 x double*], [3 x double*]* %12, i64 0, i64 %189
%191 = load double*, double** %190
%192 = load i32, i32* %7
%193 = add nsw i32 %192, 1
%194 = sext i32 %193 to i64
%195 = mul i64 %194, 8
%196 = trunc i64 %195 to i32
%197 = call i32 @memcpy(double* %187, double* %191, i32 %196)
br label %198
198: ; preds = %186, %182
%199 = load i32, i32* %13
%200 = load i32, i32* %8
%201 = icmp eq i32 %199, %200
br i1 %201, label %202, label %214
202: ; preds = %198
%203 = load double*, double** %10
%204 = load i32, i32* %14
%205 = sext i32 %204 to i64
%206 = getelementptr inbounds [3 x double*], [3 x double*]* %12, i64 0, i64 %205
%207 = load double*, double** %206
%208 = load i32, i32* %8
%209 = add nsw i32 %208, 1
%210 = sext i32 %209 to i64
%211 = mul i64 %210, 8
%212 = trunc i64 %211 to i32
%213 = call i32 @memcpy(double* %203, double* %207, i32 %212)
br label %214
214: ; preds = %202, %198
br label %215
215: ; preds = %214
%216 = load i32, i32* %13
%217 = add nsw i32 %216, 1
store i32 %217, i32* %13
br label %47
218: ; preds = %47
%219 = getelementptr inbounds [3 x double*], [3 x double*]* %12, i64 0, i64 0
%220 = load double*, double** %219
%221 = call i32 @free(double* %220)
ret i32 0
}

LLVM IR (-O2):
define i32 @cheleg(i32 %0, i32 %1, i32 %2, double* %3, double* %4) {
%6 = alloca [3 x double*]
%7 = icmp sgt i32 %1, %2
%8 = select i1 %7, i32 %1, i32 %2
%9 = bitcast [3 x double*]* %6 to i8*
%10 = add i32 %8, 1
%11 = mul nsw i32 %10, 3
%12 = tail call double* @calloc(i32 %11, i32 8)
%13 = getelementptr inbounds [3 x double*], [3 x double*]* %6, i64 0, i64 0
store double* %12, double** %13
%14 = sext i32 %10 to i64
%15 = getelementptr inbounds double, double* %12, i64 %14
%16 = getelementptr inbounds [3 x double*], [3 x double*]* %6, i64 0, i64 1
store double* %15, double** %16
%17 = getelementptr inbounds double, double* %15, i64 %14
%18 = getelementptr inbounds [3 x double*], [3 x double*]* %6, i64 0, i64 2
store double* %17, double** %18
%19 = icmp slt i32 %8, 0
br i1 %19, label %29, label %20
20: ; preds = %5
%21 = getelementptr inbounds double, double* %15, i64 1
%22 = shl i32 %10, 3
%23 = icmp eq i32 %8, 0
%24 = shl i32 %1, 3
%25 = add i32 %24, 8
%26 = shl i32 %2, 3
%27 = add i32 %26, 8
%28 = zext i32 %8 to i64
br label %31
29: ; preds = %104, %5
%30 = tail call i32 @free(double* %12)
ret i32 0
31: ; preds = %20, %104
%32 = phi i32 [ 0, %20 ], [ %105, %104 ]
%33 = urem i32 %32, 3
switch i32 %32, label %35 [
i32 0, label %88
i32 1, label %34
]
34: ; preds = %31
br label %88
35: ; preds = %31
%36 = zext i32 %33 to i64
%37 = getelementptr inbounds [3 x double*], [3 x double*]* %6, i64 0, i64 %36
%38 = load double*, double** %37
%39 = tail call i32 @memset(double* %38, i32 0, i32 %22)
%40 = sitofp i32 %32 to double
br i1 %23, label %90, label %41
41: ; preds = %35
%42 = add nsw i32 %32, -2
%43 = srem i32 %42, 3
%44 = add nsw i32 %32, -1
%45 = srem i32 %44, 3
%46 = tail call double @llvm.fmuladd.f64(double %40, double 2.000000e+00, double -1.000000e+00)
%47 = sext i32 %45 to i64
%48 = getelementptr inbounds [3 x double*], [3 x double*]* %6, i64 0, i64 %47
%49 = fadd double %40, -1.000000e+00
%50 = sext i32 %43 to i64
%51 = getelementptr inbounds [3 x double*], [3 x double*]* %6, i64 0, i64 %50
br label %52
52: ; preds = %41, %85
%53 = phi i64 [ 0, %41 ], [ %86, %85 ]
switch i32 %0, label %54 [
i32 1, label %56
i32 2, label %69
]
54: ; preds = %52
%55 = add nuw nsw i64 %53, 1
br label %85
56: ; preds = %52
%57 = load double*, double** %48
%58 = getelementptr inbounds double, double* %57, i64 %53
%59 = load double, double* %58
%60 = fmul double %59, 2.000000e+00
%61 = add nuw nsw i64 %53, 1
%62 = getelementptr inbounds double, double* %38, i64 %61
store double %60, double* %62
%63 = load double*, double** %51
%64 = getelementptr inbounds double, double* %63, i64 %53
%65 = load double, double* %64
%66 = getelementptr inbounds double, double* %38, i64 %53
%67 = load double, double* %66
%68 = fsub double %67, %65
store double %68, double* %66
br label %85
69: ; preds = %52
%70 = load double*, double** %48
%71 = getelementptr inbounds double, double* %70, i64 %53
%72 = load double, double* %71
%73 = fmul double %46, %72
%74 = fdiv double %73, %40
%75 = add nuw nsw i64 %53, 1
%76 = getelementptr inbounds double, double* %38, i64 %75
store double %74, double* %76
%77 = load double*, double** %51
%78 = getelementptr inbounds double, double* %77, i64 %53
%79 = load double, double* %78
%80 = fmul double %49, %79
%81 = fdiv double %80, %40
%82 = getelementptr inbounds double, double* %38, i64 %53
%83 = load double, double* %82
%84 = fsub double %83, %81
store double %84, double* %82
br label %85
85: ; preds = %54, %56, %69
%86 = phi i64 [ %55, %54 ], [ %61, %56 ], [ %75, %69 ]
%87 = icmp eq i64 %86, %28
br i1 %87, label %90, label %52
88: ; preds = %31, %34
%89 = phi double* [ %21, %34 ], [ %12, %31 ]
store double 1.000000e+00, double* %89
br label %90
90: ; preds = %85, %88, %35
%91 = icmp eq i32 %32, %1
br i1 %91, label %92, label %97
92: ; preds = %90
%93 = zext i32 %33 to i64
%94 = getelementptr inbounds [3 x double*], [3 x double*]* %6, i64 0, i64 %93
%95 = load double*, double** %94
%96 = tail call i32 @memcpy(double* %3, double* %95, i32 %25)
br label %97
97: ; preds = %92, %90
%98 = icmp eq i32 %32, %2
br i1 %98, label %99, label %104
99: ; preds = %97
%100 = zext i32 %33 to i64
%101 = getelementptr inbounds [3 x double*], [3 x double*]* %6, i64 0, i64 %100
%102 = load double*, double** %101
%103 = tail call i32 @memcpy(double* %4, double* %102, i32 %27)
br label %104
104: ; preds = %99, %97
%105 = add nuw i32 %32, 1
%106 = icmp eq i32 %32, %8
br i1 %106, label %29, label %31
}