#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(double, unsigned int);
double symbol_newtona(unsigned int, unsigned int);
double dwumian(double a, double b, unsigned n) {
  unsigned i;
  double suma = 0;
  for (i = 0; i <= n; ++i) {
    suma += symbol_newtona(n, i) * pow(a, n - i) * pow(b, i);
  }
  return suma;
}


x86 assembly (clang, -O0):
<dwumian>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %edi,-0x14(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
ja     11b6 <dwumian+0x96>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1030 <symbol_newtona@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0x14(%rbp),%edi
sub    -0x18(%rbp),%edi
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%edi
call   1040 <pow@plt>
movaps %xmm0,%xmm2
movsd  -0x28(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1144 <dwumian+0x24>
movsd  -0x20(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dwumian>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %edi,%r14d
movsd  %xmm1,0x18(%rsp)
movsd  %xmm0,0x10(%rsp)
xor    %ebp,%ebp
xorps  %xmm0,%xmm0
mov    %edi,%ebx
xchg   %ax,%ax
movsd  %xmm0,0x8(%rsp)
mov    %r14d,%edi
mov    %ebp,%esi
call   1030 <symbol_newtona@plt>
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
mov    %ebx,%edi
call   1040 <pow@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x18(%rsp),%xmm0
mov    %ebp,%edi
call   1040 <pow@plt>
mulsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x8(%rsp),%xmm0
add    $0x1,%ebp
add    $0xffffffff,%ebx
cmp    %r14d,%ebp
jbe    1140 <dwumian+0x20>
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define double @dwumian(double %0, double %1, i32 %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca i32
%7 = alloca i32
%8 = alloca double
store double %0, double* %4
store double %1, double* %5
store i32 %2, i32* %6
store double 0.000000e+00, double* %8
store i32 0, i32* %7
br label %9
9: ; preds = %28, %3
%10 = load i32, i32* %7
%11 = load i32, i32* %6
%12 = icmp ule i32 %10, %11
br i1 %12, label %13, label %31
13: ; preds = %9
%14 = load i32, i32* %6
%15 = load i32, i32* %7
%16 = call double @symbol_newtona(i32 %14, i32 %15)
%17 = load double, double* %4
%18 = load i32, i32* %6
%19 = load i32, i32* %7
%20 = sub i32 %18, %19
%21 = call double @pow(double %17, i32 %20)
%22 = fmul double %16, %21
%23 = load double, double* %5
%24 = load i32, i32* %7
%25 = call double @pow(double %23, i32 %24)
%26 = load double, double* %8
%27 = call double @llvm.fmuladd.f64(double %22, double %25, double %26)
store double %27, double* %8
br label %28
28: ; preds = %13
%29 = load i32, i32* %7
%30 = add i32 %29, 1
store i32 %30, i32* %7
br label %9
31: ; preds = %9
%32 = load double, double* %8
ret double %32
}

LLVM IR (-O2):
define double @dwumian(double %0, double %1, i32 %2) {
br label %4
4: ; preds = %3, %4
%5 = phi double [ 0.000000e+00, %3 ], [ %12, %4 ]
%6 = phi i32 [ 0, %3 ], [ %13, %4 ]
%7 = tail call double @symbol_newtona(i32 %2, i32 %6)
%8 = sub i32 %2, %6
%9 = tail call double @pow(double %0, i32 %8)
%10 = fmul double %7, %9
%11 = tail call double @pow(double %1, i32 %6)
%12 = tail call double @llvm.fmuladd.f64(double %10, double %11, double %5)
%13 = add i32 %6, 1
%14 = icmp ugt i32 %13, %2
br i1 %14, label %15, label %4
15: ; preds = %4
ret double %12
}