#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 */
typedef int /*<<< orphan*/ nums;

/* Variables and functions */
int /*<<< orphan*/ dump_nums(int *, int);
int /*<<< orphan*/ moveZeroes(int *, int);
int main() {
  int nums[] = {1, 3, 0, 0, 5, 7, 8, 0, 8};
  dump_nums(nums, sizeof(nums) / sizeof((nums)[0]));
  moveZeroes(nums, sizeof(nums) / sizeof((nums)[0]));
  dump_nums(nums, sizeof(nums) / sizeof((nums)[0]));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x24,%edx
call   1030 <memset@plt>
movl   $0x1,-0x30(%rbp)
movl   $0x3,-0x2c(%rbp)
movl   $0x5,-0x20(%rbp)
movl   $0x7,-0x1c(%rbp)
movl   $0x8,-0x18(%rbp)
movl   $0x8,-0x10(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x9,%esi
call   1050 <dump_nums@plt>
lea    -0x30(%rbp),%rdi
mov    $0x9,%esi
call   1040 <moveZeroes@plt>
lea    -0x30(%rbp),%rdi
mov    $0x9,%esi
call   1050 <dump_nums@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movaps %xmm0,0x10(%rsp)
movabs $0x300000001,%rax
mov    %rax,(%rsp)
movabs $0x700000005,%rax
mov    %rax,0x10(%rsp)
movl   $0x8,0x18(%rsp)
movl   $0x8,0x20(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x9,%esi
call   1040 <dump_nums@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
call   1030 <moveZeroes@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
call   1040 <dump_nums@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [9 x i32]
store i32 0, i32* %1
%3 = bitcast [9 x i32]* %2 to i8*
%4 = bitcast i8* %3 to [9 x i32]*
%5 = getelementptr inbounds [9 x i32], [9 x i32]* %4, i32 0, i32 0
store i32 1, i32* %5
%6 = getelementptr inbounds [9 x i32], [9 x i32]* %4, i32 0, i32 1
store i32 3, i32* %6
%7 = getelementptr inbounds [9 x i32], [9 x i32]* %4, i32 0, i32 4
store i32 5, i32* %7
%8 = getelementptr inbounds [9 x i32], [9 x i32]* %4, i32 0, i32 5
store i32 7, i32* %8
%9 = getelementptr inbounds [9 x i32], [9 x i32]* %4, i32 0, i32 6
store i32 8, i32* %9
%10 = getelementptr inbounds [9 x i32], [9 x i32]* %4, i32 0, i32 8
store i32 8, i32* %10
%11 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 0
%12 = call i32 @dump_nums(i32* %11, i32 9)
%13 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 0
%14 = call i32 @moveZeroes(i32* %13, i32 9)
%15 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 0
%16 = call i32 @dump_nums(i32* %15, i32 9)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [9 x i32]
%2 = bitcast [9 x i32]* %1 to i8*
%3 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 0
store i32 1, i32* %3
%4 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 1
store i32 3, i32* %4
%5 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 4
store i32 5, i32* %5
%6 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 5
store i32 7, i32* %6
%7 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 6
store i32 8, i32* %7
%8 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 8
store i32 8, i32* %8
%9 = call i32 @dump_nums(i32* %3, i32 9)
%10 = call i32 @moveZeroes(i32* %3, i32 9)
%11 = call i32 @dump_nums(i32* %3, i32 9)
ret i32 0
}