#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*/ assert(int);
int rotate(int N) {
  int a, b, c, x, i, temp;
  a = 1;
  b = 2;
  c = 3;
  x = 0;
  for (i = 0; i < N; i++) {
    assert(a != b);
    temp = a;
    a = b;
    b = c;
    c = temp;
  }
  assert(x == 0);
}


x86 assembly (clang, -O0):
<rotate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x2,-0x10(%rbp)
movl   $0x3,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1183 <rotate+0x73>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113e <rotate+0x2e>
cmpl   $0x0,-0x18(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rotate>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %edi,%edi
jle    114d <rotate+0x3d>
mov    %edi,%ebx
mov    $0x3,%r14d
mov    $0x2,%ebp
mov    $0x1,%eax
nopl   (%rax)
mov    %eax,%r15d
xor    %edi,%edi
cmp    %ebp,%eax
setne  %dil
call   1030 <assert@plt>
mov    %ebp,%eax
mov    %r14d,%ebp
mov    %r15d,%r14d
add    $0xffffffff,%ebx
jne    1130 <rotate+0x20>
mov    $0x1,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <assert@plt>

LLVM IR (-O0):
define i32 @rotate(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %3
store i32 1, i32* %4
store i32 2, i32* %5
store i32 3, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
br label %10
10: ; preds = %24, %1
%11 = load i32, i32* %8
%12 = load i32, i32* %3
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %27
14: ; preds = %10
%15 = load i32, i32* %4
%16 = load i32, i32* %5
%17 = icmp ne i32 %15, %16
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
%20 = load i32, i32* %4
store i32 %20, i32* %9
%21 = load i32, i32* %5
store i32 %21, i32* %4
%22 = load i32, i32* %6
store i32 %22, i32* %5
%23 = load i32, i32* %9
store i32 %23, i32* %6
br label %24
24: ; preds = %14
%25 = load i32, i32* %8
%26 = add nsw i32 %25, 1
store i32 %26, i32* %8
br label %10
27: ; preds = %10
%28 = load i32, i32* %7
%29 = icmp eq i32 %28, 0
%30 = zext i1 %29 to i32
%31 = call i32 @assert(i32 %30)
%32 = load i32, i32* %2
ret i32 %32
}

LLVM IR (-O2):
define i32 @rotate(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %13
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 1, %1 ]
%5 = phi i32 [ %11, %3 ], [ 0, %1 ]
%6 = phi i32 [ %7, %3 ], [ 2, %1 ]
%7 = phi i32 [ %4, %3 ], [ 3, %1 ]
%8 = icmp ne i32 %4, %6
%9 = zext i1 %8 to i32
%10 = tail call i32 @assert(i32 %9)
%11 = add nuw nsw i32 %5, 1
%12 = icmp eq i32 %11, %0
br i1 %12, label %13, label %3
13: ; preds = %3, %1
%14 = tail call i32 @assert(i32 1)
ret i32 undef
}