#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 */
double b_flat(double, double, double, double);
int WFG1_t2(double *y, int y_size, int k, double *result) {
  int i;
  for (i = 0; i < k; i++)
    result[i] = y[i];
  for (i = k; i < y_size; i++)
    result[i] = b_flat(y[i], 0.8, 0.75, 0.85);
  return y_size;
}


x86 assembly (clang, -O0):
<WFG1_t2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1161 <WFG1_t2+0x51>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112d <WFG1_t2+0x1d>
mov    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11b8 <WFG1_t2+0xa8>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  0xe78(%rip),%xmm1
movsd  0xe78(%rip),%xmm2
movsd  0xe78(%rip),%xmm3
call   1030 <b_flat@plt>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1167 <WFG1_t2+0x57>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WFG1_t2>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%r14d
test   %edx,%edx
jle    1295 <WFG1_t2+0x185>
mov    %edx,%r9d
cmp    $0x4,%edx
jb     1141 <WFG1_t2+0x31>
lea    (%rdi,%r9,8),%rax
cmp    %rcx,%rax
jbe    11bc <WFG1_t2+0xac>
lea    (%rcx,%r9,8),%rax
cmp    %rdi,%rax
jbe    11bc <WFG1_t2+0xac>
xor    %esi,%esi
mov    %rsi,%rbp
not    %rbp
add    %r9,%rbp
mov    %r9,%rax
and    $0x3,%rax
je     1174 <WFG1_t2+0x64>
cs nopw 0x0(%rax,%rax,1)
nop
movsd  (%rdi,%rsi,8),%xmm0
movsd  %xmm0,(%rcx,%rsi,8)
add    $0x1,%rsi
add    $0xffffffffffffffff,%rax
jne    1160 <WFG1_t2+0x50>
cmp    $0x3,%rbp
jb     1295 <WFG1_t2+0x185>
xchg   %ax,%ax
movsd  (%rdi,%rsi,8),%xmm0
movsd  %xmm0,(%rcx,%rsi,8)
movsd  0x8(%rdi,%rsi,8),%xmm0
movsd  %xmm0,0x8(%rcx,%rsi,8)
movsd  0x10(%rdi,%rsi,8),%xmm0
movsd  %xmm0,0x10(%rcx,%rsi,8)
movsd  0x18(%rdi,%rsi,8),%xmm0
movsd  %xmm0,0x18(%rcx,%rsi,8)
add    $0x4,%rsi
cmp    %rsi,%r9
jne    1180 <WFG1_t2+0x70>
jmp    1295 <WFG1_t2+0x185>
mov    %r9d,%esi
and    $0xfffffffc,%esi
lea    -0x4(%rsi),%rax
mov    %rax,%rbx
shr    $0x2,%rbx
add    $0x1,%rbx
mov    %ebx,%r8d
and    $0x3,%r8d
cmp    $0xc,%rax
jae    11e2 <WFG1_t2+0xd2>
xor    %ebp,%ebp
jmp    1248 <WFG1_t2+0x138>
and    $0xfffffffffffffffc,%rbx
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
movups (%rdi,%rbp,8),%xmm0
movups 0x10(%rdi,%rbp,8),%xmm1
movups %xmm0,(%rcx,%rbp,8)
movups %xmm1,0x10(%rcx,%rbp,8)
movups 0x20(%rdi,%rbp,8),%xmm0
movups 0x30(%rdi,%rbp,8),%xmm1
movups %xmm0,0x20(%rcx,%rbp,8)
movups %xmm1,0x30(%rcx,%rbp,8)
movups 0x40(%rdi,%rbp,8),%xmm0
movups 0x50(%rdi,%rbp,8),%xmm1
movups %xmm0,0x40(%rcx,%rbp,8)
movups %xmm1,0x50(%rcx,%rbp,8)
movups 0x60(%rdi,%rbp,8),%xmm0
movups 0x70(%rdi,%rbp,8),%xmm1
movups %xmm0,0x60(%rcx,%rbp,8)
movups %xmm1,0x70(%rcx,%rbp,8)
add    $0x10,%rbp
add    $0xfffffffffffffffc,%rbx
jne    11f0 <WFG1_t2+0xe0>
test   %r8,%r8
je     128c <WFG1_t2+0x17c>
lea    (%rcx,%rbp,8),%rax
add    $0x10,%rax
lea    (%rdi,%rbp,8),%rbp
add    $0x10,%rbp
shl    $0x5,%r8
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movups -0x10(%rbp,%rbx,1),%xmm0
movups 0x0(%rbp,%rbx,1),%xmm1
movups %xmm0,-0x10(%rax,%rbx,1)
movups %xmm1,(%rax,%rbx,1)
add    $0x20,%rbx
cmp    %rbx,%r8
jne    1270 <WFG1_t2+0x160>
cmp    %r9,%rsi
jne    1143 <WFG1_t2+0x33>
cmp    %r14d,%edx
jge    12e1 <WFG1_t2+0x1d1>
movslq %edx,%rax
lea    (%rdi,%rax,8),%r15
lea    (%rcx,%rax,8),%r12
mov    %r14d,%ebx
sub    %edx,%ebx
xor    %ebp,%ebp
nopl   0x0(%rax)
movsd  (%r15,%rbp,8),%xmm0
movsd  0xd42(%rip),%xmm1
movsd  0xd42(%rip),%xmm2
movsd  0xd42(%rip),%xmm3
call   1030 <b_flat@plt>
movsd  %xmm0,(%r12,%rbp,8)
add    $0x1,%rbp
cmp    %ebp,%ebx
jne    12b0 <WFG1_t2+0x1a0>
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @WFG1_t2(double* %0, i32 %1, i32 %2, double* %3) {
%5 = alloca double*
%6 = alloca i32
%7 = alloca i32
%8 = alloca double*
%9 = alloca i32
store double* %0, double** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store double* %3, double** %8
store i32 0, i32* %9
br label %10
10: ; preds = %24, %4
%11 = load i32, i32* %9
%12 = load i32, i32* %7
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %27
14: ; preds = %10
%15 = load double*, double** %5
%16 = load i32, i32* %9
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds double, double* %15, i64 %17
%19 = load double, double* %18
%20 = load double*, double** %8
%21 = load i32, i32* %9
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds double, double* %20, i64 %22
store double %19, double* %23
br label %24
24: ; preds = %14
%25 = load i32, i32* %9
%26 = add nsw i32 %25, 1
store i32 %26, i32* %9
br label %10
27: ; preds = %10
%28 = load i32, i32* %7
store i32 %28, i32* %9
br label %29
29: ; preds = %44, %27
%30 = load i32, i32* %9
%31 = load i32, i32* %6
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %47
33: ; preds = %29
%34 = load double*, double** %5
%35 = load i32, i32* %9
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds double, double* %34, i64 %36
%38 = load double, double* %37
%39 = call double @b_flat(double %38, double 8.000000e-01, double 7.500000e-01, double 8.500000e-01)
%40 = load double*, double** %8
%41 = load i32, i32* %9
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds double, double* %40, i64 %42
store double %39, double* %43
br label %44
44: ; preds = %33
%45 = load i32, i32* %9
%46 = add nsw i32 %45, 1
store i32 %46, i32* %9
br label %29
47: ; preds = %29
%48 = load i32, i32* %6
ret i32 %48
}

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