#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() {
  int A, B, C, D;
  printf("Please enter 4 numbers separated by spaces > ");
  scanf("%i %i %i %i", &A, &B, &C, &D);
  if (A < B && A < C && A < D) {
    printf("%i is the smallest\n", A);
    return 0;
  } else if (B < A && B < C && B < D) {
    printf("%i is the smallest\n", B);
    return 0;
  } else if (C < A && C < B && C < D) {
    printf("%i is the smallest\n", C);
    return 0;
  } else if (D < A && D < B && D < C) {
    printf("%i is the smallest\n", D);
    return 0;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeea(%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
jge    119a <main+0x7a>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    119a <main+0x7a>
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    119a <main+0x7a>
mov    -0x8(%rbp),%esi
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    126c <main+0x14c>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11db <main+0xbb>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11db <main+0xbb>
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11db <main+0xbb>
mov    -0xc(%rbp),%esi
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    126c <main+0x14c>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    121c <main+0xfc>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    121c <main+0xfc>
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    121c <main+0xfc>
mov    -0x10(%rbp),%esi
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    126c <main+0x14c>
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    125d <main+0x13d>
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    125d <main+0x13d>
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    125d <main+0x13d>
mov    -0x14(%rbp),%esi
lea    0xdf0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    126c <main+0x14c>
jmp    1262 <main+0x142>
jmp    1267 <main+0x147>
jmp    126c <main+0x14c>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef5(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
call   1040 <scanf@plt>
mov    0x14(%rsp),%edx
mov    0x10(%rsp),%ecx
mov    0xc(%rsp),%eax
mov    0x8(%rsp),%esi
cmp    %ecx,%edx
jge    1172 <main+0x52>
cmp    %eax,%edx
jge    1172 <main+0x52>
cmp    %esi,%edx
jge    1172 <main+0x52>
mov    %edx,%esi
jmp    119e <main+0x7e>
cmp    %edx,%ecx
jge    1182 <main+0x62>
cmp    %eax,%ecx
jge    1182 <main+0x62>
cmp    %esi,%ecx
jge    1182 <main+0x62>
mov    %ecx,%esi
jmp    119e <main+0x7e>
cmp    %edx,%eax
jge    1192 <main+0x72>
cmp    %ecx,%eax
jge    1192 <main+0x72>
cmp    %esi,%eax
jge    1192 <main+0x72>
mov    %eax,%esi
jmp    119e <main+0x7e>
cmp    %edx,%esi
jge    11ac <main+0x8c>
cmp    %ecx,%esi
jge    11ac <main+0x8c>
cmp    %eax,%esi
jge    11ac <main+0x8c>
lea    0xe95(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [46 x i8] c"Please enter 4 numbers separated by spaces > \00"
@.str.1 = [12 x i8] c"%i %i %i %i\00"
@.str.2 = [20 x i8] c"%i is the smallest\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 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%7 = 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)
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %22
11: ; preds = %0
%12 = load i32, i32* %2
%13 = load i32, i32* %4
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %22
15: ; preds = %11
%16 = load i32, i32* %2
%17 = load i32, i32* %5
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %22
19: ; preds = %15
%20 = load i32, i32* %2
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %20)
store i32 0, i32* %1
br label %70
22: ; preds = %15, %11, %0
%23 = load i32, i32* %3
%24 = load i32, i32* %2
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %37
26: ; preds = %22
%27 = load i32, i32* %3
%28 = load i32, i32* %4
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %37
30: ; preds = %26
%31 = load i32, i32* %3
%32 = load i32, i32* %5
%33 = icmp slt i32 %31, %32
br i1 %33, label %34, label %37
34: ; preds = %30
%35 = load i32, i32* %3
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %35)
store i32 0, i32* %1
br label %70
37: ; preds = %30, %26, %22
%38 = load i32, i32* %4
%39 = load i32, i32* %2
%40 = icmp slt i32 %38, %39
br i1 %40, label %41, label %52
41: ; preds = %37
%42 = load i32, i32* %4
%43 = load i32, i32* %3
%44 = icmp slt i32 %42, %43
br i1 %44, label %45, label %52
45: ; preds = %41
%46 = load i32, i32* %4
%47 = load i32, i32* %5
%48 = icmp slt i32 %46, %47
br i1 %48, label %49, label %52
49: ; preds = %45
%50 = load i32, i32* %4
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %50)
store i32 0, i32* %1
br label %70
52: ; preds = %45, %41, %37
%53 = load i32, i32* %5
%54 = load i32, i32* %2
%55 = icmp slt i32 %53, %54
br i1 %55, label %56, label %67
56: ; preds = %52
%57 = load i32, i32* %5
%58 = load i32, i32* %3
%59 = icmp slt i32 %57, %58
br i1 %59, label %60, label %67
60: ; preds = %56
%61 = load i32, i32* %5
%62 = load i32, i32* %4
%63 = icmp slt i32 %61, %62
br i1 %63, label %64, label %67
64: ; preds = %60
%65 = load i32, i32* %5
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %65)
store i32 0, i32* %1
br label %70
67: ; preds = %60, %56, %52
br label %68
68: ; preds = %67
br label %69
69: ; preds = %68
br label %70
70: ; preds = %19, %34, %49, %64, %69
%71 = load i32, i32* %1
ret i32 %71
}

LLVM IR (-O2):
@.str = [46 x i8] c"Please enter 4 numbers separated by spaces > \00"
@.str.1 = [12 x i8] c"%i %i %i %i\00"
@.str.2 = [20 x i8] c"%i is the smallest\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 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 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 = load i32, i32* %3
%15 = icmp slt i32 %11, %14
%16 = select i1 %13, i1 %15, i1 false
%17 = load i32, i32* %4
%18 = icmp slt i32 %11, %17
%19 = select i1 %16, i1 %18, i1 false
br i1 %19, label %38, label %20
20: ; preds = %0
%21 = icmp slt i32 %12, %11
%22 = icmp slt i32 %12, %14
%23 = select i1 %21, i1 %22, i1 false
%24 = icmp slt i32 %12, %17
%25 = select i1 %23, i1 %24, i1 false
br i1 %25, label %38, label %26
26: ; preds = %20
%27 = icmp slt i32 %14, %11
%28 = icmp slt i32 %14, %12
%29 = select i1 %27, i1 %28, i1 false
%30 = icmp slt i32 %14, %17
%31 = select i1 %29, i1 %30, i1 false
br i1 %31, label %38, label %32
32: ; preds = %26
%33 = icmp slt i32 %17, %11
%34 = icmp slt i32 %17, %12
%35 = select i1 %33, i1 %34, i1 false
%36 = icmp slt i32 %17, %14
%37 = select i1 %35, i1 %36, i1 false
br i1 %37, label %38, label %41
38: ; preds = %32, %26, %20, %0
%39 = phi i32 [ %11, %0 ], [ %12, %20 ], [ %14, %26 ], [ %17, %32 ]
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %39)
br label %41
41: ; preds = %38, %32
ret i32 0
}