#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 atoi(char const *);
void *malloc(unsigned long);
int /*<<< orphan*/ megaInit();
int /*<<< orphan*/ printf(char const *, ...);
int /*<<< orphan*/ sort(int *, int);
int main(int argc, char **argv) {
  int lsize;
  int tmp;
  int *list;
  void *tmp___0;
  int i;
  int i___0;
  {
    megaInit();
    tmp = atoi((char const *)*(argv + 1));
    lsize = tmp;
    tmp___0 = malloc((unsigned long)lsize * sizeof(int));
    list = (int *)tmp___0;
    i = 0;
    while (i < lsize) {
      *(list + i) = atoi((char const *)*(argv + (2 + i)));
      i++;
    }
    sort(list, lsize);
    i___0 = 0;
    while (i___0 < lsize) {
      printf((char const *)"%d", *(list + i___0));
      i___0++;
    }
    printf((char const *)"\n");
    return (0);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <megaInit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
movslq -0x14(%rbp),%rdi
shl    $0x2,%rdi
call   1060 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11e0 <main+0x90>
mov    -0x10(%rbp),%rax
mov    -0x2c(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1070 <atoi@plt>
mov    %eax,%edx
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11a3 <main+0x53>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <sort@plt>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1226 <main+0xd6>
mov    -0x20(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xdef(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11f3 <main+0xa3>
lea    0xdd6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r14
xor    %eax,%eax
call   1040 <megaInit@plt>
mov    0x8(%r14),%rdi
call   1080 <atoi@plt>
mov    %eax,%r15d
movslq %eax,%rbx
lea    0x0(,%rbx,4),%rdi
call   1070 <malloc@plt>
mov    %rax,%r12
test   %ebx,%ebx
jle    11e9 <main+0x89>
mov    %r15d,%ebp
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    0x10(%r14,%rbx,8),%rdi
call   1080 <atoi@plt>
mov    %eax,(%r12,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    11a0 <main+0x40>
mov    %r12,%rdi
mov    %r15d,%esi
call   1060 <sort@plt>
test   %r15d,%r15d
jle    11f4 <main+0x94>
lea    0xe32(%rip),%r14
xor    %ebx,%ebx
mov    (%r12,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    11d0 <main+0x70>
jmp    11f4 <main+0x94>
mov    %r12,%rdi
mov    %r15d,%esi
call   1060 <sort@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = call i32 (...) @megaInit()
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @atoi(i8* %15)
store i32 %16, i32* %7
%17 = load i32, i32* %7
store i32 %17, i32* %6
%18 = load i32, i32* %6
%19 = sext i32 %18 to i64
%20 = mul i64 %19, 4
%21 = call i8* @malloc(i64 %20)
store i8* %21, i8** %9
%22 = load i8*, i8** %9
%23 = bitcast i8* %22 to i32*
store i32* %23, i32** %8
store i32 0, i32* %10
br label %24
24: ; preds = %28, %2
%25 = load i32, i32* %10
%26 = load i32, i32* %6
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %42
28: ; preds = %24
%29 = load i8**, i8*** %5
%30 = load i32, i32* %10
%31 = add nsw i32 2, %30
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8*, i8** %29, i64 %32
%34 = load i8*, i8** %33
%35 = call i32 @atoi(i8* %34)
%36 = load i32*, i32** %8
%37 = load i32, i32* %10
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i32, i32* %36, i64 %38
store i32 %35, i32* %39
%40 = load i32, i32* %10
%41 = add nsw i32 %40, 1
store i32 %41, i32* %10
br label %24
42: ; preds = %24
%43 = load i32*, i32** %8
%44 = load i32, i32* %6
%45 = call i32 @sort(i32* %43, i32 %44)
store i32 0, i32* %11
br label %46
46: ; preds = %50, %42
%47 = load i32, i32* %11
%48 = load i32, i32* %6
%49 = icmp slt i32 %47, %48
br i1 %49, label %50, label %59
50: ; preds = %46
%51 = load i32*, i32** %8
%52 = load i32, i32* %11
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i32, i32* %51, i64 %53
%55 = load i32, i32* %54
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %55)
%57 = load i32, i32* %11
%58 = add nsw i32 %57, 1
store i32 %58, i32* %11
br label %46
59: ; preds = %46
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 (...) @megaInit()
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = tail call i32 @atoi(i8* %5)
%7 = sext i32 %6 to i64
%8 = shl nsw i64 %7, 2
%9 = tail call i8* @malloc(i64 %8)
%10 = bitcast i8* %9 to i32*
%11 = icmp sgt i32 %6, 0
br i1 %11, label %14, label %12
12: ; preds = %2
%13 = tail call i32 @sort(i32* %10, i32 %6)
br label %36
14: ; preds = %2
%15 = zext i32 %6 to i64
br label %16
16: ; preds = %14, %16
%17 = phi i64 [ 0, %14 ], [ %23, %16 ]
%18 = add nuw nsw i64 %17, 2
%19 = getelementptr inbounds i8*, i8** %1, i64 %18
%20 = load i8*, i8** %19
%21 = tail call i32 @atoi(i8* %20)
%22 = getelementptr inbounds i32, i32* %10, i64 %17
store i32 %21, i32* %22
%23 = add nuw nsw i64 %17, 1
%24 = icmp eq i64 %23, %15
br i1 %24, label %25, label %16
25: ; preds = %16
%26 = tail call i32 @sort(i32* %10, i32 %6)
br i1 %11, label %27, label %36
27: ; preds = %25
%28 = zext i32 %6 to i64
br label %29
29: ; preds = %27, %29
%30 = phi i64 [ 0, %27 ], [ %34, %29 ]
%31 = getelementptr inbounds i32, i32* %10, i64 %30
%32 = load i32, i32* %31
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %32)
%34 = add nuw nsw i64 %30, 1
%35 = icmp eq i64 %34, %28
br i1 %35, label %36, label %29
36: ; preds = %29, %12, %25
%37 = tail call i32 @putchar(i32 10)
ret i32 0
}