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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x61aa0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
lea    -0x61a9c(%rbp),%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    127a <main+0x15a>
movl   $0x0,-0x61aa0(%rbp)
cmpl   $0x0,-0x61a9c(%rbp)
jne    116a <main+0x4a>
jmp    127a <main+0x15a>
mov    -0x61a9c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,-0x61a90(%rbp)
movl   $0x1,-0x61a94(%rbp)
mov    -0x61a9c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%eax
jle    11e3 <main+0xc3>
mov    -0x61a9c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x61a9c(%rbp)
mov    -0x61a9c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
movslq -0x61a94(%rbp),%rax
mov    %edx,-0x61a90(%rbp,%rax,4)
mov    -0x61a94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x61a94(%rbp)
jmp    1188 <main+0x68>
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x61a94(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x61a98(%rbp)
cmpl   $0x0,-0x61a98(%rbp)
jl     1261 <main+0x141>
movslq -0x61a98(%rbp),%rax
cmpl   $0x1,-0x61a90(%rbp,%rax,4)
01
jne    1231 <main+0x111>
mov    -0x61aa0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x61aa0(%rbp)
movslq -0x61a98(%rbp),%rax
mov    -0x61a90(%rbp,%rax,4),%esi
lea    0xdba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x61a98(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x61a98(%rbp)
jmp    1200 <main+0xe0>
mov    -0x61aa0(%rbp),%esi
lea    0xda4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1132 <main+0x12>
xor    %eax,%eax
add    $0x61aa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x61a98,%rsp
lea    0xec8(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    1224 <main+0x104>
lea    0xeae(%rip),%r13
lea    0xeb9(%rip),%r15
lea    0xc(%rsp),%r12
xchg   %ax,%ax
mov    0xc(%rsp),%eax
test   %eax,%eax
je     1224 <main+0x104>
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
and    $0xfffffffe,%ecx
mov    %eax,%edx
sub    %ecx,%edx
mov    %edx,0x10(%rsp)
mov    $0x1,%ebx
cmp    $0x2,%eax
jl     11ba <main+0x9a>
mov    $0x1,%ebx
nopl   (%rax)
mov    %eax,%ecx
mov    %eax,%edx
shr    $0x1f,%edx
add    %eax,%edx
mov    %edx,%eax
sar    %eax
shr    $0x1f,%edx
add    %eax,%edx
and    $0xfffffffe,%edx
mov    %eax,%esi
sub    %edx,%esi
mov    %esi,0x10(%rsp,%rbx,4)
add    $0x1,%rbx
cmp    $0x3,%ecx
jg     1190 <main+0x70>
mov    %eax,0xc(%rsp)
xor    %ebp,%ebp
lea    0xe40(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x1(%rbx),%r14d
add    $0xffffffff,%ebx
lea    (%rsp,%rbx,4),%rbx
add    $0x10,%rbx
nopl   0x0(%rax)
mov    (%rbx),%esi
xor    %eax,%eax
cmp    $0x1,%esi
sete   %al
add    %eax,%ebp
mov    %r13,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0xffffffff,%r14d
add    $0xfffffffffffffffc,%rbx
cmp    $0x1,%r14d
jg     11e0 <main+0xc0>
mov    %r15,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r13,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
je     1160 <main+0x40>
xor    %eax,%eax
add    $0x61a98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\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 [100000 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
br label %7
7: ; preds = %58, %0
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %61
10: ; preds = %7
store i32 0, i32* %6
%11 = load i32, i32* %5
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %10
br label %61
14: ; preds = %10
%15 = load i32, i32* %5
%16 = srem i32 %15, 2
%17 = getelementptr inbounds [100000 x i32], [100000 x i32]* %2, i64 0, i64 0
store i32 %16, i32* %17
store i32 1, i32* %3
br label %18
18: ; preds = %30, %14
%19 = load i32, i32* %5
%20 = sdiv i32 %19, 2
%21 = icmp sgt i32 %20, 0
br i1 %21, label %22, label %33
22: ; preds = %18
%23 = load i32, i32* %5
%24 = sdiv i32 %23, 2
store i32 %24, i32* %5
%25 = load i32, i32* %5
%26 = srem i32 %25, 2
%27 = load i32, i32* %3
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [100000 x i32], [100000 x i32]* %2, i64 0, i64 %28
store i32 %26, i32* %29
br label %30
30: ; preds = %22
%31 = load i32, i32* %3
%32 = add nsw i32 %31, 1
store i32 %32, i32* %3
br label %18
33: ; preds = %18
%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
store i32 %36, i32* %4
br label %37
37: ; preds = %55, %33
%38 = load i32, i32* %4
%39 = icmp sge i32 %38, 0
br i1 %39, label %40, label %58
40: ; preds = %37
%41 = load i32, i32* %4
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [100000 x i32], [100000 x i32]* %2, i64 0, i64 %42
%44 = load i32, i32* %43
%45 = icmp eq i32 %44, 1
br i1 %45, label %46, label %49
46: ; preds = %40
%47 = load i32, i32* %6
%48 = add nsw i32 %47, 1
store i32 %48, i32* %6
br label %49
49: ; preds = %46, %40
%50 = load i32, i32* %4
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [100000 x i32], [100000 x i32]* %2, i64 0, i64 %51
%53 = load i32, i32* %52
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %53)
br label %55
55: ; preds = %49
%56 = load i32, i32* %4
%57 = add nsw i32 %56, -1
store i32 %57, i32* %4
br label %37
58: ; preds = %37
%59 = load i32, i32* %6
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %59)
br label %7
61: ; preds = %13, %7
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\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 [100000 x i32]
%2 = alloca i32
%3 = bitcast [100000 x i32]* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %45
7: ; preds = %0
%8 = getelementptr inbounds [100000 x i32], [100000 x i32]* %1, i64 0, i64 0
br label %9
9: ; preds = %7, %41
%10 = load i32, i32* %2
%11 = icmp eq i32 %10, 0
br i1 %11, label %45, label %12
12: ; preds = %9
%13 = srem i32 %10, 2
store i32 %13, i32* %8
%14 = icmp sgt i32 %10, 1
br i1 %14, label %15, label %24
15: ; preds = %12, %15
%16 = phi i64 [ %21, %15 ], [ 1, %12 ]
%17 = phi i32 [ %18, %15 ], [ %10, %12 ]
%18 = sdiv i32 %17, 2
%19 = srem i32 %18, 2
%20 = getelementptr inbounds [100000 x i32], [100000 x i32]* %1, i64 0, i64 %16
store i32 %19, i32* %20
%21 = add nuw i64 %16, 1
%22 = icmp sgt i32 %17, 3
br i1 %22, label %15, label %23
23: ; preds = %15
store i32 %18, i32* %2
br label %24
24: ; preds = %23, %12
%25 = phi i64 [ %21, %23 ], [ 1, %12 ]
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%27 = and i64 %25, 4294967295
br label %28
28: ; preds = %24, %28
%29 = phi i64 [ %27, %24 ], [ %31, %28 ]
%30 = phi i32 [ 0, %24 ], [ %37, %28 ]
%31 = add nsw i64 %29, -1
%32 = and i64 %31, 4294967295
%33 = getelementptr inbounds [100000 x i32], [100000 x i32]* %1, i64 0, i64 %32
%34 = load i32, i32* %33
%35 = icmp eq i32 %34, 1
%36 = zext i1 %35 to i32
%37 = add nuw nsw i32 %30, %36
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %34)
%39 = trunc i64 %29 to i32
%40 = icmp sgt i32 %39, 1
br i1 %40, label %28, label %41
41: ; preds = %28
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %37)
%43 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%44 = icmp eq i32 %43, 1
br i1 %44, label %9, label %45
45: ; preds = %41, %9, %0
ret i32 0
}