#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 cyclist {
  int dummy;
};

/* Variables and functions */
struct cyclist *cyclist_remove(struct cyclist *);
struct cyclist *cyclist_del(struct cyclist *entry, struct cyclist **head) {
  if (!head || !(entry && *head))
    return 0;
  if (*head) {
    struct cyclist *next_entry = cyclist_remove(entry);
    if (*head == entry)
      *head = next_entry;
  }
  return entry;
}


x86 assembly (clang, -O0):
<cyclist_del>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1144 <cyclist_del+0x34>
cmpq   $0x0,-0x10(%rbp)
je     1144 <cyclist_del+0x34>
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
jne    1151 <cyclist_del+0x41>
movq   $0x0,-0x8(%rbp)
jmp    1195 <cyclist_del+0x85>
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
je     118d <cyclist_del+0x7d>
mov    -0x10(%rbp),%rdi
call   1030 <cyclist_remove@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
cmp    -0x10(%rbp),%rax
jne    1188 <cyclist_del+0x78>
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
jmp    118d <cyclist_del+0x7d>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cyclist_del>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
test   %rdi,%rdi
je     1140 <cyclist_del+0x30>
mov    %rsi,%r14
test   %rsi,%rsi
je     1140 <cyclist_del+0x30>
cmpq   $0x0,(%r14)
je     113e <cyclist_del+0x2e>
mov    %rdi,%rbx
call   1030 <cyclist_remove@plt>
cmp    %rbx,(%r14)
jne    1139 <cyclist_del+0x29>
mov    %rax,(%r14)
mov    %rbx,%rax
jmp    1140 <cyclist_del+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
%struct.cyclist = type { i32 }
define %struct.cyclist* @cyclist_del(%struct.cyclist* %0, %struct.cyclist** %1) {
%3 = icmp ne %struct.cyclist** %1, null
%4 = icmp ne %struct.cyclist* %0, null
%5 = and i1 %4, %3
br i1 %5, label %6, label %14
6: ; preds = %2
%7 = load %struct.cyclist*, %struct.cyclist** %1
%8 = icmp eq %struct.cyclist* %7, null
br i1 %8, label %14, label %9
9: ; preds = %6
%10 = tail call %struct.cyclist* @cyclist_remove(%struct.cyclist* %0)
%11 = load %struct.cyclist*, %struct.cyclist** %1
%12 = icmp eq %struct.cyclist* %11, %0
br i1 %12, label %13, label %14
13: ; preds = %9
store %struct.cyclist* %10, %struct.cyclist** %1
br label %14
14: ; preds = %13, %9, %2, %6
%15 = phi %struct.cyclist* [ null, %6 ], [ null, %2 ], [ %0, %9 ], [ %0, %13 ]
ret %struct.cyclist* %15
}