#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 movesToMakeZigzag(int *, int);
int /*<<< orphan*/ printf(char *, int, int, int);
int main() {
  int a[3] = {1, 2, 3};
  int b[5] = {9, 6, 1, 6, 2};
  int c[7] = {7, 4, 8, 9, 7, 7, 5};
  int cnts = movesToMakeZigzag(a, 3);
  int cnts1 = movesToMakeZigzag(b, 5);
  int cnts2 = movesToMakeZigzag(c, 7);
  printf("%d %d %d\n", cnts, cnts1, cnts2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec8(%rip),%eax
mov    %eax,-0x8(%rbp)
mov    0xec6(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec3(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xec1(%rip),%eax
mov    %eax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xec1(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xebf(%rip),%eax
mov    %eax,-0x38(%rbp)
lea    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   1030 <movesToMakeZigzag@plt>
mov    %eax,-0x54(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x5,%esi
call   1030 <movesToMakeZigzag@plt>
mov    %eax,-0x58(%rbp)
lea    -0x50(%rbp),%rdi
mov    $0x7,%esi
call   1030 <movesToMakeZigzag@plt>
mov    %eax,-0x5c(%rbp)
mov    -0x54(%rbp),%esi
mov    -0x58(%rbp),%edx
mov    -0x5c(%rbp),%ecx
lea    0xe7d(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x58,%rsp
mov    0xedc(%rip),%eax
mov    %eax,0x8(%rsp)
mov    0xec9(%rip),%rax
mov    %rax,(%rsp)
mov    0xedf(%rip),%eax
mov    %eax,0x20(%rsp)
movaps 0xec4(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movups 0xee4(%rip),%xmm0
movups %xmm0,0x3c(%rsp)
movaps 0xecc(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
mov    %rsp,%rdi
mov    $0x3,%esi
call   1030 <movesToMakeZigzag@plt>
mov    %eax,%ebx
lea    0x10(%rsp),%rdi
mov    $0x5,%esi
call   1030 <movesToMakeZigzag@plt>
mov    %eax,%ebp
lea    0x30(%rsp),%rdi
mov    $0x7,%esi
call   1030 <movesToMakeZigzag@plt>
lea    0xead(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %eax,%ecx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.a = [3 x i32] [i32 1, i32 2, i32 3]
@__const.main.b = [5 x i32] [i32 9, i32 6, i32 1, i32 6, i32 2]
@__const.main.c = [7 x i32] [i32 7, i32 4, i32 8, i32 9, i32 7, i32 7, i32 5]
@.str = [10 x i8] c"%d %d %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i32]
%3 = alloca [5 x i32]
%4 = alloca [7 x i32]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = bitcast [3 x i32]* %2 to i8*
%9 = bitcast [5 x i32]* %3 to i8*
%10 = bitcast [7 x i32]* %4 to i8*
%11 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%12 = call i32 @movesToMakeZigzag(i32* %11, i32 3)
store i32 %12, i32* %5
%13 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%14 = call i32 @movesToMakeZigzag(i32* %13, i32 5)
store i32 %14, i32* %6
%15 = getelementptr inbounds [7 x i32], [7 x i32]* %4, i64 0, i64 0
%16 = call i32 @movesToMakeZigzag(i32* %15, i32 7)
store i32 %16, i32* %7
%17 = load i32, i32* %5
%18 = load i32, i32* %6
%19 = load i32, i32* %7
%20 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %17, i32 %18, i32 %19)
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [3 x i32] [i32 1, i32 2, i32 3]
@__const.main.b = [5 x i32] [i32 9, i32 6, i32 1, i32 6, i32 2]
@__const.main.c = [7 x i32] [i32 7, i32 4, i32 8, i32 9, i32 7, i32 7, i32 5]
@.str = [10 x i8] c"%d %d %d\0A\00"
define i32 @main() {
%1 = alloca [3 x i32]
%2 = alloca [5 x i32]
%3 = alloca [7 x i32]
%4 = bitcast [3 x i32]* %1 to i8*
%5 = bitcast [5 x i32]* %2 to i8*
%6 = bitcast [7 x i32]* %3 to i8*
%7 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%8 = call i32 @movesToMakeZigzag(i32* %7, i32 3)
%9 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%10 = call i32 @movesToMakeZigzag(i32* %9, i32 5)
%11 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 0
%12 = call i32 @movesToMakeZigzag(i32* %11, i32 7)
%13 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %10, i32 %12)
ret i32 0
}