#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 *);
void main() {
  int a, b, c, temp;
  int *p1 = &a, *p2 = &b, *p3 = &c;
  printf("Enter a,b,c:\n");
  scanf("%d %d %d", p1, p2, p3);
  if (a >= b) {
    if (b >= c) {
      p1 = &c;
      p2 = &b;
      p3 = &a;
    } else {
      if (a >= c) {
        p3 = &a;
        p2 = &c;
      } else {
        p3 = &c;
        p2 = &a;
      }
      p1 = &b;
    }
  } else {
    if (b <= c) {
      p1 = &a;
      p2 = &b;
      p3 = &c;
    } else {
      if (a >= c) {
        p1 = &c;
        p2 = &a;
      } else {
        p1 = &a;
        p2 = &c;
      }
      p3 = &b;
    }
  }
  printf("%d %d %d", *p1, *p2, *p3);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x4(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
lea    0xead(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     11d9 <main+0xb9>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     119b <main+0x7b>
lea    -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    11d4 <main+0xb4>
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     11bc <main+0x9c>
lea    -0x4(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    11cc <main+0xac>
lea    -0xc(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1240 <main+0x120>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1202 <main+0xe2>
lea    -0x4(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    123b <main+0x11b>
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     1223 <main+0x103>
lea    -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    1233 <main+0x113>
lea    -0x4(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    1240 <main+0x120>
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
mov    -0x20(%rbp),%rax
mov    (%rax),%edx
mov    -0x28(%rbp),%rax
mov    (%rax),%ecx
lea    0xdb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xec9(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb4(%rip),%rdi
lea    0x8(%rsp),%r15
lea    0xc(%rsp),%r14
lea    0x4(%rsp),%rbx
mov    %r15,%rsi
mov    %r14,%rdx
mov    %rbx,%rcx
call   1050 <scanf@plt>
mov    0x8(%rsp),%eax
mov    0xc(%rsp),%edx
mov    0x4(%rsp),%ecx
cmp    %edx,%eax
jge    119b <main+0x6b>
cmp    %ecx,%edx
jle    11bd <main+0x8d>
cmp    %ecx,%eax
lea    0x8(%rsp),%r14
lea    0x4(%rsp),%rax
mov    %rax,%rbx
cmovl  %r14,%rbx
cmovl  %rax,%r14
lea    0xc(%rsp),%r15
jmp    11c7 <main+0x97>
cmp    %ecx,%edx
jge    11c7 <main+0x97>
cmp    %ecx,%eax
lea    0x8(%rsp),%r15
lea    0x4(%rsp),%rax
mov    %rax,%r14
cmovl  %r15,%r14
cmovl  %rax,%r15
lea    0xc(%rsp),%rbx
jmp    11c7 <main+0x97>
lea    0x4(%rsp),%r15
lea    0x8(%rsp),%rbx
mov    (%rbx),%esi
mov    (%r14),%edx
mov    (%r15),%ecx
lea    0xe2a(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Enter a,b,c:\0A\00"
@.str.1 = [9 x i8] c"%d %d %d\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32*
store i32* %1, i32** %5
store i32* %2, i32** %6
store i32* %3, i32** %7
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%9 = load i32*, i32** %5
%10 = load i32*, i32** %6
%11 = load i32*, i32** %7
%12 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %9, i32* %10, i32* %11)
%13 = load i32, i32* %1
%14 = load i32, i32* %2
%15 = icmp sge i32 %13, %14
br i1 %15, label %16, label %29
16: ; preds = %0
%17 = load i32, i32* %2
%18 = load i32, i32* %3
%19 = icmp sge i32 %17, %18
br i1 %19, label %20, label %21
20: ; preds = %16
store i32* %3, i32** %5
store i32* %2, i32** %6
store i32* %1, i32** %7
br label %28
21: ; preds = %16
%22 = load i32, i32* %1
%23 = load i32, i32* %3
%24 = icmp sge i32 %22, %23
br i1 %24, label %25, label %26
25: ; preds = %21
store i32* %1, i32** %7
store i32* %3, i32** %6
br label %27
26: ; preds = %21
store i32* %3, i32** %7
store i32* %1, i32** %6
br label %27
27: ; preds = %26, %25
store i32* %2, i32** %5
br label %28
28: ; preds = %27, %20
br label %42
29: ; preds = %0
%30 = load i32, i32* %2
%31 = load i32, i32* %3
%32 = icmp sle i32 %30, %31
br i1 %32, label %33, label %34
33: ; preds = %29
store i32* %1, i32** %5
store i32* %2, i32** %6
store i32* %3, i32** %7
br label %41
34: ; preds = %29
%35 = load i32, i32* %1
%36 = load i32, i32* %3
%37 = icmp sge i32 %35, %36
br i1 %37, label %38, label %39
38: ; preds = %34
store i32* %3, i32** %5
store i32* %1, i32** %6
br label %40
39: ; preds = %34
store i32* %1, i32** %5
store i32* %3, i32** %6
br label %40
40: ; preds = %39, %38
store i32* %2, i32** %7
br label %41
41: ; preds = %40, %33
br label %42
42: ; preds = %41, %28
%43 = load i32*, i32** %5
%44 = load i32, i32* %43
%45 = load i32*, i32** %6
%46 = load i32, i32* %45
%47 = load i32*, i32** %7
%48 = load i32, i32* %47
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %44, i32 %46, i32 %48)
ret void
}

LLVM IR (-O2):
@.str.1 = [9 x i8] c"%d %d %d\00"
@str = [13 x i8] c"Enter a,b,c:\00"
define void @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 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 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 slt i32 %9, %10
%12 = load i32, i32* %3
br i1 %11, label %19, label %13
13: ; preds = %0
%14 = icmp slt i32 %10, %12
br i1 %14, label %15, label %25
15: ; preds = %13
%16 = icmp slt i32 %9, %12
%17 = select i1 %16, i32* %1, i32* %3
%18 = select i1 %16, i32* %3, i32* %1
br label %25
19: ; preds = %0
%20 = icmp sgt i32 %10, %12
br i1 %20, label %21, label %25
21: ; preds = %19
%22 = icmp slt i32 %9, %12
%23 = select i1 %22, i32* %1, i32* %3
%24 = select i1 %22, i32* %3, i32* %1
br label %25
25: ; preds = %19, %13, %21, %15
%26 = phi i32* [ %2, %15 ], [ %23, %21 ], [ %3, %13 ], [ %1, %19 ]
%27 = phi i32* [ %17, %15 ], [ %24, %21 ], [ %2, %13 ], [ %2, %19 ]
%28 = phi i32* [ %18, %15 ], [ %2, %21 ], [ %1, %13 ], [ %3, %19 ]
%29 = load i32, i32* %26
%30 = load i32, i32* %27
%31 = load i32, i32* %28
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %29, i32 %30, i32 %31)
ret void
}