#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*/ nums;

/* Variables and functions */
int /*<<< orphan*/ print_array(int *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ rotate3(int *, int, int);
int main(void) {
  int size, k;
  int nums[] = {1, 2, 3, 4, 5, 6, 7};
  size = sizeof(nums) / sizeof(int);
  printf("Origin:\n");
  print_array(nums, size);
  printf("\n");
  k = 5;
  rotate3(nums, size, k);
  printf("After rotating:\n");
  print_array(nums, size);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%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    0xeb2(%rip),%eax
mov    %eax,-0x18(%rbp)
movl   $0x7,-0x8(%rbp)
lea    0xea5(%rip),%rdi
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1030 <print_array@plt>
lea    0xea5(%rip),%rdi
call   1040 <printf@plt>
movl   $0x5,-0xc(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1050 <rotate3@plt>
lea    0xe74(%rip),%rdi
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1030 <print_array@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movups 0xec0(%rip),%xmm0
movups %xmm0,0xc(%rsp)
movaps 0xea8(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xeb9(%rip),%rdi
call   1040 <puts@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x7,%esi
call   1050 <print_array@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
mov    $0x5,%edx
call   1060 <rotate3@plt>
lea    0xe89(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
call   1050 <print_array@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.nums = [7 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7]
@.str = [9 x i8] c"Origin:\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [17 x i8] c"After rotating:\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [7 x i32]
store i32 0, i32* %1
%5 = bitcast [7 x i32]* %4 to i8*
store i32 7, i32* %2
%6 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [7 x i32], [7 x i32]* %4, i64 0, i64 0
%8 = load i32, i32* %2
%9 = call i32 @print_array(i32* %7, i32 %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 5, i32* %3
%11 = getelementptr inbounds [7 x i32], [7 x i32]* %4, i64 0, i64 0
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = call i32 @rotate3(i32* %11, i32 %12, i32 %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%16 = getelementptr inbounds [7 x i32], [7 x i32]* %4, i64 0, i64 0
%17 = load i32, i32* %2
%18 = call i32 @print_array(i32* %16, i32 %17)
ret i32 0
}

LLVM IR (-O2):
@__const.main.nums = [7 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7]
@str = [8 x i8] c"Origin:\00"
@str.3 = [16 x i8] c"After rotating:\00"
define i32 @main() {
%1 = alloca [7 x i32]
%2 = bitcast [7 x i32]* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%4 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 0
%5 = call i32 @print_array(i32* %4, i32 7)
%6 = call i32 @putchar(i32 10)
%7 = call i32 @rotate3(i32* %4, i32 7, i32 5)
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.3, i64 0, i64 0))
%9 = call i32 @print_array(i32* %4, i32 7)
ret i32 0
}