#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 */
scalar_t__ calloc(int, int);
int fills(int, int *);
int /*<<< orphan*/ free(int *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int *array = (int *)calloc(16, sizeof(int));
  array[0] = 1;
  array[1] = 1;
  int n;
  while (1) {
    scanf("%d", &n);
    if (n < 0)
      break;
    else if (n & 1)
      printf("0\n");
    else
      printf("%d\n", fills((n >> 1) + 1, array));
  }
  free(array);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x10,%edi
mov    $0x4,%esi
call   1050 <calloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x1,0x4(%rax)
lea    0xe72(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1060 <scanf@plt>
cmpl   $0x0,-0x14(%rbp)
jge    11a6 <main+0x56>
jmp    11f4 <main+0xa4>
mov    -0x14(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     11c8 <main+0x78>
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11ea <main+0x9a>
mov    -0x14(%rbp),%edi
sar    $0x1,%edi
add    $0x1,%edi
mov    -0x10(%rbp),%rsi
call   1070 <fills@plt>
mov    %eax,%esi
lea    0xe23(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11ef <main+0x9f>
jmp    1187 <main+0x37>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    $0x10,%edi
mov    $0x4,%esi
call   1060 <calloc@plt>
mov    %rax,%r15
movabs $0x100000001,%rax
mov    %rax,(%r15)
lea    0xe6d(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
mov    0xc(%rsp),%edi
test   %edi,%edi
js     120c <main+0xac>
lea    0xe57(%rip),%r14
lea    0xe4d(%rip),%r12
lea    0xc(%rsp),%rbx
lea    0xe48(%rip),%r13
jmp    11fc <main+0x9c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
shr    %edi
add    $0x1,%edi
mov    %r15,%rsi
call   1080 <fills@plt>
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
mov    0xc(%rsp),%edi
test   %edi,%edi
js     120c <main+0xac>
test   $0x1,%dil
je     11d0 <main+0x70>
mov    %r13,%rdi
call   1040 <puts@plt>
jmp    11e9 <main+0x89>
mov    %r15,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

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