#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*/ free(int *);
int *malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  int i, j;
  int midp = 11 / 2;
  if (midp % 2 == 1)
    midp++;
  int *ia = malloc(11 * sizeof(int));
  j = 0;
  for (i = 0; i < midp; i++) {
    ia[j] = i;
    j += 2;
  }
  j = 1;
  for (i = 11 - 1; i >= midp; i--) {
    ia[j] = i;
    j += 2;
  }
  printf(
      "This is a series of od different ways to travel along a linera array\n");
  printf("First off: bounce from one end to the other until reaching the "
         "middle.\n");
  for (i = 0; i < 11; ++i)
    printf("%i ", ia[i]);
  printf("\n");
  free(ia);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x5,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    116a <main+0x3a>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    $0x2c,%edi
call   1050 <malloc@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11b7 <main+0x87>
mov    -0x14(%rbp),%edx
mov    -0x28(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1186 <main+0x56>
movl   $0x1,-0x18(%rbp)
movl   $0xa,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jl     11f6 <main+0xc6>
mov    -0x14(%rbp),%edx
mov    -0x28(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    11c5 <main+0x95>
lea    0xe03(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0xb,-0x14(%rbp)
jge    124a <main+0x11a>
mov    -0x28(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1219 <main+0xe9>
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x2c,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
movabs $0x600000004,%rax
mov    %rax,0x20(%rbx)
movl   $0x5,0x28(%rbx)
movaps 0xe83(%rip),%xmm0
movups %xmm0,(%rbx)
movaps 0xe89(%rip),%xmm0
movups %xmm0,0x10(%rbx)
lea    0xe92(%rip),%rdi
call   1050 <puts@plt>
lea    0xecb(%rip),%rdi
call   1050 <puts@plt>
mov    (%rbx),%esi
lea    0xe74(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x4(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x8(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [70 x i8] c"This is a series of od different ways to travel along a linera array\0A\00"
@.str.1 = [72 x i8] c"First off: bounce from one end to the other until reaching the middle.\0A\00"
@.str.2 = [4 x i8] c"%i \00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 5, i32* %8
%10 = load i32, i32* %8
%11 = srem i32 %10, 2
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %16
13: ; preds = %2
%14 = load i32, i32* %8
%15 = add nsw i32 %14, 1
store i32 %15, i32* %8
br label %16
16: ; preds = %13, %2
%17 = call i32* @malloc(i32 44)
store i32* %17, i32** %9
store i32 0, i32* %7
store i32 0, i32* %6
br label %18
18: ; preds = %30, %16
%19 = load i32, i32* %6
%20 = load i32, i32* %8
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %33
22: ; preds = %18
%23 = load i32, i32* %6
%24 = load i32*, i32** %9
%25 = load i32, i32* %7
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* %24, i64 %26
store i32 %23, i32* %27
%28 = load i32, i32* %7
%29 = add nsw i32 %28, 2
store i32 %29, i32* %7
br label %30
30: ; preds = %22
%31 = load i32, i32* %6
%32 = add nsw i32 %31, 1
store i32 %32, i32* %6
br label %18
33: ; preds = %18
store i32 1, i32* %7
store i32 10, i32* %6
br label %34
34: ; preds = %46, %33
%35 = load i32, i32* %6
%36 = load i32, i32* %8
%37 = icmp sge i32 %35, %36
br i1 %37, label %38, label %49
38: ; preds = %34
%39 = load i32, i32* %6
%40 = load i32*, i32** %9
%41 = load i32, i32* %7
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i32, i32* %40, i64 %42
store i32 %39, i32* %43
%44 = load i32, i32* %7
%45 = add nsw i32 %44, 2
store i32 %45, i32* %7
br label %46
46: ; preds = %38
%47 = load i32, i32* %6
%48 = add nsw i32 %47, -1
store i32 %48, i32* %6
br label %34
49: ; preds = %34
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0))
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %6
br label %52
52: ; preds = %62, %49
%53 = load i32, i32* %6
%54 = icmp slt i32 %53, 11
br i1 %54, label %55, label %65
55: ; preds = %52
%56 = load i32*, i32** %9
%57 = load i32, i32* %6
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds i32, i32* %56, i64 %58
%60 = load i32, i32* %59
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %60)
br label %62
62: ; preds = %55
%63 = load i32, i32* %6
%64 = add nsw i32 %63, 1
store i32 %64, i32* %6
br label %52
65: ; preds = %52
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%67 = load i32*, i32** %9
%68 = call i32 @free(i32* %67)
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [4 x i8] c"%i \00"
@str = [69 x i8] c"This is a series of od different ways to travel along a linera array\00"
@str.4 = [71 x i8] c"First off: bounce from one end to the other until reaching the middle.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32* @malloc(i32 44)
%4 = getelementptr inbounds i32, i32* %3, i64 2
%5 = getelementptr inbounds i32, i32* %3, i64 4
%6 = getelementptr inbounds i32, i32* %3, i64 8
store i32 4, i32* %6
%7 = getelementptr inbounds i32, i32* %3, i64 10
store i32 5, i32* %7
%8 = getelementptr inbounds i32, i32* %3, i64 1
%9 = bitcast i32* %3 to <4 x i32>*
store <4 x i32> <i32 0, i32 10, i32 1, i32 9>, <4 x i32>* %9
%10 = bitcast i32* %5 to <4 x i32>*
store <4 x i32> <i32 2, i32 8, i32 3, i32 7>, <4 x i32>* %10
%11 = getelementptr inbounds i32, i32* %3, i64 9
store i32 6, i32* %11
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @str, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([71 x i8], [71 x i8]* @str.4, i64 0, i64 0))
%14 = load i32, i32* %3
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %14)
%16 = load i32, i32* %8
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%18 = load i32, i32* %4
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %18)
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 9)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 2)
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 8)
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 3)
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 7)
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 4)
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 6)
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 5)
%28 = tail call i32 @putchar(i32 10)
%29 = tail call i32 @free(i32* %3)
ret i32 0
}