#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 */
char *hamming(long);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  short n, i;
  long a[10000];
  scanf("%hd", &n);
  for (i = 0; i < n; i++)
    scanf("%ld", &a[i]);
  for (i = 0; i < n; i++)
    printf("%s\n", hamming(a[i]));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x13890,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
lea    -0x6(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movw   $0x0,-0x8(%rbp)
movswl -0x8(%rbp),%eax
movswl -0x6(%rbp),%ecx
cmp    %ecx,%eax
jge    119c <main+0x6c>
movswq -0x8(%rbp),%rax
lea    -0x13890(%rbp),%rsi
shl    $0x3,%rax
add    %rax,%rsi
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x8(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x8(%rbp)
jmp    115a <main+0x2a>
movw   $0x0,-0x8(%rbp)
movswl -0x8(%rbp),%eax
movswl -0x6(%rbp),%ecx
cmp    %ecx,%eax
jge    11e4 <main+0xb4>
movswq -0x8(%rbp),%rax
mov    -0x13890(%rbp,%rax,8),%rdi
ff
call   1040 <hamming@plt>
mov    %rax,%rsi
lea    0xe3a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x8(%rbp)
jmp    11a2 <main+0x72>
xor    %eax,%eax
add    $0x13890,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x13890,%rsp
lea    0xebd(%rip),%rdi
lea    0xe(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpw   $0x0,0xe(%rsp)
jle    11c4 <main+0x94>
lea    0x10(%rsp),%r15
lea    0xea1(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
add    $0x1,%rbx
movswq 0xe(%rsp),%rax
add    $0x8,%r15
cmp    %rax,%rbx
jl     1170 <main+0x40>
test   %ax,%ax
jle    11c4 <main+0x94>
xor    %ebx,%ebx
lea    0xe6a(%rip),%r14
xchg   %ax,%ax
mov    0x10(%rsp,%rbx,8),%rdi
call   1040 <hamming@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
add    $0x1,%rbx
movswq 0xe(%rsp),%rax
cmp    %rax,%rbx
jl     11a0 <main+0x70>
xor    %eax,%eax
add    $0x13890,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%hd\00"
@.str.1 = [4 x i8] c"%ld\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i16
%3 = alloca i16
%4 = alloca [10000 x i64]
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i16* %2)
store i16 0, i16* %3
br label %6
6: ; preds = %17, %0
%7 = load i16, i16* %3
%8 = sext i16 %7 to i32
%9 = load i16, i16* %2
%10 = sext i16 %9 to i32
%11 = icmp slt i32 %8, %10
br i1 %11, label %12, label %20
12: ; preds = %6
%13 = load i16, i16* %3
%14 = sext i16 %13 to i64
%15 = getelementptr inbounds [10000 x i64], [10000 x i64]* %4, i64 0, i64 %14
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %15)
br label %17
17: ; preds = %12
%18 = load i16, i16* %3
%19 = add i16 %18, 1
store i16 %19, i16* %3
br label %6
20: ; preds = %6
store i16 0, i16* %3
br label %21
21: ; preds = %34, %20
%22 = load i16, i16* %3
%23 = sext i16 %22 to i32
%24 = load i16, i16* %2
%25 = sext i16 %24 to i32
%26 = icmp slt i32 %23, %25
br i1 %26, label %27, label %37
27: ; preds = %21
%28 = load i16, i16* %3
%29 = sext i16 %28 to i64
%30 = getelementptr inbounds [10000 x i64], [10000 x i64]* %4, i64 0, i64 %29
%31 = load i64, i64* %30
%32 = call i8* @hamming(i64 %31)
%33 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %32)
br label %34
34: ; preds = %27
%35 = load i16, i16* %3
%36 = add i16 %35, 1
store i16 %36, i16* %3
br label %21
37: ; preds = %21
ret i32 0
}

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