#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 max(int, int);
int min(int, int);
int /*<<< orphan*/ printf(char *, int);
int scanf(char *, int *, int *, int *, int *);
int main() {
  int a, b, c, d;
  if (scanf("%d,%d,%d,%d", &a, &b, &c, &d) == 4) {
    printf("MAX: %d\n", max(max(a, b), max(c, d)));
    printf("MIN: %d\n", min(min(a, b), min(c, d)));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
call   1060 <scanf@plt>
cmp    $0x4,%eax
jne    11d6 <main+0x96>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <max@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1050 <max@plt>
mov    -0x1c(%rbp),%edi
mov    %eax,%esi
call   1050 <max@plt>
mov    %eax,%esi
lea    0xe6c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <min@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1040 <min@plt>
mov    -0x18(%rbp),%edi
mov    %eax,%esi
call   1040 <min@plt>
mov    %eax,%esi
lea    0xe44(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xeb4(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
lea    0x4(%rsp),%rcx
mov    %rsp,%r8
call   1060 <scanf@plt>
cmp    $0x4,%eax
jne    11cc <main+0x8c>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
call   1050 <max@plt>
mov    %eax,%ebx
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
call   1050 <max@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1050 <max@plt>
lea    0xe79(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
call   1040 <min@plt>
mov    %eax,%ebx
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
call   1040 <min@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1040 <min@plt>
lea    0xe50(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"%d,%d,%d,%d\00"
@.str.1 = [9 x i8] c"MAX: %d\0A\00"
@.str.2 = [9 x i8] c"MIN: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3, i32* %4, i32* %5)
%7 = icmp eq i32 %6, 4
br i1 %7, label %8, label %25
8: ; preds = %0
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = call i32 @max(i32 %9, i32 %10)
%12 = load i32, i32* %4
%13 = load i32, i32* %5
%14 = call i32 @max(i32 %12, i32 %13)
%15 = call i32 @max(i32 %11, i32 %14)
%16 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = load i32, i32* %2
%18 = load i32, i32* %3
%19 = call i32 @min(i32 %17, i32 %18)
%20 = load i32, i32* %4
%21 = load i32, i32* %5
%22 = call i32 @min(i32 %20, i32 %21)
%23 = call i32 @min(i32 %19, i32 %22)
%24 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %8, %0
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"%d,%d,%d,%d\00"
@.str.1 = [9 x i8] c"MAX: %d\0A\00"
@.str.2 = [9 x i8] c"MIN: %d\0A\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 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3, i32* %4)
%10 = icmp eq i32 %9, 4
br i1 %10, label %11, label %28
11: ; preds = %0
%12 = load i32, i32* %1
%13 = load i32, i32* %2
%14 = call i32 @max(i32 %12, i32 %13)
%15 = load i32, i32* %3
%16 = load i32, i32* %4
%17 = call i32 @max(i32 %15, i32 %16)
%18 = call i32 @max(i32 %14, i32 %17)
%19 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%20 = load i32, i32* %1
%21 = load i32, i32* %2
%22 = call i32 @min(i32 %20, i32 %21)
%23 = load i32, i32* %3
%24 = load i32, i32* %4
%25 = call i32 @min(i32 %23, i32 %24)
%26 = call i32 @min(i32 %22, i32 %25)
%27 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %26)
br label %28
28: ; preds = %11, %0
ret i32 0
}