#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 firstMissingPositive(int *, int);
int /*<<< orphan*/ printf(char *, int, int, int);
int main() {
  int n1[10] = {4, 3, -5, 2, -6, 7, -1, 3, 2, 2};
  int n2[10] = {4, 3, -5, 2, -6, 7, 1, 3, 2, 2};
  int n3[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
  printf("%d\t%d\t%d\n", firstMissingPositive(n1, 10),
         firstMissingPositive(n2, 10), firstMissingPositive(n3, 10));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xeb3(%rip),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
lea    -0x60(%rbp),%rdi
lea    0xece(%rip),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
lea    -0x90(%rbp),%rdi
lea    0xee6(%rip),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1040 <firstMissingPositive@plt>
mov    %eax,-0x98(%rbp)
lea    -0x60(%rbp),%rdi
mov    $0xa,%esi
call   1040 <firstMissingPositive@plt>
mov    %eax,-0x94(%rbp)
lea    -0x90(%rbp),%rdi
mov    $0xa,%esi
call   1040 <firstMissingPositive@plt>
mov    -0x98(%rbp),%esi
mov    -0x94(%rbp),%edx
mov    %eax,%ecx
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x88,%rsp
mov    0xef0(%rip),%rax
mov    %rax,0x80(%rsp)
movaps 0xed1(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xeb5(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
mov    0xef9(%rip),%rax
mov    %rax,0x50(%rsp)
movaps 0xedd(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xec1(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
mov    0xf05(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xee9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xecd(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x60(%rsp),%rdi
mov    $0xa,%esi
call   1040 <firstMissingPositive@plt>
mov    %eax,%ebx
lea    0x30(%rsp),%rdi
mov    $0xa,%esi
call   1040 <firstMissingPositive@plt>
mov    %eax,%ebp
mov    %rsp,%rdi
mov    $0xa,%esi
call   1040 <firstMissingPositive@plt>
lea    0xebb(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.n1 = [10 x i32] [i32 4, i32 3, i32 -5, i32 2, i32 -6, i32 7, i32 -1, i32 3, i32 2, i32 2]
@__const.main.n2 = [10 x i32] [i32 4, i32 3, i32 -5, i32 2, i32 -6, i32 7, i32 1, i32 3, i32 2, i32 2]
@__const.main.n3 = [10 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10]
@.str = [10 x i8] c"%d\09%d\09%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca [10 x i32]
%4 = alloca [10 x i32]
store i32 0, i32* %1
%5 = bitcast [10 x i32]* %2 to i8*
%6 = bitcast [10 x i32]* %3 to i8*
%7 = bitcast [10 x i32]* %4 to i8*
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%9 = call i32 @firstMissingPositive(i32* %8, i32 10)
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%11 = call i32 @firstMissingPositive(i32* %10, i32 10)
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 0
%13 = call i32 @firstMissingPositive(i32* %12, i32 10)
%14 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %11, i32 %13)
ret i32 0
}

LLVM IR (-O2):
@__const.main.n1 = [10 x i32] [i32 4, i32 3, i32 -5, i32 2, i32 -6, i32 7, i32 -1, i32 3, i32 2, i32 2]
@__const.main.n2 = [10 x i32] [i32 4, i32 3, i32 -5, i32 2, i32 -6, i32 7, i32 1, i32 3, i32 2, i32 2]
@__const.main.n3 = [10 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10]
@.str = [10 x i8] c"%d\09%d\09%d\0A\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = alloca [10 x i32]
%3 = alloca [10 x i32]
%4 = bitcast [10 x i32]* %1 to i8*
%5 = bitcast [10 x i32]* %2 to i8*
%6 = bitcast [10 x i32]* %3 to i8*
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%8 = call i32 @firstMissingPositive(i32* %7, i32 10)
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%10 = call i32 @firstMissingPositive(i32* %9, i32 10)
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%12 = call i32 @firstMissingPositive(i32* %11, i32 10)
%13 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %10, i32 %12)
ret i32 0
}