#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 /*<<< orphan*/ simple_sort(int *, int);
int main() {
  int i;
  int x[] = {1, 2, 3, 4, 5, 6, 7};
  int y[] = {7, 6, 5, 4, 3, 2, 1};
  int z[] = {4, 2, 6, 7, 5, 1, 3};
  simple_sort(x, 7);
  for (i = 0; i < 7; i++) {
    printf("%d ", x[i]);
  }
  printf("\n");
  simple_sort(y, 7);
  for (i = 0; i < 7; i++) {
    printf("%d ", y[i]);
  }
  printf("\n");
  simple_sort(z, 7);
  for (i = 0; i < 7; i++) {
    printf("%d ", z[i]);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec2(%rip),%eax
mov    %eax,-0x18(%rbp)
mov    0xec0(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xebd(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xeb8(%rip),%eax
mov    %eax,-0x38(%rbp)
mov    0xeb6(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0xeb3(%rip),%rax
mov    %rax,-0x68(%rbp)
mov    0xeb0(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xeae(%rip),%eax
mov    %eax,-0x58(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x7,%esi
call   1040 <simple_sort@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x7,-0x8(%rbp)
jge    11f0 <main+0xd0>
movslq -0x8(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11c2 <main+0xa2>
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x50(%rbp),%rdi
mov    $0x7,%esi
call   1040 <simple_sort@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x7,-0x8(%rbp)
jge    1241 <main+0x121>
movslq -0x8(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%esi
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1213 <main+0xf3>
lea    0xe18(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x70(%rbp),%rdi
mov    $0x7,%esi
call   1040 <simple_sort@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x7,-0x8(%rbp)
jge    1292 <main+0x172>
movslq -0x8(%rbp),%rax
mov    -0x70(%rbp,%rax,4),%esi
lea    0xddf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1264 <main+0x144>
lea    0xdc7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x60,%rsp
movups 0xed0(%rip),%xmm0
movups %xmm0,0x4c(%rsp)
movaps 0xeb8(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movups 0xed8(%rip),%xmm0
movups %xmm0,0x2c(%rsp)
movaps 0xec0(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movups 0xee0(%rip),%xmm0
movups %xmm0,0xc(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x40(%rsp),%rdi
mov    $0x7,%esi
call   1050 <simple_sort@plt>
mov    0x40(%rsp),%esi
lea    0xec6(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x44(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x48(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x50(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x54(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x58(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x20(%rsp),%rdi
mov    $0x7,%esi
call   1050 <simple_sort@plt>
mov    0x20(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x24(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x28(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x30(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x34(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x38(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rsp,%rdi
mov    $0x7,%esi
call   1050 <simple_sort@plt>
mov    (%rsp),%esi
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    0x14(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
ret

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