#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 */
void left_rotate(bool v[], int vsize, int n) {
  int i, j;
  for (j = 0; j < n; j++) {
    bool temp = v[0];
    for (i = 0; i < vsize - 1; i++) {
      v[i] = v[i + 1];
    }
    v[vsize - 1] = temp;
  }
}


x86 assembly (clang, -O0):
<left_rotate>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    118c <left_rotate+0x8c>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    116b <left_rotate+0x6b>
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    1131 <left_rotate+0x31>
mov    -0x1c(%rbp),%edx
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1115 <left_rotate+0x15>
pop    %rbp
ret

x86 assembly (clang, -O2):
<left_rotate>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
test   %edx,%edx
jle    116f <left_rotate+0x5f>
mov    %esi,%r14d
mov    %rdi,%rbx
lea    -0x1(%r14),%eax
movslq %eax,%r15
lea    0x4(%rdi),%rcx
mov    %rcx,0x8(%rsp)
shl    $0x2,%rax
mov    %rax,0x10(%rsp)
mov    %edx,0x4(%rsp)
cmp    $0x1,%edx
jne    117e <left_rotate+0x6e>
testb  $0x1,0x4(%rsp)
je     116f <left_rotate+0x5f>
mov    (%rbx),%ebp
cmp    $0x2,%r14d
jl     116b <left_rotate+0x5b>
mov    %rbx,%rdi
mov    0x8(%rsp),%rsi
mov    0x10(%rsp),%rdx
call   1030 <memmove@plt>
mov    %ebp,(%rbx,%r15,4)
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x4(%rsp),%r13d
and    $0xfffffffe,%r13d
jmp    119a <left_rotate+0x8a>
nopl   0x0(%rax)
mov    %ebp,(%rbx,%r15,4)
add    $0xfffffffe,%r13d
je     114a <left_rotate+0x3a>
mov    (%rbx),%r12d
cmp    $0x2,%r14d
jl     11b5 <left_rotate+0xa5>
mov    %rbx,%rdi
mov    0x8(%rsp),%rsi
mov    0x10(%rsp),%rdx
call   1030 <memmove@plt>
mov    %r12d,(%rbx,%r15,4)
mov    (%rbx),%ebp
cmp    $0x2,%r14d
jl     1190 <left_rotate+0x80>
mov    %rbx,%rdi
mov    0x8(%rsp),%rsi
mov    0x10(%rsp),%rdx
call   1030 <memmove@plt>
jmp    1190 <left_rotate+0x80>

LLVM IR (-O0):
define void @left_rotate(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %8
br label %10
10: ; preds = %44, %3
%11 = load i32, i32* %8
%12 = load i32, i32* %6
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %47
14: ; preds = %10
%15 = load i32*, i32** %4
%16 = getelementptr inbounds i32, i32* %15, i64 0
%17 = load i32, i32* %16
store i32 %17, i32* %9
store i32 0, i32* %7
br label %18
18: ; preds = %34, %14
%19 = load i32, i32* %7
%20 = load i32, i32* %5
%21 = sub nsw i32 %20, 1
%22 = icmp slt i32 %19, %21
br i1 %22, label %23, label %37
23: ; preds = %18
%24 = load i32*, i32** %4
%25 = load i32, i32* %7
%26 = add nsw i32 %25, 1
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i32, i32* %24, i64 %27
%29 = load i32, i32* %28
%30 = load i32*, i32** %4
%31 = load i32, i32* %7
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i32, i32* %30, i64 %32
store i32 %29, i32* %33
br label %34
34: ; preds = %23
%35 = load i32, i32* %7
%36 = add nsw i32 %35, 1
store i32 %36, i32* %7
br label %18
37: ; preds = %18
%38 = load i32, i32* %9
%39 = load i32*, i32** %4
%40 = load i32, i32* %5
%41 = sub nsw i32 %40, 1
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i32, i32* %39, i64 %42
store i32 %38, i32* %43
br label %44
44: ; preds = %37
%45 = load i32, i32* %8
%46 = add nsw i32 %45, 1
store i32 %46, i32* %8
br label %10
47: ; preds = %10
ret void
}

LLVM IR (-O2):
define void @left_rotate(i32* nocapture %0, i32 %1, i32 %2) {
%4 = bitcast i32* %0 to i8*
%5 = icmp sgt i32 %2, 0
br i1 %5, label %6, label %35
6: ; preds = %3
%7 = add i32 %1, -1
%8 = icmp sgt i32 %1, 1
%9 = sext i32 %7 to i64
%10 = getelementptr inbounds i32, i32* %0, i64 %9
%11 = getelementptr i32, i32* %0, i64 1
%12 = bitcast i32* %11 to i8*
%13 = zext i32 %7 to i64
%14 = shl nuw nsw i64 %13, 2
%15 = and i32 %2, 1
%16 = icmp eq i32 %2, 1
br i1 %16, label %29, label %17
17: ; preds = %6
%18 = and i32 %2, -2
br label %19
19: ; preds = %26, %17
%20 = phi i32 [ 0, %17 ], [ %27, %26 ]
%21 = load i32, i32* %0
br i1 %8, label %22, label %23
22: ; preds = %19
br label %23
23: ; preds = %22, %19
store i32 %21, i32* %10
%24 = load i32, i32* %0
br i1 %8, label %25, label %26
25: ; preds = %23
br label %26
26: ; preds = %25, %23
store i32 %24, i32* %10
%27 = add i32 %20, 2
%28 = icmp eq i32 %27, %18
br i1 %28, label %29, label %19
29: ; preds = %26, %6
%30 = icmp eq i32 %15, 0
br i1 %30, label %35, label %31
31: ; preds = %29
%32 = load i32, i32* %0
br i1 %8, label %33, label %34
33: ; preds = %31
br label %34
34: ; preds = %33, %31
store i32 %32, i32* %10
br label %35
35: ; preds = %34, %29, %3
ret void
}