#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 find_missing_int(int *, size_t);
int /*<<< orphan*/ printf(char *, ...);
int scanf(char *, ...);
int main(void) {
  static int arr_buff[1024];
  size_t arr_sz;
  printf("Enter size of array, followed by the array elements.\n");
  printf("> ");
  while (scanf("%zu", &arr_sz) == 1) {
    size_t i;
    for (i = 0; i < arr_sz; i++)
      scanf("%d", &arr_buff[i]);
    printf("%d\n", find_missing_int(arr_buff, arr_sz));
    printf("> ");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed7(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    11f0 <main+0xc0>
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    11bd <main+0x8d>
mov    -0x18(%rbp),%rax
lea    0x2eb9(%rip),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    117e <main+0x4e>
mov    -0x10(%rbp),%rsi
lea    0x2e88(%rip),%rdi
call   1050 <find_missing_int@plt>
mov    %eax,%esi
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    115b <main+0x2b>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xebc(%rip),%rdi
call   1030 <puts@plt>
lea    0xea2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe97(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    1210 <main+0xd0>
lea    0x2eca(%rip),%r14
lea    0xe76(%rip),%r12
mov    %rsp,%r13
lea    0xe70(%rip),%rbp
jmp    11da <main+0x9a>
nopl   0x0(%rax)
xor    %esi,%esi
mov    %r14,%rdi
call   1060 <find_missing_int@plt>
lea    0xe59(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe3f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    1210 <main+0xd0>
cmpq   $0x0,(%rsp)
je     11a0 <main+0x60>
mov    %r14,%rbx
xor    %r15d,%r15d
nopw   0x0(%rax,%rax,1)
mov    %rbp,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
add    $0x1,%r15
mov    (%rsp),%rsi
add    $0x4,%rbx
cmp    %rsi,%r15
jb     11f0 <main+0xb0>
jmp    11a2 <main+0x62>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@main.arr_buff = internal global [1024 x i32] zeroinitializer
@.str = [54 x i8] c"Enter size of array, followed by the array elements.\0A\00"
@.str.1 = [3 x i8] c"> \00"
@.str.2 = [4 x i8] c"%zu\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %6
6: ; preds = %21, %0
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i64* %2)
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %26
9: ; preds = %6
store i64 0, i64* %3
br label %10
10: ; preds = %18, %9
%11 = load i64, i64* %3
%12 = load i64, i64* %2
%13 = icmp ult i64 %11, %12
br i1 %13, label %14, label %21
14: ; preds = %10
%15 = load i64, i64* %3
%16 = getelementptr inbounds [1024 x i32], [1024 x i32]* @main.arr_buff, i64 0, i64 %15
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %16)
br label %18
18: ; preds = %14
%19 = load i64, i64* %3
%20 = add i64 %19, 1
store i64 %20, i64* %3
br label %10
21: ; preds = %10
%22 = load i64, i64* %2
%23 = call i32 @find_missing_int(i32* getelementptr inbounds ([1024 x i32], [1024 x i32]* @main.arr_buff, i64 0, i64 0), i64 %22)
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %23)
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %6
26: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@main.arr_buff = internal global [1024 x i32] zeroinitializer
@.str.1 = [3 x i8] c"> \00"
@.str.2 = [4 x i8] c"%zu\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [4 x i8] c"%d\0A\00"
@str = [53 x i8] c"Enter size of array, followed by the array elements.\00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i64* %1)
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %24
7: ; preds = %0, %17
%8 = load i64, i64* %1
%9 = icmp eq i64 %8, 0
br i1 %9, label %17, label %10
10: ; preds = %7, %10
%11 = phi i64 [ %14, %10 ], [ 0, %7 ]
%12 = getelementptr inbounds [1024 x i32], [1024 x i32]* @main.arr_buff, i64 0, i64 %11
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %12)
%14 = add nuw i64 %11, 1
%15 = load i64, i64* %1
%16 = icmp ult i64 %14, %15
br i1 %16, label %10, label %17
17: ; preds = %10, %7
%18 = phi i64 [ 0, %7 ], [ %15, %10 ]
%19 = call i32 @find_missing_int(i32* getelementptr inbounds ([1024 x i32], [1024 x i32]* @main.arr_buff, i64 0, i64 0), i64 %18)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %19)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i64* %1)
%23 = icmp eq i32 %22, 1
br i1 %23, label %7, label %24
24: ; preds = %17, %0
ret i32 0
}