#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 rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/);
int main() {
  int i;
  int str[20];
  srand(time(0));
  for (i = 0; i < 20; i++) {
    str[i] = rand() % 1000;
  }
  int j;
  int temp = 0;
  for (i = 0; i < 20; i++) {
    for (j = 1; j < 20 - i; j++) {
      if (str[j - 1] > str[j]) {
        temp = str[j - 1];
        str[j - 1] = str[j];
        str[j] = temp;
      }
    }
  }
  for (i = 0; i < 20; i++) {
    printf("%d\n", str[i]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x14,-0x8(%rbp)
jge    1193 <main+0x53>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x3e8,%ecx
cltd
idiv   %ecx
movslq -0x8(%rbp),%rax
mov    %edx,-0x60(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1164 <main+0x24>
movl   $0x0,-0x68(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x14,-0x8(%rbp)
jge    1233 <main+0xf3>
movl   $0x1,-0x64(%rbp)
mov    -0x64(%rbp),%eax
mov    $0x14,%ecx
sub    -0x8(%rbp),%ecx
cmp    %ecx,%eax
jge    1220 <main+0xe0>
mov    -0x64(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x60(%rbp,%rax,4),%eax
movslq -0x64(%rbp),%rcx
cmp    -0x60(%rbp,%rcx,4),%eax
jle    120d <main+0xcd>
mov    -0x64(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x60(%rbp,%rax,4),%eax
mov    %eax,-0x68(%rbp)
movslq -0x64(%rbp),%rax
mov    -0x60(%rbp,%rax,4),%ecx
mov    -0x64(%rbp),%eax
sub    $0x1,%eax
cltq
mov    %ecx,-0x60(%rbp,%rax,4)
mov    -0x68(%rbp),%ecx
movslq -0x64(%rbp),%rax
mov    %ecx,-0x60(%rbp,%rax,4)
jmp    1212 <main+0xd2>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    11b2 <main+0x72>
jmp    1225 <main+0xe5>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11a1 <main+0x61>
movl   $0x0,-0x8(%rbp)
cmpl   $0x14,-0x8(%rbp)
jge    1266 <main+0x126>
movslq -0x8(%rbp),%rax
mov    -0x60(%rbp,%rax,4),%esi
lea    0xdad(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    123a <main+0xfa>
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x10624dd3,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rcx
add    %edx,%ecx
imul   $0x3e8,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,(%rsp,%rbx,4)
add    $0x1,%rbx
cmp    $0x14,%rbx
jne    1160 <main+0x20>
xor    %eax,%eax
jmp    11aa <main+0x6a>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%rax
cmp    $0x14,%rax
je     11eb <main+0xab>
cmp    $0x12,%rax
ja     11a0 <main+0x60>
mov    $0x14,%ecx
sub    %rax,%rcx
mov    $0x1,%edx
mov    (%rsp),%esi
jmp    11e0 <main+0xa0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %edi,-0x4(%rsp,%rdx,4)
mov    %esi,(%rsp,%rdx,4)
add    $0x1,%rdx
cmp    %rcx,%rdx
jae    11a0 <main+0x60>
mov    (%rsp,%rdx,4),%edi
cmp    %edi,%esi
jg     11d0 <main+0x90>
mov    %edi,%esi
jmp    11d7 <main+0x97>
mov    (%rsp),%esi
lea    0xe0b(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x18(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x1c(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x20(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x24(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x28(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x2c(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x30(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x34(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x38(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x3c(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x40(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x44(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x48(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x4c(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [20 x i32]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 @time(i32 0)
%7 = call i32 @srand(i32 %6)
store i32 0, i32* %2
br label %8
8: ; preds = %17, %0
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 20
br i1 %10, label %11, label %20
11: ; preds = %8
%12 = call i32 (...) @rand()
%13 = srem i32 %12, 1000
%14 = load i32, i32* %2
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %15
store i32 %13, i32* %16
br label %17
17: ; preds = %11
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 1
store i32 %19, i32* %2
br label %8
20: ; preds = %8
store i32 0, i32* %5
store i32 0, i32* %2
br label %21
21: ; preds = %64, %20
%22 = load i32, i32* %2
%23 = icmp slt i32 %22, 20
br i1 %23, label %24, label %67
24: ; preds = %21
store i32 1, i32* %4
br label %25
25: ; preds = %60, %24
%26 = load i32, i32* %4
%27 = load i32, i32* %2
%28 = sub nsw i32 20, %27
%29 = icmp slt i32 %26, %28
br i1 %29, label %30, label %63
30: ; preds = %25
%31 = load i32, i32* %4
%32 = sub nsw i32 %31, 1
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %33
%35 = load i32, i32* %34
%36 = load i32, i32* %4
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %37
%39 = load i32, i32* %38
%40 = icmp sgt i32 %35, %39
br i1 %40, label %41, label %59
41: ; preds = %30
%42 = load i32, i32* %4
%43 = sub nsw i32 %42, 1
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %44
%46 = load i32, i32* %45
store i32 %46, i32* %5
%47 = load i32, i32* %4
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %48
%50 = load i32, i32* %49
%51 = load i32, i32* %4
%52 = sub nsw i32 %51, 1
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %53
store i32 %50, i32* %54
%55 = load i32, i32* %5
%56 = load i32, i32* %4
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %57
store i32 %55, i32* %58
br label %59
59: ; preds = %41, %30
br label %60
60: ; preds = %59
%61 = load i32, i32* %4
%62 = add nsw i32 %61, 1
store i32 %62, i32* %4
br label %25
63: ; preds = %25
br label %64
64: ; preds = %63
%65 = load i32, i32* %2
%66 = add nsw i32 %65, 1
store i32 %66, i32* %2
br label %21
67: ; preds = %21
store i32 0, i32* %2
br label %68
68: ; preds = %77, %67
%69 = load i32, i32* %2
%70 = icmp slt i32 %69, 20
br i1 %70, label %71, label %80
71: ; preds = %68
%72 = load i32, i32* %2
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds [20 x i32], [20 x i32]* %3, i64 0, i64 %73
%75 = load i32, i32* %74
%76 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %75)
br label %77
77: ; preds = %71
%78 = load i32, i32* %2
%79 = add nsw i32 %78, 1
store i32 %79, i32* %2
br label %68
80: ; preds = %68
%81 = load i32, i32* %1
ret i32 %81
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [20 x i32]
%2 = bitcast [20 x i32]* %1 to i8*
%3 = tail call i32 @time(i32 0)
%4 = tail call i32 @srand(i32 %3)
br label %5
5: ; preds = %0, %5
%6 = phi i64 [ 0, %0 ], [ %10, %5 ]
%7 = tail call i32 (...) @rand()
%8 = srem i32 %7, 1000
%9 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 %6
store i32 %8, i32* %9
%10 = add nuw nsw i64 %6, 1
%11 = icmp eq i64 %10, 20
br i1 %11, label %12, label %5
12: ; preds = %5
%13 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 0
br label %14
14: ; preds = %12, %33
%15 = phi i64 [ 0, %12 ], [ %34, %33 ]
%16 = sub nuw nsw i64 20, %15
%17 = icmp ult i64 %15, 19
br i1 %17, label %18, label %33
18: ; preds = %14
%19 = load i32, i32* %13
br label %20
20: ; preds = %18, %29
%21 = phi i32 [ %19, %18 ], [ %30, %29 ]
%22 = phi i64 [ 1, %18 ], [ %31, %29 ]
%23 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 %22
%24 = load i32, i32* %23
%25 = icmp sgt i32 %21, %24
br i1 %25, label %26, label %29
26: ; preds = %20
%27 = add nsw i64 %22, -1
%28 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 %27
store i32 %24, i32* %28
store i32 %21, i32* %23
br label %29
29: ; preds = %20, %26
%30 = phi i32 [ %24, %20 ], [ %21, %26 ]
%31 = add nuw nsw i64 %22, 1
%32 = icmp ult i64 %31, %16
br i1 %32, label %20, label %33
33: ; preds = %29, %14
%34 = add nuw nsw i64 %15, 1
%35 = icmp eq i64 %34, 20
br i1 %35, label %36, label %14
36: ; preds = %33
%37 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 0
%38 = load i32, i32* %37
%39 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %38)
%40 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 1
%41 = load i32, i32* %40
%42 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %41)
%43 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 2
%44 = load i32, i32* %43
%45 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %44)
%46 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 3
%47 = load i32, i32* %46
%48 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %47)
%49 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 4
%50 = load i32, i32* %49
%51 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %50)
%52 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 5
%53 = load i32, i32* %52
%54 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %53)
%55 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 6
%56 = load i32, i32* %55
%57 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %56)
%58 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 7
%59 = load i32, i32* %58
%60 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %59)
%61 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 8
%62 = load i32, i32* %61
%63 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %62)
%64 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 9
%65 = load i32, i32* %64
%66 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %65)
%67 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 10
%68 = load i32, i32* %67
%69 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %68)
%70 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 11
%71 = load i32, i32* %70
%72 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %71)
%73 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 12
%74 = load i32, i32* %73
%75 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %74)
%76 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 13
%77 = load i32, i32* %76
%78 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %77)
%79 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 14
%80 = load i32, i32* %79
%81 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %80)
%82 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 15
%83 = load i32, i32* %82
%84 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %83)
%85 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 16
%86 = load i32, i32* %85
%87 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %86)
%88 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 17
%89 = load i32, i32* %88
%90 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %89)
%91 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 18
%92 = load i32, i32* %91
%93 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %92)
%94 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 19
%95 = load i32, i32* %94
%96 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %95)
ret i32 0
}