#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*/ getchar();
int /*<<< orphan*/ inputArray(int *, unsigned int);
int /*<<< orphan*/ outputArray(int *, unsigned int);
int scanf(char *, unsigned int *);
int /*<<< orphan*/ selectSort(int *, unsigned int);
void main(void) {
  unsigned count;
  int array[20] = {0};
  while (scanf("%u", &count), getchar(), count != 0 && count <= 20) {
    inputArray(array, count);
    selectSort(array, count);
    outputArray(array, count);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x50,%edx
call   1030 <memset@plt>
lea    0xe81(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1080 <scanf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x61(%rbp)
je     11a8 <main+0x48>
cmpl   $0x14,-0x4(%rbp)
setbe  %al
mov    %al,-0x61(%rbp)
mov    -0x61(%rbp),%al
test   $0x1,%al
jne    11b8 <main+0x58>
jmp    11e1 <main+0x81>
lea    -0x60(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1050 <inputArray@plt>
lea    -0x60(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1070 <selectSort@plt>
lea    -0x60(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1060 <outputArray@plt>
jmp    1178 <main+0x18>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x60,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
lea    0xe84(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
xor    %eax,%eax
call   1030 <getchar@plt>
mov    0xc(%rsp),%esi
lea    -0x1(%rsi),%eax
cmp    $0x13,%eax
ja     11ee <main+0x9e>
lea    0x10(%rsp),%rbx
lea    0xe5b(%rip),%r14
lea    0xc(%rsp),%r15
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <inputArray@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1060 <selectSort@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1050 <outputArray@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1070 <scanf@plt>
xor    %eax,%eax
call   1030 <getchar@plt>
mov    0xc(%rsp),%esi
lea    -0x1(%rsi),%eax
cmp    $0x14,%eax
jb     11b0 <main+0x60>
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%u\00"
define void @main() {
%1 = alloca i32
%2 = alloca [20 x i32]
%3 = bitcast [20 x i32]* %2 to i8*
br label %4
4: ; preds = %14, %0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = call i32 (...) @getchar()
%7 = load i32, i32* %1
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %4
%10 = load i32, i32* %1
%11 = icmp ule i32 %10, 20
br label %12
12: ; preds = %9, %4
%13 = phi i1 [ false, %4 ], [ %11, %9 ]
br i1 %13, label %14, label %24
14: ; preds = %12
%15 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
%16 = load i32, i32* %1
%17 = call i32 @inputArray(i32* %15, i32 %16)
%18 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
%19 = load i32, i32* %1
%20 = call i32 @selectSort(i32* %18, i32 %19)
%21 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
%22 = load i32, i32* %1
%23 = call i32 @outputArray(i32* %21, i32 %22)
br label %4
24: ; preds = %12
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%u\00"
define void @main() {
%1 = alloca i32
%2 = alloca [20 x i32]
%3 = bitcast i32* %1 to i8*
%4 = bitcast [20 x i32]* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = call i32 (...) @getchar()
%7 = load i32, i32* %1
%8 = add i32 %7, -1
%9 = icmp ult i32 %8, 20
br i1 %9, label %10, label %24
10: ; preds = %0
%11 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
br label %12
12: ; preds = %10, %12
%13 = phi i32 [ %7, %10 ], [ %21, %12 ]
%14 = call i32 @inputArray(i32* %11, i32 %13)
%15 = load i32, i32* %1
%16 = call i32 @selectSort(i32* %11, i32 %15)
%17 = load i32, i32* %1
%18 = call i32 @outputArray(i32* %11, i32 %17)
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%20 = call i32 (...) @getchar()
%21 = load i32, i32* %1
%22 = add i32 %21, -1
%23 = icmp ult i32 %22, 20
br i1 %23, label %12, label %24
24: ; preds = %12, %0
ret void
}