#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 */
typedef int /*<<< orphan*/ mpz_t;

/* Variables and functions */
int /*<<< orphan*/ i_stirling_first(int /*<<< orphan*/, unsigned int,
                                    unsigned int);
int /*<<< orphan*/ mpz_add(int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int /*<<< orphan*/ mpz_bin_uiui(int /*<<< orphan*/, unsigned int, unsigned int);
int /*<<< orphan*/ mpz_clear(int /*<<< orphan*/);
int /*<<< orphan*/ mpz_init(int /*<<< orphan*/);
int /*<<< orphan*/ mpz_mul(int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int /*<<< orphan*/ mpz_set_ui(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ mpz_sub(int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/);
void i_stirbin_sum_compute(mpz_t s, unsigned int n, unsigned int m) {
  unsigned int k;
  mpz_t term, stir, bin;
  mpz_init(term);
  mpz_init(stir);
  mpz_init(bin);
  mpz_set_ui(s, 0);
  for (k = m; k <= n; k++) {
    i_stirling_first(stir, n, k);
    mpz_bin_uiui(bin, k, m);
    mpz_mul(term, bin, stir);
    if (k % 2) {
      mpz_sub(s, s, term);
    } else {
      mpz_add(s, s, term);
    }
  }
  mpz_clear(term);
  mpz_clear(stir);
  mpz_clear(bin);
}


x86 assembly (clang, -O0):
<i_stirbin_sum_compute>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <mpz_init@plt>
mov    -0x18(%rbp),%edi
call   1050 <mpz_init@plt>
mov    -0x1c(%rbp),%edi
call   1050 <mpz_init@plt>
mov    -0x4(%rbp),%edi
xor    %esi,%esi
call   1080 <mpz_set_ui@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
ja     1232 <i_stirbin_sum_compute+0xb2>
mov    -0x18(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%edx
call   10a0 <i_stirling_first@plt>
mov    -0x1c(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1040 <mpz_bin_uiui@plt>
mov    -0x14(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1070 <mpz_mul@plt>
mov    -0x10(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1211 <i_stirbin_sum_compute+0x91>
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1030 <mpz_sub@plt>
jmp    121f <i_stirbin_sum_compute+0x9f>
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1060 <mpz_add@plt>
jmp    1224 <i_stirbin_sum_compute+0xa4>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11b9 <i_stirbin_sum_compute+0x39>
mov    -0x14(%rbp),%edi
call   1090 <mpz_clear@plt>
mov    -0x18(%rbp),%edi
call   1090 <mpz_clear@plt>
mov    -0x1c(%rbp),%edi
call   1090 <mpz_clear@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i_stirbin_sum_compute>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %esi,%r15d
mov    %edi,%ebx
call   1050 <mpz_init@plt>
call   1050 <mpz_init@plt>
call   1050 <mpz_init@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1080 <mpz_set_ui@plt>
cmp    %r15d,%r14d
jbe    11c5 <i_stirbin_sum_compute+0x45>
call   1090 <mpz_clear@plt>
call   1090 <mpz_clear@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1090 <mpz_clear@plt>
mov    %r14d,%ebp
jmp    11dd <i_stirbin_sum_compute+0x5d>
nopw   0x0(%rax,%rax,1)
call   1060 <mpz_add@plt>
add    $0x1,%ebp
cmp    %r15d,%ebp
ja     11ac <i_stirbin_sum_compute+0x2c>
mov    %r15d,%esi
mov    %ebp,%edx
call   10a0 <i_stirling_first@plt>
mov    %ebp,%esi
mov    %r14d,%edx
call   1040 <mpz_bin_uiui@plt>
call   1070 <mpz_mul@plt>
mov    %ebx,%edi
mov    %ebx,%esi
test   $0x1,%bpl
je     11d0 <i_stirbin_sum_compute+0x50>
call   1030 <mpz_sub@plt>
jmp    11d5 <i_stirbin_sum_compute+0x55>

LLVM IR (-O0):
define void @i_stirbin_sum_compute(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%11 = load i32, i32* %8
%12 = call i32 @mpz_init(i32 %11)
%13 = load i32, i32* %9
%14 = call i32 @mpz_init(i32 %13)
%15 = load i32, i32* %10
%16 = call i32 @mpz_init(i32 %15)
%17 = load i32, i32* %4
%18 = call i32 @mpz_set_ui(i32 %17, i32 0)
%19 = load i32, i32* %6
store i32 %19, i32* %7
br label %20
20: ; preds = %51, %3
%21 = load i32, i32* %7
%22 = load i32, i32* %5
%23 = icmp ule i32 %21, %22
br i1 %23, label %24, label %54
24: ; preds = %20
%25 = load i32, i32* %9
%26 = load i32, i32* %5
%27 = load i32, i32* %7
%28 = call i32 @i_stirling_first(i32 %25, i32 %26, i32 %27)
%29 = load i32, i32* %10
%30 = load i32, i32* %7
%31 = load i32, i32* %6
%32 = call i32 @mpz_bin_uiui(i32 %29, i32 %30, i32 %31)
%33 = load i32, i32* %8
%34 = load i32, i32* %10
%35 = load i32, i32* %9
%36 = call i32 @mpz_mul(i32 %33, i32 %34, i32 %35)
%37 = load i32, i32* %7
%38 = urem i32 %37, 2
%39 = icmp ne i32 %38, 0
br i1 %39, label %40, label %45
40: ; preds = %24
%41 = load i32, i32* %4
%42 = load i32, i32* %4
%43 = load i32, i32* %8
%44 = call i32 @mpz_sub(i32 %41, i32 %42, i32 %43)
br label %50
45: ; preds = %24
%46 = load i32, i32* %4
%47 = load i32, i32* %4
%48 = load i32, i32* %8
%49 = call i32 @mpz_add(i32 %46, i32 %47, i32 %48)
br label %50
50: ; preds = %45, %40
br label %51
51: ; preds = %50
%52 = load i32, i32* %7
%53 = add i32 %52, 1
store i32 %53, i32* %7
br label %20
54: ; preds = %20
%55 = load i32, i32* %8
%56 = call i32 @mpz_clear(i32 %55)
%57 = load i32, i32* %9
%58 = call i32 @mpz_clear(i32 %57)
%59 = load i32, i32* %10
%60 = call i32 @mpz_clear(i32 %59)
ret void
}

LLVM IR (-O2):
define void @i_stirbin_sum_compute(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @mpz_init(i32 undef)
%5 = tail call i32 @mpz_init(i32 undef)
%6 = tail call i32 @mpz_init(i32 undef)
%7 = tail call i32 @mpz_set_ui(i32 %0, i32 0)
%8 = icmp ugt i32 %2, %1
br i1 %8, label %23, label %9
9: ; preds = %3, %20
%10 = phi i32 [ %21, %20 ], [ %2, %3 ]
%11 = tail call i32 @i_stirling_first(i32 undef, i32 %1, i32 %10)
%12 = tail call i32 @mpz_bin_uiui(i32 undef, i32 %10, i32 %2)
%13 = tail call i32 @mpz_mul(i32 undef, i32 undef, i32 undef)
%14 = and i32 %10, 1
%15 = icmp eq i32 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %9
%17 = tail call i32 @mpz_sub(i32 %0, i32 %0, i32 undef)
br label %20
18: ; preds = %9
%19 = tail call i32 @mpz_add(i32 %0, i32 %0, i32 undef)
br label %20
20: ; preds = %16, %18
%21 = add i32 %10, 1
%22 = icmp ugt i32 %21, %1
br i1 %22, label %23, label %9
23: ; preds = %20, %3
%24 = tail call i32 @mpz_clear(i32 undef)
%25 = tail call i32 @mpz_clear(i32 undef)
%26 = tail call i32 @mpz_clear(i32 undef)
ret void
}