#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*/ scanf(char *, ...);
int /*<<< orphan*/ sum(long long);
int main() {
  int i, n;
  long long int num;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%lld", &num);
    while (!(num & 1)) {
      num >>= 1;
    }
    sum(num);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11ac <main+0x8c>
lea    0xea8(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x18(%rbp),%rax
and    $0x1,%rax
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1184 <main+0x64>
jmp    1195 <main+0x75>
mov    -0x18(%rbp),%rax
sar    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1166 <main+0x46>
mov    -0x18(%rbp),%rdi
call   1030 <sum@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1148 <main+0x28>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jle    11a1 <main+0x81>
lea    0xeba(%rip),%r14
lea    0x8(%rsp),%rbx
xor    %ebp,%ebp
jmp    116e <main+0x4e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
call   1030 <sum@plt>
add    $0x1,%ebp
cmp    0x4(%rsp),%ebp
jge    11a1 <main+0x81>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x8(%rsp),%rdi
test   $0x1,%dil
jne    1160 <main+0x40>
cs nopw 0x0(%rax,%rax,1)
mov    %rdi,%rax
sar    %rdi
test   $0x2,%al
je     1190 <main+0x70>
mov    %rdi,0x8(%rsp)
jmp    1160 <main+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%lld\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i64
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
store i32 0, i32* %2
br label %6
6: ; preds = %23, %0
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %26
10: ; preds = %6
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %4)
br label %12
12: ; preds = %17, %10
%13 = load i64, i64* %4
%14 = and i64 %13, 1
%15 = icmp ne i64 %14, 0
%16 = xor i1 %15, true
br i1 %16, label %17, label %20
17: ; preds = %12
%18 = load i64, i64* %4
%19 = ashr i64 %18, 1
store i64 %19, i64* %4
br label %12
20: ; preds = %12
%21 = load i64, i64* %4
%22 = call i32 @sum(i64 %21)
br label %23
23: ; preds = %20
%24 = load i32, i32* %2
%25 = add nsw i32 %24, 1
store i32 %25, i32* %2
br label %6
26: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%lld\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = bitcast i32* %1 to i8*
%4 = bitcast i64* %2 to i8*
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %26
8: ; preds = %0, %20
%9 = phi i32 [ %23, %20 ], [ 0, %0 ]
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %2)
%11 = load i64, i64* %2
%12 = and i64 %11, 1
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %20
14: ; preds = %8, %14
%15 = phi i64 [ %16, %14 ], [ %11, %8 ]
%16 = ashr i64 %15, 1
%17 = and i64 %15, 2
%18 = icmp eq i64 %17, 0
br i1 %18, label %14, label %19
19: ; preds = %14
store i64 %16, i64* %2
br label %20
20: ; preds = %19, %8
%21 = phi i64 [ %16, %19 ], [ %11, %8 ]
%22 = call i32 @sum(i64 %21)
%23 = add nuw nsw i32 %9, 1
%24 = load i32, i32* %1
%25 = icmp slt i32 %23, %24
br i1 %25, label %8, label %26
26: ; preds = %20, %0
ret i32 0
}