#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 pow(int /*<<< orphan*/, double);
int /*<<< orphan*/ sin(int);
int /*<<< orphan*/ tan(int);
double delay(double iat) {
  int i;
  double sc = 0.0;
  for (i = 0; i < 600; i++)
    sc += 1.0 / (pow(tan(i * 3.14159265358979323846 / 600), 2.0) + 1.0) +
          pow(sin(i * 3.14159265358979323846 / 600), 2.0);
  sc /= 600;
  return (iat * sc);
}


x86 assembly (clang, -O0):
<delay>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x258,-0xc(%rbp)
jge    1207 <delay+0xd7>
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  0xeaa(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe8e(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <tan@plt>
mov    %eax,%edi
movsd  0xe7f(%rip),%xmm0
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xe7f(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xe73(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  0xe55(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe39(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
mov    %eax,%edi
movsd  0xe2a(%rip),%xmm0
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
addsd  %xmm1,%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114c <delay+0x1c>
movsd  -0x18(%rbp),%xmm0
movsd  0xdec(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<delay>:
push   %rbp
push   %rbx
sub    $0x28,%rsp
movsd  %xmm0,0x10(%rsp)
xorpd  %xmm0,%xmm0
mov    $0x258,%ebp
xorpd  %xmm1,%xmm1
nopl   0x0(%rax)
movsd  %xmm1,0x20(%rsp)
movsd  %xmm0,0x8(%rsp)
movapd %xmm1,%xmm0
mulsd  0xe98(%rip),%xmm0
divsd  0xe98(%rip),%xmm0
cvttsd2si %xmm0,%ebx
mov    %ebx,%edi
call   1040 <tan@plt>
mov    %eax,%edi
movsd  0xe8b(%rip),%xmm0
call   1050 <pow@plt>
movsd  0xe86(%rip),%xmm1
addsd  %xmm1,%xmm0
divsd  %xmm0,%xmm1
movsd  %xmm1,0x18(%rsp)
mov    %ebx,%edi
call   1030 <sin@plt>
mov    %eax,%edi
movsd  0xe5f(%rip),%xmm0
call   1050 <pow@plt>
addsd  0x18(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x20(%rsp),%xmm1
movsd  0x8(%rsp),%xmm0
addsd  0xe38(%rip),%xmm1
add    $0xffffffff,%ebp
jne    1150 <delay+0x20>
divsd  0xe17(%rip),%xmm0
mulsd  0x10(%rsp),%xmm0
add    $0x28,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define double @delay(double %0) {
%2 = alloca double
%3 = alloca i32
%4 = alloca double
store double %0, double* %2
store double 0.000000e+00, double* %4
store i32 0, i32* %3
br label %5
5: ; preds = %28, %1
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 600
br i1 %7, label %8, label %31
8: ; preds = %5
%9 = load i32, i32* %3
%10 = sitofp i32 %9 to double
%11 = fmul double %10, 0x400921FB54442D18
%12 = fdiv double %11, 6.000000e+02
%13 = fptosi double %12 to i32
%14 = call i32 @tan(i32 %13)
%15 = call double @pow(i32 %14, double 2.000000e+00)
%16 = fadd double %15, 1.000000e+00
%17 = fdiv double 1.000000e+00, %16
%18 = load i32, i32* %3
%19 = sitofp i32 %18 to double
%20 = fmul double %19, 0x400921FB54442D18
%21 = fdiv double %20, 6.000000e+02
%22 = fptosi double %21 to i32
%23 = call i32 @sin(i32 %22)
%24 = call double @pow(i32 %23, double 2.000000e+00)
%25 = fadd double %17, %24
%26 = load double, double* %4
%27 = fadd double %26, %25
store double %27, double* %4
br label %28
28: ; preds = %8
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 1
store i32 %30, i32* %3
br label %5
31: ; preds = %5
%32 = load double, double* %4
%33 = fdiv double %32, 6.000000e+02
store double %33, double* %4
%34 = load double, double* %2
%35 = load double, double* %4
%36 = fmul double %34, %35
ret double %36
}

LLVM IR (-O2):
define double @delay(double %0) {
br label %2
2: ; preds = %1, %2
%3 = phi double [ 0.000000e+00, %1 ], [ %16, %2 ]
%4 = phi i32 [ 0, %1 ], [ %17, %2 ]
%5 = sitofp i32 %4 to double
%6 = fmul double %5, 0x400921FB54442D18
%7 = fdiv double %6, 6.000000e+02
%8 = fptosi double %7 to i32
%9 = tail call i32 @tan(i32 %8)
%10 = tail call double @pow(i32 %9, double 2.000000e+00)
%11 = fadd double %10, 1.000000e+00
%12 = fdiv double 1.000000e+00, %11
%13 = tail call i32 @sin(i32 %8)
%14 = tail call double @pow(i32 %13, double 2.000000e+00)
%15 = fadd double %12, %14
%16 = fadd double %3, %15
%17 = add nuw nsw i32 %4, 1
%18 = icmp eq i32 %17, 600
br i1 %18, label %19, label %2
19: ; preds = %2
%20 = fdiv double %16, 6.000000e+02
%21 = fmul double %20, %0
ret double %21
}