#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*/ print_array(int *, int);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int my_array[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
  for (int i = 0; i < 10; i++)
    printf("%d, ", my_array[i]);
  printf("\n\n");
  for (int i = 9; i >= 0; i -= 2)
    printf("%d, ", my_array[i]);
  printf("\n\n");
  int temp = my_array[0];
  for (int i = 0; i < 9; i++)
    my_array[i] = my_array[i + 1];
  my_array[9] = temp;
  print_array(my_array, 10);
  temp = my_array[9];
  for (int i = 9; i > 0; i--)
    my_array[i] = my_array[i - 1];
  my_array[0] = temp;
  print_array(my_array, 10);
  for (int i = 0; i < 10 / 2; i++)
    my_array[i] = my_array[9 - i];
  print_array(my_array, 10);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    1189 <main+0x59>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    115b <main+0x2b>
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x9,-0x38(%rbp)
cmpl   $0x0,-0x38(%rbp)
jl     11cc <main+0x9c>
movslq -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x38(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x38(%rbp)
jmp    119e <main+0x6e>
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%eax
mov    %eax,-0x3c(%rbp)
movl   $0x0,-0x40(%rbp)
cmpl   $0x9,-0x40(%rbp)
jge    1213 <main+0xe3>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
cltq
mov    -0x30(%rbp,%rax,4),%ecx
movslq -0x40(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    11e7 <main+0xb7>
mov    -0x3c(%rbp),%eax
mov    %eax,-0xc(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1030 <print_array@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x3c(%rbp)
movl   $0x9,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
jle    1260 <main+0x130>
mov    -0x44(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x30(%rbp,%rax,4),%ecx
movslq -0x44(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x44(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x44(%rbp)
jmp    1234 <main+0x104>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x30(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1030 <print_array@plt>
movl   $0x0,-0x48(%rbp)
cmpl   $0x5,-0x48(%rbp)
jge    12a9 <main+0x179>
mov    $0x9,%eax
sub    -0x48(%rbp),%eax
cltq
mov    -0x30(%rbp,%rax,4),%ecx
movslq -0x48(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    127b <main+0x14b>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1030 <print_array@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    0xee2(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xec6(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeaa(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xec7(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe32(%rip),%r14
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
movups 0x4(%rsp),%xmm0
movups 0x14(%rsp),%xmm1
movaps %xmm1,0x10(%rsp)
movaps %xmm0,(%rsp)
mov    0x24(%rsp),%eax
mov    %eax,0x20(%rsp)
movl   $0x0,0x24(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <print_array@plt>
mov    0x24(%rsp),%eax
mov    0x20(%rsp),%ecx
mov    %ecx,0x24(%rsp)
movaps (%rsp),%xmm0
movaps 0x10(%rsp),%xmm1
movups %xmm0,0x4(%rsp)
movups %xmm1,0x14(%rsp)
mov    %eax,(%rsp)
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <print_array@plt>
movdqu 0x18(%rsp),%xmm0
pshufd $0x1b,%xmm0,%xmm0
movdqa %xmm0,(%rsp)
mov    0x14(%rsp),%eax
mov    %eax,0x10(%rsp)
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <print_array@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@__const.main.my_array = [10 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9]
@.str = [5 x i8] c"%d, \00"
@str.2 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 0)
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 1)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 2)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 3)
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 5)
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 6)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 7)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 8)
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 9)
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.2, i64 0, i64 0))
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 9)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 7)
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 5)
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 3)
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 1)
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.2, i64 0, i64 0))
%26 = bitcast i32* %5 to i8*
store i32 0, i32* %17
%27 = call i32 @print_array(i32* %3, i32 10)
%28 = load i32, i32* %17
store i32 %28, i32* %3
%29 = call i32 @print_array(i32* %3, i32 10)
%30 = bitcast i32* %13 to <4 x i32>*
%31 = load <4 x i32>, <4 x i32>* %30
%32 = shufflevector <4 x i32> %31, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
%33 = bitcast [10 x i32]* %1 to <4 x i32>*
store <4 x i32> %32, <4 x i32>* %33
%34 = load i32, i32* %11
store i32 %34, i32* %9
%35 = call i32 @print_array(i32* %3, i32 10)
ret i32 0
}