#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, r;
  printf("Please enter 4 numbers seperated by spaces > ");
  scanf("%d%d%d%d", &a, &b, &c, &d);
  if (a < b && a < c && a < d)
    r = a;
  else if (b < a && b < c && b < d)
    r = b;
  else if (c < a && c < b && c < d)
    r = c;
  else
    r = d;
  printf("%d is the smallest\n", r);
  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    1188 <main+0x68>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1188 <main+0x68>
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1188 <main+0x68>
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    11f6 <main+0xd6>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11b7 <main+0x97>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11b7 <main+0x97>
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11b7 <main+0x97>
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    11f1 <main+0xd1>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11e6 <main+0xc6>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11e6 <main+0xc6>
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11e6 <main+0xc6>
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    11ec <main+0xcc>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    11f1 <main+0xd1>
jmp    11f6 <main+0xd6>
mov    -0x18(%rbp),%esi
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%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),%esi
mov    0x10(%rsp),%ecx
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%eax
cmp    %ecx,%esi
jge    116e <main+0x4e>
cmp    %edx,%esi
jge    116e <main+0x4e>
cmp    %eax,%esi
jl     1191 <main+0x71>
cmp    %esi,%ecx
jge    117e <main+0x5e>
cmp    %edx,%ecx
jge    117e <main+0x5e>
cmp    %eax,%ecx
jge    117e <main+0x5e>
mov    %ecx,%esi
jmp    1191 <main+0x71>
cmp    %eax,%edx
mov    %eax,%edi
cmovl  %edx,%edi
cmp    %ecx,%edx
cmovge %eax,%edi
cmp    %esi,%edx
cmovge %eax,%edi
mov    %edi,%esi
lea    0xe9f(%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 seperated by spaces > \00"
@.str.1 = [9 x i8] c"%d%d%d%d\00"
@.str.2 = [20 x i8] c"%d is the smallest\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 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* %2, i32* %3, i32* %4, i32* %5)
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %22
12: ; preds = %0
%13 = load i32, i32* %2
%14 = load i32, i32* %4
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %22
16: ; preds = %12
%17 = load i32, i32* %2
%18 = load i32, i32* %5
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = load i32, i32* %2
store i32 %21, i32* %6
br label %54
22: ; preds = %16, %12, %0
%23 = load i32, i32* %3
%24 = load i32, i32* %2
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %36
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 %36
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 %36
34: ; preds = %30
%35 = load i32, i32* %3
store i32 %35, i32* %6
br label %53
36: ; preds = %30, %26, %22
%37 = load i32, i32* %4
%38 = load i32, i32* %2
%39 = icmp slt i32 %37, %38
br i1 %39, label %40, label %50
40: ; preds = %36
%41 = load i32, i32* %4
%42 = load i32, i32* %3
%43 = icmp slt i32 %41, %42
br i1 %43, label %44, label %50
44: ; preds = %40
%45 = load i32, i32* %4
%46 = load i32, i32* %5
%47 = icmp slt i32 %45, %46
br i1 %47, label %48, label %50
48: ; preds = %44
%49 = load i32, i32* %4
store i32 %49, i32* %6
br label %52
50: ; preds = %44, %40, %36
%51 = load i32, i32* %5
store i32 %51, i32* %6
br label %52
52: ; preds = %50, %48
br label %53
53: ; preds = %52, %34
br label %54
54: ; preds = %53, %20
%55 = load i32, i32* %6
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %55)
ret i32 0
}

LLVM IR (-O2):
@.str = [46 x i8] c"Please enter 4 numbers seperated by spaces > \00"
@.str.1 = [9 x i8] c"%d%d%d%d\00"
@.str.2 = [20 x i8] c"%d 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 ([9 x i8], [9 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 %33, 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 %33, 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
%32 = select i1 %31, i32 %14, i32 %17
br label %33
33: ; preds = %26, %20, %0
%34 = phi i32 [ %11, %0 ], [ %12, %20 ], [ %32, %26 ]
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %34)
ret i32 0
}