#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 */

/* Variables and functions */
int /*<<< orphan*/ findNthFromEnd(int);
int /*<<< orphan*/ insert(int);
int /*<<< orphan*/ printList();
int main(int argc, char **argv) {
  int i;
  int maxValue = 31;
  for (i = 0; i < maxValue; i += 2) {
    insert(i);
  }
  printList();
  findNthFromEnd(0);
  findNthFromEnd(2);
  findNthFromEnd(6);
  findNthFromEnd(60);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1f,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1176 <main+0x46>
mov    -0x14(%rbp),%edi
call   1040 <insert@plt>
mov    -0x14(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x14(%rbp)
jmp    1154 <main+0x24>
mov    $0x0,%al
call   1050 <printList@plt>
xor    %edi,%edi
call   1030 <findNthFromEnd@plt>
mov    $0x2,%edi
call   1030 <findNthFromEnd@plt>
mov    $0x6,%edi
call   1030 <findNthFromEnd@plt>
mov    $0x3c,%edi
call   1030 <findNthFromEnd@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1040 <insert@plt>
mov    $0x2,%edi
call   1040 <insert@plt>
mov    $0x4,%edi
call   1040 <insert@plt>
mov    $0x6,%edi
call   1040 <insert@plt>
mov    $0x8,%edi
call   1040 <insert@plt>
mov    $0xa,%edi
call   1040 <insert@plt>
mov    $0xc,%edi
call   1040 <insert@plt>
mov    $0xe,%edi
call   1040 <insert@plt>
mov    $0x10,%edi
call   1040 <insert@plt>
mov    $0x12,%edi
call   1040 <insert@plt>
mov    $0x14,%edi
call   1040 <insert@plt>
mov    $0x16,%edi
call   1040 <insert@plt>
mov    $0x18,%edi
call   1040 <insert@plt>
mov    $0x1a,%edi
call   1040 <insert@plt>
mov    $0x1c,%edi
call   1040 <insert@plt>
mov    $0x1e,%edi
call   1040 <insert@plt>
xor    %eax,%eax
call   1050 <printList@plt>
xor    %edi,%edi
call   1030 <findNthFromEnd@plt>
mov    $0x2,%edi
call   1030 <findNthFromEnd@plt>
mov    $0x6,%edi
call   1030 <findNthFromEnd@plt>
mov    $0x3c,%edi
call   1030 <findNthFromEnd@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 31, i32* %7
store i32 0, i32* %6
br label %8
8: ; preds = %15, %2
%9 = load i32, i32* %6
%10 = load i32, i32* %7
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %18
12: ; preds = %8
%13 = load i32, i32* %6
%14 = call i32 @insert(i32 %13)
br label %15
15: ; preds = %12
%16 = load i32, i32* %6
%17 = add nsw i32 %16, 2
store i32 %17, i32* %6
br label %8
18: ; preds = %8
%19 = call i32 (...) @printList()
%20 = call i32 @findNthFromEnd(i32 0)
%21 = call i32 @findNthFromEnd(i32 2)
%22 = call i32 @findNthFromEnd(i32 6)
%23 = call i32 @findNthFromEnd(i32 60)
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @insert(i32 0)
%4 = tail call i32 @insert(i32 2)
%5 = tail call i32 @insert(i32 4)
%6 = tail call i32 @insert(i32 6)
%7 = tail call i32 @insert(i32 8)
%8 = tail call i32 @insert(i32 10)
%9 = tail call i32 @insert(i32 12)
%10 = tail call i32 @insert(i32 14)
%11 = tail call i32 @insert(i32 16)
%12 = tail call i32 @insert(i32 18)
%13 = tail call i32 @insert(i32 20)
%14 = tail call i32 @insert(i32 22)
%15 = tail call i32 @insert(i32 24)
%16 = tail call i32 @insert(i32 26)
%17 = tail call i32 @insert(i32 28)
%18 = tail call i32 @insert(i32 30)
%19 = tail call i32 (...) @printList()
%20 = tail call i32 @findNthFromEnd(i32 0)
%21 = tail call i32 @findNthFromEnd(i32 2)
%22 = tail call i32 @findNthFromEnd(i32 6)
%23 = tail call i32 @findNthFromEnd(i32 60)
ret i32 0
}