#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*/ exit(int);
int /*<<< orphan*/ printf(char *);
void deleteTranslation(int nDim, double *dR) {
  double dx = 0.0, dy = 0.0, dz = 0.0;
  int N;
  int i;
  if (nDim % 3 != 0) {
    printf("deleteTranslation: error nDim not multiple of 3\n");
    exit(-1);
  }
  N = nDim / 3;
  for (i = 0; i < N; i++) {
    dx += dR[i * 3 + 0] / N;
    dy += dR[i * 3 + 1] / N;
    dz += dR[i * 3 + 2] / N;
  }
  for (i = 0; i < N; i++) {
    dR[i * 3 + 0] -= dx;
    dR[i * 3 + 1] -= dy;
    dR[i * 3 + 2] -= dz;
  }
}


x86 assembly (clang, -O0):
<deleteTranslation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1171 <deleteTranslation+0x51>
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>
mov    -0x4(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    1212 <deleteTranslation+0xf2>
mov    -0x10(%rbp),%rax
imul   $0x3,-0x30(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
cvtsi2sdl -0x2c(%rbp),%xmm1
divsd  %xmm1,%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
imul   $0x3,-0x30(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
cvtsi2sdl -0x2c(%rbp),%xmm1
divsd  %xmm1,%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
imul   $0x3,-0x30(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
cvtsi2sdl -0x2c(%rbp),%xmm1
divsd  %xmm1,%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1186 <deleteTranslation+0x66>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    1296 <deleteTranslation+0x176>
movsd  -0x18(%rbp),%xmm1
mov    -0x10(%rbp),%rax
imul   $0x3,-0x30(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x20(%rbp),%xmm1
mov    -0x10(%rbp),%rax
imul   $0x3,-0x30(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x28(%rbp),%xmm1
mov    -0x10(%rbp),%rax
imul   $0x3,-0x30(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1219 <deleteTranslation+0xf9>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<deleteTranslation>:
push   %rax
imul   $0xaaaaaaab,%edi,%eax
add    $0x2aaaaaaa,%eax
cmp    $0x55555555,%eax
jae    1352 <deleteTranslation+0x232>
cmp    $0x3,%edi
jl     1344 <deleteTranslation+0x224>
movslq %edi,%rax
imul   $0x55555556,%rax,%r8
mov    %r8,%rax
shr    $0x3f,%rax
shr    $0x20,%r8
add    %eax,%r8d
cvtsi2sd %r8d,%xmm2
mov    %r8d,%ecx
movapd %xmm2,%xmm3
unpcklpd %xmm2,%xmm3
lea    0x10(%rsi),%rdx
xorpd  %xmm0,%xmm0
xorpd  %xmm1,%xmm1
mov    %rcx,%rax
nopw   0x0(%rax,%rax,1)
movupd -0x10(%rdx),%xmm4
divpd  %xmm3,%xmm4
addpd  %xmm4,%xmm0
movsd  (%rdx),%xmm4
divsd  %xmm2,%xmm4
addsd  %xmm4,%xmm1
add    $0x18,%rdx
add    $0xffffffffffffffff,%rax
jne    1180 <deleteTranslation+0x60>
cmp    $0x3,%edi
jl     1344 <deleteTranslation+0x224>
cmp    $0x2,%r8d
jae    11ba <deleteTranslation+0x9a>
xor    %r8d,%r8d
jmp    130f <deleteTranslation+0x1ef>
mov    %ecx,%r8d
and    $0xfffffffe,%r8d
movapd %xmm0,%xmm8
unpcklpd %xmm0,%xmm8
movapd %xmm0,%xmm9
unpckhpd %xmm0,%xmm9
movapd %xmm1,%xmm4
unpcklpd %xmm1,%xmm4
lea    -0x2(%r8),%rdx
mov    %rdx,%rax
shr    %rax
add    $0x1,%rax
test   %rdx,%rdx
je     1346 <deleteTranslation+0x226>
mov    %rax,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %edx,%edx
nopl   (%rax)
movupd (%rsi,%rdx,8),%xmm6
movupd 0x10(%rsi,%rdx,8),%xmm3
movupd 0x20(%rsi,%rdx,8),%xmm2
movupd 0x30(%rsi,%rdx,8),%xmm5
movapd %xmm3,%xmm7
movsd  %xmm6,%xmm7
shufpd $0x1,%xmm2,%xmm6
movsd  %xmm3,%xmm2
subpd  %xmm8,%xmm7
subpd  %xmm9,%xmm6
subpd  %xmm4,%xmm2
movapd %xmm6,%xmm3
unpckhpd %xmm2,%xmm3
shufpd $0x2,%xmm7,%xmm2
unpcklpd %xmm6,%xmm7
movupd %xmm7,(%rsi,%rdx,8)
movupd %xmm2,0x10(%rsi,%rdx,8)
movupd %xmm3,0x20(%rsi,%rdx,8)
movupd 0x50(%rsi,%rdx,8),%xmm2
movupd 0x40(%rsi,%rdx,8),%xmm3
movapd %xmm3,%xmm6
movsd  %xmm5,%xmm6
shufpd $0x1,%xmm2,%xmm5
movsd  %xmm3,%xmm2
subpd  %xmm8,%xmm6
subpd  %xmm9,%xmm5
subpd  %xmm4,%xmm2
movapd %xmm5,%xmm3
unpckhpd %xmm2,%xmm3
shufpd $0x2,%xmm6,%xmm2
unpcklpd %xmm5,%xmm6
movupd %xmm6,0x30(%rsi,%rdx,8)
movupd %xmm2,0x40(%rsi,%rdx,8)
movupd %xmm3,0x50(%rsi,%rdx,8)
add    $0xc,%rdx
add    $0xfffffffffffffffe,%rdi
jne    1200 <deleteTranslation+0xe0>
test   $0x1,%al
je     130a <deleteTranslation+0x1ea>
movupd (%rsi,%rdx,8),%xmm2
movupd 0x10(%rsi,%rdx,8),%xmm3
movupd 0x20(%rsi,%rdx,8),%xmm5
movapd %xmm3,%xmm6
movsd  %xmm2,%xmm6
shufpd $0x1,%xmm5,%xmm2
movsd  %xmm3,%xmm5
subpd  %xmm8,%xmm6
subpd  %xmm9,%xmm2
subpd  %xmm4,%xmm5
movapd %xmm2,%xmm3
unpckhpd %xmm5,%xmm3
shufpd $0x2,%xmm6,%xmm5
unpcklpd %xmm2,%xmm6
movupd %xmm6,(%rsi,%rdx,8)
movupd %xmm5,0x10(%rsi,%rdx,8)
movupd %xmm3,0x20(%rsi,%rdx,8)
cmp    %rcx,%r8
je     1344 <deleteTranslation+0x224>
lea    (%r8,%r8,2),%rax
lea    (%rsi,%rax,8),%rax
add    $0x10,%rax
sub    %r8,%rcx
xchg   %ax,%ax
movupd -0x10(%rax),%xmm2
subpd  %xmm0,%xmm2
movupd %xmm2,-0x10(%rax)
movsd  (%rax),%xmm2
subsd  %xmm1,%xmm2
movsd  %xmm2,(%rax)
add    $0x18,%rax
add    $0xffffffffffffffff,%rcx
jne    1320 <deleteTranslation+0x200>
pop    %rax
ret
xor    %edx,%edx
test   $0x1,%al
jne    12b8 <deleteTranslation+0x198>
jmp    130a <deleteTranslation+0x1ea>
lea    0xca7(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [49 x i8] c"deleteTranslation: error nDim not multiple of 3\0A\00"
define void @deleteTranslation(i32 %0, double* %1) {
%3 = alloca i32
%4 = alloca double*
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %3
store double* %1, double** %4
store double 0.000000e+00, double* %5
store double 0.000000e+00, double* %6
store double 0.000000e+00, double* %7
%10 = load i32, i32* %3
%11 = srem i32 %10, 3
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %2
%14 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @exit(i32 -1)
unreachable
16: ; preds = %2
%17 = load i32, i32* %3
%18 = sdiv i32 %17, 3
store i32 %18, i32* %8
store i32 0, i32* %9
br label %19
19: ; preds = %60, %16
%20 = load i32, i32* %9
%21 = load i32, i32* %8
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %63
23: ; preds = %19
%24 = load double*, double** %4
%25 = load i32, i32* %9
%26 = mul nsw i32 %25, 3
%27 = add nsw i32 %26, 0
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds double, double* %24, i64 %28
%30 = load double, double* %29
%31 = load i32, i32* %8
%32 = sitofp i32 %31 to double
%33 = fdiv double %30, %32
%34 = load double, double* %5
%35 = fadd double %34, %33
store double %35, double* %5
%36 = load double*, double** %4
%37 = load i32, i32* %9
%38 = mul nsw i32 %37, 3
%39 = add nsw i32 %38, 1
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds double, double* %36, i64 %40
%42 = load double, double* %41
%43 = load i32, i32* %8
%44 = sitofp i32 %43 to double
%45 = fdiv double %42, %44
%46 = load double, double* %6
%47 = fadd double %46, %45
store double %47, double* %6
%48 = load double*, double** %4
%49 = load i32, i32* %9
%50 = mul nsw i32 %49, 3
%51 = add nsw i32 %50, 2
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds double, double* %48, i64 %52
%54 = load double, double* %53
%55 = load i32, i32* %8
%56 = sitofp i32 %55 to double
%57 = fdiv double %54, %56
%58 = load double, double* %7
%59 = fadd double %58, %57
store double %59, double* %7
br label %60
60: ; preds = %23
%61 = load i32, i32* %9
%62 = add nsw i32 %61, 1
store i32 %62, i32* %9
br label %19
63: ; preds = %19
store i32 0, i32* %9
br label %64
64: ; preds = %96, %63
%65 = load i32, i32* %9
%66 = load i32, i32* %8
%67 = icmp slt i32 %65, %66
br i1 %67, label %68, label %99
68: ; preds = %64
%69 = load double, double* %5
%70 = load double*, double** %4
%71 = load i32, i32* %9
%72 = mul nsw i32 %71, 3
%73 = add nsw i32 %72, 0
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds double, double* %70, i64 %74
%76 = load double, double* %75
%77 = fsub double %76, %69
store double %77, double* %75
%78 = load double, double* %6
%79 = load double*, double** %4
%80 = load i32, i32* %9
%81 = mul nsw i32 %80, 3
%82 = add nsw i32 %81, 1
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds double, double* %79, i64 %83
%85 = load double, double* %84
%86 = fsub double %85, %78
store double %86, double* %84
%87 = load double, double* %7
%88 = load double*, double** %4
%89 = load i32, i32* %9
%90 = mul nsw i32 %89, 3
%91 = add nsw i32 %90, 2
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds double, double* %88, i64 %92
%94 = load double, double* %93
%95 = fsub double %94, %87
store double %95, double* %93
br label %96
96: ; preds = %68
%97 = load i32, i32* %9
%98 = add nsw i32 %97, 1
store i32 %98, i32* %9
br label %64
99: ; preds = %64
ret void
}

LLVM IR (-O2):
@str = [48 x i8] c"deleteTranslation: error nDim not multiple of 3\00"
define void @deleteTranslation(i32 %0, double* nocapture %1) {
%3 = srem i32 %0, 3
%4 = sdiv i32 %0, 3
%5 = icmp eq i32 %3, 0
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 -1)
unreachable
9: ; preds = %2
%10 = icmp sgt i32 %0, 2
br i1 %10, label %11, label %125
11: ; preds = %9
%12 = sitofp i32 %4 to double
%13 = zext i32 %4 to i64
%14 = insertelement <2 x double> poison, double %12, i64 0
%15 = shufflevector <2 x double> %14, <2 x double> poison, <2 x i32> zeroinitializer
br label %94
16: ; preds = %94
br i1 %10, label %17, label %125
17: ; preds = %16
%18 = zext i32 %4 to i64
%19 = icmp ult i32 %4, 2
br i1 %19, label %92, label %20
20: ; preds = %17
%21 = and i64 %13, 4294967294
%22 = shufflevector <2 x double> %103, <2 x double> poison, <2 x i32> zeroinitializer
%23 = shufflevector <2 x double> %103, <2 x double> undef, <2 x i32> <i32 1, i32 1>
%24 = insertelement <2 x double> poison, double %108, i64 0
%25 = shufflevector <2 x double> %24, <2 x double> poison, <2 x i32> zeroinitializer
%26 = add nsw i64 %21, -2
%27 = lshr exact i64 %26, 1
%28 = add nuw i64 %27, 1
%29 = and i64 %28, 1
%30 = icmp eq i64 %26, 0
br i1 %30, label %72, label %31
31: ; preds = %20
%32 = and i64 %28, -2
br label %33
33: ; preds = %33, %31
%34 = phi i64 [ 0, %31 ], [ %67, %33 ]
%35 = phi i64 [ 0, %31 ], [ %68, %33 ]
%36 = mul nuw nsw i64 %34, 3
%37 = getelementptr inbounds double, double* %1, i64 %36
%38 = bitcast double* %37 to <6 x double>*
%39 = load <6 x double>, <6 x double>* %38
%40 = shufflevector <6 x double> %39, <6 x double> poison, <2 x i32> <i32 0, i32 3>
%41 = shufflevector <6 x double> %39, <6 x double> poison, <2 x i32> <i32 1, i32 4>
%42 = shufflevector <6 x double> %39, <6 x double> poison, <2 x i32> <i32 2, i32 5>
%43 = fsub <2 x double> %40, %22
%44 = fsub <2 x double> %41, %23
%45 = fsub <2 x double> %42, %25
%46 = getelementptr inbounds double, double* %1, i64 %36
%47 = bitcast double* %46 to <6 x double>*
%48 = shufflevector <2 x double> %43, <2 x double> %44, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
%49 = shufflevector <2 x double> %45, <2 x double> poison, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
%50 = shufflevector <4 x double> %48, <4 x double> %49, <6 x i32> <i32 0, i32 2, i32 4, i32 1, i32 3, i32 5>
store <6 x double> %50, <6 x double>* %47
%51 = or i64 %34, 2
%52 = mul nuw nsw i64 %51, 3
%53 = getelementptr inbounds double, double* %1, i64 %52
%54 = bitcast double* %53 to <6 x double>*
%55 = load <6 x double>, <6 x double>* %54
%56 = shufflevector <6 x double> %55, <6 x double> poison, <2 x i32> <i32 0, i32 3>
%57 = shufflevector <6 x double> %55, <6 x double> poison, <2 x i32> <i32 1, i32 4>
%58 = shufflevector <6 x double> %55, <6 x double> poison, <2 x i32> <i32 2, i32 5>
%59 = fsub <2 x double> %56, %22
%60 = fsub <2 x double> %57, %23
%61 = fsub <2 x double> %58, %25
%62 = getelementptr inbounds double, double* %1, i64 %52
%63 = bitcast double* %62 to <6 x double>*
%64 = shufflevector <2 x double> %59, <2 x double> %60, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
%65 = shufflevector <2 x double> %61, <2 x double> poison, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
%66 = shufflevector <4 x double> %64, <4 x double> %65, <6 x i32> <i32 0, i32 2, i32 4, i32 1, i32 3, i32 5>
store <6 x double> %66, <6 x double>* %63
%67 = add nuw i64 %34, 4
%68 = add nuw i64 %35, 2
%69 = icmp eq i64 %68, %32
br i1 %69, label %70, label %33
70: ; preds = %33
%71 = mul i64 %67, 3
br label %72
72: ; preds = %70, %20
%73 = phi i64 [ 0, %20 ], [ %71, %70 ]
%74 = icmp eq i64 %29, 0
br i1 %74, label %90, label %75
75: ; preds = %72
%76 = getelementptr inbounds double, double* %1, i64 %73
%77 = bitcast double* %76 to <6 x double>*
%78 = load <6 x double>, <6 x double>* %77
%79 = shufflevector <6 x double> %78, <6 x double> poison, <2 x i32> <i32 0, i32 3>
%80 = shufflevector <6 x double> %78, <6 x double> poison, <2 x i32> <i32 1, i32 4>
%81 = shufflevector <6 x double> %78, <6 x double> poison, <2 x i32> <i32 2, i32 5>
%82 = fsub <2 x double> %79, %22
%83 = fsub <2 x double> %80, %23
%84 = fsub <2 x double> %81, %25
%85 = getelementptr inbounds double, double* %1, i64 %73
%86 = bitcast double* %85 to <6 x double>*
%87 = shufflevector <2 x double> %82, <2 x double> %83, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
%88 = shufflevector <2 x double> %84, <2 x double> poison, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
%89 = shufflevector <4 x double> %87, <4 x double> %88, <6 x i32> <i32 0, i32 2, i32 4, i32 1, i32 3, i32 5>
store <6 x double> %89, <6 x double>* %86
br label %90
90: ; preds = %72, %75
%91 = icmp eq i64 %21, %13
br i1 %91, label %125, label %92
92: ; preds = %17, %90
%93 = phi i64 [ 0, %17 ], [ %21, %90 ]
br label %111
94: ; preds = %11, %94
%95 = phi i64 [ 0, %11 ], [ %109, %94 ]
%96 = phi double [ 0.000000e+00, %11 ], [ %108, %94 ]
%97 = phi <2 x double> [ zeroinitializer, %11 ], [ %103, %94 ]
%98 = mul nuw nsw i64 %95, 3
%99 = getelementptr inbounds double, double* %1, i64 %98
%100 = bitcast double* %99 to <2 x double>*
%101 = load <2 x double>, <2 x double>* %100
%102 = fdiv <2 x double> %101, %15
%103 = fadd <2 x double> %97, %102
%104 = add nuw nsw i64 %98, 2
%105 = getelementptr inbounds double, double* %1, i64 %104
%106 = load double, double* %105
%107 = fdiv double %106, %12
%108 = fadd double %96, %107
%109 = add nuw nsw i64 %95, 1
%110 = icmp eq i64 %109, %13
br i1 %110, label %16, label %94
111: ; preds = %92, %111
%112 = phi i64 [ %123, %111 ], [ %93, %92 ]
%113 = mul nuw nsw i64 %112, 3
%114 = getelementptr inbounds double, double* %1, i64 %113
%115 = bitcast double* %114 to <2 x double>*
%116 = load <2 x double>, <2 x double>* %115
%117 = fsub <2 x double> %116, %103
%118 = bitcast double* %114 to <2 x double>*
store <2 x double> %117, <2 x double>* %118
%119 = add nuw nsw i64 %113, 2
%120 = getelementptr inbounds double, double* %1, i64 %119
%121 = load double, double* %120
%122 = fsub double %121, %108
store double %122, double* %120
%123 = add nuw nsw i64 %112, 1
%124 = icmp eq i64 %123, %18
br i1 %124, label %125, label %111
125: ; preds = %111, %90, %9, %16
ret void
}