#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);
int /*<<< orphan*/ printList(struct ListNode *);
int /*<<< orphan*/ printf(char *, int);
struct ListNode *reverseKGroup(struct ListNode *, int);
int main(void) {
  int arr[20];
  struct ListNode *l[18];
  for (int i = 0; i < 20; i++) {
    arr[i] = i + 1;
  }
  for (int i = 0; i < 18; i++) {
    l[i] = createList(arr, 20);
  }
  for (int i = 0; i < 18; i++) {
    l[i] = reverseKGroup(l[i], i + 2);
  }
  for (int i = 0; i < 18; i++) {
    printf("No. %d testcase:\n", i + 1);
    printList(l[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xf4(%rbp)
cmpl   $0x14,-0xf4(%rbp)
jge    1191 <main+0x51>
mov    -0xf4(%rbp),%ecx
add    $0x1,%ecx
movslq -0xf4(%rbp),%rax
mov    %ecx,-0x60(%rbp,%rax,4)
mov    -0xf4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xf4(%rbp)
jmp    115c <main+0x1c>
movl   $0x0,-0xf8(%rbp)
cmpl   $0x12,-0xf8(%rbp)
jge    11dc <main+0x9c>
lea    -0x60(%rbp),%rdi
mov    $0x14,%esi
call   1050 <createList@plt>
mov    %rax,%rcx
movslq -0xf8(%rbp),%rax
mov    %rcx,-0xf0(%rbp,%rax,8)
ff
mov    -0xf8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xf8(%rbp)
jmp    119b <main+0x5b>
movl   $0x0,-0xfc(%rbp)
cmpl   $0x12,-0xfc(%rbp)
jge    1236 <main+0xf6>
movslq -0xfc(%rbp),%rax
mov    -0xf0(%rbp,%rax,8),%rdi
ff
mov    -0xfc(%rbp),%esi
add    $0x2,%esi
call   1040 <reverseKGroup@plt>
mov    %rax,%rcx
movslq -0xfc(%rbp),%rax
mov    %rcx,-0xf0(%rbp,%rax,8)
ff
mov    -0xfc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfc(%rbp)
jmp    11e6 <main+0xa6>
movl   $0x0,-0x100(%rbp)
cmpl   $0x12,-0x100(%rbp)
jge    128a <main+0x14a>
mov    -0x100(%rbp),%esi
add    $0x1,%esi
lea    0xda3(%rip),%rdi
call   1030 <printf@plt>
movslq -0x100(%rbp),%rax
mov    -0xf0(%rbp,%rax,8),%rdi
ff
call   1060 <printList@plt>
mov    -0x100(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x100(%rbp)
jmp    1240 <main+0x100>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xe8,%rsp
movaps 0xea8(%rip),%xmm0
movaps %xmm0,0x90(%rsp)
movaps 0xea9(%rip),%xmm0
movaps %xmm0,0xa0(%rsp)
movaps 0xeaa(%rip),%xmm0
movaps %xmm0,0xb0(%rsp)
movaps 0xeab(%rip),%xmm0
movaps %xmm0,0xc0(%rsp)
movaps 0xeac(%rip),%xmm0
movaps %xmm0,0xd0(%rsp)
lea    0x90(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x14,%esi
call   1050 <createList@plt>
mov    %rax,%r12
mov    %rbx,%rdi
mov    $0x14,%esi
call   1050 <createList@plt>
mov    %rax,%r15
mov    %rbx,%rdi
mov    $0x14,%esi
call   1050 <createList@plt>
mov    %rax,%r14
mov    %rbx,%rdi
mov    $0x14,%esi
call   1050 <createList@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
mov    $0x14,%esi
call   1050 <createList@plt>
mov    %rax,%r13
mov    %rbx,%rdi
mov    $0x14,%esi
call   1050 <createList@plt>
mov    %rax,0x8(%rsp)
mov    %rbx,%rdi
mov    $0x14,%esi
call   1050 <createList@plt>
mov    %rax,0x10(%rsp)
mov    %rbx,%rdi
mov    $0x14,%esi
call   1050 <createList@plt>
mov    %rax,0x18(%rsp)
mov    %rbx,%rdi
mov    $0x14,%esi
call   1050 <createList@plt>
mov    %rax,0x20(%rsp)
mov    %rbx,%rdi
mov    $0x14,%esi
call   1050 <createList@plt>
mov    %rax,0x28(%rsp)
mov    %rbx,%rdi
mov    $0x14,%esi
call   1050 <createList@plt>
mov    %rax,0x30(%rsp)
mov    %rbx,%rdi
mov    $0x14,%esi
call   1050 <createList@plt>
mov    %rax,0x38(%rsp)
mov    %rbx,%rdi
mov    $0x14,%esi
call   1050 <createList@plt>
mov    %rax,0x40(%rsp)
mov    %rbx,%rdi
mov    $0x14,%esi
call   1050 <createList@plt>
mov    %rax,0x48(%rsp)
mov    %rbx,%rdi
mov    $0x14,%esi
call   1050 <createList@plt>
mov    %rax,0x50(%rsp)
mov    %rbx,%rdi
mov    $0x14,%esi
call   1050 <createList@plt>
mov    %rax,0x58(%rsp)
mov    %rbx,%rdi
mov    $0x14,%esi
call   1050 <createList@plt>
mov    %rax,0x60(%rsp)
mov    %rbx,%rdi
mov    $0x14,%esi
call   1050 <createList@plt>
mov    %rax,%rbx
mov    %r12,%rdi
mov    $0x2,%esi
call   1040 <reverseKGroup@plt>
mov    %rax,0x68(%rsp)
mov    %r15,%rdi
mov    $0x3,%esi
call   1040 <reverseKGroup@plt>
mov    %rax,0x70(%rsp)
mov    %r14,%rdi
mov    $0x4,%esi
call   1040 <reverseKGroup@plt>
mov    %rax,0x78(%rsp)
mov    %rbp,%rdi
mov    $0x5,%esi
call   1040 <reverseKGroup@plt>
mov    %rax,0x80(%rsp)
mov    %r13,%rdi
mov    $0x6,%esi
call   1040 <reverseKGroup@plt>
mov    %rax,0x88(%rsp)
mov    0x8(%rsp),%rdi
mov    $0x7,%esi
call   1040 <reverseKGroup@plt>
mov    %rax,0x8(%rsp)
mov    0x10(%rsp),%rdi
mov    $0x8,%esi
call   1040 <reverseKGroup@plt>
mov    %rax,0x10(%rsp)
mov    0x18(%rsp),%rdi
mov    $0x9,%esi
call   1040 <reverseKGroup@plt>
mov    %rax,0x18(%rsp)
mov    0x20(%rsp),%rdi
mov    $0xa,%esi
call   1040 <reverseKGroup@plt>
mov    %rax,0x20(%rsp)
mov    0x28(%rsp),%rdi
mov    $0xb,%esi
call   1040 <reverseKGroup@plt>
mov    %rax,0x28(%rsp)
mov    0x30(%rsp),%rdi
mov    $0xc,%esi
call   1040 <reverseKGroup@plt>
mov    %rax,0x30(%rsp)
mov    0x38(%rsp),%rdi
mov    $0xd,%esi
call   1040 <reverseKGroup@plt>
mov    %rax,0x38(%rsp)
mov    0x40(%rsp),%rdi
mov    $0xe,%esi
call   1040 <reverseKGroup@plt>
mov    %rax,0x40(%rsp)
mov    0x48(%rsp),%rdi
mov    $0xf,%esi
call   1040 <reverseKGroup@plt>
mov    %rax,%rbp
mov    0x50(%rsp),%rdi
mov    $0x10,%esi
call   1040 <reverseKGroup@plt>
mov    %rax,%r13
mov    0x58(%rsp),%rdi
mov    $0x11,%esi
call   1040 <reverseKGroup@plt>
mov    %rax,%r12
mov    0x60(%rsp),%rdi
mov    $0x12,%esi
call   1040 <reverseKGroup@plt>
mov    %rax,%r15
mov    %rbx,%rdi
mov    $0x13,%esi
call   1040 <reverseKGroup@plt>
mov    %rax,%r14
lea    0xc15(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    0x68(%rsp),%rdi
call   1060 <printList@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    0x70(%rsp),%rdi
call   1060 <printList@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
mov    0x78(%rsp),%rdi
call   1060 <printList@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
mov    0x80(%rsp),%rdi
call   1060 <printList@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
mov    0x88(%rsp),%rdi
call   1060 <printList@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
call   1030 <printf@plt>
mov    0x8(%rsp),%rdi
call   1060 <printList@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
call   1030 <printf@plt>
mov    0x10(%rsp),%rdi
call   1060 <printList@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
mov    0x18(%rsp),%rdi
call   1060 <printList@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
call   1030 <printf@plt>
mov    0x20(%rsp),%rdi
call   1060 <printList@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <printf@plt>
mov    0x28(%rsp),%rdi
call   1060 <printList@plt>
mov    %rbx,%rdi
mov    $0xb,%esi
call   1030 <printf@plt>
mov    0x30(%rsp),%rdi
call   1060 <printList@plt>
mov    %rbx,%rdi
mov    $0xc,%esi
call   1030 <printf@plt>
mov    0x38(%rsp),%rdi
call   1060 <printList@plt>
mov    %rbx,%rdi
mov    $0xd,%esi
call   1030 <printf@plt>
mov    0x40(%rsp),%rdi
call   1060 <printList@plt>
mov    %rbx,%rdi
mov    $0xe,%esi
call   1030 <printf@plt>
mov    %rbp,%rdi
call   1060 <printList@plt>
mov    %rbx,%rdi
mov    $0xf,%esi
call   1030 <printf@plt>
mov    %r13,%rdi
call   1060 <printList@plt>
mov    %rbx,%rdi
mov    $0x10,%esi
call   1030 <printf@plt>
mov    %r12,%rdi
call   1060 <printList@plt>
mov    %rbx,%rdi
mov    $0x11,%esi
call   1030 <printf@plt>
mov    %r15,%rdi
call   1060 <printList@plt>
mov    %rbx,%rdi
mov    $0x12,%esi
call   1030 <printf@plt>
mov    %r14,%rdi
call   1060 <printList@plt>
xor    %eax,%eax
add    $0xe8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.ListNode = type { i32 }
@.str = [18 x i8] c"No. %d testcase:\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i32]
%3 = alloca [18 x %struct.ListNode*]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
br label %8
8: ; preds = %17, %0
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 20
br i1 %10, label %11, label %20
11: ; preds = %8
%12 = load i32, i32* %4
%13 = add nsw i32 %12, 1
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 %15
store i32 %13, i32* %16
br label %17
17: ; preds = %11
%18 = load i32, i32* %4
%19 = add nsw i32 %18, 1
store i32 %19, i32* %4
br label %8
20: ; preds = %8
store i32 0, i32* %5
br label %21
21: ; preds = %30, %20
%22 = load i32, i32* %5
%23 = icmp slt i32 %22, 18
br i1 %23, label %24, label %33
24: ; preds = %21
%25 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
%26 = call %struct.ListNode* @createList(i32* %25, i32 20)
%27 = load i32, i32* %5
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [18 x %struct.ListNode*], [18 x %struct.ListNode*]* %3, i64 0, i64 %28
store %struct.ListNode* %26, %struct.ListNode** %29
br label %30
30: ; preds = %24
%31 = load i32, i32* %5
%32 = add nsw i32 %31, 1
store i32 %32, i32* %5
br label %21
33: ; preds = %21
store i32 0, i32* %6
br label %34
34: ; preds = %48, %33
%35 = load i32, i32* %6
%36 = icmp slt i32 %35, 18
br i1 %36, label %37, label %51
37: ; preds = %34
%38 = load i32, i32* %6
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [18 x %struct.ListNode*], [18 x %struct.ListNode*]* %3, i64 0, i64 %39
%41 = load %struct.ListNode*, %struct.ListNode** %40
%42 = load i32, i32* %6
%43 = add nsw i32 %42, 2
%44 = call %struct.ListNode* @reverseKGroup(%struct.ListNode* %41, i32 %43)
%45 = load i32, i32* %6
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [18 x %struct.ListNode*], [18 x %struct.ListNode*]* %3, i64 0, i64 %46
store %struct.ListNode* %44, %struct.ListNode** %47
br label %48
48: ; preds = %37
%49 = load i32, i32* %6
%50 = add nsw i32 %49, 1
store i32 %50, i32* %6
br label %34
51: ; preds = %34
store i32 0, i32* %7
br label %52
52: ; preds = %64, %51
%53 = load i32, i32* %7
%54 = icmp slt i32 %53, 18
br i1 %54, label %55, label %67
55: ; preds = %52
%56 = load i32, i32* %7
%57 = add nsw i32 %56, 1
%58 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %57)
%59 = load i32, i32* %7
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [18 x %struct.ListNode*], [18 x %struct.ListNode*]* %3, i64 0, i64 %60
%62 = load %struct.ListNode*, %struct.ListNode** %61
%63 = call i32 @printList(%struct.ListNode* %62)
br label %64
64: ; preds = %55
%65 = load i32, i32* %7
%66 = add nsw i32 %65, 1
store i32 %66, i32* %7
br label %52
67: ; preds = %52
ret i32 0
}

LLVM IR (-O2):
%struct.ListNode = type { i32 }
@.str = [18 x i8] c"No. %d testcase:\0A\00"
define i32 @main() {
%1 = alloca [20 x i32]
%2 = bitcast [20 x i32]* %1 to i8*
%3 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 0
%4 = bitcast [20 x i32]* %1 to <4 x i32>*
store <4 x i32> <i32 1, i32 2, i32 3, i32 4>, <4 x i32>* %4
%5 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 4
%6 = bitcast i32* %5 to <4 x i32>*
store <4 x i32> <i32 5, i32 6, i32 7, i32 8>, <4 x i32>* %6
%7 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 8
%8 = bitcast i32* %7 to <4 x i32>*
store <4 x i32> <i32 9, i32 10, i32 11, i32 12>, <4 x i32>* %8
%9 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 12
%10 = bitcast i32* %9 to <4 x i32>*
store <4 x i32> <i32 13, i32 14, i32 15, i32 16>, <4 x i32>* %10
%11 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 16
%12 = bitcast i32* %11 to <4 x i32>*
store <4 x i32> <i32 17, i32 18, i32 19, i32 20>, <4 x i32>* %12
%13 = call %struct.ListNode* @createList(i32* %3, i32 20)
%14 = call %struct.ListNode* @createList(i32* %3, i32 20)
%15 = call %struct.ListNode* @createList(i32* %3, i32 20)
%16 = call %struct.ListNode* @createList(i32* %3, i32 20)
%17 = call %struct.ListNode* @createList(i32* %3, i32 20)
%18 = call %struct.ListNode* @createList(i32* %3, i32 20)
%19 = call %struct.ListNode* @createList(i32* %3, i32 20)
%20 = call %struct.ListNode* @createList(i32* %3, i32 20)
%21 = call %struct.ListNode* @createList(i32* %3, i32 20)
%22 = call %struct.ListNode* @createList(i32* %3, i32 20)
%23 = call %struct.ListNode* @createList(i32* %3, i32 20)
%24 = call %struct.ListNode* @createList(i32* %3, i32 20)
%25 = call %struct.ListNode* @createList(i32* %3, i32 20)
%26 = call %struct.ListNode* @createList(i32* %3, i32 20)
%27 = call %struct.ListNode* @createList(i32* %3, i32 20)
%28 = call %struct.ListNode* @createList(i32* %3, i32 20)
%29 = call %struct.ListNode* @createList(i32* %3, i32 20)
%30 = call %struct.ListNode* @createList(i32* %3, i32 20)
%31 = call %struct.ListNode* @reverseKGroup(%struct.ListNode* %13, i32 2)
%32 = call %struct.ListNode* @reverseKGroup(%struct.ListNode* %14, i32 3)
%33 = call %struct.ListNode* @reverseKGroup(%struct.ListNode* %15, i32 4)
%34 = call %struct.ListNode* @reverseKGroup(%struct.ListNode* %16, i32 5)
%35 = call %struct.ListNode* @reverseKGroup(%struct.ListNode* %17, i32 6)
%36 = call %struct.ListNode* @reverseKGroup(%struct.ListNode* %18, i32 7)
%37 = call %struct.ListNode* @reverseKGroup(%struct.ListNode* %19, i32 8)
%38 = call %struct.ListNode* @reverseKGroup(%struct.ListNode* %20, i32 9)
%39 = call %struct.ListNode* @reverseKGroup(%struct.ListNode* %21, i32 10)
%40 = call %struct.ListNode* @reverseKGroup(%struct.ListNode* %22, i32 11)
%41 = call %struct.ListNode* @reverseKGroup(%struct.ListNode* %23, i32 12)
%42 = call %struct.ListNode* @reverseKGroup(%struct.ListNode* %24, i32 13)
%43 = call %struct.ListNode* @reverseKGroup(%struct.ListNode* %25, i32 14)
%44 = call %struct.ListNode* @reverseKGroup(%struct.ListNode* %26, i32 15)
%45 = call %struct.ListNode* @reverseKGroup(%struct.ListNode* %27, i32 16)
%46 = call %struct.ListNode* @reverseKGroup(%struct.ListNode* %28, i32 17)
%47 = call %struct.ListNode* @reverseKGroup(%struct.ListNode* %29, i32 18)
%48 = call %struct.ListNode* @reverseKGroup(%struct.ListNode* %30, i32 19)
%49 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 1)
%50 = call i32 @printList(%struct.ListNode* %31)
%51 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 2)
%52 = call i32 @printList(%struct.ListNode* %32)
%53 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 3)
%54 = call i32 @printList(%struct.ListNode* %33)
%55 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 4)
%56 = call i32 @printList(%struct.ListNode* %34)
%57 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 5)
%58 = call i32 @printList(%struct.ListNode* %35)
%59 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 6)
%60 = call i32 @printList(%struct.ListNode* %36)
%61 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 7)
%62 = call i32 @printList(%struct.ListNode* %37)
%63 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 8)
%64 = call i32 @printList(%struct.ListNode* %38)
%65 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 9)
%66 = call i32 @printList(%struct.ListNode* %39)
%67 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 10)
%68 = call i32 @printList(%struct.ListNode* %40)
%69 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 11)
%70 = call i32 @printList(%struct.ListNode* %41)
%71 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 12)
%72 = call i32 @printList(%struct.ListNode* %42)
%73 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 13)
%74 = call i32 @printList(%struct.ListNode* %43)
%75 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 14)
%76 = call i32 @printList(%struct.ListNode* %44)
%77 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 15)
%78 = call i32 @printList(%struct.ListNode* %45)
%79 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 16)
%80 = call i32 @printList(%struct.ListNode* %46)
%81 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 17)
%82 = call i32 @printList(%struct.ListNode* %47)
%83 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 18)
%84 = call i32 @printList(%struct.ListNode* %48)
ret i32 0
}