#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 *, int *, int *);
int main() {
  int t, a, b, c, d;
  printf("输入4个数：");
  scanf("%d,%d,%d,%d", &a, &b, &c, &d);
  printf("a=%d,b=%d,c=%d,d=%d", a, b, c, d);
  if (a > b) {
    t = a;
    a = b;
    b = t;
  }
  if (a > c) {
    t = a;
    a = c;
    c = t;
  }
  if (a > d) {
    t = a;
    a = d;
    d = t;
  }
  if (b > c) {
    t = b;
    b = c;
    c = t;
  }
  if (b > d) {
    t = b;
    b = d;
    d = t;
  }
  if (c > d) {
    t = c;
    c = d;
    d = t;
  }
  printf("由小到大顺序为：\n");
  printf("%d   %d   %d   %d\n", a, b, c, d);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecd(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x14(%rbp),%rcx
lea    -0x18(%rbp),%r8
call   1040 <scanf@plt>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    1192 <main+0x72>
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    11b0 <main+0x90>
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    11ce <main+0xae>
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    11ec <main+0xcc>
mov    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    120a <main+0xea>
mov    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    1228 <main+0x108>
mov    -0x14(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
lea    0xe02(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
lea    0xe01(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xec5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec8(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
call   1050 <scanf@plt>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
mov    0xc(%rsp),%ecx
mov    0x8(%rsp),%r8d
lea    0xea3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%rsp),%eax
mov    0x10(%rsp),%esi
cmp    %esi,%eax
jle    1199 <main+0x69>
mov    %esi,0x14(%rsp)
mov    %eax,0x10(%rsp)
mov    %eax,%edx
jmp    119d <main+0x6d>
mov    %esi,%edx
mov    %eax,%esi
mov    0xc(%rsp),%ecx
cmp    %ecx,%esi
jle    11b1 <main+0x81>
mov    %ecx,0x14(%rsp)
mov    %esi,0xc(%rsp)
mov    %esi,%eax
jmp    11b5 <main+0x85>
mov    %ecx,%eax
mov    %esi,%ecx
mov    0x8(%rsp),%esi
cmp    %esi,%ecx
jle    11d9 <main+0xa9>
mov    %esi,0x14(%rsp)
mov    %ecx,0x8(%rsp)
cmp    %eax,%edx
jg     11df <main+0xaf>
mov    %eax,%esi
mov    %edx,%eax
cmp    %ecx,%eax
jg     11ed <main+0xbd>
mov    %ecx,%eax
cmp    %eax,%esi
jg     11f9 <main+0xc9>
jmp    1201 <main+0xd1>
mov    %esi,%ecx
cmp    %eax,%edx
jle    11c9 <main+0x99>
mov    %eax,0x10(%rsp)
mov    %edx,0xc(%rsp)
mov    %edx,%esi
cmp    %ecx,%eax
jle    11d1 <main+0xa1>
mov    %ecx,0x10(%rsp)
mov    %eax,0x8(%rsp)
cmp    %eax,%esi
jle    1201 <main+0xd1>
mov    %eax,0xc(%rsp)
mov    %esi,0x8(%rsp)
lea    0xe3c(%rip),%rdi
call   1030 <puts@plt>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
mov    0xc(%rsp),%ecx
mov    0x8(%rsp),%r8d
lea    0xe0c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"\E8\BE\93\E5\85\A54\E4\B8\AA\E6\95\B0\EF\BC\9A\00"
@.str.1 = [12 x i8] c"%d,%d,%d,%d\00"
@.str.2 = [20 x i8] c"a=%d,b=%d,c=%d,d=%d\00"
@.str.3 = [26 x i8] c"\E7\94\B1\E5\B0\8F\E5\88\B0\E5\A4\A7\E9\A1\BA\E5\BA\8F\E4\B8\BA\EF\BC\9A\0A\00"
@.str.4 = [19 x i8] c"%d %d %d %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %4, i32* %5, i32* %6)
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %9, i32 %10, i32 %11, i32 %12)
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = icmp sgt i32 %14, %15
br i1 %16, label %17, label %21
17: ; preds = %0
%18 = load i32, i32* %3
store i32 %18, i32* %2
%19 = load i32, i32* %4
store i32 %19, i32* %3
%20 = load i32, i32* %2
store i32 %20, i32* %4
br label %21
21: ; preds = %17, %0
%22 = load i32, i32* %3
%23 = load i32, i32* %5
%24 = icmp sgt i32 %22, %23
br i1 %24, label %25, label %29
25: ; preds = %21
%26 = load i32, i32* %3
store i32 %26, i32* %2
%27 = load i32, i32* %5
store i32 %27, i32* %3
%28 = load i32, i32* %2
store i32 %28, i32* %5
br label %29
29: ; preds = %25, %21
%30 = load i32, i32* %3
%31 = load i32, i32* %6
%32 = icmp sgt i32 %30, %31
br i1 %32, label %33, label %37
33: ; preds = %29
%34 = load i32, i32* %3
store i32 %34, i32* %2
%35 = load i32, i32* %6
store i32 %35, i32* %3
%36 = load i32, i32* %2
store i32 %36, i32* %6
br label %37
37: ; preds = %33, %29
%38 = load i32, i32* %4
%39 = load i32, i32* %5
%40 = icmp sgt i32 %38, %39
br i1 %40, label %41, label %45
41: ; preds = %37
%42 = load i32, i32* %4
store i32 %42, i32* %2
%43 = load i32, i32* %5
store i32 %43, i32* %4
%44 = load i32, i32* %2
store i32 %44, i32* %5
br label %45
45: ; preds = %41, %37
%46 = load i32, i32* %4
%47 = load i32, i32* %6
%48 = icmp sgt i32 %46, %47
br i1 %48, label %49, label %53
49: ; preds = %45
%50 = load i32, i32* %4
store i32 %50, i32* %2
%51 = load i32, i32* %6
store i32 %51, i32* %4
%52 = load i32, i32* %2
store i32 %52, i32* %6
br label %53
53: ; preds = %49, %45
%54 = load i32, i32* %5
%55 = load i32, i32* %6
%56 = icmp sgt i32 %54, %55
br i1 %56, label %57, label %61
57: ; preds = %53
%58 = load i32, i32* %5
store i32 %58, i32* %2
%59 = load i32, i32* %6
store i32 %59, i32* %5
%60 = load i32, i32* %2
store i32 %60, i32* %6
br label %61
61: ; preds = %57, %53
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%63 = load i32, i32* %3
%64 = load i32, i32* %4
%65 = load i32, i32* %5
%66 = load i32, i32* %6
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %63, i32 %64, i32 %65, i32 %66)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"\E8\BE\93\E5\85\A54\E4\B8\AA\E6\95\B0\EF\BC\9A\00"
@.str.1 = [12 x i8] c"%d,%d,%d,%d\00"
@.str.2 = [20 x i8] c"a=%d,b=%d,c=%d,d=%d\00"
@.str.4 = [19 x i8] c"%d %d %d %d\0A\00"
@str = [25 x i8] c"\E7\94\B1\E5\B0\8F\E5\88\B0\E5\A4\A7\E9\A1\BA\E5\BA\8F\E4\B8\BA\EF\BC\9A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2, i32* %3, i32* %4)
%11 = load i32, i32* %1
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %11, i32 %12, i32 %13, i32 %14)
%16 = load i32, i32* %1
%17 = load i32, i32* %2
%18 = icmp sgt i32 %16, %17
br i1 %18, label %19, label %20
19: ; preds = %0
store i32 %17, i32* %1
store i32 %16, i32* %2
br label %20
20: ; preds = %19, %0
%21 = phi i32 [ %16, %19 ], [ %17, %0 ]
%22 = phi i32 [ %17, %19 ], [ %16, %0 ]
%23 = load i32, i32* %3
%24 = icmp sgt i32 %22, %23
br i1 %24, label %25, label %26
25: ; preds = %20
store i32 %23, i32* %1
store i32 %22, i32* %3
br label %26
26: ; preds = %25, %20
%27 = phi i32 [ %22, %25 ], [ %23, %20 ]
%28 = phi i32 [ %23, %25 ], [ %22, %20 ]
%29 = load i32, i32* %4
%30 = icmp sgt i32 %28, %29
br i1 %30, label %31, label %32
31: ; preds = %26
store i32 %29, i32* %1
store i32 %28, i32* %4
br label %32
32: ; preds = %31, %26
%33 = phi i32 [ %28, %31 ], [ %29, %26 ]
%34 = icmp sgt i32 %21, %27
br i1 %34, label %35, label %36
35: ; preds = %32
store i32 %27, i32* %2
store i32 %21, i32* %3
br label %36
36: ; preds = %35, %32
%37 = phi i32 [ %21, %35 ], [ %27, %32 ]
%38 = phi i32 [ %27, %35 ], [ %21, %32 ]
%39 = icmp sgt i32 %38, %33
br i1 %39, label %40, label %41
40: ; preds = %36
store i32 %33, i32* %2
store i32 %38, i32* %4
br label %41
41: ; preds = %40, %36
%42 = phi i32 [ %38, %40 ], [ %33, %36 ]
%43 = icmp sgt i32 %37, %42
br i1 %43, label %44, label %45
44: ; preds = %41
store i32 %42, i32* %3
store i32 %37, i32* %4
br label %45
45: ; preds = %44, %41
%46 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%47 = load i32, i32* %1
%48 = load i32, i32* %2
%49 = load i32, i32* %3
%50 = load i32, i32* %4
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %47, i32 %48, i32 %49, i32 %50)
ret i32 0
}