#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 /*<<< orphan*/ printf(char *, unsigned long long);
int /*<<< orphan*/ scanf(char *, unsigned long long *);
unsigned long long sum(unsigned long long, int);
int main() {
  unsigned long long num = 0, test = 0;
  unsigned long long totalSum = 0;
  scanf("%llu", &test);
  while (test != 0) {
    scanf("%llu", &num);
    printf("Sum of 3's : %llu\n", sum(num, 3));
    printf("Sum of 5's : %llu\n", sum(num, 5));
    printf("Sum of 15's : %llu\n", sum(num, 15));
    totalSum = sum(num, 3) + sum(num, 5) - sum(num, 15);
    printf("%llu\n", totalSum);
    --test;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
lea    0xea2(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <scanf@plt>
cmpq   $0x0,-0x18(%rbp)
je     1244 <main+0x114>
lea    0xe87(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   1040 <sum@plt>
mov    %rax,%rsi
lea    0xe6b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    $0x5,%esi
call   1040 <sum@plt>
mov    %rax,%rsi
lea    0xe61(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    $0xf,%esi
call   1040 <sum@plt>
mov    %rax,%rsi
lea    0xe57(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   1040 <sum@plt>
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x5,%esi
call   1040 <sum@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0xf,%esi
call   1040 <sum@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xde4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
jmp    1167 <main+0x37>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movq   $0x0,0x8(%rsp)
movq   $0x0,0x10(%rsp)
lea    0xea9(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1050 <scanf@plt>
cmpq   $0x0,0x10(%rsp)
je     123a <main+0x10a>
lea    0x8(%rsp),%r15
lea    0xe8c(%rip),%r12
lea    0xe98(%rip),%r13
lea    0xea4(%rip),%rbx
lea    0xe84(%rip),%rbp
xchg   %ax,%ax
lea    0xe69(%rip),%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    0x8(%rsp),%rdi
mov    $0x3,%esi
call   1040 <sum@plt>
mov    %r12,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    0x8(%rsp),%rdi
mov    $0x5,%esi
call   1040 <sum@plt>
mov    %r13,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    0x8(%rsp),%rdi
mov    $0xf,%esi
call   1040 <sum@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    0x8(%rsp),%rdi
mov    $0x3,%esi
call   1040 <sum@plt>
mov    %rax,%r14
mov    0x8(%rsp),%rdi
mov    $0x5,%esi
call   1040 <sum@plt>
add    %rax,%r14
mov    0x8(%rsp),%rdi
mov    $0xf,%esi
call   1040 <sum@plt>
sub    %rax,%r14
mov    %rbp,%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
addq   $0xffffffffffffffff,0x10(%rsp)
jne    1190 <main+0x60>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%llu\00"
@.str.1 = [19 x i8] c"Sum of 3's : %llu\0A\00"
@.str.2 = [19 x i8] c"Sum of 5's : %llu\0A\00"
@.str.3 = [20 x i8] c"Sum of 15's : %llu\0A\00"
@.str.4 = [6 x i8] c"%llu\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
store i32 0, i32* %1
store i64 0, i64* %2
store i64 0, i64* %3
store i64 0, i64* %4
%5 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %3)
br label %6
6: ; preds = %9, %0
%7 = load i64, i64* %3
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %32
9: ; preds = %6
%10 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %2)
%11 = load i64, i64* %2
%12 = call i64 @sum(i64 %11, i32 3)
%13 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i64 %12)
%14 = load i64, i64* %2
%15 = call i64 @sum(i64 %14, i32 5)
%16 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i64 %15)
%17 = load i64, i64* %2
%18 = call i64 @sum(i64 %17, i32 15)
%19 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i64 %18)
%20 = load i64, i64* %2
%21 = call i64 @sum(i64 %20, i32 3)
%22 = load i64, i64* %2
%23 = call i64 @sum(i64 %22, i32 5)
%24 = add i64 %21, %23
%25 = load i64, i64* %2
%26 = call i64 @sum(i64 %25, i32 15)
%27 = sub i64 %24, %26
store i64 %27, i64* %4
%28 = load i64, i64* %4
%29 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i64 %28)
%30 = load i64, i64* %3
%31 = add i64 %30, -1
store i64 %31, i64* %3
br label %6
32: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%llu\00"
@.str.1 = [19 x i8] c"Sum of 3's : %llu\0A\00"
@.str.2 = [19 x i8] c"Sum of 5's : %llu\0A\00"
@.str.3 = [20 x i8] c"Sum of 15's : %llu\0A\00"
@.str.4 = [6 x i8] c"%llu\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = bitcast i64* %1 to i8*
store i64 0, i64* %1
%4 = bitcast i64* %2 to i8*
store i64 0, i64* %2
%5 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %2)
%6 = load i64, i64* %2
%7 = icmp eq i64 %6, 0
br i1 %7, label %31, label %8
8: ; preds = %0, %8
%9 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %1)
%10 = load i64, i64* %1
%11 = call i64 @sum(i64 %10, i32 3)
%12 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i64 %11)
%13 = load i64, i64* %1
%14 = call i64 @sum(i64 %13, i32 5)
%15 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i64 %14)
%16 = load i64, i64* %1
%17 = call i64 @sum(i64 %16, i32 15)
%18 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i64 %17)
%19 = load i64, i64* %1
%20 = call i64 @sum(i64 %19, i32 3)
%21 = load i64, i64* %1
%22 = call i64 @sum(i64 %21, i32 5)
%23 = add i64 %22, %20
%24 = load i64, i64* %1
%25 = call i64 @sum(i64 %24, i32 15)
%26 = sub i64 %23, %25
%27 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i64 %26)
%28 = load i64, i64* %2
%29 = add i64 %28, -1
store i64 %29, i64* %2
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %8
31: ; preds = %8, %0
ret i32 0
}