#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 *alloc_1d_double(int);
int *alloc_1d_int(int);
double **alloc_2d_double(int, int);
int /*<<< orphan*/ free_1d_double(double *);
int /*<<< orphan*/ free_1d_int(int *);
int /*<<< orphan*/ free_2d_double(double **);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
scalar_t__ sqrt(int);
int main() {
  void cdft2d(int, int, int, double **, int *, double *);
  void rdft2d(int, int, int, double **, int *, double *);
  void ddct2d(int, int, int, double **, double **, int *, double *);
  void ddst2d(int, int, int, double **, double **, int *, double *);
  void putdata2d(int n1, int n2, double **a);
  double errorcheck2d(int n1, int n2, double scale, double **a);
  int *ip, n1, n2, n, i;
  double **a, **t, *w, err;
  printf("data length n1=? (n1 = power of 2) \n");
  scanf("%d", &n1);
  printf("data length n2=? (n2 = power of 2) \n");
  scanf("%d", &n2);
  a = alloc_2d_double(n1, n2);
  t = alloc_2d_double(n1, n2);
  n = ((n1) > (n2 / 2) ? (n1) : (n2 / 2));
  ip = alloc_1d_int(2 + (int)sqrt(n + 0.5));
  n = ((n1 / 2) > (n2 / 4) ? (n1 / 2) : (n2 / 4)) + ((n1) > (n2) ? (n1) : (n2));
  w = alloc_1d_double(n);
  ip[0] = 0;
  putdata2d(n1, n2, a);
  cdft2d(n1, n2, 1, a, ip, w);
  cdft2d(n1, n2, -1, a, ip, w);
  err = errorcheck2d(n1, n2, 2.0 / n1 / n2, a);
  printf("cdft2d err= %g \n", err);
  putdata2d(n1, n2, a);
  rdft2d(n1, n2, 1, a, ip, w);
  rdft2d(n1, n2, -1, a, ip, w);
  err = errorcheck2d(n1, n2, 2.0 / n1 / n2, a);
  printf("rdft2d err= %g \n", err);
  putdata2d(n1, n2, a);
  ddct2d(n1, n2, 1, a, t, ip, w);
  ddct2d(n1, n2, -1, a, t, ip, w);
  for (i = 0; i <= n1 - 1; i++) {
    a[i][0] *= 0.5;
  }
  for (i = 0; i <= n2 - 1; i++) {
    a[0][i] *= 0.5;
  }
  err = errorcheck2d(n1, n2, 4.0 / n1 / n2, a);
  printf("ddct2d err= %g \n", err);
  putdata2d(n1, n2, a);
  ddst2d(n1, n2, 1, a, t, ip, w);
  ddst2d(n1, n2, -1, a, t, ip, w);
  for (i = 0; i <= n1 - 1; i++) {
    a[i][0] *= 0.5;
  }
  for (i = 0; i <= n2 - 1; i++) {
    a[0][i] *= 0.5;
  }
  err = errorcheck2d(n1, n2, 4.0 / n1 / n2, a);
  printf("ddst2d err= %g \n", err);
  free_1d_double(w);
  free_1d_int(ip);
  free_2d_double(t);
  free_2d_double(a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe12(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    0xe29(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   10f0 <scanf@plt>
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    0xe0b(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   10f0 <scanf@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1070 <alloc_2d_double@plt>
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1070 <alloc_2d_double@plt>
mov    %rax,-0x30(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x44(%rbp),%eax
cmp    %ecx,%eax
jle    1282 <main+0x92>
mov    -0x14(%rbp),%eax
mov    %eax,-0x48(%rbp)
jmp    1290 <main+0xa0>
mov    -0x18(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x48(%rbp)
mov    -0x48(%rbp),%eax
mov    %eax,-0x1c(%rbp)
cvtsi2sdl -0x1c(%rbp),%xmm0
movsd  0xd5d(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1100 <sqrt@plt>
mov    %eax,%edi
add    $0x2,%edi
call   1110 <alloc_1d_int@plt>
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4c(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x4c(%rbp),%eax
cmp    %ecx,%eax
jle    12f7 <main+0x107>
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x50(%rbp)
jmp    1305 <main+0x115>
mov    -0x18(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,-0x50(%rbp)
mov    -0x50(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    1322 <main+0x132>
mov    -0x14(%rbp),%eax
mov    %eax,-0x58(%rbp)
jmp    1328 <main+0x138>
mov    -0x18(%rbp),%eax
mov    %eax,-0x58(%rbp)
mov    -0x54(%rbp),%eax
mov    -0x58(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
call   10e0 <alloc_1d_double@plt>
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x28(%rbp),%rdx
call   10d0 <putdata2d@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x28(%rbp),%rcx
mov    -0x10(%rbp),%r8
mov    -0x38(%rbp),%r9
mov    $0x1,%edx
call   10a0 <cdft2d@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x28(%rbp),%rcx
mov    -0x10(%rbp),%r8
mov    -0x38(%rbp),%r9
mov    $0xffffffff,%edx
call   10a0 <cdft2d@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
cvtsi2sdl -0x14(%rbp),%xmm1
movsd  0xc65(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsi2sdl -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rdx
call   10c0 <errorcheck2d@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
lea    0xc9b(%rip),%rdi
mov    $0x1,%al
call   1090 <printf@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x28(%rbp),%rdx
call   10d0 <putdata2d@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x28(%rbp),%rcx
mov    -0x10(%rbp),%r8
mov    -0x38(%rbp),%r9
mov    $0x1,%edx
call   10b0 <rdft2d@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x28(%rbp),%rcx
mov    -0x10(%rbp),%r8
mov    -0x38(%rbp),%r9
mov    $0xffffffff,%edx
call   10b0 <rdft2d@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
cvtsi2sdl -0x14(%rbp),%xmm1
movsd  0xbdd(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsi2sdl -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rdx
call   10c0 <errorcheck2d@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
lea    0xc24(%rip),%rdi
mov    $0x1,%al
call   1090 <printf@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x28(%rbp),%rdx
call   10d0 <putdata2d@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    -0x10(%rbp),%r9
mov    -0x38(%rbp),%rax
mov    $0x1,%edx
mov    %rax,(%rsp)
call   1060 <ddct2d@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    -0x10(%rbp),%r9
mov    -0x38(%rbp),%rax
mov    $0xffffffff,%edx
mov    %rax,(%rsp)
call   1060 <ddct2d@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     14f2 <main+0x302>
mov    -0x28(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  0xb24(%rip),%xmm0
mulsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    14b7 <main+0x2c7>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     1535 <main+0x345>
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
movslq -0x20(%rbp),%rcx
movsd  0xae3(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    14f9 <main+0x309>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
cvtsi2sdl -0x14(%rbp),%xmm1
movsd  0xac8(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsi2sdl -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rdx
call   10c0 <errorcheck2d@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
lea    0xb18(%rip),%rdi
mov    $0x1,%al
call   1090 <printf@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x28(%rbp),%rdx
call   10d0 <putdata2d@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    -0x10(%rbp),%r9
mov    -0x38(%rbp),%rax
mov    $0x1,%edx
mov    %rax,(%rsp)
call   1040 <ddst2d@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    -0x10(%rbp),%r9
mov    -0x38(%rbp),%rax
mov    $0xffffffff,%edx
mov    %rax,(%rsp)
call   1040 <ddst2d@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     160f <main+0x41f>
mov    -0x28(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  0xa07(%rip),%xmm0
mulsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    15d4 <main+0x3e4>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     1652 <main+0x462>
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
movslq -0x20(%rbp),%rcx
movsd  0x9c6(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1616 <main+0x426>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
cvtsi2sdl -0x14(%rbp),%xmm1
movsd  0x9ab(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsi2sdl -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rdx
call   10c0 <errorcheck2d@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
lea    0xa0c(%rip),%rdi
mov    $0x1,%al
call   1090 <printf@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free_1d_double@plt>
mov    -0x10(%rbp),%rdi
call   1050 <free_1d_int@plt>
mov    -0x30(%rbp),%rdi
call   1080 <free_2d_double@plt>
mov    -0x28(%rbp),%rdi
call   1080 <free_2d_double@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xe63(%rip),%rdi
call   1050 <puts@plt>
lea    0xe10(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1100 <scanf@plt>
lea    0xe67(%rip),%rdi
call   1050 <puts@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1100 <scanf@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
call   1080 <alloc_2d_double@plt>
mov    %rax,%r13
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
call   1080 <alloc_2d_double@plt>
mov    %rax,%r14
mov    0xc(%rsp),%eax
mov    0x8(%rsp),%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
add    %ecx,%edx
sar    %edx
cmp    %edx,%eax
cmovg  %eax,%edx
cvtsi2sd %edx,%xmm0
addsd  0xd78(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1110 <sqrt@plt>
lea    0x2(%rax),%edi
call   1120 <alloc_1d_int@plt>
mov    %rax,%r15
mov    0xc(%rsp),%edi
mov    %edi,%eax
shr    $0x1f,%eax
add    %edi,%eax
sar    %eax
mov    0x8(%rsp),%ecx
lea    0x3(%rcx),%edx
test   %ecx,%ecx
cmovns %ecx,%edx
sar    $0x2,%edx
cmp    %edx,%eax
cmovg  %eax,%edx
cmp    %ecx,%edi
cmovle %ecx,%edi
add    %edx,%edi
call   10f0 <alloc_1d_double@plt>
mov    %rax,%r12
movl   $0x0,(%r15)
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
mov    %r13,%rdx
call   10e0 <putdata2d@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
mov    $0x1,%edx
mov    %r13,%rcx
mov    %r15,%r8
mov    %r12,%r9
call   10b0 <cdft2d@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
mov    $0xffffffff,%edx
mov    %r13,%rcx
mov    %r15,%r8
mov    %r12,%r9
call   10b0 <cdft2d@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
cvtsi2sd %edi,%xmm1
movsd  0xcdb(%rip),%xmm0
divsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %esi,%xmm1
divsd  %xmm1,%xmm0
mov    %r13,%rdx
call   10d0 <errorcheck2d@plt>
lea    0xce8(%rip),%rdi
mov    $0x1,%al
call   10a0 <printf@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
mov    %r13,%rdx
call   10e0 <putdata2d@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
mov    $0x1,%edx
mov    %r13,%rcx
mov    %r15,%r8
mov    %r12,%r9
call   10c0 <rdft2d@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
mov    $0xffffffff,%edx
mov    %r13,%rcx
mov    %r15,%r8
mov    %r12,%r9
call   10c0 <rdft2d@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
xorps  %xmm0,%xmm0
cvtsi2sd %edi,%xmm0
movsd  0xc59(%rip),%xmm1
divsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %esi,%xmm0
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
mov    %r13,%rdx
call   10d0 <errorcheck2d@plt>
lea    0xc73(%rip),%rdi
mov    $0x1,%al
call   10a0 <printf@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
mov    %r13,%rdx
call   10e0 <putdata2d@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
mov    %r12,(%rsp)
mov    $0x1,%edx
mov    %r13,%rcx
mov    %r14,%r8
mov    %r15,%r9
call   1070 <ddct2d@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
mov    %r12,(%rsp)
mov    $0xffffffff,%edx
mov    %r13,%rcx
mov    %r14,%r8
mov    %r15,%r9
call   1070 <ddct2d@plt>
mov    0xc(%rsp),%edi
test   %edi,%edi
jle    14e9 <main+0x2e9>
lea    -0x1(%rdi),%rcx
mov    %edi,%eax
and    $0x3,%eax
cmp    $0x3,%rcx
jae    1445 <main+0x245>
xor    %ecx,%ecx
jmp    14ad <main+0x2ad>
mov    %edi,%edx
and    $0xfffffffc,%edx
xor    %ecx,%ecx
movsd  0xbac(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x0(%r13,%rcx,8),%rsi
movsd  (%rsi),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rsi)
mov    0x8(%r13,%rcx,8),%rsi
movsd  (%rsi),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rsi)
mov    0x10(%r13,%rcx,8),%rsi
movsd  (%rsi),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rsi)
mov    0x18(%r13,%rcx,8),%rsi
movsd  (%rsi),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rsi)
add    $0x4,%rcx
cmp    %rcx,%rdx
jne    1460 <main+0x260>
test   %rax,%rax
je     14e9 <main+0x2e9>
lea    0x0(,%rcx,8),%rcx
add    %r13,%rcx
xor    %edx,%edx
movsd  0xb39(%rip),%xmm0
nopw   0x0(%rax,%rax,1)
mov    (%rcx,%rdx,8),%rsi
movsd  (%rsi),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rsi)
add    $0x1,%rdx
cmp    %rdx,%rax
jne    14d0 <main+0x2d0>
mov    0x8(%rsp),%esi
test   %esi,%esi
jle    15e7 <main+0x3e7>
mov    0x0(%r13),%rax
cmp    $0x4,%esi
jae    1505 <main+0x305>
xor    %ecx,%ecx
jmp    15b9 <main+0x3b9>
mov    %esi,%ecx
and    $0xfffffffc,%ecx
lea    -0x4(%rcx),%rdx
mov    %rdx,%r8
shr    $0x2,%r8
add    $0x1,%r8
test   %rdx,%rdx
je     188b <main+0x68b>
mov    %r8,%rbx
and    $0xfffffffffffffffe,%rbx
xor    %edx,%edx
movapd 0xaed(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movupd (%rax,%rdx,8),%xmm1
movupd 0x10(%rax,%rdx,8),%xmm2
movupd 0x20(%rax,%rdx,8),%xmm3
movupd 0x30(%rax,%rdx,8),%xmm4
mulpd  %xmm0,%xmm1
mulpd  %xmm0,%xmm2
movupd %xmm1,(%rax,%rdx,8)
movupd %xmm2,0x10(%rax,%rdx,8)
mulpd  %xmm0,%xmm3
mulpd  %xmm0,%xmm4
movupd %xmm3,0x20(%rax,%rdx,8)
movupd %xmm4,0x30(%rax,%rdx,8)
add    $0x8,%rdx
add    $0xfffffffffffffffe,%rbx
jne    1540 <main+0x340>
test   $0x1,%r8b
je     15b4 <main+0x3b4>
movupd (%rax,%rdx,8),%xmm0
movupd 0x10(%rax,%rdx,8),%xmm1
movapd 0xa7f(%rip),%xmm2
mulpd  %xmm2,%xmm0
mulpd  %xmm2,%xmm1
movupd %xmm0,(%rax,%rdx,8)
movupd %xmm1,0x10(%rax,%rdx,8)
cmp    %rsi,%rcx
je     15e7 <main+0x3e7>
movsd  0xa3f(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rax,%rcx,8)
add    $0x1,%rcx
cmp    %rcx,%rsi
jne    15d0 <main+0x3d0>
xorps  %xmm1,%xmm1
cvtsi2sd %edi,%xmm1
movsd  0xa1a(%rip),%xmm0
divsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %esi,%xmm1
divsd  %xmm1,%xmm0
mov    %r13,%rdx
call   10d0 <errorcheck2d@plt>
lea    0xa41(%rip),%rdi
mov    $0x1,%al
call   10a0 <printf@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
mov    %r13,%rdx
call   10e0 <putdata2d@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
mov    %r12,(%rsp)
mov    $0x1,%edx
mov    %r13,%rcx
mov    %r14,%r8
mov    %r15,%r9
call   1040 <ddst2d@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
mov    %r12,(%rsp)
mov    $0xffffffff,%edx
mov    %r13,%rcx
mov    %r14,%r8
mov    %r15,%r9
call   1040 <ddst2d@plt>
mov    0xc(%rsp),%edi
test   %edi,%edi
jle    1729 <main+0x529>
lea    -0x1(%rdi),%rcx
mov    %edi,%eax
and    $0x3,%eax
cmp    $0x3,%rcx
jae    1688 <main+0x488>
xor    %ecx,%ecx
jmp    16ed <main+0x4ed>
mov    %edi,%edx
and    $0xfffffffc,%edx
xor    %ecx,%ecx
movsd  0x969(%rip),%xmm0
nopw   0x0(%rax,%rax,1)
mov    0x0(%r13,%rcx,8),%rsi
movsd  (%rsi),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rsi)
mov    0x8(%r13,%rcx,8),%rsi
movsd  (%rsi),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rsi)
mov    0x10(%r13,%rcx,8),%rsi
movsd  (%rsi),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rsi)
mov    0x18(%r13,%rcx,8),%rsi
movsd  (%rsi),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rsi)
add    $0x4,%rcx
cmp    %rcx,%rdx
jne    16a0 <main+0x4a0>
test   %rax,%rax
je     1729 <main+0x529>
lea    0x0(,%rcx,8),%rcx
add    %r13,%rcx
xor    %edx,%edx
movsd  0x8f9(%rip),%xmm0
nopw   0x0(%rax,%rax,1)
mov    (%rcx,%rdx,8),%rsi
movsd  (%rsi),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rsi)
add    $0x1,%rdx
cmp    %rdx,%rax
jne    1710 <main+0x510>
mov    0x8(%rsp),%esi
test   %esi,%esi
jle    1827 <main+0x627>
mov    0x0(%r13),%rax
cmp    $0x4,%esi
jae    1745 <main+0x545>
xor    %ecx,%ecx
jmp    17f9 <main+0x5f9>
mov    %esi,%ecx
and    $0xfffffffc,%ecx
lea    -0x4(%rcx),%rdx
mov    %rdx,%r8
shr    $0x2,%r8
add    $0x1,%r8
test   %rdx,%rdx
je     189c <main+0x69c>
mov    %r8,%rbx
and    $0xfffffffffffffffe,%rbx
xor    %edx,%edx
movapd 0x8ad(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movupd (%rax,%rdx,8),%xmm1
movupd 0x10(%rax,%rdx,8),%xmm2
movupd 0x20(%rax,%rdx,8),%xmm3
movupd 0x30(%rax,%rdx,8),%xmm4
mulpd  %xmm0,%xmm1
mulpd  %xmm0,%xmm2
movupd %xmm1,(%rax,%rdx,8)
movupd %xmm2,0x10(%rax,%rdx,8)
mulpd  %xmm0,%xmm3
mulpd  %xmm0,%xmm4
movupd %xmm3,0x20(%rax,%rdx,8)
movupd %xmm4,0x30(%rax,%rdx,8)
add    $0x8,%rdx
add    $0xfffffffffffffffe,%rbx
jne    1780 <main+0x580>
test   $0x1,%r8b
je     17f4 <main+0x5f4>
movupd (%rax,%rdx,8),%xmm0
movupd 0x10(%rax,%rdx,8),%xmm1
movapd 0x83f(%rip),%xmm2
mulpd  %xmm2,%xmm0
mulpd  %xmm2,%xmm1
movupd %xmm0,(%rax,%rdx,8)
movupd %xmm1,0x10(%rax,%rdx,8)
cmp    %rsi,%rcx
je     1827 <main+0x627>
movsd  0x7ff(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rax,%rcx,8)
add    $0x1,%rcx
cmp    %rcx,%rsi
jne    1810 <main+0x610>
xorps  %xmm1,%xmm1
cvtsi2sd %edi,%xmm1
movsd  0x7da(%rip),%xmm0
divsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %esi,%xmm1
divsd  %xmm1,%xmm0
mov    %r13,%rdx
call   10d0 <errorcheck2d@plt>
lea    0x812(%rip),%rdi
mov    $0x1,%al
call   10a0 <printf@plt>
mov    %r12,%rdi
call   1030 <free_1d_double@plt>
mov    %r15,%rdi
call   1060 <free_1d_int@plt>
mov    %r14,%rdi
call   1090 <free_2d_double@plt>
mov    %r13,%rdi
call   1090 <free_2d_double@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
xor    %edx,%edx
test   $0x1,%r8b
jne    158e <main+0x38e>
jmp    15b4 <main+0x3b4>
xor    %edx,%edx
test   $0x1,%r8b
jne    17ce <main+0x5ce>
jmp    17f4 <main+0x5f4>

LLVM IR (-O0):
@.str = [37 x i8] c"data length n1=? (n1 = power of 2) \0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [37 x i8] c"data length n2=? (n2 = power of 2) \0A\00"
@.str.3 = [17 x i8] c"cdft2d err= %g \0A\00"
@.str.4 = [17 x i8] c"rdft2d err= %g \0A\00"
@.str.5 = [17 x i8] c"ddct2d err= %g \0A\00"
@.str.6 = [17 x i8] c"ddst2d err= %g \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca double**
%8 = alloca double**
%9 = alloca double*
%10 = alloca double
store i32 0, i32* %1
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%15 = load i32, i32* %3
%16 = load i32, i32* %4
%17 = call double** @alloc_2d_double(i32 %15, i32 %16)
store double** %17, double*** %7
%18 = load i32, i32* %3
%19 = load i32, i32* %4
%20 = call double** @alloc_2d_double(i32 %18, i32 %19)
store double** %20, double*** %8
%21 = load i32, i32* %3
%22 = load i32, i32* %4
%23 = sdiv i32 %22, 2
%24 = icmp sgt i32 %21, %23
br i1 %24, label %25, label %27
25: ; preds = %0
%26 = load i32, i32* %3
br label %30
27: ; preds = %0
%28 = load i32, i32* %4
%29 = sdiv i32 %28, 2
br label %30
30: ; preds = %27, %25
%31 = phi i32 [ %26, %25 ], [ %29, %27 ]
store i32 %31, i32* %5
%32 = load i32, i32* %5
%33 = sitofp i32 %32 to double
%34 = fadd double %33, 5.000000e-01
%35 = fptosi double %34 to i32
%36 = call i64 @sqrt(i32 %35)
%37 = trunc i64 %36 to i32
%38 = add nsw i32 2, %37
%39 = call i32* @alloc_1d_int(i32 %38)
store i32* %39, i32** %2
%40 = load i32, i32* %3
%41 = sdiv i32 %40, 2
%42 = load i32, i32* %4
%43 = sdiv i32 %42, 4
%44 = icmp sgt i32 %41, %43
br i1 %44, label %45, label %48
45: ; preds = %30
%46 = load i32, i32* %3
%47 = sdiv i32 %46, 2
br label %51
48: ; preds = %30
%49 = load i32, i32* %4
%50 = sdiv i32 %49, 4
br label %51
51: ; preds = %48, %45
%52 = phi i32 [ %47, %45 ], [ %50, %48 ]
%53 = load i32, i32* %3
%54 = load i32, i32* %4
%55 = icmp sgt i32 %53, %54
br i1 %55, label %56, label %58
56: ; preds = %51
%57 = load i32, i32* %3
br label %60
58: ; preds = %51
%59 = load i32, i32* %4
br label %60
60: ; preds = %58, %56
%61 = phi i32 [ %57, %56 ], [ %59, %58 ]
%62 = add nsw i32 %52, %61
store i32 %62, i32* %5
%63 = load i32, i32* %5
%64 = call double* @alloc_1d_double(i32 %63)
store double* %64, double** %9
%65 = load i32*, i32** %2
%66 = getelementptr inbounds i32, i32* %65, i64 0
store i32 0, i32* %66
%67 = load i32, i32* %3
%68 = load i32, i32* %4
%69 = load double**, double*** %7
%70 = load i32, i32* %3
%71 = load i32, i32* %4
%72 = load double**, double*** %7
%73 = load i32*, i32** %2
%74 = load double*, double** %9
%75 = load i32, i32* %3
%76 = load i32, i32* %4
%77 = load double**, double*** %7
%78 = load i32*, i32** %2
%79 = load double*, double** %9
%80 = load i32, i32* %3
%81 = load i32, i32* %4
%82 = load i32, i32* %3
%83 = sitofp i32 %82 to double
%84 = fdiv double 2.000000e+00, %83
%85 = load i32, i32* %4
%86 = sitofp i32 %85 to double
%87 = fdiv double %84, %86
%88 = load double**, double*** %7
%89 = call double @errorcheck2d(i32 %80, i32 %81, double %87, double** %88)
store double %89, double* %10
%90 = load double, double* %10
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), double %90)
%92 = load i32, i32* %3
%93 = load i32, i32* %4
%94 = load double**, double*** %7
%95 = load i32, i32* %3
%96 = load i32, i32* %4
%97 = load double**, double*** %7
%98 = load i32*, i32** %2
%99 = load double*, double** %9
%100 = load i32, i32* %3
%101 = load i32, i32* %4
%102 = load double**, double*** %7
%103 = load i32*, i32** %2
%104 = load double*, double** %9
%105 = load i32, i32* %3
%106 = load i32, i32* %4
%107 = load i32, i32* %3
%108 = sitofp i32 %107 to double
%109 = fdiv double 2.000000e+00, %108
%110 = load i32, i32* %4
%111 = sitofp i32 %110 to double
%112 = fdiv double %109, %111
%113 = load double**, double*** %7
%114 = call double @errorcheck2d(i32 %105, i32 %106, double %112, double** %113)
store double %114, double* %10
%115 = load double, double* %10
%116 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), double %115)
%117 = load i32, i32* %3
%118 = load i32, i32* %4
%119 = load double**, double*** %7
%120 = load i32, i32* %3
%121 = load i32, i32* %4
%122 = load double**, double*** %7
%123 = load double**, double*** %8
%124 = load i32*, i32** %2
%125 = load double*, double** %9
%126 = load i32, i32* %3
%127 = load i32, i32* %4
%128 = load double**, double*** %7
%129 = load double**, double*** %8
%130 = load i32*, i32** %2
%131 = load double*, double** %9
store i32 0, i32* %6
br label %132
132: ; preds = %146, %60
%133 = load i32, i32* %6
%134 = load i32, i32* %3
%135 = sub nsw i32 %134, 1
%136 = icmp sle i32 %133, %135
br i1 %136, label %137, label %149
137: ; preds = %132
%138 = load double**, double*** %7
%139 = load i32, i32* %6
%140 = sext i32 %139 to i64
%141 = getelementptr inbounds double*, double** %138, i64 %140
%142 = load double*, double** %141
%143 = getelementptr inbounds double, double* %142, i64 0
%144 = load double, double* %143
%145 = fmul double %144, 5.000000e-01
store double %145, double* %143
br label %146
146: ; preds = %137
%147 = load i32, i32* %6
%148 = add nsw i32 %147, 1
store i32 %148, i32* %6
br label %132
149: ; preds = %132
store i32 0, i32* %6
br label %150
150: ; preds = %164, %149
%151 = load i32, i32* %6
%152 = load i32, i32* %4
%153 = sub nsw i32 %152, 1
%154 = icmp sle i32 %151, %153
br i1 %154, label %155, label %167
155: ; preds = %150
%156 = load double**, double*** %7
%157 = getelementptr inbounds double*, double** %156, i64 0
%158 = load double*, double** %157
%159 = load i32, i32* %6
%160 = sext i32 %159 to i64
%161 = getelementptr inbounds double, double* %158, i64 %160
%162 = load double, double* %161
%163 = fmul double %162, 5.000000e-01
store double %163, double* %161
br label %164
164: ; preds = %155
%165 = load i32, i32* %6
%166 = add nsw i32 %165, 1
store i32 %166, i32* %6
br label %150
167: ; preds = %150
%168 = load i32, i32* %3
%169 = load i32, i32* %4
%170 = load i32, i32* %3
%171 = sitofp i32 %170 to double
%172 = fdiv double 4.000000e+00, %171
%173 = load i32, i32* %4
%174 = sitofp i32 %173 to double
%175 = fdiv double %172, %174
%176 = load double**, double*** %7
%177 = call double @errorcheck2d(i32 %168, i32 %169, double %175, double** %176)
store double %177, double* %10
%178 = load double, double* %10
%179 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), double %178)
%180 = load i32, i32* %3
%181 = load i32, i32* %4
%182 = load double**, double*** %7
%183 = load i32, i32* %3
%184 = load i32, i32* %4
%185 = load double**, double*** %7
%186 = load double**, double*** %8
%187 = load i32*, i32** %2
%188 = load double*, double** %9
%189 = load i32, i32* %3
%190 = load i32, i32* %4
%191 = load double**, double*** %7
%192 = load double**, double*** %8
%193 = load i32*, i32** %2
%194 = load double*, double** %9
store i32 0, i32* %6
br label %195
195: ; preds = %209, %167
%196 = load i32, i32* %6
%197 = load i32, i32* %3
%198 = sub nsw i32 %197, 1
%199 = icmp sle i32 %196, %198
br i1 %199, label %200, label %212
200: ; preds = %195
%201 = load double**, double*** %7
%202 = load i32, i32* %6
%203 = sext i32 %202 to i64
%204 = getelementptr inbounds double*, double** %201, i64 %203
%205 = load double*, double** %204
%206 = getelementptr inbounds double, double* %205, i64 0
%207 = load double, double* %206
%208 = fmul double %207, 5.000000e-01
store double %208, double* %206
br label %209
209: ; preds = %200
%210 = load i32, i32* %6
%211 = add nsw i32 %210, 1
store i32 %211, i32* %6
br label %195
212: ; preds = %195
store i32 0, i32* %6
br label %213
213: ; preds = %227, %212
%214 = load i32, i32* %6
%215 = load i32, i32* %4
%216 = sub nsw i32 %215, 1
%217 = icmp sle i32 %214, %216
br i1 %217, label %218, label %230
218: ; preds = %213
%219 = load double**, double*** %7
%220 = getelementptr inbounds double*, double** %219, i64 0
%221 = load double*, double** %220
%222 = load i32, i32* %6
%223 = sext i32 %222 to i64
%224 = getelementptr inbounds double, double* %221, i64 %223
%225 = load double, double* %224
%226 = fmul double %225, 5.000000e-01
store double %226, double* %224
br label %227
227: ; preds = %218
%228 = load i32, i32* %6
%229 = add nsw i32 %228, 1
store i32 %229, i32* %6
br label %213
230: ; preds = %213
%231 = load i32, i32* %3
%232 = load i32, i32* %4
%233 = load i32, i32* %3
%234 = sitofp i32 %233 to double
%235 = fdiv double 4.000000e+00, %234
%236 = load i32, i32* %4
%237 = sitofp i32 %236 to double
%238 = fdiv double %235, %237
%239 = load double**, double*** %7
%240 = call double @errorcheck2d(i32 %231, i32 %232, double %238, double** %239)
store double %240, double* %10
%241 = load double, double* %10
%242 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), double %241)
%243 = load double*, double** %9
%244 = call i32 @free_1d_double(double* %243)
%245 = load i32*, i32** %2
%246 = call i32 @free_1d_int(i32* %245)
%247 = load double**, double*** %8
%248 = call i32 @free_2d_double(double** %247)
%249 = load double**, double*** %7
%250 = call i32 @free_2d_double(double** %249)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [17 x i8] c"cdft2d err= %g \0A\00"
@.str.4 = [17 x i8] c"rdft2d err= %g \0A\00"
@.str.5 = [17 x i8] c"ddct2d err= %g \0A\00"
@.str.6 = [17 x i8] c"ddst2d err= %g \0A\00"
@str = [36 x i8] c"data length n1=? (n1 = power of 2) \00"
@str.7 = [36 x i8] c"data length n2=? (n2 = power of 2) \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.7, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = call double** @alloc_2d_double(i32 %9, i32 %10)
%12 = load i32, i32* %1
%13 = load i32, i32* %2
%14 = call double** @alloc_2d_double(i32 %12, i32 %13)
%15 = load i32, i32* %1
%16 = load i32, i32* %2
%17 = sdiv i32 %16, 2
%18 = icmp sgt i32 %15, %17
%19 = select i1 %18, i32 %15, i32 %17
%20 = sitofp i32 %19 to double
%21 = fadd double %20, 5.000000e-01
%22 = fptosi double %21 to i32
%23 = call i64 @sqrt(i32 %22)
%24 = trunc i64 %23 to i32
%25 = add nsw i32 %24, 2
%26 = call i32* @alloc_1d_int(i32 %25)
%27 = load i32, i32* %1
%28 = sdiv i32 %27, 2
%29 = load i32, i32* %2
%30 = sdiv i32 %29, 4
%31 = icmp sgt i32 %28, %30
%32 = select i1 %31, i32 %28, i32 %30
%33 = icmp sgt i32 %27, %29
%34 = select i1 %33, i32 %27, i32 %29
%35 = add nsw i32 %32, %34
%36 = call double* @alloc_1d_double(i32 %35)
store i32 0, i32* %26
%37 = load i32, i32* %1
%38 = load i32, i32* %2
%39 = load i32, i32* %1
%40 = load i32, i32* %2
%41 = load i32, i32* %1
%42 = load i32, i32* %2
%43 = load i32, i32* %1
%44 = load i32, i32* %2
%45 = sitofp i32 %43 to double
%46 = fdiv double 2.000000e+00, %45
%47 = sitofp i32 %44 to double
%48 = fdiv double %46, %47
%49 = call double @errorcheck2d(i32 %43, i32 %44, double %48, double** %11)
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), double %49)
%51 = load i32, i32* %1
%52 = load i32, i32* %2
%53 = load i32, i32* %1
%54 = load i32, i32* %2
%55 = load i32, i32* %1
%56 = load i32, i32* %2
%57 = load i32, i32* %1
%58 = load i32, i32* %2
%59 = sitofp i32 %57 to double
%60 = fdiv double 2.000000e+00, %59
%61 = sitofp i32 %58 to double
%62 = fdiv double %60, %61
%63 = call double @errorcheck2d(i32 %57, i32 %58, double %62, double** %11)
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), double %63)
%65 = load i32, i32* %1
%66 = load i32, i32* %2
%67 = load i32, i32* %1
%68 = load i32, i32* %2
%69 = load i32, i32* %1
%70 = load i32, i32* %2
%71 = load i32, i32* %1
%72 = icmp sgt i32 %71, 0
br i1 %72, label %73, label %93
73: ; preds = %0
%74 = zext i32 %71 to i64
%75 = add nsw i64 %74, -1
%76 = and i64 %74, 3
%77 = icmp ult i64 %75, 3
br i1 %77, label %80, label %78
78: ; preds = %73
%79 = and i64 %74, 4294967292
br label %154
80: ; preds = %154, %73
%81 = phi i64 [ 0, %73 ], [ %176, %154 ]
%82 = icmp eq i64 %76, 0
br i1 %82, label %93, label %83
83: ; preds = %80, %83
%84 = phi i64 [ %90, %83 ], [ %81, %80 ]
%85 = phi i64 [ %91, %83 ], [ 0, %80 ]
%86 = getelementptr inbounds double*, double** %11, i64 %84
%87 = load double*, double** %86
%88 = load double, double* %87
%89 = fmul double %88, 5.000000e-01
store double %89, double* %87
%90 = add nuw nsw i64 %84, 1
%91 = add i64 %85, 1
%92 = icmp eq i64 %91, %76
br i1 %92, label %93, label %83
93: ; preds = %80, %83, %0
%94 = load i32, i32* %2
%95 = icmp sgt i32 %94, 0
br i1 %95, label %96, label %186
96: ; preds = %93
%97 = load double*, double** %11
%98 = zext i32 %94 to i64
%99 = icmp ult i32 %94, 4
br i1 %99, label %152, label %100
100: ; preds = %96
%101 = and i64 %98, 4294967292
%102 = add nsw i64 %101, -4
%103 = lshr exact i64 %102, 2
%104 = add nuw nsw i64 %103, 1
%105 = and i64 %104, 1
%106 = icmp eq i64 %102, 0
br i1 %106, label %136, label %107
107: ; preds = %100
%108 = and i64 %104, 9223372036854775806
br label %109
109: ; preds = %109, %107
%110 = phi i64 [ 0, %107 ], [ %133, %109 ]
%111 = phi i64 [ 0, %107 ], [ %134, %109 ]
%112 = getelementptr inbounds double, double* %97, i64 %110
%113 = bitcast double* %112 to <2 x double>*
%114 = load <2 x double>, <2 x double>* %113
%115 = getelementptr inbounds double, double* %112, i64 2
%116 = bitcast double* %115 to <2 x double>*
%117 = load <2 x double>, <2 x double>* %116
%118 = fmul <2 x double> %114, <double 5.000000e-01, double 5.000000e-01>
%119 = fmul <2 x double> %117, <double 5.000000e-01, double 5.000000e-01>
%120 = bitcast double* %112 to <2 x double>*
store <2 x double> %118, <2 x double>* %120
%121 = bitcast double* %115 to <2 x double>*
store <2 x double> %119, <2 x double>* %121
%122 = or i64 %110, 4
%123 = getelementptr inbounds double, double* %97, i64 %122
%124 = bitcast double* %123 to <2 x double>*
%125 = load <2 x double>, <2 x double>* %124
%126 = getelementptr inbounds double, double* %123, i64 2
%127 = bitcast double* %126 to <2 x double>*
%128 = load <2 x double>, <2 x double>* %127
%129 = fmul <2 x double> %125, <double 5.000000e-01, double 5.000000e-01>
%130 = fmul <2 x double> %128, <double 5.000000e-01, double 5.000000e-01>
%131 = bitcast double* %123 to <2 x double>*
store <2 x double> %129, <2 x double>* %131
%132 = bitcast double* %126 to <2 x double>*
store <2 x double> %130, <2 x double>* %132
%133 = add nuw i64 %110, 8
%134 = add i64 %111, 2
%135 = icmp eq i64 %134, %108
br i1 %135, label %136, label %109
136: ; preds = %109, %100
%137 = phi i64 [ 0, %100 ], [ %133, %109 ]
%138 = icmp eq i64 %105, 0
br i1 %138, label %150, label %139
139: ; preds = %136
%140 = getelementptr inbounds double, double* %97, i64 %137
%141 = bitcast double* %140 to <2 x double>*
%142 = load <2 x double>, <2 x double>* %141
%143 = getelementptr inbounds double, double* %140, i64 2
%144 = bitcast double* %143 to <2 x double>*
%145 = load <2 x double>, <2 x double>* %144
%146 = fmul <2 x double> %142, <double 5.000000e-01, double 5.000000e-01>
%147 = fmul <2 x double> %145, <double 5.000000e-01, double 5.000000e-01>
%148 = bitcast double* %140 to <2 x double>*
store <2 x double> %146, <2 x double>* %148
%149 = bitcast double* %143 to <2 x double>*
store <2 x double> %147, <2 x double>* %149
br label %150
150: ; preds = %136, %139
%151 = icmp eq i64 %101, %98
br i1 %151, label %186, label %152
152: ; preds = %96, %150
%153 = phi i64 [ 0, %96 ], [ %101, %150 ]
br label %179
154: ; preds = %154, %78
%155 = phi i64 [ 0, %78 ], [ %176, %154 ]
%156 = phi i64 [ 0, %78 ], [ %177, %154 ]
%157 = getelementptr inbounds double*, double** %11, i64 %155
%158 = load double*, double** %157
%159 = load double, double* %158
%160 = fmul double %159, 5.000000e-01
store double %160, double* %158
%161 = or i64 %155, 1
%162 = getelementptr inbounds double*, double** %11, i64 %161
%163 = load double*, double** %162
%164 = load double, double* %163
%165 = fmul double %164, 5.000000e-01
store double %165, double* %163
%166 = or i64 %155, 2
%167 = getelementptr inbounds double*, double** %11, i64 %166
%168 = load double*, double** %167
%169 = load double, double* %168
%170 = fmul double %169, 5.000000e-01
store double %170, double* %168
%171 = or i64 %155, 3
%172 = getelementptr inbounds double*, double** %11, i64 %171
%173 = load double*, double** %172
%174 = load double, double* %173
%175 = fmul double %174, 5.000000e-01
store double %175, double* %173
%176 = add nuw nsw i64 %155, 4
%177 = add i64 %156, 4
%178 = icmp eq i64 %177, %79
br i1 %178, label %80, label %154
179: ; preds = %152, %179
%180 = phi i64 [ %184, %179 ], [ %153, %152 ]
%181 = getelementptr inbounds double, double* %97, i64 %180
%182 = load double, double* %181
%183 = fmul double %182, 5.000000e-01
store double %183, double* %181
%184 = add nuw nsw i64 %180, 1
%185 = icmp eq i64 %184, %98
br i1 %185, label %186, label %179
186: ; preds = %179, %150, %93
%187 = sitofp i32 %71 to double
%188 = fdiv double 4.000000e+00, %187
%189 = sitofp i32 %94 to double
%190 = fdiv double %188, %189
%191 = call double @errorcheck2d(i32 %71, i32 %94, double %190, double** %11)
%192 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), double %191)
%193 = load i32, i32* %1
%194 = load i32, i32* %2
%195 = load i32, i32* %1
%196 = load i32, i32* %2
%197 = load i32, i32* %1
%198 = load i32, i32* %2
%199 = load i32, i32* %1
%200 = icmp sgt i32 %199, 0
br i1 %200, label %201, label %221
201: ; preds = %186
%202 = zext i32 %199 to i64
%203 = add nsw i64 %202, -1
%204 = and i64 %202, 3
%205 = icmp ult i64 %203, 3
br i1 %205, label %208, label %206
206: ; preds = %201
%207 = and i64 %202, 4294967292
br label %282
208: ; preds = %282, %201
%209 = phi i64 [ 0, %201 ], [ %304, %282 ]
%210 = icmp eq i64 %204, 0
br i1 %210, label %221, label %211
211: ; preds = %208, %211
%212 = phi i64 [ %218, %211 ], [ %209, %208 ]
%213 = phi i64 [ %219, %211 ], [ 0, %208 ]
%214 = getelementptr inbounds double*, double** %11, i64 %212
%215 = load double*, double** %214
%216 = load double, double* %215
%217 = fmul double %216, 5.000000e-01
store double %217, double* %215
%218 = add nuw nsw i64 %212, 1
%219 = add i64 %213, 1
%220 = icmp eq i64 %219, %204
br i1 %220, label %221, label %211
221: ; preds = %208, %211, %186
%222 = load i32, i32* %2
%223 = icmp sgt i32 %222, 0
br i1 %223, label %224, label %314
224: ; preds = %221
%225 = load double*, double** %11
%226 = zext i32 %222 to i64
%227 = icmp ult i32 %222, 4
br i1 %227, label %280, label %228
228: ; preds = %224
%229 = and i64 %226, 4294967292
%230 = add nsw i64 %229, -4
%231 = lshr exact i64 %230, 2
%232 = add nuw nsw i64 %231, 1
%233 = and i64 %232, 1
%234 = icmp eq i64 %230, 0
br i1 %234, label %264, label %235
235: ; preds = %228
%236 = and i64 %232, 9223372036854775806
br label %237
237: ; preds = %237, %235
%238 = phi i64 [ 0, %235 ], [ %261, %237 ]
%239 = phi i64 [ 0, %235 ], [ %262, %237 ]
%240 = getelementptr inbounds double, double* %225, i64 %238
%241 = bitcast double* %240 to <2 x double>*
%242 = load <2 x double>, <2 x double>* %241
%243 = getelementptr inbounds double, double* %240, i64 2
%244 = bitcast double* %243 to <2 x double>*
%245 = load <2 x double>, <2 x double>* %244
%246 = fmul <2 x double> %242, <double 5.000000e-01, double 5.000000e-01>
%247 = fmul <2 x double> %245, <double 5.000000e-01, double 5.000000e-01>
%248 = bitcast double* %240 to <2 x double>*
store <2 x double> %246, <2 x double>* %248
%249 = bitcast double* %243 to <2 x double>*
store <2 x double> %247, <2 x double>* %249
%250 = or i64 %238, 4
%251 = getelementptr inbounds double, double* %225, i64 %250
%252 = bitcast double* %251 to <2 x double>*
%253 = load <2 x double>, <2 x double>* %252
%254 = getelementptr inbounds double, double* %251, i64 2
%255 = bitcast double* %254 to <2 x double>*
%256 = load <2 x double>, <2 x double>* %255
%257 = fmul <2 x double> %253, <double 5.000000e-01, double 5.000000e-01>
%258 = fmul <2 x double> %256, <double 5.000000e-01, double 5.000000e-01>
%259 = bitcast double* %251 to <2 x double>*
store <2 x double> %257, <2 x double>* %259
%260 = bitcast double* %254 to <2 x double>*
store <2 x double> %258, <2 x double>* %260
%261 = add nuw i64 %238, 8
%262 = add i64 %239, 2
%263 = icmp eq i64 %262, %236
br i1 %263, label %264, label %237
264: ; preds = %237, %228
%265 = phi i64 [ 0, %228 ], [ %261, %237 ]
%266 = icmp eq i64 %233, 0
br i1 %266, label %278, label %267
267: ; preds = %264
%268 = getelementptr inbounds double, double* %225, i64 %265
%269 = bitcast double* %268 to <2 x double>*
%270 = load <2 x double>, <2 x double>* %269
%271 = getelementptr inbounds double, double* %268, i64 2
%272 = bitcast double* %271 to <2 x double>*
%273 = load <2 x double>, <2 x double>* %272
%274 = fmul <2 x double> %270, <double 5.000000e-01, double 5.000000e-01>
%275 = fmul <2 x double> %273, <double 5.000000e-01, double 5.000000e-01>
%276 = bitcast double* %268 to <2 x double>*
store <2 x double> %274, <2 x double>* %276
%277 = bitcast double* %271 to <2 x double>*
store <2 x double> %275, <2 x double>* %277
br label %278
278: ; preds = %264, %267
%279 = icmp eq i64 %229, %226
br i1 %279, label %314, label %280
280: ; preds = %224, %278
%281 = phi i64 [ 0, %224 ], [ %229, %278 ]
br label %307
282: ; preds = %282, %206
%283 = phi i64 [ 0, %206 ], [ %304, %282 ]
%284 = phi i64 [ 0, %206 ], [ %305, %282 ]
%285 = getelementptr inbounds double*, double** %11, i64 %283
%286 = load double*, double** %285
%287 = load double, double* %286
%288 = fmul double %287, 5.000000e-01
store double %288, double* %286
%289 = or i64 %283, 1
%290 = getelementptr inbounds double*, double** %11, i64 %289
%291 = load double*, double** %290
%292 = load double, double* %291
%293 = fmul double %292, 5.000000e-01
store double %293, double* %291
%294 = or i64 %283, 2
%295 = getelementptr inbounds double*, double** %11, i64 %294
%296 = load double*, double** %295
%297 = load double, double* %296
%298 = fmul double %297, 5.000000e-01
store double %298, double* %296
%299 = or i64 %283, 3
%300 = getelementptr inbounds double*, double** %11, i64 %299
%301 = load double*, double** %300
%302 = load double, double* %301
%303 = fmul double %302, 5.000000e-01
store double %303, double* %301
%304 = add nuw nsw i64 %283, 4
%305 = add i64 %284, 4
%306 = icmp eq i64 %305, %207
br i1 %306, label %208, label %282
307: ; preds = %280, %307
%308 = phi i64 [ %312, %307 ], [ %281, %280 ]
%309 = getelementptr inbounds double, double* %225, i64 %308
%310 = load double, double* %309
%311 = fmul double %310, 5.000000e-01
store double %311, double* %309
%312 = add nuw nsw i64 %308, 1
%313 = icmp eq i64 %312, %226
br i1 %313, label %314, label %307
314: ; preds = %307, %278, %221
%315 = sitofp i32 %199 to double
%316 = fdiv double 4.000000e+00, %315
%317 = sitofp i32 %222 to double
%318 = fdiv double %316, %317
%319 = call double @errorcheck2d(i32 %199, i32 %222, double %318, double** %11)
%320 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), double %319)
%321 = call i32 @free_1d_double(double* %36)
%322 = call i32 @free_1d_int(i32* %26)
%323 = call i32 @free_2d_double(double** %14)
%324 = call i32 @free_2d_double(double** %11)
ret i32 0
}