#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 */
double avg_lambda(int, int);
scalar_t__ is_internal(int, int);
scalar_t__ near_neumann(int, int);
int point_condition(int i, int j) {
  if (is_internal(i, j)) {
    double C = avg_lambda(i, j);
    if (C == 1) {
      return (0);
    } else {
      if (near_neumann(i, j)) {
        return (2);
      } else {
        return (1);
      }
    }
  } else {
    return (-1);
  }
}


x86 assembly (clang, -O0):
<point_condition>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <is_internal@plt>
cmp    $0x0,%rax
je     11b9 <point_condition+0x89>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <avg_lambda@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe90(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    118c <point_condition+0x5c>
jp     118c <point_condition+0x5c>
movl   $0x0,-0x4(%rbp)
jmp    11c0 <point_condition+0x90>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <near_neumann@plt>
cmp    $0x0,%rax
je     11ad <point_condition+0x7d>
movl   $0x2,-0x4(%rbp)
jmp    11c0 <point_condition+0x90>
movl   $0x1,-0x4(%rbp)
jmp    11c0 <point_condition+0x90>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<point_condition>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
call   1040 <is_internal@plt>
test   %rax,%rax
je     116f <point_condition+0x3f>
mov    %ebp,%edi
mov    %ebx,%esi
call   1050 <avg_lambda@plt>
xor    %eax,%eax
ucomisd 0xeac(%rip),%xmm0
jne    1158 <point_condition+0x28>
jnp    1174 <point_condition+0x44>
mov    %ebp,%edi
mov    %ebx,%esi
call   1030 <near_neumann@plt>
cmp    $0x1,%rax
mov    $0x2,%eax
sbb    $0x0,%eax
jmp    1174 <point_condition+0x44>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @point_condition(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca double
store i32 %0, i32* %4
store i32 %1, i32* %5
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = call i64 @is_internal(i32 %7, i32 %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %25
11: ; preds = %2
%12 = load i32, i32* %4
%13 = load i32, i32* %5
%14 = call double @avg_lambda(i32 %12, i32 %13)
store double %14, double* %6
%15 = load double, double* %6
%16 = fcmp oeq double %15, 1.000000e+00
br i1 %16, label %17, label %18
17: ; preds = %11
store i32 0, i32* %3
br label %26
18: ; preds = %11
%19 = load i32, i32* %4
%20 = load i32, i32* %5
%21 = call i64 @near_neumann(i32 %19, i32 %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %18
store i32 2, i32* %3
br label %26
24: ; preds = %18
store i32 1, i32* %3
br label %26
25: ; preds = %2
store i32 -1, i32* %3
br label %26
26: ; preds = %25, %24, %23, %17
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
define i32 @point_condition(i32 %0, i32 %1) {
%3 = tail call i64 @is_internal(i32 %0, i32 %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %12, label %5
5: ; preds = %2
%6 = tail call double @avg_lambda(i32 %0, i32 %1)
%7 = fcmp oeq double %6, 1.000000e+00
br i1 %7, label %12, label %8
8: ; preds = %5
%9 = tail call i64 @near_neumann(i32 %0, i32 %1)
%10 = icmp eq i64 %9, 0
%11 = select i1 %10, i32 1, i32 2
br label %12
12: ; preds = %2, %5, %8
%13 = phi i32 [ 0, %5 ], [ %11, %8 ], [ -1, %2 ]
ret i32 %13
}