#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(void) {
  int num_1 = 0, num_2 = 0, num_3 = 0, num_4 = 0, max = 0, min = 0, max_1 = 0,
      min_1 = 0;
  printf("enter 4 different number:\n");
  scanf("%d %d %d %d", &num_1, &num_2, &num_3, &num_4);
  if (num_1 >= num_2) {
    max = num_1;
    min = num_2;
  } else {
    max = num_2;
    min = num_1;
  }
  if (num_3 >= num_4) {
    max_1 = num_3;
    min_1 = num_4;
  } else {
    max_1 = num_4;
    min_1 = num_3;
  }
  if (max < max_1) {
    max = max_1;
  }
  if (min > min_1) {
    min = min_1;
  }
  printf("Largest: %d\n", max);
  printf("Smallest: %d\n", min);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9f(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     11ae <main+0x8e>
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    11ba <main+0x9a>
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jl     11d7 <main+0xb7>
mov    -0x10(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    11e3 <main+0xc3>
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    11f5 <main+0xd5>
mov    -0x20(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jle    1207 <main+0xe7>
mov    -0x24(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%esi
lea    0xe16(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xe12(%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
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
movl   $0x0,0x4(%rsp)
movl   $0x0,(%rsp)
lea    0xecc(%rip),%rdi
call   1030 <puts@plt>
lea    0xe99(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
lea    0x4(%rsp),%rcx
mov    %rsp,%r8
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
mov    0x8(%rsp),%ecx
cmp    %ecx,%eax
mov    %eax,%edx
cmovl  %ecx,%edx
cmovl  %eax,%ecx
mov    0x4(%rsp),%eax
mov    (%rsp),%ebx
cmp    %ebx,%eax
mov    %eax,%esi
cmovl  %ebx,%esi
cmovl  %eax,%ebx
cmp    %esi,%edx
cmovge %edx,%esi
cmp    %ebx,%ecx
cmovle %ecx,%ebx
lea    0xe5a(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe59(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"enter 4 different number:\0A\00"
@.str.1 = [12 x i8] c"%d %d %d %d\00"
@.str.2 = [13 x i8] c"Largest: %d\0A\00"
@.str.3 = [14 x i8] c"Smallest: %d\0A\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
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3, i32* %4, i32* %5)
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = icmp sge i32 %12, %13
br i1 %14, label %15, label %18
15: ; preds = %0
%16 = load i32, i32* %2
store i32 %16, i32* %6
%17 = load i32, i32* %3
store i32 %17, i32* %7
br label %21
18: ; preds = %0
%19 = load i32, i32* %3
store i32 %19, i32* %6
%20 = load i32, i32* %2
store i32 %20, i32* %7
br label %21
21: ; preds = %18, %15
%22 = load i32, i32* %4
%23 = load i32, i32* %5
%24 = icmp sge i32 %22, %23
br i1 %24, label %25, label %28
25: ; preds = %21
%26 = load i32, i32* %4
store i32 %26, i32* %8
%27 = load i32, i32* %5
store i32 %27, i32* %9
br label %31
28: ; preds = %21
%29 = load i32, i32* %5
store i32 %29, i32* %8
%30 = load i32, i32* %4
store i32 %30, i32* %9
br label %31
31: ; preds = %28, %25
%32 = load i32, i32* %6
%33 = load i32, i32* %8
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %37
35: ; preds = %31
%36 = load i32, i32* %8
store i32 %36, i32* %6
br label %37
37: ; preds = %35, %31
%38 = load i32, i32* %7
%39 = load i32, i32* %9
%40 = icmp sgt i32 %38, %39
br i1 %40, label %41, label %43
41: ; preds = %37
%42 = load i32, i32* %9
store i32 %42, i32* %7
br label %43
43: ; preds = %41, %37
%44 = load i32, i32* %6
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %44)
%46 = load i32, i32* %7
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %46)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [12 x i8] c"%d %d %d %d\00"
@.str.2 = [13 x i8] c"Largest: %d\0A\00"
@.str.3 = [14 x i8] c"Smallest: %d\0A\00"
@str = [26 x i8] c"enter 4 different number:\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%6 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%7 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%8 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 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 = icmp slt i32 %11, %12
%14 = select i1 %13, i32 %12, i32 %11
%15 = select i1 %13, i32 %11, i32 %12
%16 = load i32, i32* %3
%17 = load i32, i32* %4
%18 = icmp slt i32 %16, %17
%19 = select i1 %18, i32 %17, i32 %16
%20 = select i1 %18, i32 %16, i32 %17
%21 = icmp slt i32 %14, %19
%22 = select i1 %21, i32 %19, i32 %14
%23 = icmp sgt i32 %15, %20
%24 = select i1 %23, i32 %20, i32 %15
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %22)
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %24)
ret i32 0
}