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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x9c60,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    122d <main+0x10d>
cmpq   $0x0,-0x10(%rbp)
jne    115b <main+0x3b>
jmp    122d <main+0x10d>
movl   $0x0,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11a8 <main+0x88>
mov    -0x10(%rbp),%rax
mov    $0x2,%ecx
cqto
idiv   %rcx
mov    %edx,%ecx
movslq -0x14(%rbp),%rax
mov    %ecx,-0x9c60(%rbp,%rax,4)
mov    -0x10(%rbp),%rax
mov    $0x2,%ecx
cqto
idiv   %rcx
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1162 <main+0x42>
movl   $0x0,-0x18(%rbp)
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     1217 <main+0xf7>
movslq -0x14(%rbp),%rax
mov    -0x9c60(%rbp,%rax,4),%esi
lea    0xe32(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x14(%rbp),%rax
cmpl   $0x1,-0x9c60(%rbp,%rax,4)
01
jne    1204 <main+0xe4>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1209 <main+0xe9>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    11c6 <main+0xa6>
mov    -0x18(%rbp),%esi
lea    0xdf6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1132 <main+0x12>
xor    %eax,%eax
add    $0x9c60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x9c58,%rsp
lea    0xec8(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    121d <main+0xfd>
mov    0x8(%rsp),%rax
test   %rax,%rax
je     121d <main+0xfd>
lea    0xeb4(%rip),%r15
lea    0xe99(%rip),%r12
lea    0x8(%rsp),%r13
xor    %ebx,%ebx
xchg   %ax,%ax
mov    %rax,%rcx
shr    $0x3f,%rax
add    %rcx,%rax
mov    %eax,%edx
and    $0xfffffffe,%edx
mov    %ecx,%esi
sub    %edx,%esi
mov    %esi,0x10(%rsp,%rbx,4)
sar    %rax
add    $0x1,%rbx
add    $0x1,%rcx
cmp    $0x2,%rcx
ja     1170 <main+0x50>
mov    %rax,0x8(%rsp)
xor    %ebp,%ebp
lea    0xe5f(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
test   %ebx,%ebx
jle    11ea <main+0xca>
mov    %ebx,%ebx
add    $0x1,%rbx
xor    %ebp,%ebp
nopl   0x0(%rax)
lea    -0x2(%rbx),%eax
mov    0x10(%rsp,%rax,4),%r14d
mov    %r15,%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
cmp    $0x1,%r14d
sete   %al
add    %eax,%ebp
add    $0xffffffffffffffff,%rbx
cmp    $0x1,%rbx
ja     11c0 <main+0xa0>
lea    0xe26(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    121d <main+0xfd>
mov    0x8(%rsp),%rax
mov    $0x0,%ebx
test   %rax,%rax
jne    1170 <main+0x50>
xor    %eax,%eax
add    $0x9c58,%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 = [15 x i8] c"The parity of \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [17 x i8] c" is %d (mod 2).\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i32
%4 = alloca i32
%5 = alloca [10000 x i32]
store i32 0, i32* %1
br label %6
6: ; preds = %53, %0
%7 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %2)
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %56
9: ; preds = %6
%10 = load i64, i64* %2
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %9
br label %56
13: ; preds = %9
store i32 0, i32* %3
br label %14
14: ; preds = %17, %13
%15 = load i64, i64* %2
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %28
17: ; preds = %14
%18 = load i64, i64* %2
%19 = srem i64 %18, 2
%20 = trunc i64 %19 to i32
%21 = load i32, i32* %3
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [10000 x i32], [10000 x i32]* %5, i64 0, i64 %22
store i32 %20, i32* %23
%24 = load i64, i64* %2
%25 = sdiv i64 %24, 2
store i64 %25, i64* %2
%26 = load i32, i32* %3
%27 = add nsw i32 %26, 1
store i32 %27, i32* %3
br label %14
28: ; preds = %14
store i32 0, i32* %4
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%30 = load i32, i32* %3
%31 = sub nsw i32 %30, 1
store i32 %31, i32* %3
br label %32
32: ; preds = %50, %28
%33 = load i32, i32* %3
%34 = icmp sge i32 %33, 0
br i1 %34, label %35, label %53
35: ; preds = %32
%36 = load i32, i32* %3
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [10000 x i32], [10000 x i32]* %5, i64 0, i64 %37
%39 = load i32, i32* %38
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %39)
%41 = load i32, i32* %3
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [10000 x i32], [10000 x i32]* %5, i64 0, i64 %42
%44 = load i32, i32* %43
%45 = icmp eq i32 %44, 1
br i1 %45, label %46, label %49
46: ; preds = %35
%47 = load i32, i32* %4
%48 = add nsw i32 %47, 1
store i32 %48, i32* %4
br label %49
49: ; preds = %46, %35
br label %50
50: ; preds = %49
%51 = load i32, i32* %3
%52 = add nsw i32 %51, -1
store i32 %52, i32* %3
br label %32
53: ; preds = %32
%54 = load i32, i32* %4
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %54)
br label %6
56: ; preds = %12, %6
ret i32 0
}

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