#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 onpoints(int, int *, int);
int first_nonstable_point(int *p, int n) {
  int i;
  for (i = 1; i <= n; i++) {
    if (onpoints(i, p, n) != i)
      return (i);
  }
  return (0);
}


x86 assembly (clang, -O0):
<first_nonstable_point>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     1168 <first_nonstable_point+0x58>
mov    -0x18(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <onpoints@plt>
cmp    -0x18(%rbp),%eax
je     1155 <first_nonstable_point+0x45>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    116f <first_nonstable_point+0x5f>
jmp    115a <first_nonstable_point+0x4a>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1126 <first_nonstable_point+0x16>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<first_nonstable_point>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
xor    %r14d,%r14d
test   %esi,%esi
jle    1158 <first_nonstable_point+0x48>
mov    %esi,%r12d
mov    %rdi,%r15
mov    %esi,%ebp
neg    %ebp
mov    $0x1,%ebx
xchg   %ax,%ax
mov    %ebx,%edi
mov    %r15,%rsi
mov    %r12d,%edx
call   1030 <onpoints@plt>
cmp    %eax,%ebx
jne    1155 <first_nonstable_point+0x45>
lea    (%rbx,%rbp,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
jne    1130 <first_nonstable_point+0x20>
jmp    1158 <first_nonstable_point+0x48>
mov    %ebx,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @first_nonstable_point(i32* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 1, i32* %6
br label %7
7: ; preds = %21, %2
%8 = load i32, i32* %6
%9 = load i32, i32* %5
%10 = icmp sle i32 %8, %9
br i1 %10, label %11, label %24
11: ; preds = %7
%12 = load i32, i32* %6
%13 = load i32*, i32** %4
%14 = load i32, i32* %5
%15 = call i32 @onpoints(i32 %12, i32* %13, i32 %14)
%16 = load i32, i32* %6
%17 = icmp ne i32 %15, %16
br i1 %17, label %18, label %20
18: ; preds = %11
%19 = load i32, i32* %6
store i32 %19, i32* %3
br label %25
20: ; preds = %11
br label %21
21: ; preds = %20
%22 = load i32, i32* %6
%23 = add nsw i32 %22, 1
store i32 %23, i32* %6
br label %7
24: ; preds = %7
store i32 0, i32* %3
br label %25
25: ; preds = %24, %18
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
define i32 @first_nonstable_point(i32* %0, i32 %1) {
%3 = icmp slt i32 %1, 1
br i1 %3, label %11, label %4
4: ; preds = %2, %8
%5 = phi i32 [ %9, %8 ], [ 1, %2 ]
%6 = tail call i32 @onpoints(i32 %5, i32* %0, i32 %1)
%7 = icmp eq i32 %6, %5
br i1 %7, label %8, label %11
8: ; preds = %4
%9 = add nuw i32 %5, 1
%10 = icmp eq i32 %5, %1
br i1 %10, label %11, label %4
11: ; preds = %4, %8, %2
%12 = phi i32 [ 0, %2 ], [ 0, %8 ], [ %5, %4 ]
ret i32 %12
}