#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*/ assert(int);
double cos(int);
double sin(int);
double f_ana(double x, double y, int kx, int ky) {
  assert(kx >= 0 && ky >= 0);
  double out = sin(kx * x) * cos(ky * y);
  return out;
}


x86 assembly (clang, -O0):
<f_ana>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %edi,-0x14(%rbp)
mov    %esi,-0x18(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x14(%rbp)
mov    %al,-0x21(%rbp)
jl     1161 <f_ana+0x31>
cmpl   $0x0,-0x18(%rbp)
setge  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cvtsi2sdl -0x14(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sin@plt>
movsd  %xmm0,-0x30(%rbp)
cvtsi2sdl -0x18(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1050 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_ana>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %esi,%ebx
mov    %edi,%ebp
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
mov    %esi,%edi
or     %ebp,%edi
not    %edi
shr    $0x1f,%edi
call   1030 <assert@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
mulsd  0x8(%rsp),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sin@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %ebx,%xmm1
movsd  %xmm0,0x8(%rsp)
mulsd  0x10(%rsp),%xmm1
cvttsd2si %xmm1,%edi
call   1050 <cos@plt>
mulsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define double @f_ana(double %0, double %1, i32 %2, i32 %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
store double %0, double* %5
store double %1, double* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load i32, i32* %7
%11 = icmp sge i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %4
%13 = load i32, i32* %8
%14 = icmp sge i32 %13, 0
br label %15
15: ; preds = %12, %4
%16 = phi i1 [ false, %4 ], [ %14, %12 ]
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
%19 = load i32, i32* %7
%20 = sitofp i32 %19 to double
%21 = load double, double* %5
%22 = fmul double %20, %21
%23 = fptosi double %22 to i32
%24 = call double @sin(i32 %23)
%25 = load i32, i32* %8
%26 = sitofp i32 %25 to double
%27 = load double, double* %6
%28 = fmul double %26, %27
%29 = fptosi double %28 to i32
%30 = call double @cos(i32 %29)
%31 = fmul double %24, %30
store double %31, double* %9
%32 = load double, double* %9
ret double %32
}

LLVM IR (-O2):
define double @f_ana(double %0, double %1, i32 %2, i32 %3) {
%5 = or i32 %3, %2
%6 = xor i32 %5, -1
%7 = lshr i32 %6, 31
%8 = tail call i32 @assert(i32 %7)
%9 = sitofp i32 %2 to double
%10 = fmul double %9, %0
%11 = fptosi double %10 to i32
%12 = tail call double @sin(i32 %11)
%13 = sitofp i32 %3 to double
%14 = fmul double %13, %1
%15 = fptosi double %14 to i32
%16 = tail call double @cos(i32 %15)
%17 = fmul double %12, %16
ret double %17
}