#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 exp(double);
double poly(int, int, double *, double *, double *);
double exp_poly(int N, double args[N]) {
  int n = (int)args[N - 3];
  int m = (int)args[N - 4];
  return exp(-args[N - 2] *
             (poly(n, m, &args[n], &args[n + m], &args[0]) + args[N - 1]));
}


x86 assembly (clang, -O0):
<exp_poly>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x3,%ecx
movslq %ecx,%rcx
cvttsd2si (%rax,%rcx,8),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x4,%ecx
movslq %ecx,%rcx
cvttsd2si (%rax,%rcx,8),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x10(%rbp),%rdx
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
mov    -0x10(%rbp),%rcx
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rcx
mov    -0x10(%rbp),%r8
call   1030 <poly@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm1,%xmm0
call   1040 <exp@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exp_poly>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
movslq %edi,%r14
movupd -0x20(%rsi,%r14,8),%xmm0
cvttpd2dq %xmm0,%xmm0
movsd  -0x10(%rsi,%r14,8),%xmm1
xorps  0xeba(%rip),%xmm1
movaps %xmm1,(%rsp)
pshufd $0x55,%xmm0,%xmm1
movd   %xmm1,%eax
movslq %eax,%rdi
lea    (%rsi,%rdi,8),%rdx
movd   %xmm0,%esi
lea    (%rsi,%rdi,1),%eax
cltq
lea    (%rbx,%rax,8),%rcx
mov    %rbx,%r8
call   1030 <poly@plt>
addsd  -0x8(%rbx,%r14,8),%xmm0
mulsd  (%rsp),%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %r14
jmp    1040 <exp@plt>

LLVM IR (-O0):
define double @exp_poly(i32 %0, double* %1) {
%3 = alloca i32
%4 = alloca double*
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store double* %1, double** %4
%7 = load i32, i32* %3
%8 = zext i32 %7 to i64
%9 = load double*, double** %4
%10 = load i32, i32* %3
%11 = sub nsw i32 %10, 3
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds double, double* %9, i64 %12
%14 = load double, double* %13
%15 = fptosi double %14 to i32
store i32 %15, i32* %5
%16 = load double*, double** %4
%17 = load i32, i32* %3
%18 = sub nsw i32 %17, 4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds double, double* %16, i64 %19
%21 = load double, double* %20
%22 = fptosi double %21 to i32
store i32 %22, i32* %6
%23 = load double*, double** %4
%24 = load i32, i32* %3
%25 = sub nsw i32 %24, 2
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds double, double* %23, i64 %26
%28 = load double, double* %27
%29 = fneg double %28
%30 = load i32, i32* %5
%31 = load i32, i32* %6
%32 = load double*, double** %4
%33 = load i32, i32* %5
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds double, double* %32, i64 %34
%36 = load double*, double** %4
%37 = load i32, i32* %5
%38 = load i32, i32* %6
%39 = add nsw i32 %37, %38
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds double, double* %36, i64 %40
%42 = load double*, double** %4
%43 = getelementptr inbounds double, double* %42, i64 0
%44 = call double @poly(i32 %30, i32 %31, double* %35, double* %41, double* %43)
%45 = load double*, double** %4
%46 = load i32, i32* %3
%47 = sub nsw i32 %46, 1
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds double, double* %45, i64 %48
%50 = load double, double* %49
%51 = fadd double %44, %50
%52 = fmul double %29, %51
%53 = call double @exp(double %52)
ret double %53
}

LLVM IR (-O2):
define double @exp_poly(i32 %0, double* %1) {
%3 = add nsw i32 %0, -4
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds double, double* %1, i64 %4
%6 = bitcast double* %5 to <2 x double>*
%7 = load <2 x double>, <2 x double>* %6
%8 = fptosi <2 x double> %7 to <2 x i32>
%9 = add nsw i32 %0, -2
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds double, double* %1, i64 %10
%12 = load double, double* %11
%13 = fneg double %12
%14 = extractelement <2 x i32> %8, i64 1
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds double, double* %1, i64 %15
%17 = extractelement <2 x i32> %8, i64 0
%18 = add nsw i32 %17, %14
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds double, double* %1, i64 %19
%21 = tail call double @poly(i32 %14, i32 %17, double* %16, double* %20, double* %1)
%22 = add nsw i32 %0, -1
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds double, double* %1, i64 %23
%25 = load double, double* %24
%26 = fadd double %21, %25
%27 = fmul double %26, %13
%28 = tail call double @exp(double %27)
ret double %28
}