#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 */
float polarmoment(float *, float *, float *, int);
float xmoment(float *, float *, int);
float ymoment(float *, float *, int);
void moments(float x[], float y[], float m[], float *ptr_xmoment,
             float *ptr_ymoment, float *ptr_polarmoment, int n) {
  *ptr_xmoment = xmoment(y, m, n);
  *ptr_ymoment = ymoment(x, m, n);
  *ptr_polarmoment = polarmoment(x, y, m, n);
}


x86 assembly (clang, -O0):
<moments>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    0x10(%rbp),%edx
call   1040 <xmoment@plt>
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    0x10(%rbp),%edx
call   1050 <ymoment@plt>
mov    -0x28(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    0x10(%rbp),%ecx
call   1030 <polarmoment@plt>
mov    -0x30(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<moments>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,(%rsp)
mov    %r8,%r15
mov    %rcx,%r12
mov    %rdx,%rbx
mov    %rsi,%r13
mov    %rdi,%rbp
mov    0x40(%rsp),%r14d
mov    %rsi,%rdi
mov    %rdx,%rsi
mov    %r14d,%edx
call   1040 <xmoment@plt>
movss  %xmm0,(%r12)
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1050 <ymoment@plt>
movss  %xmm0,(%r15)
mov    %rbp,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
mov    %r14d,%ecx
call   1030 <polarmoment@plt>
mov    (%rsp),%rax
movss  %xmm0,(%rax)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @moments(float* %0, float* %1, float* %2, float* %3, float* %4, float* %5, i32 %6) {
%8 = alloca float*
%9 = alloca float*
%10 = alloca float*
%11 = alloca float*
%12 = alloca float*
%13 = alloca float*
%14 = alloca i32
store float* %0, float** %8
store float* %1, float** %9
store float* %2, float** %10
store float* %3, float** %11
store float* %4, float** %12
store float* %5, float** %13
store i32 %6, i32* %14
%15 = load float*, float** %9
%16 = load float*, float** %10
%17 = load i32, i32* %14
%18 = call float @xmoment(float* %15, float* %16, i32 %17)
%19 = load float*, float** %11
store float %18, float* %19
%20 = load float*, float** %8
%21 = load float*, float** %10
%22 = load i32, i32* %14
%23 = call float @ymoment(float* %20, float* %21, i32 %22)
%24 = load float*, float** %12
store float %23, float* %24
%25 = load float*, float** %8
%26 = load float*, float** %9
%27 = load float*, float** %10
%28 = load i32, i32* %14
%29 = call float @polarmoment(float* %25, float* %26, float* %27, i32 %28)
%30 = load float*, float** %13
store float %29, float* %30
ret void
}

LLVM IR (-O2):
define void @moments(float* %0, float* %1, float* %2, float* nocapture writeonly %3, float* nocapture writeonly %4, float* nocapture writeonly %5, i32 %6) {
%8 = tail call float @xmoment(float* %1, float* %2, i32 %6)
store float %8, float* %3
%9 = tail call float @ymoment(float* %0, float* %2, i32 %6)
store float %9, float* %4
%10 = tail call float @polarmoment(float* %0, float* %1, float* %2, i32 %6)
store float %10, float* %5
ret void
}