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


x86 assembly (clang, -O0):
<f_up>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <fabs@plt>
cvtsi2sd %eax,%xmm0
movsd  0xead(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    116a <f_up+0x3a>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1200 <f_up+0xd0>
movsd  0xe96(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    0x2e6a(%rip),%rax
cvtsi2sdl (%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm1
mov    0x2e55(%rip),%rax
imul   $0x32,(%rax),%eax
cvtsi2sd %eax,%xmm0
ucomisd %xmm1,%xmm0
jb     11f6 <f_up+0xc6>
movsd  -0x18(%rbp),%xmm0
call   1030 <F_up@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x10(%rbp),%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    0x2e05(%rip),%rax
cvtsi2sdl (%rax),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1187 <f_up+0x57>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_up>:
push   %rbx
sub    $0x20,%rsp
movsd  %xmm0,0x8(%rsp)
call   1040 <fabs@plt>
xorpd  %xmm2,%xmm2
cmp    $0x1,%eax
jle    1153 <f_up+0x23>
movapd %xmm2,%xmm0
add    $0x20,%rsp
pop    %rbx
ret
mov    0x2e8e(%rip),%rbx
mov    (%rbx),%eax
cvtsi2sd %eax,%xmm3
imul   $0x32,%eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0xe8e(%rip),%xmm2
ucomisd %xmm3,%xmm0
jb     1149 <f_up+0x19>
nopl   0x0(%rax,%rax,1)
movsd  %xmm3,(%rsp)
movsd  %xmm2,0x18(%rsp)
movapd %xmm3,%xmm0
call   1030 <F_up@plt>
movsd  %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
mulsd  0x8(%rsp),%xmm0
call   1050 <cos@plt>
movsd  (%rsp),%xmm3
movsd  0x18(%rsp),%xmm2
mulsd  0x10(%rsp),%xmm0
addsd  %xmm0,%xmm2
mov    (%rbx),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  %xmm0,%xmm3
imul   $0x32,%eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
ucomisd %xmm3,%xmm0
jae    1180 <f_up+0x50>
jmp    1149 <f_up+0x19>

LLVM IR (-O0):
@M_PI = global i32 0
define double @f_up(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, 1.000000e+00
br i1 %9, label %10, label %11
10: ; preds = %1
store double 0.000000e+00, double* %2
br label %36
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 = %29, %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 %34
20: ; preds = %14
%21 = load double, double* %4
%22 = call double @F_up(double %21)
%23 = load double, double* %4
%24 = load double, double* %3
%25 = fmul double %23, %24
%26 = call double @cos(double %25)
%27 = load double, double* %5
%28 = call double @llvm.fmuladd.f64(double %22, double %26, double %27)
store double %28, double* %5
br label %29
29: ; preds = %20
%30 = load i32, i32* @M_PI
%31 = sitofp i32 %30 to double
%32 = load double, double* %4
%33 = fadd double %32, %31
store double %33, double* %4
br label %14
34: ; preds = %14
%35 = load double, double* %5
store double %35, double* %2
br label %36
36: ; preds = %34, %10
%37 = load double, double* %2
ret double %37
}

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