#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 /*<<< orphan*/ scanf(char *, int *);
scalar_t__ validateID(int *, int *);
scalar_t__ validatePrefs(int *, int *);
void acceptData(int studID[], int prefer[], int *actualSize) {
  int i = 0;
  printf("\nEnter up to 30 student ID numbers or -1 to exit: ");
  do {
    scanf("%d", &studID[i]);
    i++;
  } while (studID[i - 1] != -1 && i < 30);
  if (studID[i - 1] == -1)
    i--;
  *actualSize = i;
  while (validateID(studID, actualSize)) {
    printf("\nError! All student ID numbers must be unique!");
    *actualSize = 0;
    i = 0;
    printf("\n\nEnter up to 30 student ID numbers or -1 to exit: ");
    do {
      scanf("%d", &studID[i]);
      i++;
    } while (studID[i - 1] != -1 && i < 30);
    *actualSize = i - 1;
  }
  i = 0;
  printf("Enter lunch preferences for the class: ");
  do {
    scanf("%d", &prefer[i]);
    i++;
  } while (i < *actualSize);
  while (validatePrefs(prefer, actualSize)) {
    i = 0;
    printf("\nInvalid preference entered! Please try again!!");
    printf("\n\nEnter lunch preferences for the class:");
    do {
      scanf("%d", &prefer[i]);
      i++;
    } while (i < *actualSize);
  }
  return;
}


x86 assembly (clang, -O0):
<acceptData>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xed1(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rsi
movslq -0x1c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe83(%rip),%rdi
call   1060 <scanf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rdx
xor    %eax,%eax
cmpl   $0xffffffff,(%rcx,%rdx,4)
mov    %al,-0x1d(%rbp)
je     11b1 <acceptData+0x71>
cmpl   $0x1e,-0x1c(%rbp)
setl   %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
test   $0x1,%al
jne    1167 <acceptData+0x27>
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
cmpl   $0xffffffff,(%rax,%rcx,4)
jne    11dc <acceptData+0x9c>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <validateID@plt>
cmp    $0x0,%rax
je     128b <acceptData+0x14b>
lea    0xe00(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
movl   $0x0,-0x1c(%rbp)
lea    0xe12(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rsi
movslq -0x1c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xdc5(%rip),%rdi
call   1060 <scanf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rdx
xor    %eax,%eax
cmpl   $0xffffffff,(%rcx,%rdx,4)
mov    %al,-0x1e(%rbp)
je     126f <acceptData+0x12f>
cmpl   $0x1e,-0x1c(%rbp)
setl   %al
mov    %al,-0x1e(%rbp)
mov    -0x1e(%rbp),%al
test   $0x1,%al
jne    1225 <acceptData+0xe5>
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    11e5 <acceptData+0xa5>
movl   $0x0,-0x1c(%rbp)
lea    0xdcd(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rsi
movslq -0x1c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xd4c(%rip),%rdi
call   1060 <scanf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jl     129e <acceptData+0x15e>
jmp    12d6 <acceptData+0x196>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <validatePrefs@plt>
cmp    $0x0,%rax
je     1344 <acceptData+0x204>
movl   $0x0,-0x1c(%rbp)
lea    0xd93(%rip),%rdi
call   1040 <printf@plt>
lea    0xdb7(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rsi
movslq -0x1c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xcde(%rip),%rdi
call   1060 <scanf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jl     130c <acceptData+0x1cc>
jmp    12d6 <acceptData+0x196>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<acceptData>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xed8(%rip),%rdi
call   1040 <printf@plt>
xor    %ebp,%ebp
lea    0xe97(%rip),%r12
xor    %r13d,%r13d
nopl   0x0(%rax)
lea    (%rbx,%rbp,1),%rsi
mov    %r12,%rdi
call   1060 <scanf@plt>
lea    0x1(%r13),%rax
mov    (%rbx,%r13,4),%ecx
cmp    $0xffffffff,%ecx
je     1196 <acceptData+0x56>
add    $0x4,%rbp
cmp    $0x1d,%r13
mov    %rax,%r13
jb     1170 <acceptData+0x30>
lea    -0x1(%rax),%edx
cmp    $0xffffffff,%ecx
cmovne %eax,%edx
mov    %edx,(%r15)
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <validateID@plt>
test   %rax,%rax
je     1226 <acceptData+0xe6>
lea    0xe47(%rip),%rbp
jmp    11d6 <acceptData+0x96>
nopl   0x0(%rax,%rax,1)
add    $0xffffffff,%eax
mov    %eax,(%r15)
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <validateID@plt>
test   %rax,%rax
je     1226 <acceptData+0xe6>
lea    0xe26(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,(%r15)
lea    0xe42(%rip),%rdi
call   1040 <printf@plt>
xor    %r12d,%r12d
xor    %r13d,%r13d
nopl   0x0(%rax,%rax,1)
lea    (%rbx,%r12,1),%rsi
mov    %rbp,%rdi
call   1060 <scanf@plt>
lea    0x1(%r13),%rax
cmpl   $0xffffffff,(%rbx,%r13,4)
je     11c0 <acceptData+0x80>
add    $0x4,%r12
cmp    $0x1d,%r13
mov    %rax,%r13
jb     1200 <acceptData+0xc0>
jmp    11c0 <acceptData+0x80>
lea    0xe39(%rip),%rdi
call   1040 <printf@plt>
xor    %ebx,%ebx
lea    0xdc5(%rip),%r12
mov    %r14,%rbp
xchg   %ax,%ax
mov    %r12,%rdi
mov    %rbp,%rsi
call   1060 <scanf@plt>
add    $0x1,%rbx
movslq (%r15),%rax
add    $0x4,%rbp
cmp    %rax,%rbx
jl     1240 <acceptData+0x100>
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <validatePrefs@plt>
test   %rax,%rax
je     12cb <acceptData+0x18b>
lea    0xe4c(%rip),%r13
lea    0xd87(%rip),%rbx
nopl   0x0(%rax)
lea    0xe07(%rip),%rdi
call   1040 <printf@plt>
mov    %r13,%rdi
call   1040 <printf@plt>
mov    %r14,%rbp
xor    %r12d,%r12d
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1060 <scanf@plt>
add    $0x1,%r12
movslq (%r15),%rax
add    $0x4,%rbp
cmp    %rax,%r12
jl     12a0 <acceptData+0x160>
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <validatePrefs@plt>
test   %rax,%rax
jne    1280 <acceptData+0x140>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [51 x i8] c"\0AEnter up to 30 student ID numbers or -1 to exit: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [47 x i8] c"\0AError! All student ID numbers must be unique!\00"
@.str.3 = [52 x i8] c"\0A\0AEnter up to 30 student ID numbers or -1 to exit: \00"
@.str.4 = [40 x i8] c"Enter lunch preferences for the class: \00"
@.str.5 = [48 x i8] c"\0AInvalid preference entered! Please try again!!\00"
@.str.6 = [41 x i8] c"\0A\0AEnter lunch preferences for the class:\00"
define void @acceptData(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
store i32 0, i32* %7
%8 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %28, %3
%10 = load i32*, i32** %4
%11 = load i32, i32* %7
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i32, i32* %10, i64 %12
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %13)
%15 = load i32, i32* %7
%16 = add nsw i32 %15, 1
store i32 %16, i32* %7
br label %17
17: ; preds = %9
%18 = load i32*, i32** %4
%19 = load i32, i32* %7
%20 = sub nsw i32 %19, 1
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %18, i64 %21
%23 = load i32, i32* %22
%24 = icmp ne i32 %23, -1
br i1 %24, label %25, label %28
25: ; preds = %17
%26 = load i32, i32* %7
%27 = icmp slt i32 %26, 30
br label %28
28: ; preds = %25, %17
%29 = phi i1 [ false, %17 ], [ %27, %25 ]
br i1 %29, label %9, label %30
30: ; preds = %28
%31 = load i32*, i32** %4
%32 = load i32, i32* %7
%33 = sub nsw i32 %32, 1
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i32, i32* %31, i64 %34
%36 = load i32, i32* %35
%37 = icmp eq i32 %36, -1
br i1 %37, label %38, label %41
38: ; preds = %30
%39 = load i32, i32* %7
%40 = add nsw i32 %39, -1
store i32 %40, i32* %7
br label %41
41: ; preds = %38, %30
%42 = load i32, i32* %7
%43 = load i32*, i32** %6
store i32 %42, i32* %43
br label %44
44: ; preds = %74, %41
%45 = load i32*, i32** %4
%46 = load i32*, i32** %6
%47 = call i64 @validateID(i32* %45, i32* %46)
%48 = icmp ne i64 %47, 0
br i1 %48, label %49, label %78
49: ; preds = %44
%50 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
%51 = load i32*, i32** %6
store i32 0, i32* %51
store i32 0, i32* %7
%52 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0))
br label %53
53: ; preds = %72, %49
%54 = load i32*, i32** %4
%55 = load i32, i32* %7
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds i32, i32* %54, i64 %56
%58 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %57)
%59 = load i32, i32* %7
%60 = add nsw i32 %59, 1
store i32 %60, i32* %7
br label %61
61: ; preds = %53
%62 = load i32*, i32** %4
%63 = load i32, i32* %7
%64 = sub nsw i32 %63, 1
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i32, i32* %62, i64 %65
%67 = load i32, i32* %66
%68 = icmp ne i32 %67, -1
br i1 %68, label %69, label %72
69: ; preds = %61
%70 = load i32, i32* %7
%71 = icmp slt i32 %70, 30
br label %72
72: ; preds = %69, %61
%73 = phi i1 [ false, %61 ], [ %71, %69 ]
br i1 %73, label %53, label %74
74: ; preds = %72
%75 = load i32, i32* %7
%76 = sub nsw i32 %75, 1
%77 = load i32*, i32** %6
store i32 %76, i32* %77
br label %44
78: ; preds = %44
store i32 0, i32* %7
%79 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0))
br label %80
80: ; preds = %88, %78
%81 = load i32*, i32** %5
%82 = load i32, i32* %7
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds i32, i32* %81, i64 %83
%85 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %84)
%86 = load i32, i32* %7
%87 = add nsw i32 %86, 1
store i32 %87, i32* %7
br label %88
88: ; preds = %80
%89 = load i32, i32* %7
%90 = load i32*, i32** %6
%91 = load i32, i32* %90
%92 = icmp slt i32 %89, %91
br i1 %92, label %80, label %93
93: ; preds = %88
br label %94
94: ; preds = %115, %93
%95 = load i32*, i32** %5
%96 = load i32*, i32** %6
%97 = call i64 @validatePrefs(i32* %95, i32* %96)
%98 = icmp ne i64 %97, 0
br i1 %98, label %99, label %116
99: ; preds = %94
store i32 0, i32* %7
%100 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.5, i64 0, i64 0))
%101 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.6, i64 0, i64 0))
br label %102
102: ; preds = %110, %99
%103 = load i32*, i32** %5
%104 = load i32, i32* %7
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds i32, i32* %103, i64 %105
%107 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %106)
%108 = load i32, i32* %7
%109 = add nsw i32 %108, 1
store i32 %109, i32* %7
br label %110
110: ; preds = %102
%111 = load i32, i32* %7
%112 = load i32*, i32** %6
%113 = load i32, i32* %112
%114 = icmp slt i32 %111, %113
br i1 %114, label %102, label %115
115: ; preds = %110
br label %94
116: ; preds = %94
ret void
}

LLVM IR (-O2):
@.str = [51 x i8] c"\0AEnter up to 30 student ID numbers or -1 to exit: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [47 x i8] c"\0AError! All student ID numbers must be unique!\00"
@.str.3 = [52 x i8] c"\0A\0AEnter up to 30 student ID numbers or -1 to exit: \00"
@.str.4 = [40 x i8] c"Enter lunch preferences for the class: \00"
@.str.5 = [48 x i8] c"\0AInvalid preference entered! Please try again!!\00"
@.str.6 = [41 x i8] c"\0A\0AEnter lunch preferences for the class:\00"
define void @acceptData(i32* %0, i32* %1, i32* %2) {
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %5, %3
%6 = phi i64 [ %9, %5 ], [ 0, %3 ]
%7 = getelementptr inbounds i32, i32* %0, i64 %6
%8 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%9 = add nuw nsw i64 %6, 1
%10 = load i32, i32* %7
%11 = icmp ne i32 %10, -1
%12 = icmp ult i64 %6, 29
%13 = select i1 %11, i1 %12, i1 false
br i1 %13, label %5, label %14
14: ; preds = %5
%15 = icmp eq i32 %10, -1
%16 = select i1 %15, i64 %6, i64 %9
%17 = trunc i64 %16 to i32
store i32 %17, i32* %2
%18 = tail call i64 @validateID(i32* %0, i32* %2)
%19 = icmp eq i64 %18, 0
br i1 %19, label %36, label %24
20: ; preds = %27
%21 = trunc i64 %28 to i32
store i32 %21, i32* %2
%22 = tail call i64 @validateID(i32* %0, i32* %2)
%23 = icmp eq i64 %22, 0
br i1 %23, label %36, label %24
24: ; preds = %14, %20
%25 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %2
%26 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0))
br label %27
27: ; preds = %27, %24
%28 = phi i64 [ %31, %27 ], [ 0, %24 ]
%29 = getelementptr inbounds i32, i32* %0, i64 %28
%30 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %29)
%31 = add nuw nsw i64 %28, 1
%32 = load i32, i32* %29
%33 = icmp ne i32 %32, -1
%34 = icmp ult i64 %28, 29
%35 = select i1 %33, i1 %34, i1 false
br i1 %35, label %27, label %20
36: ; preds = %20, %14
%37 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0))
br label %38
38: ; preds = %38, %36
%39 = phi i64 [ %42, %38 ], [ 0, %36 ]
%40 = getelementptr inbounds i32, i32* %1, i64 %39
%41 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %40)
%42 = add nuw nsw i64 %39, 1
%43 = load i32, i32* %2
%44 = sext i32 %43 to i64
%45 = icmp slt i64 %42, %44
br i1 %45, label %38, label %46
46: ; preds = %38
%47 = tail call i64 @validatePrefs(i32* %1, i32* %2)
%48 = icmp eq i64 %47, 0
br i1 %48, label %63, label %52
49: ; preds = %55
%50 = tail call i64 @validatePrefs(i32* %1, i32* %2)
%51 = icmp eq i64 %50, 0
br i1 %51, label %63, label %52
52: ; preds = %46, %49
%53 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.5, i64 0, i64 0))
%54 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.6, i64 0, i64 0))
br label %55
55: ; preds = %55, %52
%56 = phi i64 [ %59, %55 ], [ 0, %52 ]
%57 = getelementptr inbounds i32, i32* %1, i64 %56
%58 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %57)
%59 = add nuw nsw i64 %56, 1
%60 = load i32, i32* %2
%61 = sext i32 %60 to i64
%62 = icmp slt i64 %59, %61
br i1 %62, label %55, label %49
63: ; preds = %49, %46
ret void
}