#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 C(int, int);
int pow(int, int);
int calc(int num) {
  int sum = 0, i;
  if (num < 10) {
    sum = pow(num, 5) * 21;
  } else if (num < 100) {
    for (i = 0; i <= 5; i++) {
      sum += C(i, 5) * pow(10, i) * pow((num - 10), (5 - i)) * (26 - i);
    }
  }
  return sum;
}


x86 assembly (clang, -O0):
<calc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    1154 <calc+0x34>
mov    -0x4(%rbp),%edi
mov    $0x5,%esi
call   1040 <pow@plt>
imul   $0x15,%eax,%eax
mov    %eax,-0x8(%rbp)
jmp    11db <calc+0xbb>
cmpl   $0x64,-0x4(%rbp)
jge    11d6 <calc+0xb6>
movl   $0x0,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jg     11d1 <calc+0xb1>
mov    -0xc(%rbp),%edi
mov    $0x5,%esi
call   1030 <C@plt>
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%esi
mov    $0xa,%edi
call   1040 <pow@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
sub    $0xa,%edi
mov    $0x5,%esi
sub    -0xc(%rbp),%esi
call   1040 <pow@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
imul   %ecx,%eax
mov    $0x1a,%ecx
sub    -0xc(%rbp),%ecx
imul   %ecx,%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1165 <calc+0x45>
jmp    11d6 <calc+0xb6>
jmp    11db <calc+0xbb>
mov    -0x8(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edi,%r15d
cmp    $0x9,%edi
jg     1148 <calc+0x28>
mov    %r15d,%edi
mov    $0x5,%esi
call   1040 <pow@plt>
lea    (%rax,%rax,4),%ecx
lea    (%rax,%rcx,4),%eax
jmp    12dc <calc+0x1bc>
xor    %eax,%eax
cmp    $0x63,%r15d
ja     12dc <calc+0x1bc>
add    $0xfffffff6,%r15d
xor    %edi,%edi
mov    $0x5,%esi
call   1030 <C@plt>
mov    %eax,%r14d
mov    $0xa,%edi
xor    %esi,%esi
call   1040 <pow@plt>
mov    %eax,%ebp
mov    %r15d,%edi
mov    $0x5,%esi
call   1040 <pow@plt>
imul   %r14d,%ebp
imul   %eax,%ebp
lea    0x0(%rbp,%rbp,4),%eax
lea    (%rax,%rax,4),%r12d
add    %ebp,%r12d
mov    $0x1,%edi
mov    $0x5,%esi
call   1030 <C@plt>
mov    %eax,%r14d
mov    $0xa,%edi
mov    $0x1,%esi
call   1040 <pow@plt>
mov    %eax,%ebp
mov    %r15d,%edi
mov    $0x4,%esi
call   1040 <pow@plt>
imul   %r14d,%ebp
imul   %eax,%ebp
lea    0x0(%rbp,%rbp,4),%eax
lea    (%rax,%rax,4),%ebx
add    %r12d,%ebx
mov    $0x2,%edi
mov    $0x5,%esi
call   1030 <C@plt>
mov    %eax,%r14d
mov    $0xa,%edi
mov    $0x2,%esi
call   1040 <pow@plt>
mov    %eax,%ebp
mov    %r15d,%edi
mov    $0x3,%esi
call   1040 <pow@plt>
imul   %r14d,%ebp
imul   %eax,%ebp
lea    0x0(%rbp,%rbp,2),%eax
lea    (%rbx,%rax,8),%r12d
mov    $0x3,%edi
mov    $0x5,%esi
call   1030 <C@plt>
mov    %eax,%r14d
mov    $0xa,%edi
mov    $0x3,%esi
call   1040 <pow@plt>
mov    %eax,%ebp
mov    %r15d,%edi
mov    $0x2,%esi
call   1040 <pow@plt>
imul   %r14d,%ebp
imul   %eax,%ebp
lea    0x0(%rbp,%rbp,2),%ebx
shl    $0x3,%ebx
sub    %ebp,%ebx
add    %r12d,%ebx
mov    $0x4,%edi
mov    $0x5,%esi
call   1030 <C@plt>
mov    %eax,%r14d
mov    $0xa,%edi
mov    $0x4,%esi
call   1040 <pow@plt>
mov    %eax,%ebp
mov    %r15d,%edi
mov    $0x1,%esi
call   1040 <pow@plt>
imul   %r14d,%ebp
imul   %eax,%ebp
lea    0x0(%rbp,%rbp,4),%eax
lea    0x0(%rbp,%rax,4),%r12d
add    %ebp,%r12d
add    %ebx,%r12d
mov    $0x5,%edi
mov    $0x5,%esi
call   1030 <C@plt>
mov    %eax,%r14d
mov    $0xa,%edi
mov    $0x5,%esi
call   1040 <pow@plt>
mov    %eax,%ebp
mov    %r15d,%edi
xor    %esi,%esi
call   1040 <pow@plt>
imul   %r14d,%ebp
imul   %eax,%ebp
lea    0x0(%rbp,%rbp,4),%eax
lea    0x0(%rbp,%rax,4),%eax
add    %r12d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @calc(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 10
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i32, i32* %2
%9 = call i32 @pow(i32 %8, i32 5)
%10 = mul nsw i32 %9, 21
store i32 %10, i32* %3
br label %40
11: ; preds = %1
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 100
br i1 %13, label %14, label %39
14: ; preds = %11
store i32 0, i32* %4
br label %15
15: ; preds = %35, %14
%16 = load i32, i32* %4
%17 = icmp sle i32 %16, 5
br i1 %17, label %18, label %38
18: ; preds = %15
%19 = load i32, i32* %4
%20 = call i32 @C(i32 %19, i32 5)
%21 = load i32, i32* %4
%22 = call i32 @pow(i32 10, i32 %21)
%23 = mul nsw i32 %20, %22
%24 = load i32, i32* %2
%25 = sub nsw i32 %24, 10
%26 = load i32, i32* %4
%27 = sub nsw i32 5, %26
%28 = call i32 @pow(i32 %25, i32 %27)
%29 = mul nsw i32 %23, %28
%30 = load i32, i32* %4
%31 = sub nsw i32 26, %30
%32 = mul nsw i32 %29, %31
%33 = load i32, i32* %3
%34 = add nsw i32 %33, %32
store i32 %34, i32* %3
br label %35
35: ; preds = %18
%36 = load i32, i32* %4
%37 = add nsw i32 %36, 1
store i32 %37, i32* %4
br label %15
38: ; preds = %15
br label %39
39: ; preds = %38, %11
br label %40
40: ; preds = %39, %7
%41 = load i32, i32* %3
ret i32 %41
}

LLVM IR (-O2):
define i32 @calc(i32 %0) {
%2 = icmp slt i32 %0, 10
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = tail call i32 @pow(i32 %0, i32 5)
%5 = mul nsw i32 %4, 21
br label %51
6: ; preds = %1
%7 = icmp ult i32 %0, 100
br i1 %7, label %8, label %51
8: ; preds = %6
%9 = add nsw i32 %0, -10
%10 = tail call i32 @C(i32 0, i32 5)
%11 = tail call i32 @pow(i32 10, i32 0)
%12 = tail call i32 @pow(i32 %9, i32 5)
%13 = mul i32 %10, 26
%14 = mul i32 %13, %11
%15 = mul i32 %14, %12
%16 = tail call i32 @C(i32 1, i32 5)
%17 = tail call i32 @pow(i32 10, i32 1)
%18 = tail call i32 @pow(i32 %9, i32 4)
%19 = mul i32 %16, 25
%20 = mul i32 %19, %17
%21 = mul i32 %20, %18
%22 = add nsw i32 %21, %15
%23 = tail call i32 @C(i32 2, i32 5)
%24 = tail call i32 @pow(i32 10, i32 2)
%25 = tail call i32 @pow(i32 %9, i32 3)
%26 = mul i32 %23, 24
%27 = mul i32 %26, %24
%28 = mul i32 %27, %25
%29 = add nsw i32 %28, %22
%30 = tail call i32 @C(i32 3, i32 5)
%31 = tail call i32 @pow(i32 10, i32 3)
%32 = tail call i32 @pow(i32 %9, i32 2)
%33 = mul i32 %30, 23
%34 = mul i32 %33, %31
%35 = mul i32 %34, %32
%36 = add nsw i32 %35, %29
%37 = tail call i32 @C(i32 4, i32 5)
%38 = tail call i32 @pow(i32 10, i32 4)
%39 = tail call i32 @pow(i32 %9, i32 1)
%40 = mul i32 %37, 22
%41 = mul i32 %40, %38
%42 = mul i32 %41, %39
%43 = add nsw i32 %42, %36
%44 = tail call i32 @C(i32 5, i32 5)
%45 = tail call i32 @pow(i32 10, i32 5)
%46 = tail call i32 @pow(i32 %9, i32 0)
%47 = mul i32 %44, 21
%48 = mul i32 %47, %45
%49 = mul i32 %48, %46
%50 = add nsw i32 %49, %43
br label %51
51: ; preds = %8, %6, %3
%52 = phi i32 [ %5, %3 ], [ 0, %6 ], [ %50, %8 ]
ret i32 %52
}