#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 *, ...);
scalar_t__ scanf(char *, long long *);
int main() {
  int x, count;
  long long int a, c;
  long long int i;
  long long bol[10000];
  while (scanf("%lld", &a) && a) {
    i = 0, x = 0;
    count = 0;
    while (a != 0) {
      bol[i] = a % 2;
      a = a / 2;
      count++;
      i++;
    }
    bol[i] = '\0';
    printf("The parity of ");
    for (i = count - 1; i >= 0; i--) {
      printf("%lld", bol[i]);
      if (bol[i] == 1) {
        x++;
      }
    }
    printf(" is %d (mod 2).\n", x);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x138c0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x138b1(%rbp)
je     1165 <main+0x45>
cmpq   $0x0,-0x18(%rbp)
setne  %al
mov    %al,-0x138b1(%rbp)
mov    -0x138b1(%rbp),%al
test   $0x1,%al
jne    1178 <main+0x58>
jmp    1276 <main+0x156>
movq   $0x0,-0x28(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11df <main+0xbf>
mov    -0x18(%rbp),%rax
mov    $0x2,%ecx
cqto
idiv   %rcx
mov    -0x28(%rbp),%rax
mov    %rdx,-0x138b0(%rbp,%rax,8)
ff
mov    -0x18(%rbp),%rax
mov    $0x2,%ecx
cqto
idiv   %rcx
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    118e <main+0x6e>
mov    -0x28(%rbp),%rax
movq   $0x0,-0x138b0(%rbp,%rax,8)
lea    0xe0f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
cltq
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jl     1260 <main+0x140>
mov    -0x28(%rbp),%rax
mov    -0x138b0(%rbp,%rax,8),%rsi
ff
lea    0xdd9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
cmpq   $0x1,-0x138b0(%rbp,%rax,8)
ff 01
jne    124a <main+0x12a>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    124f <main+0x12f>
mov    -0x28(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x28(%rbp)
jmp    1209 <main+0xe9>
mov    -0x8(%rbp),%esi
lea    0xdaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1132 <main+0x12>
xor    %eax,%eax
add    $0x138c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x13898,%rsp
lea    0xec8(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
test   %rax,%rax
je     1222 <main+0x102>
mov    0x8(%rsp),%rax
test   %rax,%rax
je     1222 <main+0x102>
lea    0xea0(%rip),%r13
lea    0xead(%rip),%r15
lea    0x8(%rsp),%r12
xor    %ecx,%ecx
xchg   %ax,%ax
mov    %rax,%rdx
mov    %rcx,%rbx
shr    $0x3f,%rax
add    %rdx,%rax
mov    %rax,%rcx
and    $0xfffffffffffffffe,%rcx
mov    %rdx,%rsi
sub    %rcx,%rsi
mov    %rsi,0x10(%rsp,%rbx,8)
sar    %rax
lea    0x1(%rbx),%rcx
add    $0x1,%rdx
cmp    $0x2,%rdx
ja     1170 <main+0x50>
mov    %rax,0x8(%rsp)
movq   $0x0,0x18(%rsp,%rbx,8)
xor    %ebp,%ebp
lea    0xe4e(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebx,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x10(%rsp,%r14,8),%rbx
mov    %r13,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
cmp    $0x1,%rbx
sete   %al
add    %eax,%ebp
add    $0xffffffffffffffff,%r14
jb     11d0 <main+0xb0>
mov    %r15,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r13,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
test   %rax,%rax
je     1222 <main+0x102>
mov    0x8(%rsp),%rax
mov    $0x0,%ecx
test   %rax,%rax
jne    1170 <main+0x50>
xor    %eax,%eax
add    $0x13898,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%lld\00"
@.str.1 = [15 x i8] c"The parity of \00"
@.str.2 = [17 x i8] c" is %d (mod 2).\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca [10000 x i64]
store i32 0, i32* %1
br label %8
8: ; preds = %57, %0
%9 = call i64 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %4)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load i64, i64* %4
%13 = icmp ne i64 %12, 0
br label %14
14: ; preds = %11, %8
%15 = phi i1 [ false, %8 ], [ %13, %11 ]
br i1 %15, label %16, label %60
16: ; preds = %14
store i64 0, i64* %6
store i32 0, i32* %2
store i32 0, i32* %3
br label %17
17: ; preds = %20, %16
%18 = load i64, i64* %4
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %31
20: ; preds = %17
%21 = load i64, i64* %4
%22 = srem i64 %21, 2
%23 = load i64, i64* %6
%24 = getelementptr inbounds [10000 x i64], [10000 x i64]* %7, i64 0, i64 %23
store i64 %22, i64* %24
%25 = load i64, i64* %4
%26 = sdiv i64 %25, 2
store i64 %26, i64* %4
%27 = load i32, i32* %3
%28 = add nsw i32 %27, 1
store i32 %28, i32* %3
%29 = load i64, i64* %6
%30 = add nsw i64 %29, 1
store i64 %30, i64* %6
br label %17
31: ; preds = %17
%32 = load i64, i64* %6
%33 = getelementptr inbounds [10000 x i64], [10000 x i64]* %7, i64 0, i64 %32
store i64 0, i64* %33
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%35 = load i32, i32* %3
%36 = sub nsw i32 %35, 1
%37 = sext i32 %36 to i64
store i64 %37, i64* %6
br label %38
38: ; preds = %54, %31
%39 = load i64, i64* %6
%40 = icmp sge i64 %39, 0
br i1 %40, label %41, label %57
41: ; preds = %38
%42 = load i64, i64* %6
%43 = getelementptr inbounds [10000 x i64], [10000 x i64]* %7, i64 0, i64 %42
%44 = load i64, i64* %43
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %44)
%46 = load i64, i64* %6
%47 = getelementptr inbounds [10000 x i64], [10000 x i64]* %7, i64 0, i64 %46
%48 = load i64, i64* %47
%49 = icmp eq i64 %48, 1
br i1 %49, label %50, label %53
50: ; preds = %41
%51 = load i32, i32* %2
%52 = add nsw i32 %51, 1
store i32 %52, i32* %2
br label %53
53: ; preds = %50, %41
br label %54
54: ; preds = %53
%55 = load i64, i64* %6
%56 = add nsw i64 %55, -1
store i64 %56, i64* %6
br label %38
57: ; preds = %38
%58 = load i32, i32* %2
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %58)
br label %8
60: ; preds = %14
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%lld\00"
@.str.1 = [15 x i8] c"The parity of \00"
@.str.2 = [17 x i8] c" is %d (mod 2).\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca [10000 x i64]
%3 = bitcast i64* %1 to i8*
%4 = bitcast [10000 x i64]* %2 to i8*
%5 = call i64 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %1)
%6 = icmp ne i64 %5, 0
%7 = load i64, i64* %1
%8 = icmp ne i64 %7, 0
%9 = select i1 %6, i1 %8, i1 false
br i1 %9, label %10, label %44
10: ; preds = %0, %19
%11 = phi i64 [ %20, %19 ], [ 0, %0 ]
%12 = phi i64 [ %21, %19 ], [ %7, %0 ]
%13 = srem i64 %12, 2
%14 = getelementptr inbounds [10000 x i64], [10000 x i64]* %2, i64 0, i64 %11
store i64 %13, i64* %14
%15 = sdiv i64 %12, 2
%16 = add nuw nsw i64 %11, 1
%17 = add i64 %12, 1
%18 = icmp ult i64 %17, 3
br i1 %18, label %22, label %19
19: ; preds = %10, %37
%20 = phi i64 [ %16, %10 ], [ 0, %37 ]
%21 = phi i64 [ %15, %10 ], [ %41, %37 ]
br label %10
22: ; preds = %10
store i64 %15, i64* %1
%23 = getelementptr inbounds [10000 x i64], [10000 x i64]* %2, i64 0, i64 %16
store i64 0, i64* %23
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%25 = and i64 %11, 4294967295
br label %26
26: ; preds = %22, %26
%27 = phi i64 [ %35, %26 ], [ %25, %22 ]
%28 = phi i32 [ %34, %26 ], [ 0, %22 ]
%29 = getelementptr inbounds [10000 x i64], [10000 x i64]* %2, i64 0, i64 %27
%30 = load i64, i64* %29
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %30)
%32 = icmp eq i64 %30, 1
%33 = zext i1 %32 to i32
%34 = add nuw nsw i32 %28, %33
%35 = add nsw i64 %27, -1
%36 = icmp eq i64 %27, 0
br i1 %36, label %37, label %26
37: ; preds = %26
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %34)
%39 = call i64 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %1)
%40 = icmp ne i64 %39, 0
%41 = load i64, i64* %1
%42 = icmp ne i64 %41, 0
%43 = select i1 %40, i1 %42, i1 false
br i1 %43, label %19, label %44
44: ; preds = %37, %0
ret i32 0
}