#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*/ NonCentral_TO_Central(int const, double *, double *);
int /*<<< orphan*/ Normalize_Central(int const, double *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ free(double *);
scalar_t__ malloc(int const);
int /*<<< orphan*/ printf(char *);
void Normalize_NonCentral(int const nmb_mom, double nc_mom[]) {
  double *c_mom;
  int i;
  if ((c_mom = (double *)malloc(nmb_mom * sizeof(double))) == NULL) {
    printf("\nNOT ENOUGH MEMORY!\n\n");
    exit(1);
  };
  NonCentral_TO_Central(nmb_mom, nc_mom, c_mom);
  Normalize_Central(nmb_mom, c_mom);
  for (i = 0; i < nmb_mom; i++)
    nc_mom[i] = c_mom[i];
  free(c_mom);
  return;
}


x86 assembly (clang, -O0):
<Normalize_NonCentral>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    11a2 <Normalize_NonCentral+0x42>
lea    0xe6d(%rip),%rdi
call   1060 <printf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1050 <NonCentral_TO_Central@plt>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1040 <Normalize_Central@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11f9 <Normalize_NonCentral+0x99>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11c5 <Normalize_NonCentral+0x65>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Normalize_NonCentral>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%r15d
lea    0x0(,%r15,8),%edi
call   1070 <malloc@plt>
test   %rax,%rax
je     1321 <Normalize_NonCentral+0x1c1>
mov    %rax,%rbx
mov    %r15d,%edi
mov    %r14,%rsi
mov    %rax,%rdx
call   1060 <NonCentral_TO_Central@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
call   1050 <Normalize_Central@plt>
test   %r15d,%r15d
jle    1314 <Normalize_NonCentral+0x1b4>
mov    %r15d,%eax
cmp    $0x4,%r15d
jb     11c5 <Normalize_NonCentral+0x65>
lea    (%rbx,%rax,8),%rcx
cmp    %r14,%rcx
jbe    1240 <Normalize_NonCentral+0xe0>
lea    (%r14,%rax,8),%rcx
cmp    %rcx,%rbx
jae    1240 <Normalize_NonCentral+0xe0>
xor    %ecx,%ecx
mov    %rcx,%rdx
not    %rdx
add    %rax,%rdx
mov    %rax,%rsi
and    $0x3,%rsi
je     11f5 <Normalize_NonCentral+0x95>
nopl   0x0(%rax)
movsd  (%rbx,%rcx,8),%xmm0
movsd  %xmm0,(%r14,%rcx,8)
add    $0x1,%rcx
add    $0xffffffffffffffff,%rsi
jne    11e0 <Normalize_NonCentral+0x80>
cmp    $0x3,%rdx
jb     1314 <Normalize_NonCentral+0x1b4>
nop
movsd  (%rbx,%rcx,8),%xmm0
movsd  %xmm0,(%r14,%rcx,8)
movsd  0x8(%rbx,%rcx,8),%xmm0
movsd  %xmm0,0x8(%r14,%rcx,8)
movsd  0x10(%rbx,%rcx,8),%xmm0
movsd  %xmm0,0x10(%r14,%rcx,8)
movsd  0x18(%rbx,%rcx,8),%xmm0
movsd  %xmm0,0x18(%r14,%rcx,8)
add    $0x4,%rcx
cmp    %rcx,%rax
jne    1200 <Normalize_NonCentral+0xa0>
jmp    1314 <Normalize_NonCentral+0x1b4>
mov    %eax,%ecx
and    $0xfffffffc,%ecx
lea    -0x4(%rcx),%rdx
mov    %rdx,%rsi
shr    $0x2,%rsi
add    $0x1,%rsi
mov    %esi,%r8d
and    $0x3,%r8d
cmp    $0xc,%rdx
jae    1265 <Normalize_NonCentral+0x105>
xor    %edi,%edi
jmp    12d0 <Normalize_NonCentral+0x170>
and    $0xfffffffffffffffc,%rsi
xor    %edi,%edi
nopl   0x0(%rax,%rax,1)
movups (%rbx,%rdi,8),%xmm0
movups 0x10(%rbx,%rdi,8),%xmm1
movups %xmm0,(%r14,%rdi,8)
movups %xmm1,0x10(%r14,%rdi,8)
movups 0x20(%rbx,%rdi,8),%xmm0
movups 0x30(%rbx,%rdi,8),%xmm1
movups %xmm0,0x20(%r14,%rdi,8)
movups %xmm1,0x30(%r14,%rdi,8)
movups 0x40(%rbx,%rdi,8),%xmm0
movups 0x50(%rbx,%rdi,8),%xmm1
movups %xmm0,0x40(%r14,%rdi,8)
movups %xmm1,0x50(%r14,%rdi,8)
movups 0x60(%rbx,%rdi,8),%xmm0
movups 0x70(%rbx,%rdi,8),%xmm1
movups %xmm0,0x60(%r14,%rdi,8)
movups %xmm1,0x70(%r14,%rdi,8)
add    $0x10,%rdi
add    $0xfffffffffffffffc,%rsi
jne    1270 <Normalize_NonCentral+0x110>
test   %r8,%r8
je     130b <Normalize_NonCentral+0x1ab>
lea    (%r14,%rdi,8),%rsi
add    $0x10,%rsi
lea    (%rbx,%rdi,8),%rdi
add    $0x10,%rdi
shl    $0x5,%r8
xor    %edx,%edx
nopl   0x0(%rax,%rax,1)
movups -0x10(%rdi,%rdx,1),%xmm0
movups (%rdi,%rdx,1),%xmm1
movups %xmm0,-0x10(%rsi,%rdx,1)
movups %xmm1,(%rsi,%rdx,1)
add    $0x20,%rdx
cmp    %rdx,%r8
jne    12f0 <Normalize_NonCentral+0x190>
cmp    %rax,%rcx
jne    11c7 <Normalize_NonCentral+0x67>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>
lea    0xcd8(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"\0ANOT ENOUGH MEMORY!\0A\0A\00"
define void @Normalize_NonCentral(i32 %0, double* %1) {
%3 = alloca i32
%4 = alloca double*
%5 = alloca double*
%6 = alloca i32
store i32 %0, i32* %3
store double* %1, double** %4
%7 = load i32, i32* %3
%8 = sext i32 %7 to i64
%9 = mul i64 %8, 8
%10 = trunc i64 %9 to i32
%11 = call i64 @malloc(i32 %10)
%12 = inttoptr i64 %11 to double*
store double* %12, double** %5
%13 = icmp eq double* %12, null
br i1 %13, label %14, label %17
14: ; preds = %2
%15 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @exit(i32 1)
unreachable
17: ; preds = %2
%18 = load i32, i32* %3
%19 = load double*, double** %4
%20 = load double*, double** %5
%21 = call i32 @NonCentral_TO_Central(i32 %18, double* %19, double* %20)
%22 = load i32, i32* %3
%23 = load double*, double** %5
%24 = call i32 @Normalize_Central(i32 %22, double* %23)
store i32 0, i32* %6
br label %25
25: ; preds = %39, %17
%26 = load i32, i32* %6
%27 = load i32, i32* %3
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %42
29: ; preds = %25
%30 = load double*, double** %5
%31 = load i32, i32* %6
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds double, double* %30, i64 %32
%34 = load double, double* %33
%35 = load double*, double** %4
%36 = load i32, i32* %6
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds double, double* %35, i64 %37
store double %34, double* %38
br label %39
39: ; preds = %29
%40 = load i32, i32* %6
%41 = add nsw i32 %40, 1
store i32 %41, i32* %6
br label %25
42: ; preds = %25
%43 = load double*, double** %5
%44 = call i32 @free(double* %43)
ret void
}

LLVM IR (-O2):
@str = [21 x i8] c"\0ANOT ENOUGH MEMORY!\0A\00"
define void @Normalize_NonCentral(i32 %0, double* %1) {
%3 = shl i32 %0, 3
%4 = tail call i64 @malloc(i32 %3)
%5 = inttoptr i64 %4 to double*
%6 = inttoptr i64 %4 to i8*
%7 = icmp eq i64 %4, 0
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %2
%12 = tail call i32 @NonCentral_TO_Central(i32 %0, double* %1, double* %5)
%13 = tail call i32 @Normalize_Central(i32 %0, double* %5)
%14 = icmp sgt i32 %0, 0
br i1 %14, label %15, label %141
15: ; preds = %11
%16 = zext i32 %0 to i64
%17 = icmp ult i32 %0, 4
br i1 %17, label %104, label %18
18: ; preds = %15
%19 = getelementptr double, double* %1, i64 %16
%20 = bitcast double* %19 to i8*
%21 = getelementptr double, double* %5, i64 %16
%22 = icmp ugt double* %21, %1
%23 = icmp ult i8* %6, %20
%24 = and i1 %22, %23
br i1 %24, label %104, label %25
25: ; preds = %18
%26 = and i64 %16, 4294967292
%27 = add nsw i64 %26, -4
%28 = lshr exact i64 %27, 2
%29 = add nuw nsw i64 %28, 1
%30 = and i64 %29, 3
%31 = icmp ult i64 %27, 12
br i1 %31, label %83, label %32
32: ; preds = %25
%33 = and i64 %29, 9223372036854775804
br label %34
34: ; preds = %34, %32
%35 = phi i64 [ 0, %32 ], [ %80, %34 ]
%36 = phi i64 [ 0, %32 ], [ %81, %34 ]
%37 = getelementptr inbounds double, double* %5, i64 %35
%38 = bitcast double* %37 to <2 x double>*
%39 = load <2 x double>, <2 x double>* %38
%40 = getelementptr inbounds double, double* %37, i64 2
%41 = bitcast double* %40 to <2 x double>*
%42 = load <2 x double>, <2 x double>* %41
%43 = getelementptr inbounds double, double* %1, i64 %35
%44 = bitcast double* %43 to <2 x double>*
store <2 x double> %39, <2 x double>* %44
%45 = getelementptr inbounds double, double* %43, i64 2
%46 = bitcast double* %45 to <2 x double>*
store <2 x double> %42, <2 x double>* %46
%47 = or i64 %35, 4
%48 = getelementptr inbounds double, double* %5, i64 %47
%49 = bitcast double* %48 to <2 x double>*
%50 = load <2 x double>, <2 x double>* %49
%51 = getelementptr inbounds double, double* %48, i64 2
%52 = bitcast double* %51 to <2 x double>*
%53 = load <2 x double>, <2 x double>* %52
%54 = getelementptr inbounds double, double* %1, i64 %47
%55 = bitcast double* %54 to <2 x double>*
store <2 x double> %50, <2 x double>* %55
%56 = getelementptr inbounds double, double* %54, i64 2
%57 = bitcast double* %56 to <2 x double>*
store <2 x double> %53, <2 x double>* %57
%58 = or i64 %35, 8
%59 = getelementptr inbounds double, double* %5, i64 %58
%60 = bitcast double* %59 to <2 x double>*
%61 = load <2 x double>, <2 x double>* %60
%62 = getelementptr inbounds double, double* %59, i64 2
%63 = bitcast double* %62 to <2 x double>*
%64 = load <2 x double>, <2 x double>* %63
%65 = getelementptr inbounds double, double* %1, i64 %58
%66 = bitcast double* %65 to <2 x double>*
store <2 x double> %61, <2 x double>* %66
%67 = getelementptr inbounds double, double* %65, i64 2
%68 = bitcast double* %67 to <2 x double>*
store <2 x double> %64, <2 x double>* %68
%69 = or i64 %35, 12
%70 = getelementptr inbounds double, double* %5, i64 %69
%71 = bitcast double* %70 to <2 x double>*
%72 = load <2 x double>, <2 x double>* %71
%73 = getelementptr inbounds double, double* %70, i64 2
%74 = bitcast double* %73 to <2 x double>*
%75 = load <2 x double>, <2 x double>* %74
%76 = getelementptr inbounds double, double* %1, i64 %69
%77 = bitcast double* %76 to <2 x double>*
store <2 x double> %72, <2 x double>* %77
%78 = getelementptr inbounds double, double* %76, i64 2
%79 = bitcast double* %78 to <2 x double>*
store <2 x double> %75, <2 x double>* %79
%80 = add nuw i64 %35, 16
%81 = add nuw i64 %36, 4
%82 = icmp eq i64 %81, %33
br i1 %82, label %83, label %34
83: ; preds = %34, %25
%84 = phi i64 [ 0, %25 ], [ %80, %34 ]
%85 = icmp eq i64 %30, 0
br i1 %85, label %102, label %86
86: ; preds = %83, %86
%87 = phi i64 [ %99, %86 ], [ %84, %83 ]
%88 = phi i64 [ %100, %86 ], [ 0, %83 ]
%89 = getelementptr inbounds double, double* %5, i64 %87
%90 = bitcast double* %89 to <2 x double>*
%91 = load <2 x double>, <2 x double>* %90
%92 = getelementptr inbounds double, double* %89, i64 2
%93 = bitcast double* %92 to <2 x double>*
%94 = load <2 x double>, <2 x double>* %93
%95 = getelementptr inbounds double, double* %1, i64 %87
%96 = bitcast double* %95 to <2 x double>*
store <2 x double> %91, <2 x double>* %96
%97 = getelementptr inbounds double, double* %95, i64 2
%98 = bitcast double* %97 to <2 x double>*
store <2 x double> %94, <2 x double>* %98
%99 = add nuw i64 %87, 4
%100 = add i64 %88, 1
%101 = icmp eq i64 %100, %30
br i1 %101, label %102, label %86
102: ; preds = %86, %83
%103 = icmp eq i64 %26, %16
br i1 %103, label %141, label %104
104: ; preds = %18, %15, %102
%105 = phi i64 [ 0, %18 ], [ 0, %15 ], [ %26, %102 ]
%106 = xor i64 %105, -1
%107 = add nsw i64 %106, %16
%108 = and i64 %16, 3
%109 = icmp eq i64 %108, 0
br i1 %109, label %119, label %110
110: ; preds = %104, %110
%111 = phi i64 [ %116, %110 ], [ %105, %104 ]
%112 = phi i64 [ %117, %110 ], [ 0, %104 ]
%113 = getelementptr inbounds double, double* %5, i64 %111
%114 = load double, double* %113
%115 = getelementptr inbounds double, double* %1, i64 %111
store double %114, double* %115
%116 = add nuw nsw i64 %111, 1
%117 = add i64 %112, 1
%118 = icmp eq i64 %117, %108
br i1 %118, label %119, label %110
119: ; preds = %110, %104
%120 = phi i64 [ %105, %104 ], [ %116, %110 ]
%121 = icmp ult i64 %107, 3
br i1 %121, label %141, label %122
122: ; preds = %119, %122
%123 = phi i64 [ %139, %122 ], [ %120, %119 ]
%124 = getelementptr inbounds double, double* %5, i64 %123
%125 = load double, double* %124
%126 = getelementptr inbounds double, double* %1, i64 %123
store double %125, double* %126
%127 = add nuw nsw i64 %123, 1
%128 = getelementptr inbounds double, double* %5, i64 %127
%129 = load double, double* %128
%130 = getelementptr inbounds double, double* %1, i64 %127
store double %129, double* %130
%131 = add nuw nsw i64 %123, 2
%132 = getelementptr inbounds double, double* %5, i64 %131
%133 = load double, double* %132
%134 = getelementptr inbounds double, double* %1, i64 %131
store double %133, double* %134
%135 = add nuw nsw i64 %123, 3
%136 = getelementptr inbounds double, double* %5, i64 %135
%137 = load double, double* %136
%138 = getelementptr inbounds double, double* %1, i64 %135
store double %137, double* %138
%139 = add nuw nsw i64 %123, 4
%140 = icmp eq i64 %139, %16
br i1 %140, label %141, label %122
141: ; preds = %119, %122, %102, %11
%142 = tail call i32 @free(double* %5)
ret void
}