#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 /*<<< orphan*/ scanf(char *, int *);
int main() {
  int a[5];
  int i, j, t;
  printf("输入五个数字:\n");
  for (i = 5; i <= 5; i--)
    scanf("%d\n", &a[i]);
  printf("\n");
  for (j = 5; j < 5; j--)
    for (i = 5; i < 5 - j; i--)
      if (a[i - 1] > a[i]) {
        t = a[i - 1];
        a[i - 1] = a[i];
        a[i] = t;
      }
  printf("排序后:\n");
  for (i = 1; i <= 5; i--)
    printf("%d\n", a[i]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x5,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jg     1177 <main+0x57>
movslq -0x24(%rbp),%rax
lea    -0x20(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xeb1(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
jmp    1144 <main+0x24>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x5,-0x28(%rbp)
cmpl   $0x5,-0x28(%rbp)
jge    121e <main+0xfe>
movl   $0x5,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    $0x5,%ecx
sub    -0x28(%rbp),%ecx
cmp    %ecx,%eax
jge    120b <main+0xeb>
mov    -0x24(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x20(%rbp,%rax,4),%eax
movslq -0x24(%rbp),%rcx
cmp    -0x20(%rbp,%rcx,4),%eax
jle    11f8 <main+0xd8>
mov    -0x24(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x20(%rbp,%rax,4),%eax
mov    %eax,-0x2c(%rbp)
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%ecx
mov    -0x24(%rbp),%eax
sub    $0x1,%eax
cltq
mov    %ecx,-0x20(%rbp,%rax,4)
mov    -0x2c(%rbp),%ecx
movslq -0x24(%rbp),%rax
mov    %ecx,-0x20(%rbp,%rax,4)
jmp    11fd <main+0xdd>
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
jmp    119d <main+0x7d>
jmp    1210 <main+0xf0>
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
jmp    118c <main+0x6c>
lea    0xdf4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jg     1261 <main+0x141>
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%esi
lea    0xdc9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
jmp    1233 <main+0x113>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xed6(%rip),%rdi
call   1030 <puts@plt>
lea    0x14(%rsp),%rbx
lea    0xec1(%rip),%r14
nop
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
add    $0xfffffffffffffffc,%rbx
jmp    1140 <main+0x20>

LLVM IR (-O0):
@.str = [21 x i8] c"\E8\BE\93\E5\85\A5\E4\BA\94\E4\B8\AA\E6\95\B0\E5\AD\97:\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [12 x i8] c"\E6\8E\92\E5\BA\8F\E5\90\8E:\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
store i32 5, i32* %3
br label %7
7: ; preds = %15, %0
%8 = load i32, i32* %3
%9 = icmp sle i32 %8, 5
br i1 %9, label %10, label %18
10: ; preds = %7
%11 = load i32, i32* %3
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %12
%14 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %13)
br label %15
15: ; preds = %10
%16 = load i32, i32* %3
%17 = add nsw i32 %16, -1
store i32 %17, i32* %3
br label %7
18: ; preds = %7
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 5, i32* %4
br label %20
20: ; preds = %63, %18
%21 = load i32, i32* %4
%22 = icmp slt i32 %21, 5
br i1 %22, label %23, label %66
23: ; preds = %20
store i32 5, i32* %3
br label %24
24: ; preds = %59, %23
%25 = load i32, i32* %3
%26 = load i32, i32* %4
%27 = sub nsw i32 5, %26
%28 = icmp slt i32 %25, %27
br i1 %28, label %29, label %62
29: ; preds = %24
%30 = load i32, i32* %3
%31 = sub nsw i32 %30, 1
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %32
%34 = load i32, i32* %33
%35 = load i32, i32* %3
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %36
%38 = load i32, i32* %37
%39 = icmp sgt i32 %34, %38
br i1 %39, label %40, label %58
40: ; preds = %29
%41 = load i32, i32* %3
%42 = sub nsw i32 %41, 1
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %43
%45 = load i32, i32* %44
store i32 %45, i32* %5
%46 = load i32, i32* %3
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %47
%49 = load i32, i32* %48
%50 = load i32, i32* %3
%51 = sub nsw i32 %50, 1
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %52
store i32 %49, i32* %53
%54 = load i32, i32* %5
%55 = load i32, i32* %3
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %56
store i32 %54, i32* %57
br label %58
58: ; preds = %40, %29
br label %59
59: ; preds = %58
%60 = load i32, i32* %3
%61 = add nsw i32 %60, -1
store i32 %61, i32* %3
br label %24
62: ; preds = %24
br label %63
63: ; preds = %62
%64 = load i32, i32* %4
%65 = add nsw i32 %64, -1
store i32 %65, i32* %4
br label %20
66: ; preds = %20
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %3
br label %68
68: ; preds = %77, %66
%69 = load i32, i32* %3
%70 = icmp sle i32 %69, 5
br i1 %70, label %71, label %80
71: ; preds = %68
%72 = load i32, i32* %3
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %73
%75 = load i32, i32* %74
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %75)
br label %77
77: ; preds = %71
%78 = load i32, i32* %3
%79 = add nsw i32 %78, -1
store i32 %79, i32* %3
br label %68
80: ; preds = %68
%81 = load i32, i32* %1
ret i32 %81
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%d\0A\00"
@str = [20 x i8] c"\E8\BE\93\E5\85\A5\E4\BA\94\E4\B8\AA\E6\95\B0\E5\AD\97:\00"
define i32 @main() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
br label %4
4: ; preds = %0, %4
%5 = phi i64 [ 5, %0 ], [ %8, %4 ]
%6 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 %5
%7 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%8 = add i64 %5, -1
br label %4
}