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

/* Variables and functions */
struct node *LinkedList_Create(int);
int /*<<< orphan*/ LinkedList_Destroy(struct node *);
int /*<<< orphan*/ LinkedList_Print(struct node *);
int /*<<< orphan*/ split(struct node **, struct node **, struct node **);
int main(void) {
  struct node *list = LinkedList_Create(8);
  struct node *a = list;
  struct node *b = NULL;
  struct node *c = NULL;
  LinkedList_Print(a);
  split(&a, &b, &c);
  LinkedList_Print(b);
  LinkedList_Print(c);
  LinkedList_Destroy(list);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x8,%edi
call   1040 <LinkedList_Create@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <LinkedList_Print@plt>
lea    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x28(%rbp),%rdx
call   1050 <split@plt>
mov    -0x20(%rbp),%rdi
call   1030 <LinkedList_Print@plt>
mov    -0x28(%rbp),%rdi
call   1030 <LinkedList_Print@plt>
mov    -0x10(%rbp),%rdi
call   1060 <LinkedList_Destroy@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
mov    $0x8,%edi
call   1040 <LinkedList_Create@plt>
mov    %rax,%rbx
mov    %rax,0x18(%rsp)
movq   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
mov    %rax,%rdi
call   1030 <LinkedList_Print@plt>
lea    0x18(%rsp),%rdi
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1050 <split@plt>
mov    0x10(%rsp),%rdi
call   1030 <LinkedList_Print@plt>
mov    0x8(%rsp),%rdi
call   1030 <LinkedList_Print@plt>
mov    %rbx,%rdi
call   1060 <LinkedList_Destroy@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.node = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.node*
%3 = alloca %struct.node*
%4 = alloca %struct.node*
%5 = alloca %struct.node*
store i32 0, i32* %1
%6 = call %struct.node* @LinkedList_Create(i32 8)
store %struct.node* %6, %struct.node** %2
%7 = load %struct.node*, %struct.node** %2
store %struct.node* %7, %struct.node** %3
store %struct.node* null, %struct.node** %4
store %struct.node* null, %struct.node** %5
%8 = load %struct.node*, %struct.node** %3
%9 = call i32 @LinkedList_Print(%struct.node* %8)
%10 = call i32 @split(%struct.node** %3, %struct.node** %4, %struct.node** %5)
%11 = load %struct.node*, %struct.node** %4
%12 = call i32 @LinkedList_Print(%struct.node* %11)
%13 = load %struct.node*, %struct.node** %5
%14 = call i32 @LinkedList_Print(%struct.node* %13)
%15 = load %struct.node*, %struct.node** %2
%16 = call i32 @LinkedList_Destroy(%struct.node* %15)
ret i32 0
}

LLVM IR (-O2):
%struct.node = type { i32 }
define i32 @main() {
%1 = alloca %struct.node*
%2 = alloca %struct.node*
%3 = alloca %struct.node*
%4 = tail call %struct.node* @LinkedList_Create(i32 8)
%5 = bitcast %struct.node** %1 to i8*
store %struct.node* %4, %struct.node** %1
%6 = bitcast %struct.node** %2 to i8*
store %struct.node* null, %struct.node** %2
%7 = bitcast %struct.node** %3 to i8*
store %struct.node* null, %struct.node** %3
%8 = tail call i32 @LinkedList_Print(%struct.node* %4)
%9 = call i32 @split(%struct.node** %1, %struct.node** %2, %struct.node** %3)
%10 = load %struct.node*, %struct.node** %2
%11 = call i32 @LinkedList_Print(%struct.node* %10)
%12 = load %struct.node*, %struct.node** %3
%13 = call i32 @LinkedList_Print(%struct.node* %12)
%14 = call i32 @LinkedList_Destroy(%struct.node* %4)
ret i32 0
}