#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() {
  int numA, numB, numC;
  int min, mid, max;
  printf("please input threee numbers: a,b,c\n");
  scanf("%d,%d,%d", &numA, &numB, &numC);
  min = numA < numB ? numA : numB;
  min = min < numC ? min : numC;
  max = numA > numB ? numA : numB;
  max = max > numC ? max : numC;
  mid = numA + numB + numC - min - max;
  printf("%d,%d,%d", min, mid, max);
  return 0;
}


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>
lea    0xee0(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    116c <main+0x4c>
mov    -0x8(%rbp),%eax
mov    %eax,-0x20(%rbp)
jmp    1172 <main+0x52>
mov    -0xc(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    118f <main+0x6f>
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    1195 <main+0x75>
mov    -0x10(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    11b2 <main+0x92>
mov    -0x8(%rbp),%eax
mov    %eax,-0x28(%rbp)
jmp    11b8 <main+0x98>
mov    -0xc(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    11d5 <main+0xb5>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
jmp    11db <main+0xbb>
mov    -0x10(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
sub    -0x14(%rbp),%eax
sub    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xecd(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb8(%rip),%rbx
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
lea    0x4(%rsp),%rcx
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
mov    0x8(%rsp),%edx
cmp    %edx,%eax
mov    %edx,%esi
cmovl  %eax,%esi
mov    %edx,%ecx
cmovg  %eax,%ecx
mov    0x4(%rsp),%edi
cmp    %edi,%esi
cmovge %edi,%esi
cmp    %edi,%ecx
cmovle %edi,%ecx
add    %eax,%edx
add    %edi,%edx
sub    %ecx,%edx
sub    %esi,%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [36 x i8] c"please input threee numbers: a,b,c\0A\00"
@.str.1 = [9 x i8] c"%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 ([36 x i8], [36 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)
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %15
13: ; preds = %0
%14 = load i32, i32* %2
br label %17
15: ; preds = %0
%16 = load i32, i32* %3
br label %17
17: ; preds = %15, %13
%18 = phi i32 [ %14, %13 ], [ %16, %15 ]
store i32 %18, i32* %5
%19 = load i32, i32* %5
%20 = load i32, i32* %4
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %24
22: ; preds = %17
%23 = load i32, i32* %5
br label %26
24: ; preds = %17
%25 = load i32, i32* %4
br label %26
26: ; preds = %24, %22
%27 = phi i32 [ %23, %22 ], [ %25, %24 ]
store i32 %27, i32* %5
%28 = load i32, i32* %2
%29 = load i32, i32* %3
%30 = icmp sgt i32 %28, %29
br i1 %30, label %31, label %33
31: ; preds = %26
%32 = load i32, i32* %2
br label %35
33: ; preds = %26
%34 = load i32, i32* %3
br label %35
35: ; preds = %33, %31
%36 = phi i32 [ %32, %31 ], [ %34, %33 ]
store i32 %36, i32* %7
%37 = load i32, i32* %7
%38 = load i32, i32* %4
%39 = icmp sgt i32 %37, %38
br i1 %39, label %40, label %42
40: ; preds = %35
%41 = load i32, i32* %7
br label %44
42: ; preds = %35
%43 = load i32, i32* %4
br label %44
44: ; preds = %42, %40
%45 = phi i32 [ %41, %40 ], [ %43, %42 ]
store i32 %45, i32* %7
%46 = load i32, i32* %2
%47 = load i32, i32* %3
%48 = add nsw i32 %46, %47
%49 = load i32, i32* %4
%50 = add nsw i32 %48, %49
%51 = load i32, i32* %5
%52 = sub nsw i32 %50, %51
%53 = load i32, i32* %7
%54 = sub nsw i32 %52, %53
store i32 %54, i32* %6
%55 = load i32, i32* %5
%56 = load i32, i32* %6
%57 = load i32, i32* %7
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %55, i32 %56, i32 %57)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [9 x i8] c"%d,%d,%d\00"
@str = [35 x i8] c"please input threee numbers: a,b,c\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 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 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 = select i1 %11, i32 %9, i32 %10
%13 = load i32, i32* %3
%14 = icmp slt i32 %12, %13
%15 = select i1 %14, i32 %12, i32 %13
%16 = icmp sgt i32 %9, %10
%17 = select i1 %16, i32 %9, i32 %10
%18 = icmp sgt i32 %17, %13
%19 = select i1 %18, i32 %17, i32 %13
%20 = add i32 %10, %9
%21 = add i32 %20, %13
%22 = add i32 %19, %15
%23 = sub i32 %21, %22
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %15, i32 %23, i32 %19)
ret i32 0
}