#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 */
typedef int /*<<< orphan*/ array0;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
scalar_t__ memcmp(int *, int *, int);
int /*<<< orphan*/ right_rotate_array_k_times_v4(int *, int, int);
int main() {
  int array0[] = {1, 2, 3, 4, 5, 6, 7, 8};
  int len0 = sizeof(array0) / sizeof(int);
  int k0 = 3;
  int expected0[] = {6, 7, 8, 1, 2, 3, 4, 5};
  right_rotate_array_k_times_v4(array0, len0, k0);
  assert(0 == memcmp(array0, expected0, sizeof(array0)));
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xeb4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb1(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x8,-0x34(%rbp)
movl   $0x3,-0x38(%rbp)
mov    0xea0(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xe9d(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    0xe9a(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xe97(%rip),%rax
mov    %rax,-0x48(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    -0x38(%rbp),%edx
call   1050 <right_rotate_array_k_times_v4@plt>
lea    -0x30(%rbp),%rdi
lea    -0x60(%rbp),%rsi
mov    $0x20,%edx
call   1030 <memcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
movaps 0xed4(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xeb8(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xedc(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xec0(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x8,%esi
mov    $0x3,%edx
call   1050 <right_rotate_array_k_times_v4@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
mov    $0x20,%edx
call   1030 <memcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.array0 = [8 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8]
@__const.main.expected0 = [8 x i32] [i32 6, i32 7, i32 8, i32 1, i32 2, i32 3, i32 4, i32 5]
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca [8 x i32]
store i32 0, i32* %1
%6 = bitcast [8 x i32]* %2 to i8*
store i32 8, i32* %3
store i32 3, i32* %4
%7 = bitcast [8 x i32]* %5 to i8*
%8 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = call i32 @right_rotate_array_k_times_v4(i32* %8, i32 %9, i32 %10)
%12 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%13 = getelementptr inbounds [8 x i32], [8 x i32]* %5, i64 0, i64 0
%14 = call i64 @memcmp(i32* %12, i32* %13, i32 32)
%15 = icmp eq i64 0, %14
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
ret i32 0
}

LLVM IR (-O2):
@__const.main.array0 = [8 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8]
@__const.main.expected0 = [8 x i32] [i32 6, i32 7, i32 8, i32 1, i32 2, i32 3, i32 4, i32 5]
define i32 @main() {
%1 = alloca [8 x i32]
%2 = alloca [8 x i32]
%3 = bitcast [8 x i32]* %1 to i8*
%4 = bitcast [8 x i32]* %2 to i8*
%5 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%6 = call i32 @right_rotate_array_k_times_v4(i32* %5, i32 8, i32 3)
%7 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%8 = call i64 @memcmp(i32* %5, i32* %7, i32 32)
%9 = icmp eq i64 %8, 0
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
ret i32 0
}