#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 *, ...);
main() {
  int i, j, k, fy[10];
  for (i = 0; i <= 9; ++i)
    fy[i] = i + 1;
  for (i = 9; i >= 0; --i) {
    int q1, q2;
    q1 = fy[i];
    q2 = fy[i + 1];
    fy[i + 1] = q1;
    fy[i] = q2;
    for (k = 0; k <= 9; ++i)
      printf("%d ", fy[k]);
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x9,-0x8(%rbp)
jg     114c <main+0x3c>
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
movslq -0x8(%rbp),%rax
mov    %ecx,-0x40(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
movl   $0x9,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     11e2 <main+0xd2>
movslq -0x8(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%eax
mov    %eax,-0x44(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
cltq
mov    -0x40(%rbp,%rax,4),%eax
mov    %eax,-0x48(%rbp)
mov    -0x44(%rbp),%ecx
mov    -0x8(%rbp),%eax
add    $0x1,%eax
cltq
mov    %ecx,-0x40(%rbp,%rax,4)
mov    -0x48(%rbp),%ecx
movslq -0x8(%rbp),%rax
mov    %ecx,-0x40(%rbp,%rax,4)
movl   $0x0,-0x10(%rbp)
cmpl   $0x9,-0x10(%rbp)
jg     11c6 <main+0xb6>
movslq -0x10(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%esi
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1198 <main+0x88>
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1153 <main+0x43>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1120 <main+0x10>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1)
br label %1
}