#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);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ sorting(int *);
int main() {
  int sort[1000] = {0};
  register int k = 0, l = 0;
  for (k = 0; (k == 0) ? sort[k] != 42 : sort[k - 1] != 42 && k < 1000; k++) {
    scanf("%d", &sort[k]);
  }
  sorting(sort);
  for (l = k; l > 0; l--) {
    printf("%d ", sort[l]);
  }
  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)
movl   $0x0,-0xfb8(%rbp)
movl   $0x0,-0xfb4(%rbp)
cmpl   $0x0,-0xfb4(%rbp)
jne    11b2 <main+0x72>
movslq -0xfb4(%rbp),%rax
cmpl   $0x2a,-0xfb0(%rbp,%rax,4)
2a
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0xfbc(%rbp)
jmp    11f8 <main+0xb8>
mov    -0xfb4(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
xor    %eax,%eax
cmpl   $0x2a,-0xfb0(%rbp,%rcx,4)
2a
mov    %al,-0xfbd(%rbp)
je     11e7 <main+0xa7>
cmpl   $0x3e8,-0xfb4(%rbp)
setl   %al
mov    %al,-0xfbd(%rbp)
mov    -0xfbd(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0xfbc(%rbp)
mov    -0xfbc(%rbp),%eax
cmp    $0x0,%eax
je     123c <main+0xfc>
movslq -0xfb4(%rbp),%rax
lea    -0xfb0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xddd(%rip),%rdi
call   1050 <scanf@plt>
mov    -0xfb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfb4(%rbp)
jmp    1183 <main+0x43>
lea    -0xfb0(%rbp),%rdi
call   1060 <sorting@plt>
mov    -0xfb4(%rbp),%eax
mov    %eax,-0xfb8(%rbp)
cmpl   $0x0,-0xfb8(%rbp)
jle    128f <main+0x14f>
movslq -0xfb8(%rbp),%rax
mov    -0xfb0(%rbp,%rax,4),%esi
lea    0xd8d(%rip),%rdi
call   1030 <printf@plt>
mov    -0xfb8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xfb8(%rbp)
jmp    1254 <main+0x114>
xor    %eax,%eax
add    $0xfc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xfa0,%rsp
mov    %rsp,%rbx
xor    %r15d,%r15d
mov    $0xfa0,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
lea    0xe98(%rip),%r14
jmp    1189 <main+0x49>
nopw   0x0(%rax,%rax,1)
cmpl   $0x2a,(%rsp)
je     11d8 <main+0x98>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
add    $0x1,%r15
add    $0x4,%rbx
test   %r15,%r15
je     1170 <main+0x30>
cmpl   $0x2a,-0x4(%rbx)
je     119d <main+0x5d>
cmp    $0x3e7,%r15
jbe    1176 <main+0x36>
mov    %rsp,%rdi
call   1060 <sorting@plt>
test   %r15d,%r15d
je     11e0 <main+0xa0>
mov    %r15d,%ebx
add    $0x1,%rbx
lea    0xe4b(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    -0x4(%rsp,%rbx,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0xffffffffffffffff,%rbx
cmp    $0x1,%rbx
ja     11c0 <main+0x80>
jmp    11e0 <main+0xa0>
mov    %rsp,%rdi
call   1060 <sorting@plt>
xor    %eax,%eax
add    $0xfa0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d \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
store i32 0, i32* %4
store i32 0, i32* %3
br label %6
6: ; preds = %37, %0
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %16
9: ; preds = %6
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [1000 x i32], [1000 x i32]* %2, i64 0, i64 %11
%13 = load i32, i32* %12
%14 = icmp ne i32 %13, 42
%15 = zext i1 %14 to i32
br label %29
16: ; preds = %6
%17 = load i32, i32* %3
%18 = sub nsw i32 %17, 1
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [1000 x i32], [1000 x i32]* %2, i64 0, i64 %19
%21 = load i32, i32* %20
%22 = icmp ne i32 %21, 42
br i1 %22, label %23, label %26
23: ; preds = %16
%24 = load i32, i32* %3
%25 = icmp slt i32 %24, 1000
br label %26
26: ; preds = %23, %16
%27 = phi i1 [ false, %16 ], [ %25, %23 ]
%28 = zext i1 %27 to i32
br label %29
29: ; preds = %26, %9
%30 = phi i32 [ %15, %9 ], [ %28, %26 ]
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %40
32: ; preds = %29
%33 = load i32, i32* %3
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [1000 x i32], [1000 x i32]* %2, i64 0, i64 %34
%36 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %35)
br label %37
37: ; preds = %32
%38 = load i32, i32* %3
%39 = add nsw i32 %38, 1
store i32 %39, i32* %3
br label %6
40: ; preds = %29
%41 = getelementptr inbounds [1000 x i32], [1000 x i32]* %2, i64 0, i64 0
%42 = call i32 @sorting(i32* %41)
%43 = load i32, i32* %3
store i32 %43, i32* %4
br label %44
44: ; preds = %53, %40
%45 = load i32, i32* %4
%46 = icmp sgt i32 %45, 0
br i1 %46, label %47, label %56
47: ; preds = %44
%48 = load i32, i32* %4
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [1000 x i32], [1000 x i32]* %2, i64 0, i64 %49
%51 = load i32, i32* %50
%52 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %51)
br label %53
53: ; preds = %47
%54 = load i32, i32* %4
%55 = add nsw i32 %54, -1
store i32 %55, i32* %4
br label %44
56: ; preds = %44
ret i32 0
}

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