#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 j, j0, j1, j2, k, N;
  double *coeff[3], d;
  N = (m > n) ? m : n;
  coeff[0] = calloc(3 * (N + 1), sizeof(double));
  coeff[1] = coeff[0] + (N + 1);
  coeff[2] = coeff[1] + (N + 1);
  for (j = 0; j <= N; j++) {
    j0 = j % 3;
    if (j == 0) {
      coeff[0][0] = 1.0;
    } else if (j == 1) {
      coeff[1][1] = 1.0;
    } else {
      j1 = (j - 1) % 3;
      j2 = (j - 2) % 3;
      memset(coeff[j0], 0, (N + 1) * sizeof(double));
      d = (double)j;
      for (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,-0x5c(%rbp)
jmp    1176 <cheleg+0x36>
mov    -0xc(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
imul   $0x3,%eax,%edi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rax
mov    -0x38(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
mov    -0x38(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x38(%rbp),%eax
jg     140a <cheleg+0x2ca>
mov    -0x24(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %edx,-0x28(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    1203 <cheleg+0xc3>
mov    -0x50(%rbp),%rax
movsd  0xe06(%rip),%xmm0
movsd  %xmm0,(%rax)
jmp    139f <cheleg+0x25f>
cmpl   $0x1,-0x24(%rbp)
jne    1223 <cheleg+0xe3>
mov    -0x48(%rbp),%rax
movsd  0xde7(%rip),%xmm0
movsd  %xmm0,0x8(%rax)
jmp    139a <cheleg+0x25a>
mov    -0x24(%rbp),%eax
sub    $0x1,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %edx,-0x2c(%rbp)
mov    -0x24(%rbp),%eax
sub    $0x2,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %edx,-0x30(%rbp)
movslq -0x28(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rdi
mov    -0x38(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edx
xor    %esi,%esi
call   1040 <memset@plt>
cvtsi2sdl -0x24(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x38(%rbp),%eax
jge    1395 <cheleg+0x255>
cmpl   $0x1,-0x4(%rbp)
jne    12ed <cheleg+0x1ad>
movslq -0x2c(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rax
movslq -0x34(%rbp),%rcx
movsd  0xd71(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
movslq -0x28(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rax
mov    -0x34(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movslq -0x30(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movslq -0x28(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rax
movslq -0x34(%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 -0x2c(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rax
movslq -0x34(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
divsd  -0x58(%rbp),%xmm0
movslq -0x28(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rax
mov    -0x34(%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 -0x30(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rax
movslq -0x34(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm1
divsd  -0x58(%rbp),%xmm1
movslq -0x28(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    1382 <cheleg+0x242>
jmp    1387 <cheleg+0x247>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1274 <cheleg+0x134>
jmp    139a <cheleg+0x25a>
jmp    139f <cheleg+0x25f>
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    13cb <cheleg+0x28b>
mov    -0x18(%rbp),%rdi
movslq -0x28(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rsi
mov    -0x8(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edx
call   1060 <memcpy@plt>
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    13f7 <cheleg+0x2b7>
mov    -0x20(%rbp),%rdi
movslq -0x28(%rbp),%rax
mov    -0x50(%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    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11ca <cheleg+0x8a>
mov    -0x50(%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 i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca [3 x double*]
%18 = alloca double
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* %16
%28 = load i32, i32* %16
%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*]* %17, i64 0, i64 0
store double* %31, double** %32
%33 = getelementptr inbounds [3 x double*], [3 x double*]* %17, i64 0, i64 0
%34 = load double*, double** %33
%35 = load i32, i32* %16
%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*]* %17, i64 0, i64 1
store double* %38, double** %39
%40 = getelementptr inbounds [3 x double*], [3 x double*]* %17, i64 0, i64 1
%41 = load double*, double** %40
%42 = load i32, i32* %16
%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*]* %17, i64 0, i64 2
store double* %45, double** %46
store i32 0, i32* %11
br label %47
47: ; preds = %215, %26
%48 = load i32, i32* %11
%49 = load i32, i32* %16
%50 = icmp sle i32 %48, %49
br i1 %50, label %51, label %218
51: ; preds = %47
%52 = load i32, i32* %11
%53 = srem i32 %52, 3
store i32 %53, i32* %12
%54 = load i32, i32* %11
%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*]* %17, 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* %11
%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*]* %17, 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* %11
%69 = sub nsw i32 %68, 1
%70 = srem i32 %69, 3
store i32 %70, i32* %13
%71 = load i32, i32* %11
%72 = sub nsw i32 %71, 2
%73 = srem i32 %72, 3
store i32 %73, i32* %14
%74 = load i32, i32* %12
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds [3 x double*], [3 x double*]* %17, i64 0, i64 %75
%77 = load double*, double** %76
%78 = load i32, i32* %16
%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* %11
%85 = sitofp i32 %84 to double
store double %85, double* %18
store i32 0, i32* %15
br label %86
86: ; preds = %177, %67
%87 = load i32, i32* %15
%88 = load i32, i32* %16
%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* %13
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds [3 x double*], [3 x double*]* %17, i64 0, i64 %95
%97 = load double*, double** %96
%98 = load i32, i32* %15
%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* %12
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds [3 x double*], [3 x double*]* %17, i64 0, i64 %104
%106 = load double*, double** %105
%107 = load i32, i32* %15
%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* %14
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds [3 x double*], [3 x double*]* %17, i64 0, i64 %112
%114 = load double*, double** %113
%115 = load i32, i32* %15
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds double, double* %114, i64 %116
%118 = load double, double* %117
%119 = load i32, i32* %12
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds [3 x double*], [3 x double*]* %17, i64 0, i64 %120
%122 = load double*, double** %121
%123 = load i32, i32* %15
%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* %18
%133 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %132, double -1.000000e+00)
%134 = load i32, i32* %13
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds [3 x double*], [3 x double*]* %17, i64 0, i64 %135
%137 = load double*, double** %136
%138 = load i32, i32* %15
%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* %18
%144 = fdiv double %142, %143
%145 = load i32, i32* %12
%146 = sext i32 %145 to i64
%147 = getelementptr inbounds [3 x double*], [3 x double*]* %17, i64 0, i64 %146
%148 = load double*, double** %147
%149 = load i32, i32* %15
%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* %18
%154 = fsub double %153, 1.000000e+00
%155 = load i32, i32* %14
%156 = sext i32 %155 to i64
%157 = getelementptr inbounds [3 x double*], [3 x double*]* %17, i64 0, i64 %156
%158 = load double*, double** %157
%159 = load i32, i32* %15
%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* %18
%165 = fdiv double %163, %164
%166 = load i32, i32* %12
%167 = sext i32 %166 to i64
%168 = getelementptr inbounds [3 x double*], [3 x double*]* %17, i64 0, i64 %167
%169 = load double*, double** %168
%170 = load i32, i32* %15
%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* %15
%179 = add nsw i32 %178, 1
store i32 %179, i32* %15
br label %86
180: ; preds = %86
br label %181
181: ; preds = %180, %63
br label %182
182: ; preds = %181, %56
%183 = load i32, i32* %11
%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* %12
%189 = sext i32 %188 to i64
%190 = getelementptr inbounds [3 x double*], [3 x double*]* %17, 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* %11
%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* %12
%205 = sext i32 %204 to i64
%206 = getelementptr inbounds [3 x double*], [3 x double*]* %17, 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* %11
%217 = add nsw i32 %216, 1
store i32 %217, i32* %11
br label %47
218: ; preds = %47
%219 = getelementptr inbounds [3 x double*], [3 x double*]* %17, 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 = bitcast [3 x double*]* %6 to i8*
%8 = icmp sgt i32 %1, %2
%9 = select i1 %8, i32 %1, i32 %2
%10 = add i32 %9, 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 %9, 0
br i1 %19, label %105, label %20
20: ; preds = %5
%21 = getelementptr inbounds double, double* %15, i64 1
%22 = shl i32 %10, 3
%23 = icmp eq i32 %9, 0
%24 = shl i32 %1, 3
%25 = add i32 %24, 8
%26 = shl i32 %2, 3
%27 = add i32 %26, 8
%28 = zext i32 %9 to i64
br label %29
29: ; preds = %20, %102
%30 = phi i32 [ 0, %20 ], [ %103, %102 ]
%31 = urem i32 %30, 3
switch i32 %30, label %33 [
i32 0, label %86
i32 1, label %32
]
32: ; preds = %29
br label %86
33: ; preds = %29
%34 = zext i32 %31 to i64
%35 = getelementptr inbounds [3 x double*], [3 x double*]* %6, i64 0, i64 %34
%36 = load double*, double** %35
%37 = tail call i32 @memset(double* %36, i32 0, i32 %22)
%38 = sitofp i32 %30 to double
br i1 %23, label %88, label %39
39: ; preds = %33
%40 = add nsw i32 %30, -2
%41 = srem i32 %40, 3
%42 = add nsw i32 %30, -1
%43 = srem i32 %42, 3
%44 = tail call double @llvm.fmuladd.f64(double %38, double 2.000000e+00, double -1.000000e+00)
%45 = sext i32 %43 to i64
%46 = getelementptr inbounds [3 x double*], [3 x double*]* %6, i64 0, i64 %45
%47 = fadd double %38, -1.000000e+00
%48 = sext i32 %41 to i64
%49 = getelementptr inbounds [3 x double*], [3 x double*]* %6, i64 0, i64 %48
br label %50
50: ; preds = %39, %83
%51 = phi i64 [ 0, %39 ], [ %84, %83 ]
switch i32 %0, label %52 [
i32 1, label %54
i32 2, label %67
]
52: ; preds = %50
%53 = add nuw nsw i64 %51, 1
br label %83
54: ; preds = %50
%55 = load double*, double** %46
%56 = getelementptr inbounds double, double* %55, i64 %51
%57 = load double, double* %56
%58 = fmul double %57, 2.000000e+00
%59 = add nuw nsw i64 %51, 1
%60 = getelementptr inbounds double, double* %36, i64 %59
store double %58, double* %60
%61 = load double*, double** %49
%62 = getelementptr inbounds double, double* %61, i64 %51
%63 = load double, double* %62
%64 = getelementptr inbounds double, double* %36, i64 %51
%65 = load double, double* %64
%66 = fsub double %65, %63
store double %66, double* %64
br label %83
67: ; preds = %50
%68 = load double*, double** %46
%69 = getelementptr inbounds double, double* %68, i64 %51
%70 = load double, double* %69
%71 = fmul double %44, %70
%72 = fdiv double %71, %38
%73 = add nuw nsw i64 %51, 1
%74 = getelementptr inbounds double, double* %36, i64 %73
store double %72, double* %74
%75 = load double*, double** %49
%76 = getelementptr inbounds double, double* %75, i64 %51
%77 = load double, double* %76
%78 = fmul double %47, %77
%79 = fdiv double %78, %38
%80 = getelementptr inbounds double, double* %36, i64 %51
%81 = load double, double* %80
%82 = fsub double %81, %79
store double %82, double* %80
br label %83
83: ; preds = %52, %54, %67
%84 = phi i64 [ %53, %52 ], [ %59, %54 ], [ %73, %67 ]
%85 = icmp eq i64 %84, %28
br i1 %85, label %88, label %50
86: ; preds = %29, %32
%87 = phi double* [ %21, %32 ], [ %12, %29 ]
store double 1.000000e+00, double* %87
br label %88
88: ; preds = %83, %86, %33
%89 = icmp eq i32 %30, %1
br i1 %89, label %90, label %95
90: ; preds = %88
%91 = zext i32 %31 to i64
%92 = getelementptr inbounds [3 x double*], [3 x double*]* %6, i64 0, i64 %91
%93 = load double*, double** %92
%94 = tail call i32 @memcpy(double* %3, double* %93, i32 %25)
br label %95
95: ; preds = %90, %88
%96 = icmp eq i32 %30, %2
br i1 %96, label %97, label %102
97: ; preds = %95
%98 = zext i32 %31 to i64
%99 = getelementptr inbounds [3 x double*], [3 x double*]* %6, i64 0, i64 %98
%100 = load double*, double** %99
%101 = tail call i32 @memcpy(double* %4, double* %100, i32 %27)
br label %102
102: ; preds = %95, %97
%103 = add nuw i32 %30, 1
%104 = icmp eq i32 %30, %9
br i1 %104, label %105, label %29
105: ; preds = %102, %5
%106 = tail call i32 @free(double* %12)
ret i32 0
}