#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 */
struct Edge {
  int dummy;
};

/* Variables and functions */
struct Edge *edge_lNext(struct Edge *);
struct Edge *edge_oNext(struct Edge *);
int predicate_edgeIsPartOfRing(struct Edge *test, struct Edge *fromOrigin) {
  struct Edge *e;
  e = fromOrigin;
  do {
    if (e == test || edge_lNext(e) == test ||
        edge_lNext(edge_lNext(e)) == test) {
      return 1;
    }
    e = edge_oNext(e);
  } while (e != fromOrigin);
  return 0;
}


x86 assembly (clang, -O0):
<predicate_edgeIsPartOfRing>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
je     1174 <predicate_edgeIsPartOfRing+0x54>
mov    -0x20(%rbp),%rdi
call   1040 <edge_lNext@plt>
cmp    -0x10(%rbp),%rax
je     1174 <predicate_edgeIsPartOfRing+0x54>
mov    -0x20(%rbp),%rdi
call   1040 <edge_lNext@plt>
mov    %rax,%rdi
call   1040 <edge_lNext@plt>
cmp    -0x10(%rbp),%rax
jne    1180 <predicate_edgeIsPartOfRing+0x60>
movl   $0x1,-0x4(%rbp)
jmp    11a2 <predicate_edgeIsPartOfRing+0x82>
mov    -0x20(%rbp),%rdi
call   1030 <edge_oNext@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jne    1138 <predicate_edgeIsPartOfRing+0x18>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<predicate_edgeIsPartOfRing>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rsi,%rbx
mov    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
cmp    %r15,%rbx
je     1179 <predicate_edgeIsPartOfRing+0x59>
mov    %rbx,%rdi
call   1040 <edge_lNext@plt>
cmp    %r15,%rax
je     1179 <predicate_edgeIsPartOfRing+0x59>
mov    %rbx,%rdi
call   1040 <edge_lNext@plt>
mov    %rax,%rdi
call   1040 <edge_lNext@plt>
cmp    %r15,%rax
je     1179 <predicate_edgeIsPartOfRing+0x59>
mov    %rbx,%rdi
call   1030 <edge_oNext@plt>
mov    %rax,%rbx
cmp    %r14,%rax
jne    1140 <predicate_edgeIsPartOfRing+0x20>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.Edge = type { i32 }
define i32 @predicate_edgeIsPartOfRing(%struct.Edge* %0, %struct.Edge* %1) {
%3 = alloca i32
%4 = alloca %struct.Edge*
%5 = alloca %struct.Edge*
%6 = alloca %struct.Edge*
store %struct.Edge* %0, %struct.Edge** %4
store %struct.Edge* %1, %struct.Edge** %5
%7 = load %struct.Edge*, %struct.Edge** %5
store %struct.Edge* %7, %struct.Edge** %6
br label %8
8: ; preds = %27, %2
%9 = load %struct.Edge*, %struct.Edge** %6
%10 = load %struct.Edge*, %struct.Edge** %4
%11 = icmp eq %struct.Edge* %9, %10
br i1 %11, label %23, label %12
12: ; preds = %8
%13 = load %struct.Edge*, %struct.Edge** %6
%14 = call %struct.Edge* @edge_lNext(%struct.Edge* %13)
%15 = load %struct.Edge*, %struct.Edge** %4
%16 = icmp eq %struct.Edge* %14, %15
br i1 %16, label %23, label %17
17: ; preds = %12
%18 = load %struct.Edge*, %struct.Edge** %6
%19 = call %struct.Edge* @edge_lNext(%struct.Edge* %18)
%20 = call %struct.Edge* @edge_lNext(%struct.Edge* %19)
%21 = load %struct.Edge*, %struct.Edge** %4
%22 = icmp eq %struct.Edge* %20, %21
br i1 %22, label %23, label %24
23: ; preds = %17, %12, %8
store i32 1, i32* %3
br label %32
24: ; preds = %17
%25 = load %struct.Edge*, %struct.Edge** %6
%26 = call %struct.Edge* @edge_oNext(%struct.Edge* %25)
store %struct.Edge* %26, %struct.Edge** %6
br label %27
27: ; preds = %24
%28 = load %struct.Edge*, %struct.Edge** %6
%29 = load %struct.Edge*, %struct.Edge** %5
%30 = icmp ne %struct.Edge* %28, %29
br i1 %30, label %8, label %31
31: ; preds = %27
store i32 0, i32* %3
br label %32
32: ; preds = %31, %23
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
%struct.Edge = type { i32 }
define i32 @predicate_edgeIsPartOfRing(%struct.Edge* readnone %0, %struct.Edge* %1) {
br label %3
3: ; preds = %13, %2
%4 = phi %struct.Edge* [ %1, %2 ], [ %14, %13 ]
%5 = icmp eq %struct.Edge* %4, %0
br i1 %5, label %16, label %6
6: ; preds = %3
%7 = tail call %struct.Edge* @edge_lNext(%struct.Edge* %4)
%8 = icmp eq %struct.Edge* %7, %0
br i1 %8, label %16, label %9
9: ; preds = %6
%10 = tail call %struct.Edge* @edge_lNext(%struct.Edge* %4)
%11 = tail call %struct.Edge* @edge_lNext(%struct.Edge* %10)
%12 = icmp eq %struct.Edge* %11, %0
br i1 %12, label %16, label %13
13: ; preds = %9
%14 = tail call %struct.Edge* @edge_oNext(%struct.Edge* %4)
%15 = icmp eq %struct.Edge* %14, %1
br i1 %15, label %16, label %3
16: ; preds = %13, %3, %6, %9
%17 = phi i32 [ 1, %9 ], [ 1, %6 ], [ 1, %3 ], [ 0, %13 ]
ret i32 %17
}