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

/* Variables and functions */
struct ListNode *createList(int *, int /*<<< orphan*/);
struct ListNode *mergeKLists(struct ListNode **, int);
int /*<<< orphan*/ printList(struct ListNode *);
struct ListNode *sortList(struct ListNode *);
int main(void) {
  int arr1[0] = {};
  int arr2[0] = {};
  struct ListNode *lists[2];
  struct ListNode *res = NULL;
  lists[0] = createList(arr1, 0);
  lists[1] = createList(arr2, 0);
  lists[0] = sortList(lists[0]);
  lists[1] = sortList(lists[1]);
  res = mergeKLists(lists, 2);
  printList(res);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x28(%rbp)
lea    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1050 <createList@plt>
mov    %rax,-0x20(%rbp)
lea    -0xc(%rbp),%rdi
xor    %esi,%esi
call   1050 <createList@plt>
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <sortList@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <sortList@plt>
mov    %rax,-0x18(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x2,%esi
call   1030 <mergeKLists@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1060 <printList@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
lea    0xc(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
call   1050 <createList@plt>
mov    %rax,%rbx
mov    %r14,%rdi
xor    %esi,%esi
call   1050 <createList@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1040 <sortList@plt>
mov    %rax,0x10(%rsp)
mov    %r14,%rdi
call   1040 <sortList@plt>
mov    %rax,0x18(%rsp)
lea    0x10(%rsp),%rdi
mov    $0x2,%esi
call   1030 <mergeKLists@plt>
mov    %rax,%rdi
call   1060 <printList@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.ListNode = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca [0 x i32]
%3 = alloca [0 x i32]
%4 = alloca [2 x %struct.ListNode*]
%5 = alloca %struct.ListNode*
store i32 0, i32* %1
%6 = bitcast [0 x i32]* %2 to i8*
%7 = bitcast [0 x i32]* %3 to i8*
store %struct.ListNode* null, %struct.ListNode** %5
%8 = getelementptr inbounds [0 x i32], [0 x i32]* %2, i64 0, i64 0
%9 = call %struct.ListNode* @createList(i32* %8, i32 0)
%10 = getelementptr inbounds [2 x %struct.ListNode*], [2 x %struct.ListNode*]* %4, i64 0, i64 0
store %struct.ListNode* %9, %struct.ListNode** %10
%11 = getelementptr inbounds [0 x i32], [0 x i32]* %3, i64 0, i64 0
%12 = call %struct.ListNode* @createList(i32* %11, i32 0)
%13 = getelementptr inbounds [2 x %struct.ListNode*], [2 x %struct.ListNode*]* %4, i64 0, i64 1
store %struct.ListNode* %12, %struct.ListNode** %13
%14 = getelementptr inbounds [2 x %struct.ListNode*], [2 x %struct.ListNode*]* %4, i64 0, i64 0
%15 = load %struct.ListNode*, %struct.ListNode** %14
%16 = call %struct.ListNode* @sortList(%struct.ListNode* %15)
%17 = getelementptr inbounds [2 x %struct.ListNode*], [2 x %struct.ListNode*]* %4, i64 0, i64 0
store %struct.ListNode* %16, %struct.ListNode** %17
%18 = getelementptr inbounds [2 x %struct.ListNode*], [2 x %struct.ListNode*]* %4, i64 0, i64 1
%19 = load %struct.ListNode*, %struct.ListNode** %18
%20 = call %struct.ListNode* @sortList(%struct.ListNode* %19)
%21 = getelementptr inbounds [2 x %struct.ListNode*], [2 x %struct.ListNode*]* %4, i64 0, i64 1
store %struct.ListNode* %20, %struct.ListNode** %21
%22 = getelementptr inbounds [2 x %struct.ListNode*], [2 x %struct.ListNode*]* %4, i64 0, i64 0
%23 = call %struct.ListNode* @mergeKLists(%struct.ListNode** %22, i32 2)
store %struct.ListNode* %23, %struct.ListNode** %5
%24 = load %struct.ListNode*, %struct.ListNode** %5
%25 = call i32 @printList(%struct.ListNode* %24)
ret i32 0
}

LLVM IR (-O2):
%struct.ListNode = type { i32 }
define i32 @main() {
%1 = alloca [0 x i32]
%2 = alloca [2 x %struct.ListNode*]
%3 = bitcast [0 x i32]* %1 to i8*
%4 = bitcast [2 x %struct.ListNode*]* %2 to i8*
%5 = getelementptr inbounds [0 x i32], [0 x i32]* %1, i64 0, i64 0
%6 = call %struct.ListNode* @createList(i32* %5, i32 0)
%7 = getelementptr inbounds [2 x %struct.ListNode*], [2 x %struct.ListNode*]* %2, i64 0, i64 0
%8 = call %struct.ListNode* @createList(i32* %5, i32 0)
%9 = getelementptr inbounds [2 x %struct.ListNode*], [2 x %struct.ListNode*]* %2, i64 0, i64 1
%10 = call %struct.ListNode* @sortList(%struct.ListNode* %6)
store %struct.ListNode* %10, %struct.ListNode** %7
%11 = call %struct.ListNode* @sortList(%struct.ListNode* %8)
store %struct.ListNode* %11, %struct.ListNode** %9
%12 = call %struct.ListNode* @mergeKLists(%struct.ListNode** %7, i32 2)
%13 = call i32 @printList(%struct.ListNode* %12)
ret i32 0
}