#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*/ acos(int /*<<< orphan*/);
scalar_t__ fmod(double, int);
int /*<<< orphan*/ sin(int /*<<< orphan*/);
int /*<<< orphan*/ sqrt(double);
double tan(int /*<<< orphan*/);
int calculate(double weight) {
  int div_times = 0;
  int i, j;
  double sqrt_result;
  double input = 99999999;
  for (j = 0; j < weight; j++) {
    div_times = 0;
    for (i = input; i > 0; i--) {
      sqrt_result = tan(sin(acos(sqrt(input * i))));
      if (fmod(input, i) == 0) {
        div_times++;
      }
    }
  }
  return div_times;
}


x86 assembly (clang, -O0):
<calculate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movsd  0xe94(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x0,-0x14(%rbp)
cvtsi2sdl -0x14(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1218 <calculate+0xc8>
movl   $0x0,-0xc(%rbp)
cvttsd2si -0x28(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jle    1205 <calculate+0xb5>
movsd  -0x28(%rbp),%xmm0
cvtsi2sdl -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1070 <sqrt@plt>
mov    %eax,%edi
call   1040 <acos@plt>
mov    %eax,%edi
call   1050 <sin@plt>
mov    %eax,%edi
call   1060 <tan@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%edi
call   1030 <fmod@plt>
cmp    $0x0,%rax
jne    11f2 <calculate+0xa2>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11f7 <calculate+0xa7>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    119b <calculate+0x4b>
jmp    120a <calculate+0xba>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1178 <calculate+0x28>
mov    -0xc(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculate>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
xor    %ebx,%ebx
xorpd  %xmm1,%xmm1
movsd  %xmm0,0x8(%rsp)
ucomisd %xmm1,%xmm0
jbe    11f3 <calculate+0xa3>
xor    %r14d,%r14d
movsd  0xe87(%rip),%xmm2
nopl   0x0(%rax)
mov    $0x5f5e100,%ebp
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
add    $0xffffffff,%ebp
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
mulsd  %xmm2,%xmm0
call   1070 <sqrt@plt>
mov    %eax,%edi
call   1040 <acos@plt>
mov    %eax,%edi
call   1050 <sin@plt>
mov    %eax,%edi
call   1060 <tan@plt>
movsd  0xe40(%rip),%xmm0
mov    %ebp,%edi
call   1030 <fmod@plt>
movsd  0xe31(%rip),%xmm2
cmp    $0x1,%rax
adc    $0x0,%ebx
cmp    $0x1,%ebp
ja     1190 <calculate+0x40>
add    $0x1,%r14d
xorps  %xmm0,%xmm0
cvtsi2sd %r14d,%xmm0
movsd  0x8(%rsp),%xmm1
ucomisd %xmm0,%xmm1
ja     1180 <calculate+0x30>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @calculate(double %0) {
%2 = alloca double
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca double
%7 = alloca double
store double %0, double* %2
store i32 0, i32* %3
store double 0x4197D783FC000000, double* %7
store i32 0, i32* %5
br label %8
8: ; preds = %40, %1
%9 = load i32, i32* %5
%10 = sitofp i32 %9 to double
%11 = load double, double* %2
%12 = fcmp olt double %10, %11
br i1 %12, label %13, label %43
13: ; preds = %8
store i32 0, i32* %3
%14 = load double, double* %7
%15 = fptosi double %14 to i32
store i32 %15, i32* %4
br label %16
16: ; preds = %36, %13
%17 = load i32, i32* %4
%18 = icmp sgt i32 %17, 0
br i1 %18, label %19, label %39
19: ; preds = %16
%20 = load double, double* %7
%21 = load i32, i32* %4
%22 = sitofp i32 %21 to double
%23 = fmul double %20, %22
%24 = call i32 @sqrt(double %23)
%25 = call i32 @acos(i32 %24)
%26 = call i32 @sin(i32 %25)
%27 = call double @tan(i32 %26)
store double %27, double* %6
%28 = load double, double* %7
%29 = load i32, i32* %4
%30 = call i64 @fmod(double %28, i32 %29)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %19
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
store i32 %34, i32* %3
br label %35
35: ; preds = %32, %19
br label %36
36: ; preds = %35
%37 = load i32, i32* %4
%38 = add nsw i32 %37, -1
store i32 %38, i32* %4
br label %16
39: ; preds = %16
br label %40
40: ; preds = %39
%41 = load i32, i32* %5
%42 = add nsw i32 %41, 1
store i32 %42, i32* %5
br label %8
43: ; preds = %8
%44 = load i32, i32* %3
ret i32 %44
}

LLVM IR (-O2):
define i32 @calculate(double %0) {
%2 = fcmp ogt double %0, 0.000000e+00
br i1 %2, label %3, label %24
3: ; preds = %1, %20
%4 = phi i32 [ %21, %20 ], [ 0, %1 ]
br label %5
5: ; preds = %3, %5
%6 = phi i32 [ 0, %3 ], [ %17, %5 ]
%7 = phi i32 [ 99999999, %3 ], [ %18, %5 ]
%8 = sitofp i32 %7 to double
%9 = fmul double %8, 0x4197D783FC000000
%10 = tail call i32 @sqrt(double %9)
%11 = tail call i32 @acos(i32 %10)
%12 = tail call i32 @sin(i32 %11)
%13 = tail call double @tan(i32 %12)
%14 = tail call i64 @fmod(double 0x4197D783FC000000, i32 %7)
%15 = icmp eq i64 %14, 0
%16 = zext i1 %15 to i32
%17 = add nuw nsw i32 %6, %16
%18 = add nsw i32 %7, -1
%19 = icmp ugt i32 %7, 1
br i1 %19, label %5, label %20
20: ; preds = %5
%21 = add nuw nsw i32 %4, 1
%22 = sitofp i32 %21 to double
%23 = fcmp olt double %22, %0
br i1 %23, label %3, label %24
24: ; preds = %20, %1
%25 = phi i32 [ 0, %1 ], [ %17, %20 ]
ret i32 %25
}