#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *);
int readNumber();
int /*<<< orphan*/ sortNumbers(int, int, int, int);
int /*<<< orphan*/ stdin;
int main(void) {
  int n1, n2, n3, n4;
  printf("Sortieren von 4 Zahlen\n");
  printf("======================\n");
  n1 = readNumber();
  n2 = readNumber();
  n3 = readNumber();
  n4 = readNumber();
  if (n1 < n2 && n2 < n3 && n3 < n4)
    printf("Was soll das?!\nDie Zahlen sind bereits sortiert!\n");
  else {
    sortNumbers(n1, n2, n3, n4);
  }
  fflush(stdin);
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
call   1050 <printf@plt>
lea    0xea6(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1030 <readNumber@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <readNumber@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <readNumber@plt>
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <readNumber@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11d4 <main+0x84>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11d4 <main+0x84>
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11d4 <main+0x84>
lea    0xe66(%rip),%rdi
call   1050 <printf@plt>
jmp    11e5 <main+0x95>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1040 <sortNumbers@plt>
mov    0x2dfc(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
lea    0xea5(%rip),%rdi
call   1040 <puts@plt>
lea    0xeb0(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1030 <readNumber@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   1030 <readNumber@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1030 <readNumber@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <readNumber@plt>
cmp    %ebp,%r14d
jge    11aa <main+0x5a>
cmp    %ebx,%ebp
jge    11aa <main+0x5a>
cmp    %eax,%ebx
jge    11aa <main+0x5a>
lea    0xe8b(%rip),%rdi
call   1040 <puts@plt>
jmp    11b8 <main+0x68>
mov    %r14d,%edi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %eax,%ecx
call   1050 <sortNumbers@plt>
mov    0x2e29(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Sortieren von 4 Zahlen\0A\00"
@.str.1 = [24 x i8] c"======================\0A\00"
@.str.2 = [50 x i8] c"Was soll das?!\0ADie Zahlen sind bereits sortiert!\0A\00"
@stdin = global i32 0
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 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 (...) @readNumber()
store i32 %8, i32* %2
%9 = call i32 (...) @readNumber()
store i32 %9, i32* %3
%10 = call i32 (...) @readNumber()
store i32 %10, i32* %4
%11 = call i32 (...) @readNumber()
store i32 %11, i32* %5
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %25
15: ; preds = %0
%16 = load i32, i32* %3
%17 = load i32, i32* %4
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %25
19: ; preds = %15
%20 = load i32, i32* %4
%21 = load i32, i32* %5
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0))
br label %31
25: ; preds = %19, %15, %0
%26 = load i32, i32* %2
%27 = load i32, i32* %3
%28 = load i32, i32* %4
%29 = load i32, i32* %5
%30 = call i32 @sortNumbers(i32 %26, i32 %27, i32 %28, i32 %29)
br label %31
31: ; preds = %25, %23
%32 = load i32, i32* @stdin
%33 = call i32 @fflush(i32 %32)
%34 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@str = [23 x i8] c"Sortieren von 4 Zahlen\00"
@str.3 = [23 x i8] c"======================\00"
@str.4 = [49 x i8] c"Was soll das?!\0ADie Zahlen sind bereits sortiert!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 (...) @readNumber()
%4 = tail call i32 (...) @readNumber()
%5 = tail call i32 (...) @readNumber()
%6 = tail call i32 (...) @readNumber()
%7 = icmp slt i32 %3, %4
%8 = icmp slt i32 %4, %5
%9 = select i1 %7, i1 %8, i1 false
%10 = icmp slt i32 %5, %6
%11 = select i1 %9, i1 %10, i1 false
br i1 %11, label %12, label %14
12: ; preds = %0
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.4, i64 0, i64 0))
br label %16
14: ; preds = %0
%15 = tail call i32 @sortNumbers(i32 %3, i32 %4, i32 %5, i32 %6)
br label %16
16: ; preds = %14, %12
%17 = load i32, i32* @stdin
%18 = tail call i32 @fflush(i32 %17)
%19 = tail call i32 (...) @getchar()
ret i32 0
}