#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 *);
void acceptArray(int originalSet[], int *origSize) {
  int i = 0;
  printf("Enter up to 35 integers or -1 to exit: ");
  do {
    scanf("%d", &originalSet[i]);
    i++;
  } while (i < 35 && originalSet[i - 1] != -1);
  if (originalSet[i - 1] == -1)
    i--;
  *origSize = i;
  return;
}


x86 assembly (clang, -O0):
<acceptArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xecf(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
cmpl   $0x23,-0x14(%rbp)
mov    %al,-0x15(%rbp)
jge    118d <acceptArray+0x6d>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
cmpl   $0xffffffff,(%rax,%rcx,4)
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1143 <acceptArray+0x23>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
cmpl   $0xffffffff,(%rax,%rcx,4)
jne    11b8 <acceptArray+0x98>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<acceptArray>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r12
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
xor    %ebx,%ebx
lea    0xee5(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
cmp    $0xffffffffffffffde,%rbx
je     1175 <acceptArray+0x55>
add    $0xffffffffffffffff,%rbx
cmpl   $0xffffffff,(%r12)
lea    0x4(%r12),%r12
jne    1150 <acceptArray+0x30>
not    %ebx
jmp    1182 <acceptArray+0x62>
xor    %ebx,%ebx
cmpl   $0xffffffff,(%r12)
sete   %bl
xor    $0x23,%ebx
mov    %ebx,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [40 x i8] c"Enter up to 35 integers or -1 to exit: \00"
@.str.1 = [3 x i8] c"%d\00"
define void @acceptArray(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
store i32 0, i32* %5
%6 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %26, %2
%8 = load i32*, i32** %3
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %8, i64 %10
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %11)
%13 = load i32, i32* %5
%14 = add nsw i32 %13, 1
store i32 %14, i32* %5
br label %15
15: ; preds = %7
%16 = load i32, i32* %5
%17 = icmp slt i32 %16, 35
br i1 %17, label %18, label %26
18: ; preds = %15
%19 = load i32*, i32** %3
%20 = load i32, i32* %5
%21 = sub nsw i32 %20, 1
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %19, i64 %22
%24 = load i32, i32* %23
%25 = icmp ne i32 %24, -1
br label %26
26: ; preds = %18, %15
%27 = phi i1 [ false, %15 ], [ %25, %18 ]
br i1 %27, label %7, label %28
28: ; preds = %26
%29 = load i32*, i32** %3
%30 = load i32, i32* %5
%31 = sub nsw i32 %30, 1
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i32, i32* %29, i64 %32
%34 = load i32, i32* %33
%35 = icmp eq i32 %34, -1
br i1 %35, label %36, label %39
36: ; preds = %28
%37 = load i32, i32* %5
%38 = add nsw i32 %37, -1
store i32 %38, i32* %5
br label %39
39: ; preds = %36, %28
%40 = load i32, i32* %5
%41 = load i32*, i32** %4
store i32 %40, i32* %41
ret void
}

LLVM IR (-O2):
@.str = [40 x i8] c"Enter up to 35 integers or -1 to exit: \00"
@.str.1 = [3 x i8] c"%d\00"
define void @acceptArray(i32* %0, i32* nocapture writeonly %1) {
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %13, %2
%5 = phi i64 [ %14, %13 ], [ 0, %2 ]
%6 = getelementptr inbounds i32, i32* %0, i64 %5
%7 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%8 = icmp eq i64 %5, 34
br i1 %8, label %9, label %13
9: ; preds = %4
%10 = load i32, i32* %6
%11 = icmp eq i32 %10, -1
%12 = select i1 %11, i32 34, i32 35
br label %19
13: ; preds = %4
%14 = add nuw nsw i64 %5, 1
%15 = load i32, i32* %6
%16 = icmp eq i32 %15, -1
br i1 %16, label %17, label %4
17: ; preds = %13
%18 = trunc i64 %5 to i32
br label %19
19: ; preds = %17, %9
%20 = phi i32 [ %12, %9 ], [ %18, %17 ]
store i32 %20, i32* %1
ret void
}