#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*/ eye(size_t, double **);
int /*<<< orphan*/ ones(size_t, double **);
int /*<<< orphan*/ scale(size_t, size_t, double **, double);
int /*<<< orphan*/ sub(size_t, size_t, double **, double **, double **);
void centers(size_t n, double X[n][n]) {
  double I[n][n], O[n][n];
  eye(n, I);
  ones(n, O);
  scale(n, n, O, 1.0 / n);
  sub(n, n, I, O, X);
}


x86 assembly (clang, -O0):
<centers>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rcx
imul   %rcx,%rcx
lea    0xf(,%rcx,8),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rsi
sub    %rcx,%rsi
mov    %rsi,-0x48(%rbp)
mov    %rsi,%rsp
mov    %rax,-0x20(%rbp)
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
imul   %rcx,%rcx
lea    0xf(,%rcx,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x50(%rbp)
mov    %rcx,%rsp
mov    %rcx,-0x40(%rbp)
mov    %rax,-0x30(%rbp)
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <eye@plt>
mov    -0x50(%rbp),%rsi
mov    -0x8(%rbp),%rdi
call   1030 <ones@plt>
mov    -0x50(%rbp),%rdx
mov    -0x8(%rbp),%rsi
mov    %rsi,%rdi
movq   %rsi,%xmm1
movaps 0xe30(%rip),%xmm0
punpckldq %xmm0,%xmm1
movapd 0xe34(%rip),%xmm0
subpd  %xmm0,%xmm1
movaps %xmm1,%xmm0
unpckhpd %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  0xdfd(%rip),%xmm0
divsd  %xmm1,%xmm0
call   1050 <scale@plt>
mov    -0x48(%rbp),%rdx
mov    -0x40(%rbp),%rcx
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%r8
call   1060 <sub@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<centers>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rdi,%rax
imul   %rdi,%rax
mov    %rsp,%r15
lea    0xf(,%rax,8),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
mov    %rsp,%r12
sub    %rax,%r12
mov    %r12,%rsp
mov    %r15,%rsi
call   1040 <eye@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1030 <ones@plt>
movq   %rbx,%xmm0
punpckldq 0xe6a(%rip),%xmm0
subpd  0xe72(%rip),%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
movsd  0xe6e(%rip),%xmm0
divsd  %xmm1,%xmm0
mov    %rbx,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1050 <scale@plt>
mov    %rbx,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
mov    %r14,%r8
call   1060 <sub@plt>
lea    -0x20(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @centers(i64 %0, double* %1) {
%3 = alloca i64
%4 = alloca double*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
store i64 %0, i64* %3
store double* %1, double** %4
%10 = load i64, i64* %3
%11 = load i64, i64* %3
%12 = load i64, i64* %3
%13 = load i64, i64* %3
%14 = call i8* @llvm.stacksave()
store i8* %14, i8** %5
%15 = mul nuw i64 %12, %13
%16 = alloca double, i64 %15
store i64 %12, i64* %6
store i64 %13, i64* %7
%17 = load i64, i64* %3
%18 = load i64, i64* %3
%19 = mul nuw i64 %17, %18
%20 = alloca double, i64 %19
store i64 %17, i64* %8
store i64 %18, i64* %9
%21 = load i64, i64* %3
%22 = bitcast double* %16 to double**
%23 = call i32 @eye(i64 %21, double** %22)
%24 = load i64, i64* %3
%25 = bitcast double* %20 to double**
%26 = call i32 @ones(i64 %24, double** %25)
%27 = load i64, i64* %3
%28 = load i64, i64* %3
%29 = bitcast double* %20 to double**
%30 = load i64, i64* %3
%31 = uitofp i64 %30 to double
%32 = fdiv double 1.000000e+00, %31
%33 = call i32 @scale(i64 %27, i64 %28, double** %29, double %32)
%34 = load i64, i64* %3
%35 = load i64, i64* %3
%36 = bitcast double* %16 to double**
%37 = bitcast double* %20 to double**
%38 = load double*, double** %4
%39 = bitcast double* %38 to double**
%40 = call i32 @sub(i64 %34, i64 %35, double** %36, double** %37, double** %39)
%41 = load i8*, i8** %5
ret void
}

LLVM IR (-O2):
define void @centers(i64 %0, double* %1) {
%3 = mul nuw i64 %0, %0
%4 = alloca double*, i64 %3
%5 = alloca double*, i64 %3
%6 = call i32 @eye(i64 %0, double** %4)
%7 = call i32 @ones(i64 %0, double** %5)
%8 = uitofp i64 %0 to double
%9 = fdiv double 1.000000e+00, %8
%10 = call i32 @scale(i64 %0, i64 %0, double** %5, double %9)
%11 = bitcast double* %1 to double**
%12 = call i32 @sub(i64 %0, i64 %0, double** %4, double** %5, double** %11)
ret void
}