#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 main() {
  void swap(int *p1, int *p2);
  int a, b, c;
  int *p1, *p2, *p3;
  printf("input three inetger a,b,c:");
  scanf("%d,%d,%d", &a, &b, &c);
  p1 = &a;
  p2 = &b;
  p3 = &c;
  if (a > b)
    swap(p1, p2);
  if (a > c)
    swap(p1, p3);
  if (b > c)
    swap(p2, p3);
  printf("Now the order is:%d,%d,%d", a, b, c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1040 <scanf@plt>
lea    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1196 <main+0x66>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <swap@plt>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    11af <main+0x7f>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1050 <swap@plt>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    11c8 <main+0x98>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1050 <swap@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xec5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee3(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
call   1040 <scanf@plt>
mov    0x14(%rsp),%eax
cmp    0x10(%rsp),%eax
jle    117a <main+0x4a>
lea    0x14(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1050 <swap@plt>
mov    0x14(%rsp),%eax
mov    0xc(%rsp),%ecx
cmp    %ecx,%eax
jle    1195 <main+0x65>
lea    0x14(%rsp),%rdi
lea    0xc(%rsp),%rsi
call   1050 <swap@plt>
mov    0xc(%rsp),%ecx
mov    0x10(%rsp),%edx
cmp    %ecx,%edx
jle    11b4 <main+0x84>
lea    0x10(%rsp),%rdi
lea    0xc(%rsp),%rsi
call   1050 <swap@plt>
mov    0x10(%rsp),%edx
mov    0xc(%rsp),%ecx
mov    0x14(%rsp),%esi
lea    0xe5c(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [27 x i8] c"input three inetger a,b,c:\00"
@.str.1 = [9 x i8] c"%d,%d,%d\00"
@.str.2 = [26 x i8] c"Now the order is:%d,%d,%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32*
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
store i32* %2, i32** %5
store i32* %3, i32** %6
store i32* %4, i32** %7
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = icmp sgt i32 %10, %11
br i1 %12, label %13, label %16
13: ; preds = %0
%14 = load i32*, i32** %5
%15 = load i32*, i32** %6
br label %16
16: ; preds = %13, %0
%17 = load i32, i32* %2
%18 = load i32, i32* %4
%19 = icmp sgt i32 %17, %18
br i1 %19, label %20, label %23
20: ; preds = %16
%21 = load i32*, i32** %5
%22 = load i32*, i32** %7
br label %23
23: ; preds = %20, %16
%24 = load i32, i32* %3
%25 = load i32, i32* %4
%26 = icmp sgt i32 %24, %25
br i1 %26, label %27, label %30
27: ; preds = %23
%28 = load i32*, i32** %6
%29 = load i32*, i32** %7
br label %30
30: ; preds = %27, %23
%31 = load i32, i32* %2
%32 = load i32, i32* %3
%33 = load i32, i32* %4
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %31, i32 %32, i32 %33)
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"input three inetger a,b,c:\00"
@.str.1 = [9 x i8] c"%d,%d,%d\00"
@.str.2 = [26 x i8] c"Now the order is:%d,%d,%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = icmp sgt i32 %9, %10
br i1 %11, label %12, label %14
12: ; preds = %0
%13 = load i32, i32* %1
br label %14
14: ; preds = %12, %0
%15 = phi i32 [ %13, %12 ], [ %9, %0 ]
%16 = load i32, i32* %3
%17 = icmp sgt i32 %15, %16
br i1 %17, label %18, label %20
18: ; preds = %14
%19 = load i32, i32* %3
br label %20
20: ; preds = %18, %14
%21 = phi i32 [ %19, %18 ], [ %16, %14 ]
%22 = load i32, i32* %2
%23 = icmp sgt i32 %22, %21
br i1 %23, label %24, label %27
24: ; preds = %20
%25 = load i32, i32* %2
%26 = load i32, i32* %3
br label %27
27: ; preds = %24, %20
%28 = phi i32 [ %26, %24 ], [ %21, %20 ]
%29 = phi i32 [ %25, %24 ], [ %22, %20 ]
%30 = load i32, i32* %1
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %30, i32 %29, i32 %28)
ret i32 0
}