#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 */
typedef int /*<<< orphan*/ list;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ swap(int *, int *);
void main() {
  int list[] = {126, 43, 26, 1, 113};
  int int_size = sizeof(int);
  int length = sizeof(list) / int_size;
  int i = 0;
  int j = 0;
  for (i = 0; i < length; i++) {
    printf("%d, ", list[i]);
  }
  printf("\n");
  for (i = 0; i < length - 1; i++) {
    for (j = i + 1; j < length; j++) {
      if (list[i] < list[j]) {
        swap(&list[i], &list[j]);
      }
    }
  }
  for (i = 0; i < length; i++) {
    printf("%d, ", list[i]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecc(%rip),%eax
mov    %eax,-0x10(%rbp)
movl   $0x4,-0x24(%rbp)
movslq -0x24(%rbp),%rcx
mov    $0x14,%eax
xor    %edx,%edx
div    %rcx
mov    %eax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    11a4 <main+0x84>
movslq -0x2c(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%esi
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1174 <main+0x54>
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0x28(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    123e <main+0x11e>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    122b <main+0x10b>
movslq -0x2c(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%eax
movslq -0x30(%rbp),%rcx
cmp    -0x20(%rbp,%rcx,4),%eax
jge    1218 <main+0xf8>
movslq -0x2c(%rbp),%rax
lea    -0x20(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
movslq -0x30(%rbp),%rax
lea    -0x20(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
call   1040 <swap@plt>
jmp    121d <main+0xfd>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11d3 <main+0xb3>
jmp    1230 <main+0x110>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11b9 <main+0x99>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    1275 <main+0x155>
movslq -0x2c(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%esi
lea    0xdb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1245 <main+0x125>
lea    0xd9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    0xecd(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xeb2(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x10(%rsp),%r12
lea    0xeb6(%rip),%rbx
mov    %rbx,%rdi
mov    $0x7e,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%r13
mov    %rbx,%rdi
mov    $0x2b,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%r15
mov    %rbx,%rdi
mov    $0x1a,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rsp),%r14
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x71,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r13,%rdi
mov    %r12,%rsi
call   1050 <swap@plt>
mov    0x8(%rsp),%eax
cmp    0xc(%rsp),%eax
jge    11e6 <main+0xb6>
mov    %r15,%rdi
mov    %r14,%rsi
call   1050 <swap@plt>
mov    0x8(%rsp),%eax
cmp    0x10(%rsp),%eax
jge    11f7 <main+0xc7>
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <swap@plt>
mov    0xc(%rsp),%eax
cmp    0x10(%rsp),%eax
jge    120c <main+0xdc>
mov    %r14,%rdi
mov    %r12,%rsi
call   1050 <swap@plt>
mov    (%rsp),%esi
lea    0xdfe(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@__const.main.list = [5 x i32] [i32 126, i32 43, i32 26, i32 1, i32 113]
@.str = [5 x i8] c"%d, \00"
define void @main() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 126)
%4 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 1
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 43)
%6 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 2
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 26)
%8 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 3
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 1)
%10 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 4
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 113)
%12 = tail call i32 @putchar(i32 10)
%13 = call i32 @swap(i32* %4, i32* %10)
%14 = load i32, i32* %6
%15 = load i32, i32* %8
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %20
17: ; preds = %0
%18 = call i32 @swap(i32* %6, i32* %8)
%19 = load i32, i32* %6
br label %20
20: ; preds = %17, %0
%21 = phi i32 [ %19, %17 ], [ %14, %0 ]
%22 = load i32, i32* %10
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %26
24: ; preds = %20
%25 = call i32 @swap(i32* %6, i32* %10)
br label %26
26: ; preds = %24, %20
%27 = load i32, i32* %8
%28 = load i32, i32* %10
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = call i32 @swap(i32* %8, i32* %10)
br label %32
32: ; preds = %26, %30
%33 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%34 = load i32, i32* %33
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %34)
%36 = load i32, i32* %4
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %36)
%38 = load i32, i32* %6
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %38)
%40 = load i32, i32* %8
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %40)
%42 = load i32, i32* %10
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %42)
%44 = call i32 @putchar(i32 10)
ret void
}