#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*/ fastSort(int *, int);
int /*<<< orphan*/ printf(char *, int, char);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int numbers[1000] = {0};
  int i = 0;
  do {
    scanf("%d", &numbers[i]);
  } while (numbers[i++] != 42);
  fastSort(numbers, i);
  int j = 0;
  for (j = 0; j < i; j++)
    printf("%d%c", numbers[j], (j == i - 1) ? ('\n') : (' '));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xfc0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xfb0(%rbp),%rdi
xor    %esi,%esi
mov    $0xfa0,%edx
call   1040 <memset@plt>
movl   $0x0,-0xfb4(%rbp)
movslq -0xfb4(%rbp),%rax
lea    -0xfb0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe75(%rip),%rdi
call   1060 <scanf@plt>
mov    -0xfb4(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xfb4(%rbp)
cltq
cmpl   $0x2a,-0xfb0(%rbp,%rax,4)
2a
jne    116f <main+0x2f>
lea    -0xfb0(%rbp),%rdi
mov    -0xfb4(%rbp),%esi
call   1050 <fastSort@plt>
movl   $0x0,-0xfb8(%rbp)
movl   $0x0,-0xfb8(%rbp)
mov    -0xfb8(%rbp),%eax
cmp    -0xfb4(%rbp),%eax
jge    1238 <main+0xf8>
movslq -0xfb8(%rbp),%rax
mov    -0xfb0(%rbp,%rax,4),%esi
mov    -0xfb8(%rbp),%edx
mov    -0xfb4(%rbp),%edi
sub    $0x1,%edi
mov    $0x20,%eax
mov    $0xa,%ecx
cmp    %edi,%edx
cmove  %ecx,%eax
lea    0xde7(%rip),%rdi
movsbl %al,%edx
call   1030 <printf@plt>
mov    -0xfb8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfb8(%rbp)
jmp    11d7 <main+0x97>
xor    %eax,%eax
add    $0xfc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xfa0,%rsp
mov    %rsp,%rbx
xor    %r14d,%r14d
mov    $0xfa0,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
lea    0xe95(%rip),%r15
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
add    $0x1,%r14d
cmpl   $0x2a,(%rbx)
lea    0x4(%rbx),%rbx
jne    1170 <main+0x30>
mov    %rsp,%rdi
mov    %r14d,%esi
call   1050 <fastSort@plt>
lea    -0x1(%r14),%r15d
mov    %r14d,%r12d
xor    %ebx,%ebx
mov    $0xa,%ebp
lea    0xe5b(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%rsp,%rbx,4),%esi
cmp    %rbx,%r15
mov    $0x20,%edx
cmove  %ebp,%edx
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    11b0 <main+0x70>
xor    %eax,%eax
add    $0xfa0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%d%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1000 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [1000 x i32]* %2 to i8*
store i32 0, i32* %3
br label %6
6: ; preds = %11, %0
%7 = load i32, i32* %3
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [1000 x i32], [1000 x i32]* %2, i64 0, i64 %8
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %9)
br label %11
11: ; preds = %6
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
%14 = sext i32 %12 to i64
%15 = getelementptr inbounds [1000 x i32], [1000 x i32]* %2, i64 0, i64 %14
%16 = load i32, i32* %15
%17 = icmp ne i32 %16, 42
br i1 %17, label %6, label %18
18: ; preds = %11
%19 = getelementptr inbounds [1000 x i32], [1000 x i32]* %2, i64 0, i64 0
%20 = load i32, i32* %3
%21 = call i32 @fastSort(i32* %19, i32 %20)
store i32 0, i32* %4
store i32 0, i32* %4
br label %22
22: ; preds = %39, %18
%23 = load i32, i32* %4
%24 = load i32, i32* %3
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %42
26: ; preds = %22
%27 = load i32, i32* %4
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [1000 x i32], [1000 x i32]* %2, i64 0, i64 %28
%30 = load i32, i32* %29
%31 = load i32, i32* %4
%32 = load i32, i32* %3
%33 = sub nsw i32 %32, 1
%34 = icmp eq i32 %31, %33
%35 = zext i1 %34 to i64
%36 = select i1 %34, i32 10, i32 32
%37 = trunc i32 %36 to i8
%38 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %30, i8 signext %37)
br label %39
39: ; preds = %26
%40 = load i32, i32* %4
%41 = add nsw i32 %40, 1
store i32 %41, i32* %4
br label %22
42: ; preds = %22
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%d%c\00"
define i32 @main() {
%1 = alloca [1000 x i32]
%2 = bitcast [1000 x i32]* %1 to i8*
br label %3
3: ; preds = %3, %0
%4 = phi i64 [ %7, %3 ], [ 0, %0 ]
%5 = getelementptr inbounds [1000 x i32], [1000 x i32]* %1, i64 0, i64 %4
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%7 = add nuw i64 %4, 1
%8 = load i32, i32* %5
%9 = icmp eq i32 %8, 42
br i1 %9, label %10, label %3
10: ; preds = %3
%11 = trunc i64 %7 to i32
%12 = getelementptr inbounds [1000 x i32], [1000 x i32]* %1, i64 0, i64 0
%13 = call i32 @fastSort(i32* %12, i32 %11)
%14 = and i64 %4, 4294967295
%15 = add i64 %4, 1
%16 = and i64 %15, 4294967295
br label %17
17: ; preds = %10, %17
%18 = phi i64 [ 0, %10 ], [ %24, %17 ]
%19 = getelementptr inbounds [1000 x i32], [1000 x i32]* %1, i64 0, i64 %18
%20 = load i32, i32* %19
%21 = icmp eq i64 %18, %14
%22 = select i1 %21, i8 10, i8 32
%23 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %20, i8 signext %22)
%24 = add nuw nsw i64 %18, 1
%25 = icmp eq i64 %24, %16
br i1 %25, label %26, label %17
26: ; preds = %17
ret i32 0
}