#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 */
scalar_t__ coco_round_double(double);
double fabs(scalar_t__);
int pow(double, int);
double f_katsuura_raw(const double *x, const size_t number_of_variables) {
  size_t i, j;
  double tmp, tmp2;
  double result;
  result = 1.0;
  for (i = 0; i < number_of_variables; ++i) {
    tmp = 0;
    for (j = 1; j < 33; ++j) {
      tmp2 = pow(2., (double)j);
      tmp += fabs(tmp2 * x[i] - coco_round_double(tmp2 * x[i])) / tmp2;
    }
    tmp = 1.0 + ((double)(long)i + 1) * tmp;
    result *= tmp;
  }
  result = 10. / ((double)number_of_variables) / ((double)number_of_variables) *
           (-1. + pow(result, 10. / pow((double)number_of_variables, 1.2)));
  return result;
}


x86 assembly (clang, -O0):
<f_katsuura_raw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  0xeb8(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1296 <f_katsuura_raw+0x166>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movq   $0x1,-0x20(%rbp)
cmpq   $0x21,-0x20(%rbp)
jae    124a <f_katsuura_raw+0x11a>
movaps 0xe9b(%rip),%xmm1
movq   -0x20(%rbp),%xmm0
punpckldq %xmm1,%xmm0
movapd 0xe9a(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
movsd  0xe67(%rip),%xmm0
call   1040 <pow@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x30(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
call   1050 <coco_round_double@plt>
movsd  -0x48(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
cvtsi2sd %rax,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdi
call   1030 <fabs@plt>
divsd  -0x30(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1173 <f_katsuura_raw+0x43>
cvtsi2sdq -0x18(%rbp),%xmm0
movsd  0xda8(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x28(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd93(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1155 <f_katsuura_raw+0x25>
movaps 0xd83(%rip),%xmm1
movq   -0x10(%rbp),%xmm0
punpckldq %xmm1,%xmm0
movapd 0xd82(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xd4b(%rip),%xmm1
divsd  %xmm0,%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,-0x50(%rbp)
movsd  -0x38(%rbp),%xmm1
movsd  %xmm1,-0x58(%rbp)
mov    $0x1,%edi
call   1040 <pow@plt>
movsd  -0x58(%rbp),%xmm0
cvtsi2sd %eax,%xmm2
movsd  0xd19(%rip),%xmm1
divsd  %xmm2,%xmm1
cvttsd2si %xmm1,%edi
call   1040 <pow@plt>
movsd  -0x50(%rbp),%xmm0
cvtsi2sd %eax,%xmm2
movsd  0xcf3(%rip),%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_katsuura_raw>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r14
test   %rsi,%rsi
je     1227 <f_katsuura_raw+0xf7>
mov    %rdi,%r15
movsd  0xeae(%rip),%xmm0
xor    %r12d,%r12d
movsd  0xeab(%rip),%xmm2
movsd  %xmm0,0x8(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xorps  %xmm3,%xmm3
mov    $0xffffffffffffffe0,%rbx
nopw   0x0(%rax,%rax,1)
movsd  %xmm3,0x10(%rsp)
lea    0x21(%rbx),%edi
movaps %xmm2,%xmm0
call   1040 <pow@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  %xmm1,0x20(%rsp)
movsd  (%r15,%r12,8),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x18(%rsp)
call   1050 <coco_round_double@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  0x18(%rsp),%xmm1
subsd  %xmm0,%xmm1
cvttsd2si %xmm1,%rdi
call   1030 <fabs@plt>
movsd  0x10(%rsp),%xmm3
movsd  0xe2b(%rip),%xmm2
divsd  0x20(%rsp),%xmm0
addsd  %xmm0,%xmm3
inc    %rbx
jne    1180 <f_katsuura_raw+0x50>
xorps  %xmm0,%xmm0
cvtsi2sd %r12,%xmm0
movsd  0xe04(%rip),%xmm1
addsd  %xmm1,%xmm0
mulsd  %xmm3,%xmm0
addsd  %xmm1,%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
add    $0x1,%r12
cmp    %r14,%r12
jne    1170 <f_katsuura_raw+0x40>
jmp    1235 <f_katsuura_raw+0x105>
movsd  0xdd1(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movq   %r14,%xmm1
punpckldq 0xdde(%rip),%xmm1
subpd  0xde6(%rip),%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
addsd  %xmm1,%xmm0
movsd  0xdb2(%rip),%xmm1
divsd  %xmm0,%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
mov    $0x1,%edi
call   1040 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0xd8b(%rip),%xmm1
divsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
movsd  0x8(%rsp),%xmm0
call   1040 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  0xd71(%rip),%xmm0
mulsd  0x10(%rsp),%xmm0
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define double @f_katsuura_raw(double* %0, i64 %1) {
%3 = alloca double*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca double
%8 = alloca double
%9 = alloca double
store double* %0, double** %3
store i64 %1, i64* %4
store double 1.000000e+00, double* %9
store i64 0, i64* %5
br label %10
10: ; preds = %57, %2
%11 = load i64, i64* %5
%12 = load i64, i64* %4
%13 = icmp ult i64 %11, %12
br i1 %13, label %14, label %60
14: ; preds = %10
store double 0.000000e+00, double* %7
store i64 1, i64* %6
br label %15
15: ; preds = %45, %14
%16 = load i64, i64* %6
%17 = icmp ult i64 %16, 33
br i1 %17, label %18, label %48
18: ; preds = %15
%19 = load i64, i64* %6
%20 = uitofp i64 %19 to double
%21 = fptosi double %20 to i32
%22 = call i32 @pow(double 2.000000e+00, i32 %21)
%23 = sitofp i32 %22 to double
store double %23, double* %8
%24 = load double, double* %8
%25 = load double*, double** %3
%26 = load i64, i64* %5
%27 = getelementptr inbounds double, double* %25, i64 %26
%28 = load double, double* %27
%29 = load double, double* %8
%30 = load double*, double** %3
%31 = load i64, i64* %5
%32 = getelementptr inbounds double, double* %30, i64 %31
%33 = load double, double* %32
%34 = fmul double %29, %33
%35 = call i64 @coco_round_double(double %34)
%36 = sitofp i64 %35 to double
%37 = fneg double %36
%38 = call double @llvm.fmuladd.f64(double %24, double %28, double %37)
%39 = fptosi double %38 to i64
%40 = call double @fabs(i64 %39)
%41 = load double, double* %8
%42 = fdiv double %40, %41
%43 = load double, double* %7
%44 = fadd double %43, %42
store double %44, double* %7
br label %45
45: ; preds = %18
%46 = load i64, i64* %6
%47 = add i64 %46, 1
store i64 %47, i64* %6
br label %15
48: ; preds = %15
%49 = load i64, i64* %5
%50 = sitofp i64 %49 to double
%51 = fadd double %50, 1.000000e+00
%52 = load double, double* %7
%53 = call double @llvm.fmuladd.f64(double %51, double %52, double 1.000000e+00)
store double %53, double* %7
%54 = load double, double* %7
%55 = load double, double* %9
%56 = fmul double %55, %54
store double %56, double* %9
br label %57
57: ; preds = %48
%58 = load i64, i64* %5
%59 = add i64 %58, 1
store i64 %59, i64* %5
br label %10
60: ; preds = %10
%61 = load i64, i64* %4
%62 = uitofp i64 %61 to double
%63 = fdiv double 1.000000e+01, %62
%64 = load i64, i64* %4
%65 = uitofp i64 %64 to double
%66 = fdiv double %63, %65
%67 = load double, double* %9
%68 = load i64, i64* %4
%69 = uitofp i64 %68 to double
%70 = call i32 @pow(double %69, i32 1)
%71 = sitofp i32 %70 to double
%72 = fdiv double 1.000000e+01, %71
%73 = fptosi double %72 to i32
%74 = call i32 @pow(double %67, i32 %73)
%75 = sitofp i32 %74 to double
%76 = fadd double -1.000000e+00, %75
%77 = fmul double %66, %76
store double %77, double* %9
%78 = load double, double* %9
ret double %78
}

LLVM IR (-O2):
define double @f_katsuura_raw(double* nocapture %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %33, label %4
4: ; preds = %2, %26
%5 = phi double [ %30, %26 ], [ 1.000000e+00, %2 ]
%6 = phi i64 [ %31, %26 ], [ 0, %2 ]
%7 = getelementptr inbounds double, double* %0, i64 %6
br label %8
8: ; preds = %4, %8
%9 = phi double [ 0.000000e+00, %4 ], [ %23, %8 ]
%10 = phi i64 [ 1, %4 ], [ %24, %8 ]
%11 = trunc i64 %10 to i32
%12 = tail call i32 @pow(double 2.000000e+00, i32 %11)
%13 = sitofp i32 %12 to double
%14 = load double, double* %7
%15 = fmul double %14, %13
%16 = tail call i64 @coco_round_double(double %15)
%17 = sitofp i64 %16 to double
%18 = fneg double %17
%19 = tail call double @llvm.fmuladd.f64(double %13, double %14, double %18)
%20 = fptosi double %19 to i64
%21 = tail call double @fabs(i64 %20)
%22 = fdiv double %21, %13
%23 = fadd double %9, %22
%24 = add nuw nsw i64 %10, 1
%25 = icmp eq i64 %24, 33
br i1 %25, label %26, label %8
26: ; preds = %8
%27 = sitofp i64 %6 to double
%28 = fadd double %27, 1.000000e+00
%29 = tail call double @llvm.fmuladd.f64(double %28, double %23, double 1.000000e+00)
%30 = fmul double %5, %29
%31 = add nuw i64 %6, 1
%32 = icmp eq i64 %31, %1
br i1 %32, label %33, label %4
33: ; preds = %26, %2
%34 = phi double [ 1.000000e+00, %2 ], [ %30, %26 ]
%35 = uitofp i64 %1 to double
%36 = fdiv double 1.000000e+01, %35
%37 = fdiv double %36, %35
%38 = tail call i32 @pow(double %35, i32 1)
%39 = sitofp i32 %38 to double
%40 = fdiv double 1.000000e+01, %39
%41 = fptosi double %40 to i32
%42 = tail call i32 @pow(double %34, i32 %41)
%43 = sitofp i32 %42 to double
%44 = fadd double %43, -1.000000e+00
%45 = fmul double %37, %44
ret double %45
}