#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 *createArray(int);
int /*<<< orphan*/ fillArray(int *, int, int /*<<< orphan*/, int);
int /*<<< orphan*/ printFlag(int *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ sort(int *, int);
int main() {
  int n;
  scanf("%d", &n);
  int *a = createArray(n);
  fillArray(a, n, 0, 3);
  printFlag(a, n);
  sort(a, n);
  printf("\n\n");
  printFlag(a, n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1080 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1070 <createArray@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
xor    %edx,%edx
mov    $0x3,%ecx
call   1050 <fillArray@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1030 <printFlag@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1060 <sort@plt>
lea    0xe46(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1030 <printFlag@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xe94(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1080 <scanf@plt>
mov    0xc(%rsp),%edi
call   1070 <createArray@plt>
mov    %rax,%rbx
mov    0xc(%rsp),%esi
mov    %rax,%rdi
xor    %edx,%edx
mov    $0x3,%ecx
call   1050 <fillArray@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printFlag@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1060 <sort@plt>
lea    0xe4f(%rip),%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printFlag@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
store i32 0, i32* %1
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = call i32* @createArray(i32 %5)
store i32* %6, i32** %3
%7 = load i32*, i32** %3
%8 = load i32, i32* %2
%9 = call i32 @fillArray(i32* %7, i32 %8, i32 0, i32 3)
%10 = load i32*, i32** %3
%11 = load i32, i32* %2
%12 = call i32 @printFlag(i32* %10, i32 %11)
%13 = load i32*, i32** %3
%14 = load i32, i32* %2
%15 = call i32 @sort(i32* %13, i32 %14)
%16 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%17 = load i32*, i32** %3
%18 = load i32, i32* %2
%19 = call i32 @printFlag(i32* %17, i32 %18)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@str = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32* @createArray(i32 %4)
%6 = load i32, i32* %1
%7 = call i32 @fillArray(i32* %5, i32 %6, i32 0, i32 3)
%8 = load i32, i32* %1
%9 = call i32 @printFlag(i32* %5, i32 %8)
%10 = load i32, i32* %1
%11 = call i32 @sort(i32* %5, i32 %10)
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%13 = load i32, i32* %1
%14 = call i32 @printFlag(i32* %5, i32 %13)
ret i32 0
}