#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*/ moveZeroes(int *, int);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int arr1[] = {0, 1, 0, 3, 12};
  int arr2[] = {1, 2, 3, 4, 5};
  int arr3[] = {0, 0, 0, 0, 1};
  int arr4[] = {1, 0};
  moveZeroes(arr1, 5);
  moveZeroes(arr2, 5);
  moveZeroes(arr3, 5);
  moveZeroes(arr4, 2);
  for (int i = 0; i < 5; i++) {
    printf("%d ", arr1[i]);
  }
  printf("\n");
  for (int i = 0; i < 5; i++) {
    printf("%d ", arr2[i]);
  }
  printf("\n");
  for (int i = 0; i < 5; i++) {
    printf("%d ", arr3[i]);
  }
  printf("\n");
  for (int i = 0; i < 2; i++) {
    printf("%d ", arr4[i]);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec2(%rip),%eax
mov    %eax,-0x10(%rbp)
mov    0xec8(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xec5(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xec3(%rip),%eax
mov    %eax,-0x30(%rbp)
mov    0xec9(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xec6(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    0xec4(%rip),%eax
mov    %eax,-0x50(%rbp)
mov    0xebe(%rip),%rax
mov    %rax,-0x68(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1040 <moveZeroes@plt>
lea    -0x40(%rbp),%rdi
mov    $0x5,%esi
call   1040 <moveZeroes@plt>
lea    -0x60(%rbp),%rdi
mov    $0x5,%esi
call   1040 <moveZeroes@plt>
lea    -0x68(%rbp),%rdi
mov    $0x2,%esi
call   1040 <moveZeroes@plt>
movl   $0x0,-0x6c(%rbp)
cmpl   $0x5,-0x6c(%rbp)
jge    1207 <main+0xe7>
movslq -0x6c(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%esi
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    11d9 <main+0xb9>
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x70(%rbp)
cmpl   $0x5,-0x70(%rbp)
jge    124a <main+0x12a>
movslq -0x70(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%esi
lea    0xe27(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x70(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x70(%rbp)
jmp    121c <main+0xfc>
lea    0xe0f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x74(%rbp)
cmpl   $0x5,-0x74(%rbp)
jge    128d <main+0x16d>
movslq -0x74(%rbp),%rax
mov    -0x60(%rbp,%rax,4),%esi
lea    0xde4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    125f <main+0x13f>
lea    0xdcc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x78(%rbp)
cmpl   $0x2,-0x78(%rbp)
jge    12d0 <main+0x1b0>
movslq -0x78(%rbp),%rax
mov    -0x68(%rbp,%rax,4),%esi
lea    0xda1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    12a2 <main+0x182>
lea    0xd89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
mov    0xed5(%rip),%eax
mov    %eax,0x60(%rsp)
movaps 0xeba(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
mov    0xedf(%rip),%eax
mov    %eax,0x40(%rsp)
movaps 0xec4(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
mov    0xee9(%rip),%eax
mov    %eax,0x20(%rsp)
movaps 0xece(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movq   $0x1,0x8(%rsp)
lea    0x50(%rsp),%rdi
mov    $0x5,%esi
call   1050 <moveZeroes@plt>
lea    0x30(%rsp),%rdi
mov    $0x5,%esi
call   1050 <moveZeroes@plt>
lea    0x10(%rsp),%rdi
mov    $0x5,%esi
call   1050 <moveZeroes@plt>
lea    0x8(%rsp),%rdi
mov    $0x2,%esi
call   1050 <moveZeroes@plt>
mov    0x50(%rsp),%esi
lea    0xe8d(%rip),%rbx
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    0x5c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x60(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@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    0x3c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x40(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@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    0x1c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x20(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@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    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

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