#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*/ F_up(double);
int M_PI;
double cos(double);
int fabs(double);
double pow(int /*<<< orphan*/, int);
double f_cup(double x) {
  if (fabs(x) > 2.)
    return 0.;
  double pik, y = 0.5;
  for (pik = M_PI; pik <= M_PI * 50; pik += M_PI) {
    y += pow(F_up(pik * 0.5), 2) * cos(pik * x * 0.5);
  }
  return y * 0.5;
}


x86 assembly (clang, -O0):
<f_cup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <fabs@plt>
cvtsi2sd %eax,%xmm0
movsd  0xe9d(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    117a <f_cup+0x3a>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1238 <f_cup+0xf8>
movsd  0xe86(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    0x2e5a(%rip),%rax
cvtsi2sdl (%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm1
mov    0x2e45(%rip),%rax
imul   $0x32,(%rax),%eax
cvtsi2sd %eax,%xmm0
ucomisd %xmm1,%xmm0
jb     1226 <f_cup+0xe6>
movsd  0xe4c(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
call   1030 <F_up@plt>
mov    %eax,%edi
mov    $0x2,%esi
call   1060 <pow@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  0xe1f(%rip),%xmm1
mulsd  %xmm1,%xmm0
call   1050 <cos@plt>
movaps %xmm0,%xmm2
movsd  -0x28(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    0x2dd5(%rip),%rax
cvtsi2sdl (%rax),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1197 <f_cup+0x57>
movsd  0xdda(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_cup>:
push   %rbx
sub    $0x20,%rsp
movsd  %xmm0,0x8(%rsp)
call   1040 <fabs@plt>
xorpd  %xmm1,%xmm1
cmp    $0x2,%eax
jg     1214 <f_cup+0xd4>
mov    0x2e84(%rip),%rbx
mov    (%rbx),%eax
cvtsi2sd %eax,%xmm2
imul   $0x32,%eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
ucomisd %xmm2,%xmm0
jae    1187 <f_cup+0x47>
movsd  0xe7e(%rip),%xmm1
jmp    1214 <f_cup+0xd4>
movsd  0xe79(%rip),%xmm1
nop
movsd  %xmm2,(%rsp)
movsd  %xmm1,0x18(%rsp)
movapd %xmm2,%xmm0
movsd  0xe61(%rip),%xmm1
mulsd  %xmm1,%xmm0
call   1030 <F_up@plt>
mov    %eax,%edi
mov    $0x2,%esi
call   1060 <pow@plt>
movsd  %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
mulsd  0x8(%rsp),%xmm0
mulsd  0xe33(%rip),%xmm0
call   1050 <cos@plt>
movsd  (%rsp),%xmm2
movsd  0x18(%rsp),%xmm1
mulsd  0x10(%rsp),%xmm0
addsd  %xmm0,%xmm1
mov    (%rbx),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  %xmm0,%xmm2
imul   $0x32,%eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
ucomisd %xmm2,%xmm0
jae    1190 <f_cup+0x50>
mulsd  0xdf4(%rip),%xmm1
movapd %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@M_PI = global i32 0
define double @f_cup(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
%6 = load double, double* %3
%7 = call i32 @fabs(double %6)
%8 = sitofp i32 %7 to double
%9 = fcmp ogt double %8, 2.000000e+00
br i1 %9, label %10, label %11
10: ; preds = %1
store double 0.000000e+00, double* %2
br label %40
11: ; preds = %1
store double 5.000000e-01, double* %5
%12 = load i32, i32* @M_PI
%13 = sitofp i32 %12 to double
store double %13, double* %4
br label %14
14: ; preds = %32, %11
%15 = load double, double* %4
%16 = load i32, i32* @M_PI
%17 = mul nsw i32 %16, 50
%18 = sitofp i32 %17 to double
%19 = fcmp ole double %15, %18
br i1 %19, label %20, label %37
20: ; preds = %14
%21 = load double, double* %4
%22 = fmul double %21, 5.000000e-01
%23 = call i32 @F_up(double %22)
%24 = call double @pow(i32 %23, i32 2)
%25 = load double, double* %4
%26 = load double, double* %3
%27 = fmul double %25, %26
%28 = fmul double %27, 5.000000e-01
%29 = call double @cos(double %28)
%30 = load double, double* %5
%31 = call double @llvm.fmuladd.f64(double %24, double %29, double %30)
store double %31, double* %5
br label %32
32: ; preds = %20
%33 = load i32, i32* @M_PI
%34 = sitofp i32 %33 to double
%35 = load double, double* %4
%36 = fadd double %35, %34
store double %36, double* %4
br label %14
37: ; preds = %14
%38 = load double, double* %5
%39 = fmul double %38, 5.000000e-01
store double %39, double* %2
br label %40
40: ; preds = %37, %10
%41 = load double, double* %2
ret double %41
}

LLVM IR (-O2):
@M_PI = global i32 0
define double @f_cup(double %0) {
%2 = tail call i32 @fabs(double %0)
%3 = icmp sgt i32 %2, 2
br i1 %3, label %28, label %4
4: ; preds = %1
%5 = load i32, i32* @M_PI
%6 = sitofp i32 %5 to double
%7 = mul nsw i32 %5, 50
%8 = sitofp i32 %7 to double
%9 = fcmp ugt double %6, %8
br i1 %9, label %28, label %10
10: ; preds = %4, %10
%11 = phi double [ %19, %10 ], [ 5.000000e-01, %4 ]
%12 = phi double [ %22, %10 ], [ %6, %4 ]
%13 = fmul double %12, 5.000000e-01
%14 = tail call i32 @F_up(double %13)
%15 = tail call double @pow(i32 %14, i32 2)
%16 = fmul double %12, %0
%17 = fmul double %16, 5.000000e-01
%18 = tail call double @cos(double %17)
%19 = tail call double @llvm.fmuladd.f64(double %15, double %18, double %11)
%20 = load i32, i32* @M_PI
%21 = sitofp i32 %20 to double
%22 = fadd double %12, %21
%23 = mul nsw i32 %20, 50
%24 = sitofp i32 %23 to double
%25 = fcmp ugt double %22, %24
br i1 %25, label %26, label %10
26: ; preds = %10
%27 = fmul double %19, 5.000000e-01
br label %28
28: ; preds = %4, %26, %1
%29 = phi double [ 0.000000e+00, %1 ], [ 2.500000e-01, %4 ], [ %27, %26 ]
ret double %29
}