#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*/ cf_cal(double *, double *, int, double *, double *, double *,
                          double *, int);
int /*<<< orphan*/ schwefel_func(double *, double *, int, double *, double *,
                                 int);
void cf03(double *x, double *f, int nx, double *Os, double *Mr, int r_flag) {
  int i, cf_num = 3;
  double fit[3];
  double delta[3] = {20, 20, 20};
  double bias[3] = {0, 100, 200};
  for (i = 0; i < cf_num; i++) {
    schwefel_func(x, &fit[i], nx, &Os[i * nx], &Mr[i * nx * nx], r_flag);
  }
  cf_cal(x, f, nx, Os, delta, bias, fit, cf_num);
}


x86 assembly (clang, -O0):
<cf03>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
movl   $0x3,-0x34(%rbp)
mov    0xeb0(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0xead(%rip),%rax
mov    %rax,-0x68(%rbp)
mov    0xeaa(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xeaf(%rip),%rax
mov    %rax,-0x90(%rbp)
mov    0xea9(%rip),%rax
mov    %rax,-0x88(%rbp)
mov    0xea3(%rip),%rax
mov    %rax,-0x80(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    11fd <cf03+0xdd>
mov    -0x8(%rbp),%rdi
movslq -0x30(%rbp),%rax
lea    -0x50(%rbp),%rsi
shl    $0x3,%rax
add    %rax,%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    -0x30(%rbp),%eax
imul   -0x14(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%eax
imul   -0x14(%rbp),%eax
imul   -0x14(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%r8
mov    -0x2c(%rbp),%r9d
call   1030 <schwefel_func@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1198 <cf03+0x78>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
lea    -0x70(%rbp),%r8
lea    -0x90(%rbp),%r9
lea    -0x50(%rbp),%r10
mov    -0x34(%rbp),%eax
mov    %r10,(%rsp)
mov    %eax,0x8(%rsp)
call   1040 <cf_cal@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cf03>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %r9d,%r13d
mov    %r8,%r12
mov    %rcx,%r15
mov    %rsi,0x8(%rsp)
mov    %rdi,%rbx
mov    0xeca(%rip),%rax
mov    %rax,0x60(%rsp)
movaps 0xeae(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
mov    0xed2(%rip),%rax
mov    %rax,0x40(%rsp)
movaps 0xeb6(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movslq %edx,%r14
lea    0x10(%rsp),%rsi
mov    %r14d,%edx
call   1030 <schwefel_func@plt>
lea    0x18(%rsp),%rsi
lea    (%r15,%r14,8),%rcx
mov    %r14,%rbp
imul   %r14,%rbp
lea    (%r12,%rbp,8),%r8
mov    %rbx,%rdi
mov    %r14d,%edx
mov    %r13d,%r9d
call   1030 <schwefel_func@plt>
lea    0x20(%rsp),%rsi
mov    %r14,%rcx
shl    $0x4,%rcx
add    %r15,%rcx
shl    $0x4,%rbp
add    %r12,%rbp
mov    %rbx,%rdi
mov    %r14d,%edx
mov    %rbp,%r8
mov    %r13d,%r9d
call   1030 <schwefel_func@plt>
lea    0x50(%rsp),%r8
lea    0x30(%rsp),%r9
mov    %rbx,%rdi
mov    0x8(%rsp),%rsi
mov    %r14d,%edx
mov    %r15,%rcx
push   $0x3
lea    0x18(%rsp),%rax
push   %rax
call   1040 <cf_cal@plt>
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.cf03.delta = [3 x double] [double 2.000000e+01, double 2.000000e+01, double 2.000000e+01]
@__const.cf03.bias = [3 x double] [double 0.000000e+00, double 1.000000e+02, double 2.000000e+02]
define void @cf03(double* %0, double* %1, i32 %2, double* %3, double* %4, i32 %5) {
%7 = alloca double*
%8 = alloca double*
%9 = alloca i32
%10 = alloca double*
%11 = alloca double*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca [3 x double]
%16 = alloca [3 x double]
%17 = alloca [3 x double]
store double* %0, double** %7
store double* %1, double** %8
store i32 %2, i32* %9
store double* %3, double** %10
store double* %4, double** %11
store i32 %5, i32* %12
store i32 3, i32* %14
%18 = bitcast [3 x double]* %16 to i8*
%19 = bitcast [3 x double]* %17 to i8*
store i32 0, i32* %13
br label %20
20: ; preds = %46, %6
%21 = load i32, i32* %13
%22 = load i32, i32* %14
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %49
24: ; preds = %20
%25 = load double*, double** %7
%26 = load i32, i32* %13
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [3 x double], [3 x double]* %15, i64 0, i64 %27
%29 = load i32, i32* %9
%30 = load double*, double** %10
%31 = load i32, i32* %13
%32 = load i32, i32* %9
%33 = mul nsw i32 %31, %32
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds double, double* %30, i64 %34
%36 = load double*, double** %11
%37 = load i32, i32* %13
%38 = load i32, i32* %9
%39 = mul nsw i32 %37, %38
%40 = load i32, i32* %9
%41 = mul nsw i32 %39, %40
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds double, double* %36, i64 %42
%44 = load i32, i32* %12
%45 = call i32 @schwefel_func(double* %25, double* %28, i32 %29, double* %35, double* %43, i32 %44)
br label %46
46: ; preds = %24
%47 = load i32, i32* %13
%48 = add nsw i32 %47, 1
store i32 %48, i32* %13
br label %20
49: ; preds = %20
%50 = load double*, double** %7
%51 = load double*, double** %8
%52 = load i32, i32* %9
%53 = load double*, double** %10
%54 = getelementptr inbounds [3 x double], [3 x double]* %16, i64 0, i64 0
%55 = getelementptr inbounds [3 x double], [3 x double]* %17, i64 0, i64 0
%56 = getelementptr inbounds [3 x double], [3 x double]* %15, i64 0, i64 0
%57 = load i32, i32* %14
%58 = call i32 @cf_cal(double* %50, double* %51, i32 %52, double* %53, double* %54, double* %55, double* %56, i32 %57)
ret void
}

LLVM IR (-O2):
@__const.cf03.delta = [3 x double] [double 2.000000e+01, double 2.000000e+01, double 2.000000e+01]
@__const.cf03.bias = [3 x double] [double 0.000000e+00, double 1.000000e+02, double 2.000000e+02]
define void @cf03(double* %0, double* %1, i32 %2, double* %3, double* %4, i32 %5) {
%7 = alloca [3 x double]
%8 = alloca [3 x double]
%9 = alloca [3 x double]
%10 = bitcast [3 x double]* %7 to i8*
%11 = bitcast [3 x double]* %8 to i8*
%12 = bitcast [3 x double]* %9 to i8*
%13 = sext i32 %2 to i64
%14 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%15 = call i32 @schwefel_func(double* %0, double* %14, i32 %2, double* %3, double* %4, i32 %5)
%16 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 1
%17 = getelementptr inbounds double, double* %3, i64 %13
%18 = mul nsw i64 %13, %13
%19 = getelementptr inbounds double, double* %4, i64 %18
%20 = call i32 @schwefel_func(double* %0, double* %16, i32 %2, double* %17, double* %19, i32 %5)
%21 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 2
%22 = shl nsw i64 %13, 1
%23 = getelementptr inbounds double, double* %3, i64 %22
%24 = mul nsw i64 %22, %13
%25 = getelementptr inbounds double, double* %4, i64 %24
%26 = call i32 @schwefel_func(double* %0, double* %21, i32 %2, double* %23, double* %25, i32 %5)
%27 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 0
%28 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 0
%29 = call i32 @cf_cal(double* %0, double* %1, i32 %2, double* %3, double* %27, double* %28, double* %14, i32 3)
ret void
}