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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x1c,%edx
call   1040 <memset@plt>
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x7,-0x8(%rbp)
jge    11b3 <main+0x63>
mov    $0x0,%al
call   1070 <random@plt>
mov    $0x2710,%ecx
cltd
idiv   %ecx
movslq -0x8(%rbp),%rax
mov    %edx,-0x30(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1184 <main+0x34>
movl   $0x0,-0x8(%rbp)
cmpl   $0x7,-0x8(%rbp)
jge    11e8 <main+0x98>
movslq -0x8(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11ba <main+0x6a>
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x7,-0x8(%rbp)
jge    128e <main+0x13e>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x7,%ecx
sub    -0x8(%rbp),%ecx
cmp    %ecx,%eax
jge    127b <main+0x12b>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x30(%rbp,%rax,4),%eax
movslq -0xc(%rbp),%rcx
cmp    -0x30(%rbp,%rcx,4),%eax
jge    1268 <main+0x118>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x10(%rbp)
movslq -0xc(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%ecx
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
cltq
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x10(%rbp),%ecx
movslq -0xc(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
jmp    126d <main+0x11d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    120d <main+0xbd>
jmp    1280 <main+0x130>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11fd <main+0xad>
movl   $0x0,-0x8(%rbp)
cmpl   $0x7,-0x8(%rbp)
jge    12c3 <main+0x173>
movslq -0x8(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xd52(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1295 <main+0x145>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
xor    %eax,%eax
call   1070 <random@plt>
movslq %eax,%rcx
imul   $0x68db8bad,%rcx,%rax
mov    %rcx,%rdx
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x2c,%rax
add    %ecx,%eax
imul   $0x2710,%eax,%eax
sub    %eax,%edx
mov    %rdx,0x8(%rsp)
xor    %eax,%eax
call   1070 <random@plt>
movslq %eax,%rbx
imul   $0x68db8bad,%rbx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x2c,%rax
add    %ecx,%eax
imul   $0x2710,%eax,%eax
sub    %eax,%ebx
xor    %eax,%eax
call   1070 <random@plt>
movslq %eax,%rcx
imul   $0x68db8bad,%rcx,%rax
mov    %rcx,%rdx
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x2c,%rax
add    %ecx,%eax
imul   $0x2710,%eax,%eax
sub    %eax,%edx
mov    %rdx,0x10(%rsp)
xor    %eax,%eax
call   1070 <random@plt>
movslq %eax,%r13
imul   $0x68db8bad,%r13,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x2c,%rax
add    %ecx,%eax
imul   $0x2710,%eax,%eax
sub    %eax,%r13d
xor    %eax,%eax
call   1070 <random@plt>
movslq %eax,%r12
imul   $0x68db8bad,%r12,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x2c,%rax
add    %ecx,%eax
imul   $0x2710,%eax,%eax
sub    %eax,%r12d
xor    %eax,%eax
call   1070 <random@plt>
movslq %eax,%r14
imul   $0x68db8bad,%r14,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x2c,%rax
add    %ecx,%eax
imul   $0x2710,%eax,%eax
sub    %eax,%r14d
xor    %eax,%eax
call   1070 <random@plt>
movslq %eax,%r15
imul   $0x68db8bad,%r15,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x2c,%rax
add    %ecx,%eax
imul   $0x2710,%eax,%eax
sub    %eax,%r15d
lea    0xd6f(%rip),%rbp
mov    %rbp,%rdi
mov    0x8(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbp,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbp,%rdi
mov    0x10(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbp,%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbp,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbp,%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbp,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x8(%rsp),%rax
cmp    %ebx,%eax
mov    %eax,%ebp
cmovl  %ebx,%ebp
cmovl  %eax,%ebx
mov    0x10(%rsp),%rcx
cmp    %ecx,%ebx
mov    %ebx,%eax
cmovl  %ecx,%eax
cmovge %ecx,%ebx
cmp    %r13d,%ebx
mov    %ebx,%edx
cmovl  %r13d,%edx
cmovge %r13d,%ebx
cmp    %r12d,%ebx
mov    %ebx,%edi
cmovl  %r12d,%edi
cmovge %r12d,%ebx
cmp    %r14d,%ebx
mov    %ebx,%r8d
cmovl  %r14d,%r8d
cmovge %r14d,%ebx
cmp    %r15d,%ebx
mov    %r15d,%ecx
cmovl  %ebx,%ecx
mov    %ecx,0x8(%rsp)
cmovl  %r15d,%ebx
cmp    %eax,%ebp
mov    %ebp,%esi
cmovl  %eax,%esi
cmovl  %ebp,%eax
cmp    %edx,%eax
mov    %eax,%ecx
cmovl  %edx,%ecx
cmovge %edx,%eax
cmp    %edi,%eax
mov    %eax,%ebp
cmovl  %edi,%ebp
cmovge %edi,%eax
cmp    %r8d,%eax
mov    %eax,%edx
cmovl  %r8d,%edx
cmovge %r8d,%eax
cmp    %ebx,%eax
mov    %ebx,%r15d
cmovl  %eax,%r15d
cmovl  %ebx,%eax
cmp    %ebp,%ecx
mov    %ecx,%r13d
cmovl  %ebp,%r13d
cmovl  %ecx,%ebp
cmp    %edx,%ebp
mov    %ebp,%ecx
cmovl  %edx,%ecx
cmovge %edx,%ebp
cmp    %eax,%ebp
mov    %eax,%r12d
cmovl  %ebp,%r12d
cmovl  %eax,%ebp
cmp    %ebp,%ecx
mov    %ebp,%ebx
cmovl  %ecx,%ebx
cmovge %ecx,%ebp
lea    0xc46(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    0x8(%rsp),%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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