#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 dlinkedlist_node {
  int dummy;
};
typedef int /*<<< orphan*/ int_least32_t;

/* Variables and functions */
int /*<<< orphan*/ __dlinkedlist_split(struct dlinkedlist_node *,
                                       struct dlinkedlist_node *,
                                       struct dlinkedlist_node *,
                                       int /*<<< orphan*/ *,
                                       int /*<<< orphan*/ *);
scalar_t__ dlinkedlist_empty(struct dlinkedlist_node *);
void dlinkedlist_split(struct dlinkedlist_node *head,
                       struct dlinkedlist_node *list,
                       struct dlinkedlist_node *node, int_least32_t *headSize,
                       int_least32_t *listSize) {

  if (!dlinkedlist_empty(list)) {
    return;
  }
  if (dlinkedlist_empty(head)) {
    return;
  }
  if (head == node) {
    return;
  }
  __dlinkedlist_split(head, list, node, headSize, listSize);
}


x86 assembly (clang, -O0):
<dlinkedlist_split>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <dlinkedlist_empty@plt>
cmp    $0x0,%rax
jne    1154 <dlinkedlist_split+0x34>
jmp    1198 <dlinkedlist_split+0x78>
mov    -0x8(%rbp),%rdi
call   1040 <dlinkedlist_empty@plt>
cmp    $0x0,%rax
je     116c <dlinkedlist_split+0x4c>
jmp    1198 <dlinkedlist_split+0x78>
mov    -0x8(%rbp),%rax
cmp    -0x18(%rbp),%rax
jne    117f <dlinkedlist_split+0x5f>
jmp    1198 <dlinkedlist_split+0x78>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
call   1030 <__dlinkedlist_split@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dlinkedlist_split>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdx,%r12
mov    %rsi,%r13
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1040 <dlinkedlist_empty@plt>
test   %rax,%rax
je     1174 <dlinkedlist_split+0x54>
mov    %rbx,%rdi
call   1040 <dlinkedlist_empty@plt>
cmp    %r12,%rbx
je     1174 <dlinkedlist_split+0x54>
test   %rax,%rax
jne    1174 <dlinkedlist_split+0x54>
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %r12,%rdx
mov    %r15,%rcx
mov    %r14,%r8
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1030 <__dlinkedlist_split@plt>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
%struct.dlinkedlist_node = type { i32 }
define void @dlinkedlist_split(%struct.dlinkedlist_node* %0, %struct.dlinkedlist_node* %1, %struct.dlinkedlist_node* %2, i32* %3, i32* %4) {
%6 = tail call i64 @dlinkedlist_empty(%struct.dlinkedlist_node* %1)
%7 = icmp eq i64 %6, 0
br i1 %7, label %15, label %8
8: ; preds = %5
%9 = tail call i64 @dlinkedlist_empty(%struct.dlinkedlist_node* %0)
%10 = icmp ne i64 %9, 0
%11 = icmp eq %struct.dlinkedlist_node* %0, %2
%12 = or i1 %11, %10
br i1 %12, label %15, label %13
13: ; preds = %8
%14 = tail call i32 @__dlinkedlist_split(%struct.dlinkedlist_node* %0, %struct.dlinkedlist_node* %1, %struct.dlinkedlist_node* %2, i32* %3, i32* %4)
br label %15
15: ; preds = %8, %5, %13
ret void
}