#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 */
float exp(double);
float sin(double);
float f(int n, int npts) {
  return exp(-(1.0 * n) / npts) * sin(2.0 * 3.1415926 * n / 50.0) +
         exp(-(2.0 * n) / npts) * sin(2.2 * 3.1415926 * n / 50.0);
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xee5(%rip),%xmm0
mulsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
call   1040 <exp@plt>
movss  %xmm0,-0xc(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xea2(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe7e(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <sin@plt>
movss  %xmm0,-0x10(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xe73(%rip),%xmm0
mulsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
call   1040 <exp@plt>
movss  %xmm0,-0x14(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xe30(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe1c(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <sin@plt>
movss  -0x14(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
movaps %xmm0,%xmm3
movss  -0xc(%rbp),%xmm0
mulss  %xmm3,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
sub    $0x28,%rsp
cvtsi2sd %edi,%xmm1
movapd %xmm1,0x10(%rsp)
movapd 0xeca(%rip),%xmm0
xorpd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %esi,%xmm1
movsd  %xmm1,(%rsp)
divsd  %xmm1,%xmm0
call   1040 <exp@plt>
movss  %xmm0,0xc(%rsp)
movsd  0xeb3(%rip),%xmm0
mulsd  0x10(%rsp),%xmm0
divsd  0xead(%rip),%xmm0
call   1030 <sin@plt>
movss  %xmm0,0x8(%rsp)
movsd  0xea2(%rip),%xmm0
mulsd  0x10(%rsp),%xmm0
divsd  (%rsp),%xmm0
call   1040 <exp@plt>
movss  %xmm0,(%rsp)
movapd 0x10(%rsp),%xmm0
mulsd  0xe87(%rip),%xmm0
divsd  0xe6f(%rip),%xmm0
call   1030 <sin@plt>
mulss  (%rsp),%xmm0
movss  0x8(%rsp),%xmm1
mulss  0xc(%rsp),%xmm1
addss  %xmm1,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define float @f(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = sitofp i32 %5 to double
%7 = fmul double 1.000000e+00, %6
%8 = fneg double %7
%9 = load i32, i32* %4
%10 = sitofp i32 %9 to double
%11 = fdiv double %8, %10
%12 = call float @exp(double %11)
%13 = load i32, i32* %3
%14 = sitofp i32 %13 to double
%15 = fmul double 0x401921FB4D12D84A, %14
%16 = fdiv double %15, 5.000000e+01
%17 = call float @sin(double %16)
%18 = load i32, i32* %3
%19 = sitofp i32 %18 to double
%20 = fmul double 2.000000e+00, %19
%21 = fneg double %20
%22 = load i32, i32* %4
%23 = sitofp i32 %22 to double
%24 = fdiv double %21, %23
%25 = call float @exp(double %24)
%26 = load i32, i32* %3
%27 = sitofp i32 %26 to double
%28 = fmul double 0x401BA5613B2E5452, %27
%29 = fdiv double %28, 5.000000e+01
%30 = call float @sin(double %29)
%31 = fmul float %25, %30
%32 = call float @llvm.fmuladd.f32(float %12, float %17, float %31)
ret float %32
}

LLVM IR (-O2):
define float @f(i32 %0, i32 %1) {
%3 = sitofp i32 %0 to double
%4 = fneg double %3
%5 = sitofp i32 %1 to double
%6 = fdiv double %4, %5
%7 = tail call float @exp(double %6)
%8 = fmul double %3, 0x401921FB4D12D84A
%9 = fdiv double %8, 5.000000e+01
%10 = tail call float @sin(double %9)
%11 = fmul double %3, -2.000000e+00
%12 = fdiv double %11, %5
%13 = tail call float @exp(double %12)
%14 = fmul double %3, 0x401BA5613B2E5452
%15 = fdiv double %14, 5.000000e+01
%16 = tail call float @sin(double %15)
%17 = fmul float %13, %16
%18 = tail call float @llvm.fmuladd.f32(float %7, float %10, float %17)
ret float %18
}