// File: /workspace/github_cpp_makefile_star2_O1/patmorin[P]rotate/rotatetest.cpp
// Function: main
int main(int argc, char *argv[]) {
    Index n, r;

    if (argc != 3) usage(argv[0]);
    std::istringstream is_n(argv[1]);
    is_n >> n;
    std::istringstream is_r(argv[2]);
    is_r >> r;

    std::cout << "n = " << n << ", r = " << r << std::endl;

		auto *a = new Data[n];

		Rotater fns[] =
		{ rotate_std<Data,Index>, rotate_stdrev<Data,Index>,
			rotate_rev<Data,Index>, rotate_gcd<Data,Index> };
		std::string fn_names[] =
		{ "rotate_std", "rotate_stdrev", "rotate_rev", "rotate_gcd" };

		if (n <= 50) {
			for (int i = 0; i < 4; i++) {
				std::iota(a, a+n, 1);
				print_array(a, n);
				rotate_std(a, n, r);
				print_array(a, n);
				std::cout << std::endl;
			}
		} else {
			for (int i = 0; i < 4; i++) {
		    std::iota(a, a+n, 1);

				std::cout << std::setw(20) << fn_names[i] << " : ";
		    speed_test(a, n, r, fns[i]);
			}
		}
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3a8, %rsp            # imm = 0x3A8
movq %rsi, %rbx
cmpl $0x3, %edi
jne 0x27c8
movq 0x8(%rbx), %rsi
leaq 0xa8(%rsp), %rdi
leaq 0x20(%rsp), %rdx
callq 0x2070
leaq 0x228(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
movl $0x8, %edx
callq 0x2180
leaq 0xb8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x238d
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x2110
leaq 0x228(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x2090
movq 0x10(%rbx), %rsi
leaq 0x20(%rsp), %rdi
leaq 0x17(%rsp), %rdx
callq 0x2070
leaq 0xa8(%rsp), %rdi
leaq 0x20(%rsp), %rsi
movl $0x8, %edx
callq 0x2180
leaq 0x30(%rsp), %r15
movq -0x10(%r15), %rdi
cmpq %r15, %rdi
je 0x23e4
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x2110
leaq 0xa8(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x2090
movq 0x2bcb(%rip), %rdi      # 0x4fc8
leaq 0xd3d(%rip), %rsi       # 0x3141
movl $0x4, %edx
callq 0x2120
movq 0x8(%rsp), %rsi
movq 0x2bae(%rip), %rbx      # 0x4fc8
movq %rbx, %rdi
callq 0x20a0
movq %rax, %r14
leaq 0xd1a(%rip), %rsi       # 0x3146
movl $0x6, %edx
movq %rax, %rdi
callq 0x2120
movq 0x18(%rsp), %rsi
movq %r14, %rdi
callq 0x20a0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x20f0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20b0
movq 0x8(%rsp), %rax
movq %rax, %rcx
shrq $0x3e, %rcx
shlq $0x2, %rax
negq %rcx
sbbq %rdi, %rdi
orq %rax, %rdi
callq 0x2030
movq %rax, %r14
leaq 0x20(%rsp), %r12
movq %r15, (%r12)
leaq 0xcac(%rip), %rsi       # 0x314d
leaq 0xcaf(%rip), %rdx       # 0x3157
movq %r12, %rdi
callq 0x2bf6
leaq 0x40(%rsp), %r15
leaq 0x50(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0xc93(%rip), %rsi       # 0x3158
leaq 0xc99(%rip), %rdx       # 0x3165
movq %r15, %rdi
callq 0x2bf6
leaq 0x60(%rsp), %r15
leaq 0x70(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0xc7d(%rip), %rsi       # 0x3166
leaq 0xc80(%rip), %rdx       # 0x3170
movq %r15, %rdi
callq 0x2bf6
leaq 0x80(%rsp), %r15
leaq 0x90(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0xc5e(%rip), %rsi       # 0x3171
leaq 0xc61(%rip), %rdx       # 0x317b
movq %r15, %rdi
callq 0x2bf6
movabsq $0x3fffffffffffffff, %r12 # imm = 0x3FFFFFFFFFFFFFFF
cmpq $0x33, 0x8(%rsp)
jae 0x2635
xorl %r15d, %r15d
movq 0x8(%rsp), %rsi
testq %rsi, %rsi
vpmovsxbq 0xbbb(%rip), %zmm4 # 0x3108
vpmovsxbq 0xbb9(%rip), %zmm5 # 0x3110
vpbroadcastd 0xb9f(%rip), %zmm6 # 0x3100
je 0x25c4
leaq (%rsi,%r12), %rax
movq %rax, %rcx
andq %r12, %rcx
andl $0xf, %eax
negq %rax
leaq 0x10(%rcx,%rax), %rax
vpbroadcastq %rcx, %zmm0
xorl %ecx, %ecx
vpmovsxbd 0xb96(%rip), %zmm1 # 0x3120
vpbroadcastq %rcx, %zmm2
vporq %zmm4, %zmm2, %zmm3
vporq %zmm5, %zmm2, %zmm2
vpcmpleuq %zmm0, %zmm2, %k0
vpcmpleuq %zmm0, %zmm3, %k1
kunpckbw %k0, %k1, %k1
vmovdqu32 %zmm1, (%r14,%rcx,4) {%k1}
addq $0x10, %rcx
vpaddd %zmm6, %zmm1, %zmm1
cmpq %rcx, %rax
jne 0x258a
movq %r14, %rdi
vzeroupper
callq 0x2ad9
movq 0x8(%rsp), %rax
movq 0x18(%rsp), %rcx
leaq (%r14,%rax,4), %rdx
shlq $0x2, %rcx
movq %rdx, %rsi
subq %rcx, %rsi
movq %r14, %rdi
callq 0x2c86
movq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x2ad9
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x20f0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20b0
incl %r15d
cmpl $0x4, %r15d
jne 0x253b
jmp 0x2747
xorl %ebp, %ebp
leaq 0x2742(%rip), %r15      # 0x4d80
vpmovsxbq 0xac0(%rip), %zmm4 # 0x3108
vpmovsxbq 0xabe(%rip), %zmm5 # 0x3110
vpbroadcastd 0xaa4(%rip), %zmm6 # 0x3100
movq 0x8(%rsp), %rax
testq %rax, %rax
je 0x26c6
addq %r12, %rax
movq %rax, %rcx
andq %r12, %rcx
andl $0xf, %eax
negq %rax
leaq 0x10(%rcx,%rax), %rax
vpbroadcastq %rcx, %zmm0
xorl %ecx, %ecx
vpmovsxbd 0xa94(%rip), %zmm1 # 0x3120
vpbroadcastq %rcx, %zmm2
vporq %zmm4, %zmm2, %zmm3
vporq %zmm5, %zmm2, %zmm2
vpcmpleuq %zmm0, %zmm2, %k0
vpcmpleuq %zmm0, %zmm3, %k1
kunpckbw %k0, %k1, %k1
vmovdqu32 %zmm1, (%r14,%rcx,4) {%k1}
addq $0x10, %rcx
vpaddd %zmm6, %zmm1, %zmm1
cmpq %rcx, %rax
jne 0x268c
movq (%rbx), %rax
movq -0x18(%rax), %rax
movq $0x14, 0x10(%rbx,%rax)
movq %rbp, %rax
shlq $0x5, %rax
movq 0x20(%rsp,%rax), %rsi
movq 0x28(%rsp,%rax), %rdx
movq %rbx, %rdi
vzeroupper
callq 0x2120
movl $0x3, %edx
movq %rax, %rdi
leaq 0xa7b(%rip), %rsi       # 0x317c
callq 0x2120
movq 0x8(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq (%r15,%rbp,8), %rcx
movq %r14, %rdi
callq 0x2b7a
incq %rbp
cmpq $0x4, %rbp
vpmovsxbq 0x9db(%rip), %zmm4 # 0x3108
vpmovsxbq 0x9d9(%rip), %zmm5 # 0x3110
vpbroadcastd 0x9bf(%rip), %zmm6 # 0x3100
jne 0x265c
movq $-0x80, %rbx
movq -0x10(%r13), %rdi
cmpq %rdi, %r13
je 0x2766
movq (%r13), %rsi
incq %rsi
vzeroupper
callq 0x2110
addq $-0x20, %r13
addq $0x20, %rbx
jne 0x274e
movq 0x2849(%rip), %rbx      # 0x4fc0
leaq 0xa8(%rsp), %rdi
movq %rbx, %rsi
vzeroupper
callq 0x2140
leaq 0x120(%rsp), %rdi
callq 0x2060
leaq 0x228(%rsp), %rdi
movq %rbx, %rsi
callq 0x2140
leaq 0x2a0(%rsp), %rdi
callq 0x2060
xorl %eax, %eax
addq $0x3a8, %rsp            # imm = 0x3A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rbx), %rdi
callq 0x22dc
jmp 0x27d4
jmp 0x27d4
movq %rax, %rbx
jmp 0x27df
movq %rax, %rbx
movq %r12, %r15
cmpq %r15, %r12
je 0x28b0
addq $-0x10, %r15
leaq 0x20(%rsp), %r14
movq -0x10(%r15), %rdi
cmpq %rdi, %r15
je 0x2805
movq (%r15), %rsi
incq %rsi
callq 0x2110
leaq -0x20(%r15), %rax
addq $-0x10, %r15
cmpq %r14, %r15
movq %rax, %r15
jne 0x27f1
jmp 0x28b0
jmp 0x287c
movq %rax, %rbx
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x28d1
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x2110
jmp 0x28d1
jmp 0x2845
movq %rax, %rbx
jmp 0x28d1
movq %rax, %rbx
leaq 0xb8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x28f2
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x2110
jmp 0x28f2
movq %rax, %rbx
jmp 0x28f2
movq %rax, %rbx
jmp 0x28b0
jmp 0x2883
movq %rax, %rbx
xorl %r14d, %r14d
movq 0x80(%rsp,%r14), %rdi
leaq (%r13,%r14), %rax
cmpq %rdi, %rax
je 0x28a6
movq (%rax), %rsi
incq %rsi
callq 0x2110
addq $-0x20, %r14
cmpq $-0x80, %r14
jne 0x2889
movq 0x2709(%rip), %rsi      # 0x4fc0
leaq 0xa8(%rsp), %rdi
callq 0x2140
leaq 0x120(%rsp), %rdi
callq 0x2060
movq 0x26e8(%rip), %rsi      # 0x4fc0
leaq 0x228(%rsp), %rdi
callq 0x2140
leaq 0x2a0(%rsp), %rdi
callq 0x2060
movq %rbx, %rdi
callq 0x2190