#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
int main() {
  void ddct8x8s(int isgn, double **a);
  void ddct16x16s(int isgn, double **a);
  void putdata2d(int n1, int n2, double **a);
  double errorcheck2d(int n1, int n2, double scale, double **a);
  double err;
  int i;
  double aarr[16][16], *a[16], barr[16][16], *b[16];
  for (i = 0; i < 16; i++)
    a[i] = aarr[i];
  for (i = 0; i < 16; i++)
    b[i] = barr[i];
  putdata2d(8, 8, a);
  ddct8x8s(-1, a);
  ddct8x8s(1, a);
  err = errorcheck2d(8, 8, 1.0, a);
  printf("ddct8x8s   err= %g\n", err);
  putdata2d(16, 16, a);
  ddct16x16s(-1, a);
  ddct16x16s(1, a);
  err = errorcheck2d(16, 16, 1.0, a);
  printf("ddct16x16s err= %g\n", err);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1120,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x10,-0x14(%rbp)
jge    119f <main+0x4f>
movslq -0x14(%rbp),%rax
lea    -0x820(%rbp),%rcx
shl    $0x7,%rax
add    %rax,%rcx
movslq -0x14(%rbp),%rax
mov    %rcx,-0x8a0(%rbp,%rax,8)
ff
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1169 <main+0x19>
movl   $0x0,-0x14(%rbp)
cmpl   $0x10,-0x14(%rbp)
jge    11dc <main+0x8c>
movslq -0x14(%rbp),%rax
lea    -0x10a0(%rbp),%rcx
shl    $0x7,%rax
add    %rax,%rcx
movslq -0x14(%rbp),%rax
mov    %rcx,-0x1120(%rbp,%rax,8)
ff
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11a6 <main+0x56>
lea    -0x8a0(%rbp),%rdx
mov    $0x8,%esi
mov    %esi,%edi
call   1070 <putdata2d@plt>
lea    -0x8a0(%rbp),%rsi
mov    $0xffffffff,%edi
call   1060 <ddct8x8s@plt>
lea    -0x8a0(%rbp),%rsi
mov    $0x1,%edi
call   1060 <ddct8x8s@plt>
lea    -0x8a0(%rbp),%rdx
mov    $0x8,%esi
movsd  0xddb(%rip),%xmm0
mov    %esi,%edi
call   1040 <errorcheck2d@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
lea    0xdcb(%rip),%rdi
call   1030 <printf@plt>
lea    -0x8a0(%rbp),%rdx
mov    $0x10,%esi
mov    %esi,%edi
call   1070 <putdata2d@plt>
lea    -0x8a0(%rbp),%rsi
mov    $0xffffffff,%edi
call   1050 <ddct16x16s@plt>
lea    -0x8a0(%rbp),%rsi
mov    $0x1,%edi
call   1050 <ddct16x16s@plt>
lea    -0x8a0(%rbp),%rdx
mov    $0x10,%esi
movsd  0xd75(%rip),%xmm0
mov    %esi,%edi
call   1040 <errorcheck2d@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
lea    0xd79(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x880,%rsp
lea    0x80(%rsp),%rax
mov    %rax,(%rsp)
lea    0x100(%rsp),%rax
mov    %rax,0x8(%rsp)
lea    0x180(%rsp),%rax
mov    %rax,0x10(%rsp)
lea    0x200(%rsp),%rax
mov    %rax,0x18(%rsp)
lea    0x280(%rsp),%rax
mov    %rax,0x20(%rsp)
lea    0x300(%rsp),%rax
mov    %rax,0x28(%rsp)
lea    0x380(%rsp),%rax
mov    %rax,0x30(%rsp)
lea    0x400(%rsp),%rax
mov    %rax,0x38(%rsp)
lea    0x480(%rsp),%rax
mov    %rax,0x40(%rsp)
lea    0x500(%rsp),%rax
mov    %rax,0x48(%rsp)
lea    0x580(%rsp),%rax
mov    %rax,0x50(%rsp)
lea    0x600(%rsp),%rax
mov    %rax,0x58(%rsp)
lea    0x680(%rsp),%rax
mov    %rax,0x60(%rsp)
lea    0x700(%rsp),%rax
mov    %rax,0x68(%rsp)
lea    0x780(%rsp),%rax
mov    %rax,0x70(%rsp)
lea    0x800(%rsp),%rax
mov    %rax,0x78(%rsp)
mov    %rsp,%rbx
mov    $0x8,%edi
mov    $0x8,%esi
mov    %rbx,%rdx
call   1070 <putdata2d@plt>
mov    $0xffffffff,%edi
mov    %rbx,%rsi
call   1060 <ddct8x8s@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
call   1060 <ddct8x8s@plt>
movsd  0xda2(%rip),%xmm0
mov    $0x8,%edi
mov    $0x8,%esi
mov    %rbx,%rdx
call   1040 <errorcheck2d@plt>
lea    0xd91(%rip),%rdi
call   1030 <printf@plt>
mov    $0x10,%edi
mov    $0x10,%esi
mov    %rbx,%rdx
call   1070 <putdata2d@plt>
mov    $0xffffffff,%edi
mov    %rbx,%rsi
call   1050 <ddct16x16s@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
call   1050 <ddct16x16s@plt>
mov    $0x10,%edi
mov    $0x10,%esi
movsd  0xd46(%rip),%xmm0
mov    %rbx,%rdx
call   1040 <errorcheck2d@plt>
lea    0xd53(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x880,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"ddct8x8s err= %g\0A\00"
@.str.1 = [20 x i8] c"ddct16x16s err= %g\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca i32
%4 = alloca [16 x [16 x double]]
%5 = alloca [16 x double*]
%6 = alloca [16 x [16 x double]]
%7 = alloca [16 x double*]
store i32 0, i32* %1
store i32 0, i32* %3
br label %8
8: ; preds = %19, %0
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 16
br i1 %10, label %11, label %22
11: ; preds = %8
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [16 x [16 x double]], [16 x [16 x double]]* %4, i64 0, i64 %13
%15 = getelementptr inbounds [16 x double], [16 x double]* %14, i64 0, i64 0
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [16 x double*], [16 x double*]* %5, i64 0, i64 %17
store double* %15, double** %18
br label %19
19: ; preds = %11
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %8
22: ; preds = %8
store i32 0, i32* %3
br label %23
23: ; preds = %34, %22
%24 = load i32, i32* %3
%25 = icmp slt i32 %24, 16
br i1 %25, label %26, label %37
26: ; preds = %23
%27 = load i32, i32* %3
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [16 x [16 x double]], [16 x [16 x double]]* %6, i64 0, i64 %28
%30 = getelementptr inbounds [16 x double], [16 x double]* %29, i64 0, i64 0
%31 = load i32, i32* %3
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [16 x double*], [16 x double*]* %7, i64 0, i64 %32
store double* %30, double** %33
br label %34
34: ; preds = %26
%35 = load i32, i32* %3
%36 = add nsw i32 %35, 1
store i32 %36, i32* %3
br label %23
37: ; preds = %23
%38 = getelementptr inbounds [16 x double*], [16 x double*]* %5, i64 0, i64 0
%39 = getelementptr inbounds [16 x double*], [16 x double*]* %5, i64 0, i64 0
%40 = getelementptr inbounds [16 x double*], [16 x double*]* %5, i64 0, i64 0
%41 = getelementptr inbounds [16 x double*], [16 x double*]* %5, i64 0, i64 0
%42 = call double @errorcheck2d(i32 8, i32 8, double 1.000000e+00, double** %41)
store double %42, double* %2
%43 = load double, double* %2
%44 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), double %43)
%45 = getelementptr inbounds [16 x double*], [16 x double*]* %5, i64 0, i64 0
%46 = getelementptr inbounds [16 x double*], [16 x double*]* %5, i64 0, i64 0
%47 = getelementptr inbounds [16 x double*], [16 x double*]* %5, i64 0, i64 0
%48 = getelementptr inbounds [16 x double*], [16 x double*]* %5, i64 0, i64 0
%49 = call double @errorcheck2d(i32 16, i32 16, double 1.000000e+00, double** %48)
store double %49, double* %2
%50 = load double, double* %2
%51 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), double %50)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"ddct8x8s err= %g\0A\00"
@.str.1 = [20 x i8] c"ddct16x16s err= %g\0A\00"
define i32 @main() {
%1 = alloca [16 x [16 x double]]
%2 = alloca [16 x double*]
%3 = bitcast [16 x [16 x double]]* %1 to i8*
%4 = bitcast [16 x double*]* %2 to i8*
%5 = getelementptr inbounds [16 x [16 x double]], [16 x [16 x double]]* %1, i64 0, i64 0, i64 0
%6 = getelementptr inbounds [16 x double*], [16 x double*]* %2, i64 0, i64 0
store double* %5, double** %6
%7 = getelementptr inbounds [16 x [16 x double]], [16 x [16 x double]]* %1, i64 0, i64 1, i64 0
%8 = getelementptr inbounds [16 x double*], [16 x double*]* %2, i64 0, i64 1
store double* %7, double** %8
%9 = getelementptr inbounds [16 x [16 x double]], [16 x [16 x double]]* %1, i64 0, i64 2, i64 0
%10 = getelementptr inbounds [16 x double*], [16 x double*]* %2, i64 0, i64 2
store double* %9, double** %10
%11 = getelementptr inbounds [16 x [16 x double]], [16 x [16 x double]]* %1, i64 0, i64 3, i64 0
%12 = getelementptr inbounds [16 x double*], [16 x double*]* %2, i64 0, i64 3
store double* %11, double** %12
%13 = getelementptr inbounds [16 x [16 x double]], [16 x [16 x double]]* %1, i64 0, i64 4, i64 0
%14 = getelementptr inbounds [16 x double*], [16 x double*]* %2, i64 0, i64 4
store double* %13, double** %14
%15 = getelementptr inbounds [16 x [16 x double]], [16 x [16 x double]]* %1, i64 0, i64 5, i64 0
%16 = getelementptr inbounds [16 x double*], [16 x double*]* %2, i64 0, i64 5
store double* %15, double** %16
%17 = getelementptr inbounds [16 x [16 x double]], [16 x [16 x double]]* %1, i64 0, i64 6, i64 0
%18 = getelementptr inbounds [16 x double*], [16 x double*]* %2, i64 0, i64 6
store double* %17, double** %18
%19 = getelementptr inbounds [16 x [16 x double]], [16 x [16 x double]]* %1, i64 0, i64 7, i64 0
%20 = getelementptr inbounds [16 x double*], [16 x double*]* %2, i64 0, i64 7
store double* %19, double** %20
%21 = getelementptr inbounds [16 x [16 x double]], [16 x [16 x double]]* %1, i64 0, i64 8, i64 0
%22 = getelementptr inbounds [16 x double*], [16 x double*]* %2, i64 0, i64 8
store double* %21, double** %22
%23 = getelementptr inbounds [16 x [16 x double]], [16 x [16 x double]]* %1, i64 0, i64 9, i64 0
%24 = getelementptr inbounds [16 x double*], [16 x double*]* %2, i64 0, i64 9
store double* %23, double** %24
%25 = getelementptr inbounds [16 x [16 x double]], [16 x [16 x double]]* %1, i64 0, i64 10, i64 0
%26 = getelementptr inbounds [16 x double*], [16 x double*]* %2, i64 0, i64 10
store double* %25, double** %26
%27 = getelementptr inbounds [16 x [16 x double]], [16 x [16 x double]]* %1, i64 0, i64 11, i64 0
%28 = getelementptr inbounds [16 x double*], [16 x double*]* %2, i64 0, i64 11
store double* %27, double** %28
%29 = getelementptr inbounds [16 x [16 x double]], [16 x [16 x double]]* %1, i64 0, i64 12, i64 0
%30 = getelementptr inbounds [16 x double*], [16 x double*]* %2, i64 0, i64 12
store double* %29, double** %30
%31 = getelementptr inbounds [16 x [16 x double]], [16 x [16 x double]]* %1, i64 0, i64 13, i64 0
%32 = getelementptr inbounds [16 x double*], [16 x double*]* %2, i64 0, i64 13
store double* %31, double** %32
%33 = getelementptr inbounds [16 x [16 x double]], [16 x [16 x double]]* %1, i64 0, i64 14, i64 0
%34 = getelementptr inbounds [16 x double*], [16 x double*]* %2, i64 0, i64 14
store double* %33, double** %34
%35 = getelementptr inbounds [16 x [16 x double]], [16 x [16 x double]]* %1, i64 0, i64 15, i64 0
%36 = getelementptr inbounds [16 x double*], [16 x double*]* %2, i64 0, i64 15
store double* %35, double** %36
%37 = call double @errorcheck2d(i32 8, i32 8, double 1.000000e+00, double** %6)
%38 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), double %37)
%39 = call double @errorcheck2d(i32 16, i32 16, double 1.000000e+00, double** %6)
%40 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), double %39)
ret i32 0
}