#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 isRudolf(int *, int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int array[200], n, i;
  do {
    printf("Enter the number of deers: ");
    scanf("%d", &n);
  } while (n % 2 == 0);
  for (i = 0; i < n; i++) {
    do {
      scanf("%d", &array[i]);
    } while (array[i] < 1 || array[i] > 100);
  }
  for (i = 0; i < n; i++) {
    if (isRudolf(array, n, array[i]) == 1)
      break;
  }
  printf("%d\n", i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x340,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec5(%rip),%rdi
lea    -0x334(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x334(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1142 <main+0x12>
movl   $0x0,-0x338(%rbp)
mov    -0x338(%rbp),%eax
cmp    -0x334(%rbp),%eax
jge    1218 <main+0xe8>
jmp    119b <main+0x6b>
movslq -0x338(%rbp),%rax
lea    -0x330(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe65(%rip),%rdi
call   1040 <scanf@plt>
movslq -0x338(%rbp),%rcx
mov    $0x1,%al
cmpl   $0x1,-0x330(%rbp,%rcx,4)
01
mov    %al,-0x339(%rbp)
jl     11f1 <main+0xc1>
movslq -0x338(%rbp),%rax
cmpl   $0x64,-0x330(%rbp,%rax,4)
64
setg   %al
mov    %al,-0x339(%rbp)
mov    -0x339(%rbp),%al
test   $0x1,%al
jne    119b <main+0x6b>
jmp    1204 <main+0xd4>
mov    -0x338(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x338(%rbp)
jmp    1184 <main+0x54>
movl   $0x0,-0x338(%rbp)
mov    -0x338(%rbp),%eax
cmp    -0x334(%rbp),%eax
jge    127b <main+0x14b>
lea    -0x330(%rbp),%rdi
mov    -0x334(%rbp),%esi
movslq -0x338(%rbp),%rax
mov    -0x330(%rbp,%rax,4),%edx
call   1050 <isRudolf@plt>
cmp    $0x1,%eax
jne    1262 <main+0x132>
jmp    127b <main+0x14b>
jmp    1267 <main+0x137>
mov    -0x338(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x338(%rbp)
jmp    1222 <main+0xf2>
mov    -0x338(%rbp),%esi
lea    0xd97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x340,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x330,%rsp
lea    0xebd(%rip),%r14
lea    0xed2(%rip),%r15
lea    0xc(%rsp),%rbx
nop
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
test   $0x1,%al
je     1150 <main+0x20>
test   %eax,%eax
jle    11e1 <main+0xb1>
xor    %r15d,%r15d
lea    0xea1(%rip),%r14
nopl   0x0(%rax,%rax,1)
lea    (%rsp,%r15,4),%rbx
add    $0x10,%rbx
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    (%rbx),%eax
add    $0xffffff9b,%eax
cmp    $0xffffff9c,%eax
jb     1190 <main+0x60>
add    $0x1,%r15
movslq 0xc(%rsp),%rsi
cmp    %rsi,%r15
jl     1180 <main+0x50>
xor    %ebx,%ebx
test   %esi,%esi
jle    11e3 <main+0xb3>
lea    0x10(%rsp),%r14
xchg   %ax,%ax
mov    0x10(%rsp,%rbx,4),%edx
mov    %r14,%rdi
call   1050 <isRudolf@plt>
cmp    $0x1,%eax
je     11e3 <main+0xb3>
add    $0x1,%rbx
movslq 0xc(%rsp),%rsi
cmp    %rsi,%rbx
jl     11c0 <main+0x90>
jmp    11e3 <main+0xb3>
xor    %ebx,%ebx
lea    0xe35(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x330,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [28 x i8] c"Enter the number of deers: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [200 x i32]
%2 = alloca i32
%3 = bitcast [200 x i32]* %1 to i8*
%4 = bitcast i32* %2 to i8*
br label %5
5: ; preds = %5, %0
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%8 = load i32, i32* %2
%9 = and i32 %8, 1
%10 = icmp eq i32 %9, 0
br i1 %10, label %5, label %11
11: ; preds = %5
%12 = icmp sgt i32 %8, 0
br i1 %12, label %13, label %44
13: ; preds = %11, %24
%14 = phi i64 [ %25, %24 ], [ 0, %11 ]
%15 = getelementptr inbounds [200 x i32], [200 x i32]* %1, i64 0, i64 %14
br label %19
16: ; preds = %24
%17 = getelementptr inbounds [200 x i32], [200 x i32]* %1, i64 0, i64 0
%18 = icmp sgt i32 %26, 0
br i1 %18, label %29, label %44
19: ; preds = %13, %19
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %15)
%21 = load i32, i32* %15
%22 = add i32 %21, -101
%23 = icmp ult i32 %22, -100
br i1 %23, label %19, label %24
24: ; preds = %19
%25 = add nuw nsw i64 %14, 1
%26 = load i32, i32* %2
%27 = sext i32 %26 to i64
%28 = icmp slt i64 %25, %27
br i1 %28, label %13, label %16
29: ; preds = %16, %36
%30 = phi i64 [ %37, %36 ], [ 0, %16 ]
%31 = phi i32 [ %38, %36 ], [ %26, %16 ]
%32 = getelementptr inbounds [200 x i32], [200 x i32]* %1, i64 0, i64 %30
%33 = load i32, i32* %32
%34 = call i32 @isRudolf(i32* %17, i32 %31, i32 %33)
%35 = icmp eq i32 %34, 1
br i1 %35, label %41, label %36
36: ; preds = %29
%37 = add nuw nsw i64 %30, 1
%38 = load i32, i32* %2
%39 = sext i32 %38 to i64
%40 = icmp slt i64 %37, %39
br i1 %40, label %29, label %41
41: ; preds = %29, %36
%42 = phi i64 [ %37, %36 ], [ %30, %29 ]
%43 = trunc i64 %42 to i32
br label %44
44: ; preds = %11, %41, %16
%45 = phi i32 [ 0, %16 ], [ %43, %41 ], [ 0, %11 ]
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %45)
ret i32 0
}