// File: akinomyoga[P]OTFFT/src/ffttune_default.cpp
// Function: main
int main() {
    using namespace std;
    static const int n_min  = 1;
    static const int n_max  = N_MAX;

    ofstream fs1("otfft_setup.h.part");
    ofstream fs2("otfft_fwd.h.part");
    ofstream fs3("otfft_inv.h.part");
    ofstream fs4("otfft_fwd0.h.part");
    ofstream fs5("otfft_invn.h.part");
    fs1 << "switch (log_N) {\ncase  0: break;\n";
    fs2 << "switch (log_N) {\ncase  0: break;\n";
    fs3 << "switch (log_N) {\ncase  0: break;\n";
    fs4 << "switch (log_N) {\ncase  0: break;\n";
    fs5 << "switch (log_N) {\ncase  0: break;\n";

    // hankel single thread 1-22
    int optimal_engines[] = {
      0, 6, 7, 7, 2, 4, 3, 7,
      2, 3, 1, 6, 4, 4, 4, 4,
      4, 4, 4, 6, 4, 4, 4, };

    // // padparadscha single thread 1-22
    // int optimal_engines[]={
    //   0, 6, 6, 6, 6, 1, 1, 1,
    //   2, 1, 1, 1, 1, 1, 1, 4,
    //   2, 3, 3, 6, 3, 3, };

    for (int n = n_min; n <= n_max; n++) {
        int fft_num = optimal_engines[n];
        fs1 << "case " << setw(2) << n << ": fft" << fft_num << "->setup2(log_N); break;\n";
        fs2 << "case " << setw(2) << n << ": fft" << fft_num << "->fwd(x, y); break;\n";
        fs3 << "case " << setw(2) << n << ": fft" << fft_num << "->inv(x, y); break;\n";
        fs4 << "case " << setw(2) << n << ": fft" << fft_num << "->fwd0(x, y); break;\n";
        fs5 << "case " << setw(2) << n << ": fft" << fft_num << "->invn(x, y); break;\n";
    }

#ifndef DO_SINGLE_THREAD
    fs1 << "default: fft5->setup2(log_N); break;\n";
    fs2 << "default: fft5->fwd(x, y); break;\n";
    fs3 << "default: fft5->inv(x, y); break;\n";
    fs4 << "default: fft5->fwd0(x, y); break;\n";
    fs5 << "default: fft5->invn(x, y); break;\n";
#else
    fs1 << "default: fft4->setup2(log_N); break;\n";
    fs2 << "default: fft4->fwd(x, y); break;\n";
    fs3 << "default: fft4->inv(x, y); break;\n";
    fs4 << "default: fft4->fwd0(x, y); break;\n";
    fs5 << "default: fft4->invn(x, y); break;\n";
#endif
    fs1 << "}\n";
    fs2 << "}\n";
    fs3 << "}\n";
    fs4 << "}\n";
    fs5 << "}\n";

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb90, %rsp            # imm = 0xB90
movl $0x0, -0x4(%rbp)
leaq 0xe63(%rip), %rsi       # 0x207c
leaq -0x208(%rbp), %rdi
movl $0x10, %edx
movl %edx, -0xaa0(%rbp)
callq 0x1060
movl -0xaa0(%rbp), %edx
leaq 0xe52(%rip), %rsi       # 0x208f
leaq -0x408(%rbp), %rdi
callq 0x1060
jmp 0x124b
leaq 0xe4e(%rip), %rsi       # 0x20a0
leaq -0x618(%rbp), %rdi
movl $0x10, %edx
callq 0x1060
jmp 0x1265
leaq 0xe45(%rip), %rsi       # 0x20b1
leaq -0x818(%rbp), %rdi
movl $0x10, %edx
callq 0x1060
jmp 0x127f
leaq 0xe3d(%rip), %rsi       # 0x20c3
leaq -0xa18(%rbp), %rdi
movl $0x10, %edx
callq 0x1060
jmp 0x1299
leaq 0xe35(%rip), %rsi       # 0x20d5
leaq -0x208(%rbp), %rdi
callq 0x1050
jmp 0x12ae
leaq 0xe20(%rip), %rsi       # 0x20d5
leaq -0x408(%rbp), %rdi
callq 0x1050
jmp 0x12c3
leaq 0xe0b(%rip), %rsi       # 0x20d5
leaq -0x618(%rbp), %rdi
callq 0x1050
jmp 0x12d8
leaq 0xdf6(%rip), %rsi       # 0x20d5
leaq -0x818(%rbp), %rdi
callq 0x1050
jmp 0x12ed
leaq 0xde1(%rip), %rsi       # 0x20d5
leaq -0xa18(%rbp), %rdi
callq 0x1050
jmp 0x1302
leaq -0xa80(%rbp), %rdi
leaq 0xd10(%rip), %rsi       # 0x2020
movl $0x5c, %edx
callq 0x1030
movl $0x1, -0xa84(%rbp)
cmpl $0x16, -0xa84(%rbp)
jg 0x1786
movslq -0xa84(%rbp), %rax
movl -0xa80(%rbp,%rax,4), %eax
movl %eax, -0xa88(%rbp)
leaq 0xdab(%rip), %rsi       # 0x20f7
leaq -0x208(%rbp), %rdi
callq 0x1050
movq %rax, -0xaa8(%rbp)
jmp 0x1361
movl $0x2, %edi
callq 0x18f0
movl %eax, -0xaac(%rbp)
jmp 0x1373
movq -0xaa8(%rbp), %rdi
movl -0xaac(%rbp), %eax
movl %eax, -0xa8c(%rbp)
movl -0xa8c(%rbp), %esi
callq 0x1070
movq %rax, -0xab8(%rbp)
jmp 0x139a
movq -0xab8(%rbp), %rdi
movl -0xa84(%rbp), %esi
callq 0x10a0
movq %rax, -0xac0(%rbp)
jmp 0x13b5
movq -0xac0(%rbp), %rdi
leaq 0xd3a(%rip), %rsi       # 0x20fd
callq 0x1050
movq %rax, -0xac8(%rbp)
jmp 0x13d1
movq -0xac8(%rbp), %rdi
movl -0xa88(%rbp), %esi
callq 0x10a0
movq %rax, -0xad0(%rbp)
jmp 0x13ec
movq -0xad0(%rbp), %rdi
leaq 0xd16(%rip), %rsi       # 0x2110
callq 0x1050
jmp 0x1401
leaq 0xcef(%rip), %rsi       # 0x20f7
leaq -0x408(%rbp), %rdi
callq 0x1050
movq %rax, -0xad8(%rbp)
jmp 0x141d
movl $0x2, %edi
callq 0x18f0
movl %eax, -0xadc(%rbp)
jmp 0x142f
movq -0xad8(%rbp), %rdi
movl -0xadc(%rbp), %eax
movl %eax, -0xa90(%rbp)
movl -0xa90(%rbp), %esi
callq 0x1070
movq %rax, -0xae8(%rbp)
jmp 0x1456
movq -0xae8(%rbp), %rdi
movl -0xa84(%rbp), %esi
callq 0x10a0
movq %rax, -0xaf0(%rbp)
jmp 0x1471
movq -0xaf0(%rbp), %rdi
leaq 0xc7e(%rip), %rsi       # 0x20fd
callq 0x1050
movq %rax, -0xaf8(%rbp)
jmp 0x148d
movq -0xaf8(%rbp), %rdi
movl -0xa88(%rbp), %esi
callq 0x10a0
movq %rax, -0xb00(%rbp)
jmp 0x14a8
movq -0xb00(%rbp), %rdi
leaq 0xc80(%rip), %rsi       # 0x2136
callq 0x1050
jmp 0x14bd
leaq 0xc33(%rip), %rsi       # 0x20f7
leaq -0x618(%rbp), %rdi
callq 0x1050
movq %rax, -0xb08(%rbp)
jmp 0x14d9
movl $0x2, %edi
callq 0x18f0
movl %eax, -0xb0c(%rbp)
jmp 0x14eb
movq -0xb08(%rbp), %rdi
movl -0xb0c(%rbp), %eax
movl %eax, -0xa94(%rbp)
movl -0xa94(%rbp), %esi
callq 0x1070
movq %rax, -0xb18(%rbp)
jmp 0x1512
movq -0xb18(%rbp), %rdi
movl -0xa84(%rbp), %esi
callq 0x10a0
movq %rax, -0xb20(%rbp)
jmp 0x152d
movq -0xb20(%rbp), %rdi
leaq 0xbc2(%rip), %rsi       # 0x20fd
callq 0x1050
movq %rax, -0xb28(%rbp)
jmp 0x1549
movq -0xb28(%rbp), %rdi
movl -0xa88(%rbp), %esi
callq 0x10a0
movq %rax, -0xb30(%rbp)
jmp 0x1564
movq -0xb30(%rbp), %rdi
leaq 0xbe6(%rip), %rsi       # 0x2158
callq 0x1050
jmp 0x1579
leaq 0xb77(%rip), %rsi       # 0x20f7
leaq -0x818(%rbp), %rdi
callq 0x1050
movq %rax, -0xb38(%rbp)
jmp 0x1595
movl $0x2, %edi
callq 0x18f0
movl %eax, -0xb3c(%rbp)
jmp 0x15a7
movq -0xb38(%rbp), %rdi
movl -0xb3c(%rbp), %eax
movl %eax, -0xa98(%rbp)
movl -0xa98(%rbp), %esi
callq 0x1070
movq %rax, -0xb48(%rbp)
jmp 0x15ce
movq -0xb48(%rbp), %rdi
movl -0xa84(%rbp), %esi
callq 0x10a0
movq %rax, -0xb50(%rbp)
jmp 0x15e9
movq -0xb50(%rbp), %rdi
leaq 0xb06(%rip), %rsi       # 0x20fd
callq 0x1050
movq %rax, -0xb58(%rbp)
jmp 0x1605
movq -0xb58(%rbp), %rdi
movl -0xa88(%rbp), %esi
callq 0x10a0
movq %rax, -0xb60(%rbp)
jmp 0x1620
movq -0xb60(%rbp), %rdi
leaq 0xb4c(%rip), %rsi       # 0x217a
callq 0x1050
jmp 0x1635
leaq 0xabb(%rip), %rsi       # 0x20f7
leaq -0xa18(%rbp), %rdi
callq 0x1050
movq %rax, -0xb68(%rbp)
jmp 0x1651
movl $0x2, %edi
callq 0x18f0
movl %eax, -0xb6c(%rbp)
jmp 0x1663
movq -0xb68(%rbp), %rdi
movl -0xb6c(%rbp), %eax
movl %eax, -0xa9c(%rbp)
movl -0xa9c(%rbp), %esi
callq 0x1070
movq %rax, -0xb78(%rbp)
jmp 0x168a
movq -0xb78(%rbp), %rdi
movl -0xa84(%rbp), %esi
callq 0x10a0
movq %rax, -0xb80(%rbp)
jmp 0x16a5
movq -0xb80(%rbp), %rdi
leaq 0xa4a(%rip), %rsi       # 0x20fd
callq 0x1050
movq %rax, -0xb88(%rbp)
jmp 0x16c1
movq -0xb88(%rbp), %rdi
movl -0xa88(%rbp), %esi
callq 0x10a0
movq %rax, -0xb90(%rbp)
jmp 0x16dc
movq -0xb90(%rbp), %rdi
leaq 0xab3(%rip), %rsi       # 0x219d
callq 0x1050
jmp 0x16f1
jmp 0x16f3
movl -0xa84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa84(%rbp)
jmp 0x1324
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x410(%rbp)
movl %eax, -0x414(%rbp)
jmp 0x18cb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x410(%rbp)
movl %eax, -0x414(%rbp)
jmp 0x18bf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x410(%rbp)
movl %eax, -0x414(%rbp)
jmp 0x18b3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x410(%rbp)
movl %eax, -0x414(%rbp)
jmp 0x18a7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x410(%rbp)
movl %eax, -0x414(%rbp)
leaq -0xa18(%rbp), %rdi
callq 0x1080
jmp 0x18a7
leaq 0x976(%rip), %rsi       # 0x2103
leaq -0x208(%rbp), %rdi
callq 0x1050
jmp 0x179b
leaq 0x987(%rip), %rsi       # 0x2129
leaq -0x408(%rbp), %rdi
callq 0x1050
jmp 0x17b0
leaq 0x994(%rip), %rsi       # 0x214b
leaq -0x618(%rbp), %rdi
callq 0x1050
jmp 0x17c5
leaq 0x9a1(%rip), %rsi       # 0x216d
leaq -0x818(%rbp), %rdi
callq 0x1050
jmp 0x17da
leaq 0x9af(%rip), %rsi       # 0x2190
leaq -0xa18(%rbp), %rdi
callq 0x1050
jmp 0x17ef
leaq 0x9bd(%rip), %rsi       # 0x21b3
leaq -0x208(%rbp), %rdi
callq 0x1050
jmp 0x1804
leaq 0x9a8(%rip), %rsi       # 0x21b3
leaq -0x408(%rbp), %rdi
callq 0x1050
jmp 0x1819
leaq 0x993(%rip), %rsi       # 0x21b3
leaq -0x618(%rbp), %rdi
callq 0x1050
jmp 0x182e
leaq 0x97e(%rip), %rsi       # 0x21b3
leaq -0x818(%rbp), %rdi
callq 0x1050
jmp 0x1843
leaq 0x969(%rip), %rsi       # 0x21b3
leaq -0xa18(%rbp), %rdi
callq 0x1050
jmp 0x1858
movl $0x0, -0x4(%rbp)
leaq -0xa18(%rbp), %rdi
callq 0x1080
leaq -0x818(%rbp), %rdi
callq 0x1080
leaq -0x618(%rbp), %rdi
callq 0x1080
leaq -0x408(%rbp), %rdi
callq 0x1080
leaq -0x208(%rbp), %rdi
callq 0x1080
movl -0x4(%rbp), %eax
addq $0xb90, %rsp            # imm = 0xB90
popq %rbp
retq
leaq -0x818(%rbp), %rdi
callq 0x1080
leaq -0x618(%rbp), %rdi
callq 0x1080
leaq -0x408(%rbp), %rdi
callq 0x1080
leaq -0x208(%rbp), %rdi
callq 0x1080
movq -0x410(%rbp), %rdi
callq 0x10b0
nopw %cs:(%rax,%rax)
nopl (%rax)