#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*/ assert(int);
void ScaledStep(const double factor, const double *x, double *xn,
                const double *direct, const int *onbound, const int n) {
  int i;
  assert(NULL != x);
  assert(NULL != xn);
  assert(NULL != direct);
  assert(NULL != onbound);
  assert(n > 0);
  for (i = 0; i < n; i++)
    xn[i] = x[i] + direct[i] * factor;
}


x86 assembly (clang, -O0):
<ScaledStep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8d,-0x2c(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
cmp    -0x18(%rbp),%rax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
cmp    -0x20(%rbp),%rax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
cmp    -0x28(%rbp),%rax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x0,-0x2c(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    11e3 <ScaledStep+0xd3>
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x20(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  -0x8(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1195 <ScaledStep+0x85>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ScaledStep>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %r8d,%ebp
mov    %rcx,%r12
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
movapd %xmm0,(%rsp)
xor    %edi,%edi
test   %r15,%r15
setne  %dil
call   1030 <assert@plt>
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1030 <assert@plt>
xor    %edi,%edi
test   %r14,%r14
setne  %dil
call   1030 <assert@plt>
xor    %edi,%edi
test   %r12,%r12
setne  %dil
call   1030 <assert@plt>
xor    %edi,%edi
test   %ebp,%ebp
setg   %dil
call   1030 <assert@plt>
movapd (%rsp),%xmm5
test   %ebp,%ebp
jle    132b <ScaledStep+0x21b>
mov    %ebp,%eax
cmp    $0x4,%ebp
jae    11fb <ScaledStep+0xeb>
xor    %ecx,%ecx
mov    %rcx,%rdx
not    %rdx
test   $0x1,%al
je     11ae <ScaledStep+0x9e>
movsd  (%r14,%rcx,8),%xmm0
mulsd  %xmm5,%xmm0
addsd  (%r15,%rcx,8),%xmm0
movsd  %xmm0,(%rbx,%rcx,8)
or     $0x1,%rcx
add    %rax,%rdx
je     132b <ScaledStep+0x21b>
nopw   0x0(%rax,%rax,1)
movsd  (%r14,%rcx,8),%xmm0
mulsd  %xmm5,%xmm0
addsd  (%r15,%rcx,8),%xmm0
movsd  %xmm0,(%rbx,%rcx,8)
movsd  0x8(%r14,%rcx,8),%xmm0
mulsd  %xmm5,%xmm0
addsd  0x8(%r15,%rcx,8),%xmm0
movsd  %xmm0,0x8(%rbx,%rcx,8)
add    $0x2,%rcx
cmp    %rcx,%rax
jne    11c0 <ScaledStep+0xb0>
jmp    132b <ScaledStep+0x21b>
lea    (%rbx,%rax,8),%rcx
lea    (%r15,%rax,8),%rdx
cmp    %rbx,%rdx
seta   %dil
lea    (%r14,%rax,8),%rdx
cmp    %r15,%rcx
seta   %r8b
cmp    %rbx,%rdx
seta   %dl
cmp    %r14,%rcx
seta   %sil
xor    %ecx,%ecx
test   %r8b,%dil
jne    118b <ScaledStep+0x7b>
and    %sil,%dl
jne    118b <ScaledStep+0x7b>
mov    %eax,%ecx
and    $0xfffffffc,%ecx
movapd %xmm5,%xmm0
unpcklpd %xmm5,%xmm0
lea    -0x4(%rcx),%rdx
mov    %rdx,%rsi
shr    $0x2,%rsi
add    $0x1,%rsi
test   %rdx,%rdx
je     1338 <ScaledStep+0x228>
mov    %rsi,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movupd (%r15,%rdx,8),%xmm1
movupd 0x10(%r15,%rdx,8),%xmm2
movupd (%r14,%rdx,8),%xmm3
movupd 0x10(%r14,%rdx,8),%xmm4
mulpd  %xmm0,%xmm3
addpd  %xmm1,%xmm3
mulpd  %xmm0,%xmm4
addpd  %xmm2,%xmm4
movupd %xmm3,(%rbx,%rdx,8)
movupd %xmm4,0x10(%rbx,%rdx,8)
movupd 0x20(%r15,%rdx,8),%xmm1
movupd 0x30(%r15,%rdx,8),%xmm2
movupd 0x20(%r14,%rdx,8),%xmm3
movupd 0x30(%r14,%rdx,8),%xmm4
mulpd  %xmm0,%xmm3
addpd  %xmm1,%xmm3
mulpd  %xmm0,%xmm4
addpd  %xmm2,%xmm4
movupd %xmm3,0x20(%rbx,%rdx,8)
movupd %xmm4,0x30(%rbx,%rdx,8)
add    $0x8,%rdx
add    $0xfffffffffffffffe,%rdi
jne    1270 <ScaledStep+0x160>
test   $0x1,%sil
je     1322 <ScaledStep+0x212>
movupd (%r15,%rdx,8),%xmm1
movupd 0x10(%r15,%rdx,8),%xmm2
movupd (%r14,%rdx,8),%xmm3
movupd 0x10(%r14,%rdx,8),%xmm4
mulpd  %xmm0,%xmm3
addpd  %xmm1,%xmm3
mulpd  %xmm0,%xmm4
addpd  %xmm2,%xmm4
movupd %xmm3,(%rbx,%rdx,8)
movupd %xmm4,0x10(%rbx,%rdx,8)
cmp    %rax,%rcx
jne    118b <ScaledStep+0x7b>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %edx,%edx
test   $0x1,%sil
jne    12ed <ScaledStep+0x1dd>
jmp    1322 <ScaledStep+0x212>

LLVM IR (-O0):
define void @ScaledStep(double %0, double* %1, double* %2, double* %3, i32* %4, i32 %5) {
%7 = alloca double
%8 = alloca double*
%9 = alloca double*
%10 = alloca double*
%11 = alloca i32*
%12 = alloca i32
%13 = alloca i32
store double %0, double* %7
store double* %1, double** %8
store double* %2, double** %9
store double* %3, double** %10
store i32* %4, i32** %11
store i32 %5, i32* %12
%14 = load double*, double** %8
%15 = icmp ne double* null, %14
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = load double*, double** %9
%19 = icmp ne double* null, %18
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = load double*, double** %10
%23 = icmp ne double* null, %22
%24 = zext i1 %23 to i32
%25 = call i32 @assert(i32 %24)
%26 = load i32*, i32** %11
%27 = icmp ne i32* null, %26
%28 = zext i1 %27 to i32
%29 = call i32 @assert(i32 %28)
%30 = load i32, i32* %12
%31 = icmp sgt i32 %30, 0
%32 = zext i1 %31 to i32
%33 = call i32 @assert(i32 %32)
store i32 0, i32* %13
br label %34
34: ; preds = %55, %6
%35 = load i32, i32* %13
%36 = load i32, i32* %12
%37 = icmp slt i32 %35, %36
br i1 %37, label %38, label %58
38: ; preds = %34
%39 = load double*, double** %8
%40 = load i32, i32* %13
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds double, double* %39, i64 %41
%43 = load double, double* %42
%44 = load double*, double** %10
%45 = load i32, i32* %13
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds double, double* %44, i64 %46
%48 = load double, double* %47
%49 = load double, double* %7
%50 = call double @llvm.fmuladd.f64(double %48, double %49, double %43)
%51 = load double*, double** %9
%52 = load i32, i32* %13
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds double, double* %51, i64 %53
store double %50, double* %54
br label %55
55: ; preds = %38
%56 = load i32, i32* %13
%57 = add nsw i32 %56, 1
store i32 %57, i32* %13
br label %34
58: ; preds = %34
ret void
}

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