#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 *, ...);
void lrotate(int seq[], int nr) {
  int try = 0;
  int i = 0;
  int num_rotations = nr % 7;
  for (try = 0; try < num_rotations; try++) {
    int tmp = seq[0];
    for (i = 0; i < 7 - 1; i++) {
      seq[i] = seq[i + 1];
    }
    seq[i] = tmp;
    for (i = 0; i < 7; i++)
      printf("%d ", seq[i]);
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<lrotate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11f3 <lrotate+0xe3>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x6,-0x14(%rbp)
jge    1191 <lrotate+0x81>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115e <lrotate+0x4e>
mov    -0x1c(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
movl   $0x0,-0x14(%rbp)
cmpl   $0x7,-0x14(%rbp)
jge    11d7 <lrotate+0xc7>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11a6 <lrotate+0x96>
lea    0xe26(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1142 <lrotate+0x32>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lrotate>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movslq %esi,%rax
imul   $0xffffffff92492493,%rax,%r15
shr    $0x20,%r15
add    %eax,%r15d
mov    %r15d,%ecx
shr    $0x1f,%ecx
sar    $0x2,%r15d
add    %ecx,%r15d
lea    0x0(,%r15,8),%ecx
sub    %ecx,%r15d
add    %eax,%r15d
test   %r15d,%r15d
jle    11f0 <lrotate+0xd0>
mov    %rdi,%rbx
lea    0x4(%rdi),%r12
lea    0xe95(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%rbx),%eax
mov    0x10(%r12),%rcx
movups (%r12),%xmm0
movups %xmm0,(%rbx)
mov    %rcx,0x10(%rbx)
mov    %eax,0x18(%rbx)
mov    (%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%r15d
jne    1170 <lrotate+0x50>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @lrotate(i32* nocapture %0, i32 %1) {
%3 = bitcast i32* %0 to i8*
%4 = srem i32 %1, 7
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %34
6: ; preds = %2
%7 = getelementptr i32, i32* %0, i64 1
%8 = bitcast i32* %7 to i8*
%9 = getelementptr inbounds i32, i32* %0, i64 6
%10 = getelementptr inbounds i32, i32* %0, i64 2
%11 = getelementptr inbounds i32, i32* %0, i64 3
%12 = getelementptr inbounds i32, i32* %0, i64 4
%13 = getelementptr inbounds i32, i32* %0, i64 5
br label %14
14: ; preds = %6, %14
%15 = phi i32 [ %32, %14 ], [ 0, %6 ]
%16 = load i32, i32* %0
store i32 %16, i32* %9
%17 = load i32, i32* %0
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = load i32, i32* %7
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %19)
%21 = load i32, i32* %10
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %21)
%23 = load i32, i32* %11
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %23)
%25 = load i32, i32* %12
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %25)
%27 = load i32, i32* %13
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %27)
%29 = load i32, i32* %9
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %29)
%31 = tail call i32 @putchar(i32 10)
%32 = add nuw nsw i32 %15, 1
%33 = icmp eq i32 %32, %4
br i1 %33, label %34, label %14
34: ; preds = %14, %2
ret void
}