#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 count_sum(int);
int hilbert(int degree) {
  int goodcount;
  goodcount = count_sum(degree);
  goodcount -= count_sum(degree - 64 + 8);
  goodcount -= count_sum(degree - 64 + 7);
  goodcount -= count_sum(degree - 64 + 15);
  goodcount -= count_sum(degree - 64 + 19);
  goodcount += count_sum(degree - 2 * 64 + (8 + 7));
  goodcount += count_sum(degree - 2 * 64 + (8 + 15));
  goodcount += count_sum(degree - 2 * 64 + (8 + 19));
  goodcount += count_sum(degree - 2 * 64 + (7 + 15));
  goodcount += count_sum(degree - 2 * 64 + (7 + 19));
  goodcount += count_sum(degree - 2 * 64 + (15 + 19));
  goodcount -= count_sum(degree - 3 * 64 + (8 + 7 + 15));
  goodcount -= count_sum(degree - 3 * 64 + (8 + 7 + 19));
  goodcount -= count_sum(degree - 3 * 64 + (8 + 15 + 19));
  goodcount -= count_sum(degree - 3 * 64 + (7 + 15 + 19));
  goodcount += count_sum(degree - 4 * 64 + (8 + 7 + 15 + 19));
  return (goodcount);
}


x86 assembly (clang, -O0):
<hilbert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <count_sum@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
sub    $0x40,%edi
add    $0x8,%edi
call   1030 <count_sum@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
sub    $0x40,%edi
add    $0x7,%edi
call   1030 <count_sum@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
sub    $0x40,%edi
add    $0xf,%edi
call   1030 <count_sum@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
sub    $0x40,%edi
add    $0x13,%edi
call   1030 <count_sum@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
sub    $0x80,%edi
add    $0xf,%edi
call   1030 <count_sum@plt>
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
sub    $0x80,%edi
add    $0x17,%edi
call   1030 <count_sum@plt>
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
sub    $0x80,%edi
add    $0x1b,%edi
call   1030 <count_sum@plt>
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
sub    $0x80,%edi
add    $0x16,%edi
call   1030 <count_sum@plt>
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
sub    $0x80,%edi
add    $0x1a,%edi
call   1030 <count_sum@plt>
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
sub    $0x80,%edi
add    $0x22,%edi
call   1030 <count_sum@plt>
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
sub    $0xc0,%edi
add    $0x1e,%edi
call   1030 <count_sum@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
sub    $0xc0,%edi
add    $0x22,%edi
call   1030 <count_sum@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
sub    $0xc0,%edi
add    $0x2a,%edi
call   1030 <count_sum@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
sub    $0xc0,%edi
add    $0x29,%edi
call   1030 <count_sum@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
sub    $0x100,%edi
add    $0x31,%edi
call   1030 <count_sum@plt>
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hilbert>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %edi,%ebx
call   1030 <count_sum@plt>
mov    %eax,%ebp
lea    -0x38(%rbx),%edi
call   1030 <count_sum@plt>
mov    %eax,0x24(%rsp)
lea    -0x39(%rbx),%edi
call   1030 <count_sum@plt>
mov    %eax,%r15d
lea    -0x31(%rbx),%edi
call   1030 <count_sum@plt>
mov    %eax,0x20(%rsp)
lea    -0x2d(%rbx),%edi
call   1030 <count_sum@plt>
mov    %eax,0x1c(%rsp)
lea    -0x71(%rbx),%edi
call   1030 <count_sum@plt>
mov    %eax,0x18(%rsp)
lea    -0x69(%rbx),%edi
call   1030 <count_sum@plt>
mov    %eax,0x14(%rsp)
lea    -0x65(%rbx),%edi
call   1030 <count_sum@plt>
mov    %eax,0x10(%rsp)
lea    -0x6a(%rbx),%edi
call   1030 <count_sum@plt>
mov    %eax,0xc(%rsp)
lea    -0x66(%rbx),%edi
call   1030 <count_sum@plt>
mov    %eax,0x8(%rsp)
lea    -0x5e(%rbx),%edi
call   1030 <count_sum@plt>
mov    %eax,0x4(%rsp)
lea    -0xa2(%rbx),%edi
call   1030 <count_sum@plt>
mov    %eax,(%rsp)
lea    -0x9e(%rbx),%edi
call   1030 <count_sum@plt>
mov    %eax,%r12d
lea    -0x96(%rbx),%edi
call   1030 <count_sum@plt>
mov    %eax,%r13d
lea    -0x97(%rbx),%edi
call   1030 <count_sum@plt>
mov    %eax,%r14d
add    $0xffffff31,%ebx
mov    %ebx,%edi
call   1030 <count_sum@plt>
add    0x24(%rsp),%r15d
add    0x20(%rsp),%r15d
add    0x1c(%rsp),%r15d
sub    %r15d,%ebp
add    0x18(%rsp),%ebp
add    0x14(%rsp),%ebp
add    0x10(%rsp),%ebp
add    0xc(%rsp),%ebp
add    0x8(%rsp),%ebp
add    0x4(%rsp),%ebp
add    (%rsp),%r12d
add    %r13d,%r12d
add    %r14d,%r12d
sub    %r12d,%ebp
add    %ebp,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @hilbert(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @count_sum(i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %2
%7 = sub nsw i32 %6, 64
%8 = add nsw i32 %7, 8
%9 = call i32 @count_sum(i32 %8)
%10 = load i32, i32* %3
%11 = sub nsw i32 %10, %9
store i32 %11, i32* %3
%12 = load i32, i32* %2
%13 = sub nsw i32 %12, 64
%14 = add nsw i32 %13, 7
%15 = call i32 @count_sum(i32 %14)
%16 = load i32, i32* %3
%17 = sub nsw i32 %16, %15
store i32 %17, i32* %3
%18 = load i32, i32* %2
%19 = sub nsw i32 %18, 64
%20 = add nsw i32 %19, 15
%21 = call i32 @count_sum(i32 %20)
%22 = load i32, i32* %3
%23 = sub nsw i32 %22, %21
store i32 %23, i32* %3
%24 = load i32, i32* %2
%25 = sub nsw i32 %24, 64
%26 = add nsw i32 %25, 19
%27 = call i32 @count_sum(i32 %26)
%28 = load i32, i32* %3
%29 = sub nsw i32 %28, %27
store i32 %29, i32* %3
%30 = load i32, i32* %2
%31 = sub nsw i32 %30, 128
%32 = add nsw i32 %31, 15
%33 = call i32 @count_sum(i32 %32)
%34 = load i32, i32* %3
%35 = add nsw i32 %34, %33
store i32 %35, i32* %3
%36 = load i32, i32* %2
%37 = sub nsw i32 %36, 128
%38 = add nsw i32 %37, 23
%39 = call i32 @count_sum(i32 %38)
%40 = load i32, i32* %3
%41 = add nsw i32 %40, %39
store i32 %41, i32* %3
%42 = load i32, i32* %2
%43 = sub nsw i32 %42, 128
%44 = add nsw i32 %43, 27
%45 = call i32 @count_sum(i32 %44)
%46 = load i32, i32* %3
%47 = add nsw i32 %46, %45
store i32 %47, i32* %3
%48 = load i32, i32* %2
%49 = sub nsw i32 %48, 128
%50 = add nsw i32 %49, 22
%51 = call i32 @count_sum(i32 %50)
%52 = load i32, i32* %3
%53 = add nsw i32 %52, %51
store i32 %53, i32* %3
%54 = load i32, i32* %2
%55 = sub nsw i32 %54, 128
%56 = add nsw i32 %55, 26
%57 = call i32 @count_sum(i32 %56)
%58 = load i32, i32* %3
%59 = add nsw i32 %58, %57
store i32 %59, i32* %3
%60 = load i32, i32* %2
%61 = sub nsw i32 %60, 128
%62 = add nsw i32 %61, 34
%63 = call i32 @count_sum(i32 %62)
%64 = load i32, i32* %3
%65 = add nsw i32 %64, %63
store i32 %65, i32* %3
%66 = load i32, i32* %2
%67 = sub nsw i32 %66, 192
%68 = add nsw i32 %67, 30
%69 = call i32 @count_sum(i32 %68)
%70 = load i32, i32* %3
%71 = sub nsw i32 %70, %69
store i32 %71, i32* %3
%72 = load i32, i32* %2
%73 = sub nsw i32 %72, 192
%74 = add nsw i32 %73, 34
%75 = call i32 @count_sum(i32 %74)
%76 = load i32, i32* %3
%77 = sub nsw i32 %76, %75
store i32 %77, i32* %3
%78 = load i32, i32* %2
%79 = sub nsw i32 %78, 192
%80 = add nsw i32 %79, 42
%81 = call i32 @count_sum(i32 %80)
%82 = load i32, i32* %3
%83 = sub nsw i32 %82, %81
store i32 %83, i32* %3
%84 = load i32, i32* %2
%85 = sub nsw i32 %84, 192
%86 = add nsw i32 %85, 41
%87 = call i32 @count_sum(i32 %86)
%88 = load i32, i32* %3
%89 = sub nsw i32 %88, %87
store i32 %89, i32* %3
%90 = load i32, i32* %2
%91 = sub nsw i32 %90, 256
%92 = add nsw i32 %91, 49
%93 = call i32 @count_sum(i32 %92)
%94 = load i32, i32* %3
%95 = add nsw i32 %94, %93
store i32 %95, i32* %3
%96 = load i32, i32* %3
ret i32 %96
}

LLVM IR (-O2):
define i32 @hilbert(i32 %0) {
%2 = tail call i32 @count_sum(i32 %0)
%3 = add nsw i32 %0, -56
%4 = tail call i32 @count_sum(i32 %3)
%5 = add nsw i32 %0, -57
%6 = tail call i32 @count_sum(i32 %5)
%7 = add nsw i32 %0, -49
%8 = tail call i32 @count_sum(i32 %7)
%9 = add nsw i32 %0, -45
%10 = tail call i32 @count_sum(i32 %9)
%11 = add nsw i32 %0, -113
%12 = tail call i32 @count_sum(i32 %11)
%13 = add nsw i32 %0, -105
%14 = tail call i32 @count_sum(i32 %13)
%15 = add nsw i32 %0, -101
%16 = tail call i32 @count_sum(i32 %15)
%17 = add nsw i32 %0, -106
%18 = tail call i32 @count_sum(i32 %17)
%19 = add nsw i32 %0, -102
%20 = tail call i32 @count_sum(i32 %19)
%21 = add nsw i32 %0, -94
%22 = tail call i32 @count_sum(i32 %21)
%23 = add nsw i32 %0, -162
%24 = tail call i32 @count_sum(i32 %23)
%25 = add nsw i32 %0, -158
%26 = tail call i32 @count_sum(i32 %25)
%27 = add nsw i32 %0, -150
%28 = tail call i32 @count_sum(i32 %27)
%29 = add nsw i32 %0, -151
%30 = tail call i32 @count_sum(i32 %29)
%31 = add nsw i32 %0, -207
%32 = tail call i32 @count_sum(i32 %31)
%33 = add i32 %4, %6
%34 = add i32 %33, %8
%35 = add i32 %34, %10
%36 = sub i32 %2, %35
%37 = add i32 %36, %12
%38 = add i32 %37, %14
%39 = add i32 %38, %16
%40 = add i32 %39, %18
%41 = add i32 %40, %20
%42 = add i32 %41, %22
%43 = add i32 %24, %26
%44 = add i32 %43, %28
%45 = add i32 %44, %30
%46 = sub i32 %42, %45
%47 = add i32 %46, %32
ret i32 %47
}