#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 */
unsigned int CalculateDivisibilitySum(int, unsigned short);
unsigned short CountDivisibility(int);
int /*<<< orphan*/ printf(char *, unsigned int);
int main() {
  unsigned short div_three_count = 0, div_five_count = 0, div_fifteen_count = 0;
  unsigned int div_three_sum, div_five_sum, div_fifteen_sum, total_sum;
  div_three_count = CountDivisibility(3);
  div_five_count = CountDivisibility(5);
  div_fifteen_count = CountDivisibility(15);
  div_three_sum = CalculateDivisibilitySum(3, div_three_count);
  div_five_sum = CalculateDivisibilitySum(5, div_five_count);
  div_fifteen_sum = CalculateDivisibilitySum(15, div_fifteen_count);
  total_sum = div_three_sum + div_five_sum - div_fifteen_sum;
  printf("%d", total_sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movw   $0x0,-0x6(%rbp)
movw   $0x0,-0x8(%rbp)
movw   $0x0,-0xa(%rbp)
mov    $0x3,%edi
call   1050 <CountDivisibility@plt>
mov    %ax,-0x6(%rbp)
mov    $0x5,%edi
call   1050 <CountDivisibility@plt>
mov    %ax,-0x8(%rbp)
mov    $0xf,%edi
call   1050 <CountDivisibility@plt>
mov    %ax,-0xa(%rbp)
mov    $0x3,%edi
movzwl -0x6(%rbp),%esi
call   1040 <CalculateDivisibilitySum@plt>
mov    %eax,-0x10(%rbp)
mov    $0x5,%edi
movzwl -0x8(%rbp),%esi
call   1040 <CalculateDivisibilitySum@plt>
mov    %eax,-0x14(%rbp)
mov    $0xf,%edi
movzwl -0xa(%rbp),%esi
call   1040 <CalculateDivisibilitySum@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
sub    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xe3c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    $0x3,%edi
call   1050 <CountDivisibility@plt>
mov    %eax,%ebx
mov    $0x5,%edi
call   1050 <CountDivisibility@plt>
mov    %eax,%ebp
mov    $0xf,%edi
call   1050 <CountDivisibility@plt>
mov    %eax,%r14d
movzwl %bx,%esi
mov    $0x3,%edi
call   1040 <CalculateDivisibilitySum@plt>
mov    %eax,%ebx
movzwl %bp,%esi
mov    $0x5,%edi
call   1040 <CalculateDivisibilitySum@plt>
mov    %eax,%ebp
movzwl %r14w,%esi
mov    $0xf,%edi
call   1040 <CalculateDivisibilitySum@plt>
add    %ebx,%ebp
sub    %eax,%ebp
lea    0xe70(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i16
%3 = alloca i16
%4 = alloca i16
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
store i16 0, i16* %2
store i16 0, i16* %3
store i16 0, i16* %4
%9 = call zeroext i16 @CountDivisibility(i32 3)
store i16 %9, i16* %2
%10 = call zeroext i16 @CountDivisibility(i32 5)
store i16 %10, i16* %3
%11 = call zeroext i16 @CountDivisibility(i32 15)
store i16 %11, i16* %4
%12 = load i16, i16* %2
%13 = call i32 @CalculateDivisibilitySum(i32 3, i16 zeroext %12)
store i32 %13, i32* %5
%14 = load i16, i16* %3
%15 = call i32 @CalculateDivisibilitySum(i32 5, i16 zeroext %14)
store i32 %15, i32* %6
%16 = load i16, i16* %4
%17 = call i32 @CalculateDivisibilitySum(i32 15, i16 zeroext %16)
store i32 %17, i32* %7
%18 = load i32, i32* %5
%19 = load i32, i32* %6
%20 = add i32 %18, %19
%21 = load i32, i32* %7
%22 = sub i32 %20, %21
store i32 %22, i32* %8
%23 = load i32, i32* %8
%24 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %23)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = tail call zeroext i16 @CountDivisibility(i32 3)
%2 = tail call zeroext i16 @CountDivisibility(i32 5)
%3 = tail call zeroext i16 @CountDivisibility(i32 15)
%4 = tail call i32 @CalculateDivisibilitySum(i32 3, i16 zeroext %1)
%5 = tail call i32 @CalculateDivisibilitySum(i32 5, i16 zeroext %2)
%6 = tail call i32 @CalculateDivisibilitySum(i32 15, i16 zeroext %3)
%7 = add i32 %5, %4
%8 = sub i32 %7, %6
%9 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %8)
ret i32 0
}