#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 *, int);
main() {
  int count[3], point[3], i, j, k;
  for (j = 0; j <= 2; ++j)
    count[j] = j + 1;
  for (i = 0; i <= 2; ++i) {
    int n1, n2;
    n1 = (i + 1) % 3;
    n2 = (i + 2) % 3;
    int t1, t2;
    t1 = count[n1];
    t2 = count[n2];
    count[n1] = t2;
    count[n2] = t1;
    for (k = 0; k <= 2; ++k)
      printf("%d ", count[k]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x2,-0x24(%rbp)
jg     114c <main+0x3c>
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
movslq -0x24(%rbp),%rax
mov    %ecx,-0x10(%rbp,%rax,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1126 <main+0x16>
movl   $0x0,-0x20(%rbp)
cmpl   $0x2,-0x20(%rbp)
jg     11f1 <main+0xe1>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %edx,-0x2c(%rbp)
mov    -0x20(%rbp),%eax
add    $0x2,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %edx,-0x30(%rbp)
movslq -0x2c(%rbp),%rax
mov    -0x10(%rbp,%rax,4),%eax
mov    %eax,-0x34(%rbp)
movslq -0x30(%rbp),%rax
mov    -0x10(%rbp,%rax,4),%eax
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%ecx
movslq -0x2c(%rbp),%rax
mov    %ecx,-0x10(%rbp,%rax,4)
mov    -0x34(%rbp),%ecx
movslq -0x30(%rbp),%rax
mov    %ecx,-0x10(%rbp,%rax,4)
movl   $0x0,-0x28(%rbp)
cmpl   $0x2,-0x28(%rbp)
jg     11de <main+0xce>
movslq -0x28(%rbp),%rax
mov    -0x10(%rbp,%rax,4),%esi
lea    0xe35(%rip),%rdi
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11b2 <main+0xa2>
jmp    11e3 <main+0xd3>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1153 <main+0x43>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 2)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 2)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 2)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1)
ret i32 0
}