#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 RemoveZeroes(int *, int);
int main(int argc, char *argv[]) {
  int size = 10;
  int a[] = {1, 0, 2, 0, 3, 0, 4, 0, 5, 0};
  int b[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  int c[] = {1, 1, 2, 1, 3, 1, 4, 1, 5, 1};
  size = RemoveZeroes(a, size);
  size = RemoveZeroes(b, size);
  size = RemoveZeroes(c, size);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xa,-0x14(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1030 <memset@plt>
movl   $0x1,-0x40(%rbp)
movl   $0x2,-0x38(%rbp)
movl   $0x3,-0x30(%rbp)
movl   $0x4,-0x28(%rbp)
movl   $0x5,-0x20(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1030 <memset@plt>
lea    -0xa0(%rbp),%rdi
lea    0xe66(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
lea    -0x40(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <RemoveZeroes@plt>
mov    %eax,-0x14(%rbp)
lea    -0x70(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <RemoveZeroes@plt>
mov    %eax,-0x14(%rbp)
lea    -0xa0(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <RemoveZeroes@plt>
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x88,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x20(%rsp)
movl   $0x1,(%rsp)
movl   $0x2,0x8(%rsp)
movl   $0x3,0x10(%rsp)
movl   $0x4,0x18(%rsp)
movl   $0x5,0x20(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movq   $0x0,0x80(%rsp)
mov    0xeb0(%rip),%rax
mov    %rax,0x50(%rsp)
movaps 0xe94(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xe78(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
mov    %rsp,%rdi
mov    $0xa,%esi
call   1030 <RemoveZeroes@plt>
lea    0x60(%rsp),%rdi
mov    %eax,%esi
call   1030 <RemoveZeroes@plt>
lea    0x30(%rsp),%rdi
mov    %eax,%esi
call   1030 <RemoveZeroes@plt>
xor    %eax,%eax
add    $0x88,%rsp
ret

LLVM IR (-O0):
@__const.main.c = [10 x i32] [i32 1, i32 1, i32 2, i32 1, i32 3, i32 1, i32 4, i32 1, i32 5, i32 1]
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca [10 x i32]
%7 = alloca [10 x i32]
%8 = alloca [10 x i32]
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 10, i32* %5
%9 = bitcast [10 x i32]* %6 to i8*
%10 = bitcast i8* %9 to [10 x i32]*
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %10, i32 0, i32 0
store i32 1, i32* %11
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %10, i32 0, i32 2
store i32 2, i32* %12
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %10, i32 0, i32 4
store i32 3, i32* %13
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %10, i32 0, i32 6
store i32 4, i32* %14
%15 = getelementptr inbounds [10 x i32], [10 x i32]* %10, i32 0, i32 8
store i32 5, i32* %15
%16 = bitcast [10 x i32]* %7 to i8*
%17 = bitcast [10 x i32]* %8 to i8*
%18 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 0
%19 = load i32, i32* %5
%20 = call i32 @RemoveZeroes(i32* %18, i32 %19)
store i32 %20, i32* %5
%21 = getelementptr inbounds [10 x i32], [10 x i32]* %7, i64 0, i64 0
%22 = load i32, i32* %5
%23 = call i32 @RemoveZeroes(i32* %21, i32 %22)
store i32 %23, i32* %5
%24 = getelementptr inbounds [10 x i32], [10 x i32]* %8, i64 0, i64 0
%25 = load i32, i32* %5
%26 = call i32 @RemoveZeroes(i32* %24, i32 %25)
store i32 %26, i32* %5
ret i32 0
}

LLVM IR (-O2):
@__const.main.c = [10 x i32] [i32 1, i32 1, i32 2, i32 1, i32 3, i32 1, i32 4, i32 1, i32 5, i32 1]
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [10 x i32]
%4 = alloca [10 x i32]
%5 = alloca [10 x i32]
%6 = bitcast [10 x i32]* %3 to i8*
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
store i32 1, i32* %7
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 2
store i32 2, i32* %8
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 4
store i32 3, i32* %9
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 6
store i32 4, i32* %10
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 8
store i32 5, i32* %11
%12 = bitcast [10 x i32]* %4 to i8*
%13 = bitcast [10 x i32]* %5 to i8*
%14 = call i32 @RemoveZeroes(i32* %7, i32 10)
%15 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 0
%16 = call i32 @RemoveZeroes(i32* %15, i32 %14)
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 0
%18 = call i32 @RemoveZeroes(i32* %17, i32 %16)
ret i32 0
}