int main(void) {
  int leftMost = 0, rightMost = 0;
  int size = 0;
  int count = 0;
  int list1[] = {1};
  size = ((int)sizeof(list1) / sizeof(int));
  leftMost = searchLeftMost(list1, 0, size - 1, 1);
  rightMost = searchRightMost(list1, 0, size - 1, 1);
  count = getNumOf(leftMost, rightMost);
  printf("leftmost: %2d , rightmost: %2d[%d]\n", leftMost, rightMost, count);
  printf("%d\n", searchRightMost(list1, 0, size - 1, 0));
  int list2[] = {1, 1};
  size = ((int)sizeof(list2) / sizeof(int));
  leftMost = searchLeftMost(list2, 0, size - 1, 1);
  rightMost = searchRightMost(list2, 0, size - 1, 1);
  count = getNumOf(leftMost, rightMost);
  printf("leftmost: %2d , rightmost: %2d[%d]\n", leftMost, rightMost, count);
  printf("%d\n", searchRightMost(list2, 0, size - 1, 0));
  int list3[] = {1, 1, 1};
  size = ((int)sizeof(list3) / sizeof(int));
  leftMost = searchLeftMost(list3, 0, size - 1, 1);
  rightMost = searchRightMost(list3, 0, size - 1, 1);
  count = getNumOf(leftMost, rightMost);
  printf("leftmost: %2d , rightmost: %2d[%d]\n", leftMost, rightMost, count);
  printf("%d\n", searchRightMost(list3, 0, size - 1, 0));
  int list4[] = {1, 1, 1, 1};
  size = ((int)sizeof(list4) / sizeof(int));
  leftMost = searchLeftMost(list4, 0, size - 1, 1);
  rightMost = searchRightMost(list4, 0, size - 1, 1);
  count = getNumOf(leftMost, rightMost);
  printf("leftmost: %2d , rightmost: %2d[%d]\n", leftMost, rightMost, count);
  printf("%d\n", searchRightMost(list4, 0, size - 1, 0));
  int list5[] = {1, 1, 1, 1, 1};
  size = ((int)sizeof(list5) / sizeof(int));
  leftMost = searchLeftMost(list5, 0, size - 1, 1);
  rightMost = searchRightMost(list5, 0, size - 1, 1);
  count = getNumOf(leftMost, rightMost);
  printf("leftmost: %2d , rightmost: %2d[%d]\n", leftMost, rightMost, count);
  printf("%d\n", searchRightMost(list5, 0, size - 1, 0));
  int list6[] = {1, 2, 2, 3, 5};
  size = ((int)sizeof(list6) / sizeof(int));
  leftMost = searchLeftMost(list6, 0, size - 1, 2);
  rightMost = searchRightMost(list6, 0, size - 1, 2);
  count = getNumOf(leftMost, rightMost);
  printf("leftmost: %2d , rightmost: %2d[%d]\n", leftMost, rightMost, count);
  printf("%d\n", searchRightMost(list6, 0, size - 1, 6));
  int list7[] = {1, 2, 2, 2, 3, 5};
  size = ((int)sizeof(list7) / sizeof(int));
  leftMost = searchLeftMost(list7, 0, size - 1, 2);
  rightMost = searchRightMost(list7, 0, size - 1, 2);
  count = getNumOf(leftMost, rightMost);
  printf("leftmost: %2d , rightmost: %2d[%d]\n", leftMost, rightMost, count);
  printf("%d\n", searchRightMost(list7, 0, size - 1, 6));
  int list8[] = {1, 2, 3, 3, 6};
  size = ((int)sizeof(list8) / sizeof(int));
  leftMost = searchLeftMost(list8, 0, size - 1, 3);
  rightMost = searchRightMost(list8, 0, size - 1, 3);
  count = getNumOf(leftMost, rightMost);
  printf("leftmost: %2d , rightmost: %2d[%d]\n", leftMost, rightMost, count);
  printf("%d\n", searchRightMost(list8, 0, size - 1, -1));
  int list9[] = {1, 1, 1, 3, 4, 5, 6, 7};
  size = ((int)sizeof(list9) / sizeof(int));
  leftMost = searchLeftMost(list9, 0, size - 1, 1);
  rightMost = searchRightMost(list9, 0, size - 1, 1);
  count = getNumOf(leftMost, rightMost);
  printf("leftmost: %2d , rightmost: %2d[%d]\n", leftMost, rightMost, count);
  printf("%d\n", searchRightMost(list9, 0, size - 1, -1));
  int list10[] = {1, 2, 4, 6, 8, 8, 8, 8, 8, 8};
  size = ((int)sizeof(list10) / sizeof(int));
  leftMost = searchLeftMost(list10, 0, size - 1, 8);
  rightMost = searchRightMost(list10, 0, size - 1, 8);
  count = getNumOf(leftMost, rightMost);
  printf("leftmost: %2d , rightmost: %2d[%d]\n", leftMost, rightMost, count);
  printf("%d\n", searchRightMost(list10, 0, size - 1, -1));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    0xe7c(%rip),%eax
mov    %eax,-0x18(%rbp)
movl   $0x1,-0x10(%rbp)
lea    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
mov    $0x1,%ecx
mov    $0x0,%al
call   1040 <searchLeftMost@plt>
mov    %eax,-0x8(%rbp)
lea    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
mov    $0x1,%ecx
mov    $0x0,%al
call   1050 <searchRightMost@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x0,%al
call   1070 <getNumOf@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
xor    %ecx,%ecx
mov    %ecx,%esi
mov    $0x0,%al
call   1050 <searchRightMost@plt>
mov    %eax,%esi
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0xe15(%rip),%rax
mov    %rax,-0x20(%rbp)
movl   $0x2,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
mov    $0x1,%ecx
mov    $0x0,%al
call   1040 <searchLeftMost@plt>
mov    %eax,-0x8(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
mov    $0x1,%ecx
mov    $0x0,%al
call   1050 <searchRightMost@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x0,%al
call   1070 <getNumOf@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xd8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
xor    %ecx,%ecx
mov    %ecx,%esi
mov    $0x0,%al
call   1050 <searchRightMost@plt>
mov    %eax,%esi
lea    0xd8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0xd95(%rip),%rax
mov    %rax,-0x2c(%rbp)
mov    0xd93(%rip),%eax
mov    %eax,-0x24(%rbp)
movl   $0x3,-0x10(%rbp)
lea    -0x2c(%rbp),%rdi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
mov    $0x1,%ecx
mov    $0x0,%al
call   1040 <searchLeftMost@plt>
mov    %eax,-0x8(%rbp)
lea    -0x2c(%rbp),%rdi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
mov    $0x1,%ecx
mov    $0x0,%al
call   1050 <searchRightMost@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x0,%al
call   1070 <getNumOf@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xcef(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x2c(%rbp),%rdi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
xor    %ecx,%ecx
mov    %ecx,%esi
mov    $0x0,%al
call   1050 <searchRightMost@plt>
mov    %eax,%esi
lea    0xcee(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0xdb8(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xdb5(%rip),%rax
mov    %rax,-0x38(%rbp)
movl   $0x4,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
mov    $0x1,%ecx
mov    $0x0,%al
call   1040 <searchLeftMost@plt>
mov    %eax,-0x8(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
mov    $0x1,%ecx
mov    $0x0,%al
call   1050 <searchRightMost@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x0,%al
call   1070 <getNumOf@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xc50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
xor    %ecx,%ecx
mov    %ecx,%esi
mov    $0x0,%al
call   1050 <searchRightMost@plt>
mov    %eax,%esi
lea    0xc4f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0xc69(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xc66(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    0xc64(%rip),%eax
mov    %eax,-0x50(%rbp)
movl   $0x5,-0x10(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
mov    $0x1,%ecx
mov    $0x0,%al
call   1040 <searchLeftMost@plt>
mov    %eax,-0x8(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
mov    $0x1,%ecx
mov    $0x0,%al
call   1050 <searchRightMost@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x0,%al
call   1070 <getNumOf@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xba8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
xor    %ecx,%ecx
mov    %ecx,%esi
mov    $0x0,%al
call   1050 <searchRightMost@plt>
mov    %eax,%esi
lea    0xba7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0xbe1(%rip),%rax
mov    %rax,-0x80(%rbp)
mov    0xbde(%rip),%rax
mov    %rax,-0x78(%rbp)
mov    0xbdc(%rip),%eax
mov    %eax,-0x70(%rbp)
movl   $0x5,-0x10(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
mov    $0x2,%ecx
mov    $0x0,%al
call   1040 <searchLeftMost@plt>
mov    %eax,-0x8(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
mov    $0x2,%ecx
mov    $0x0,%al
call   1050 <searchRightMost@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x0,%al
call   1070 <getNumOf@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xb00(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
mov    $0x6,%ecx
mov    $0x0,%al
call   1050 <searchRightMost@plt>
mov    %eax,%esi
lea    0xafc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0xb56(%rip),%rax
mov    %rax,-0xa0(%rbp)
mov    0xb50(%rip),%rax
mov    %rax,-0x98(%rbp)
mov    0xb4a(%rip),%rax
mov    %rax,-0x90(%rbp)
movl   $0x6,-0x10(%rbp)
lea    -0xa0(%rbp),%rdi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
mov    $0x2,%ecx
mov    $0x0,%al
call   1040 <searchLeftMost@plt>
mov    %eax,-0x8(%rbp)
lea    -0xa0(%rbp),%rdi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
mov    $0x2,%ecx
mov    $0x0,%al
call   1050 <searchRightMost@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x0,%al
call   1070 <getNumOf@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xa44(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xa0(%rbp),%rdi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
mov    $0x6,%ecx
mov    $0x0,%al
call   1050 <searchRightMost@plt>
mov    %eax,%esi
lea    0xa3d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0xab7(%rip),%rax
mov    %rax,-0xc0(%rbp)
mov    0xab1(%rip),%rax
mov    %rax,-0xb8(%rbp)
mov    0xaac(%rip),%eax
mov    %eax,-0xb0(%rbp)
movl   $0x5,-0x10(%rbp)
lea    -0xc0(%rbp),%rdi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
mov    $0x3,%ecx
mov    $0x0,%al
call   1040 <searchLeftMost@plt>
mov    %eax,-0x8(%rbp)
lea    -0xc0(%rbp),%rdi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
mov    $0x3,%ecx
mov    $0x0,%al
call   1050 <searchRightMost@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x0,%al
call   1070 <getNumOf@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0x987(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xc0(%rbp),%rdi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
mov    $0xffffffff,%ecx
mov    $0x0,%al
call   1050 <searchRightMost@plt>
mov    %eax,%esi
lea    0x980(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0xa5a(%rip),%rax
mov    %rax,-0xe0(%rbp)
mov    0xa54(%rip),%rax
mov    %rax,-0xd8(%rbp)
mov    0xa4e(%rip),%rax
mov    %rax,-0xd0(%rbp)
mov    0xa48(%rip),%rax
mov    %rax,-0xc8(%rbp)
movl   $0x8,-0x10(%rbp)
lea    -0xe0(%rbp),%rdi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
mov    $0x1,%ecx
mov    $0x0,%al
call   1040 <searchLeftMost@plt>
mov    %eax,-0x8(%rbp)
lea    -0xe0(%rbp),%rdi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
mov    $0x1,%ecx
mov    $0x0,%al
call   1050 <searchRightMost@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x0,%al
call   1070 <getNumOf@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0x8ba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xe0(%rbp),%rdi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
mov    $0xffffffff,%ecx
mov    $0x0,%al
call   1050 <searchRightMost@plt>
mov    %eax,%esi
lea    0x8b3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x110(%rbp),%rdi
lea    0x946(%rip),%rsi
mov    $0x28,%edx
call   1060 <memcpy@plt>
movl   $0xa,-0x10(%rbp)
lea    -0x110(%rbp),%rdi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
mov    $0x8,%ecx
mov    $0x0,%al
call   1040 <searchLeftMost@plt>
mov    %eax,-0x8(%rbp)
lea    -0x110(%rbp),%rdi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
mov    $0x8,%ecx
mov    $0x0,%al
call   1050 <searchRightMost@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x0,%al
call   1070 <getNumOf@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0x80d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x110(%rbp),%rdi
mov    -0x10(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
mov    $0xffffffff,%ecx
mov    $0x0,%al
call   1050 <searchRightMost@plt>
mov    %eax,%esi
lea    0x806(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x100,%rsp
movl   $0x1,0x4(%rsp)
lea    0x4(%rsp),%r15
mov    %r15,%rdi
xor    %esi,%esi
xor    %edx,%edx
mov    $0x1,%ecx
xor    %eax,%eax
call   1040 <searchLeftMost@plt>
mov    %eax,%ebp
mov    %r15,%rdi
xor    %esi,%esi
xor    %edx,%edx
mov    $0x1,%ecx
xor    %eax,%eax
call   1050 <searchRightMost@plt>
mov    %eax,%ebx
mov    %ebp,%edi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <getNumOf@plt>
lea    0xe68(%rip),%r14
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %eax,%eax
call   1050 <searchRightMost@plt>
lea    0xe65(%rip),%r15
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
movabs $0x100000001,%rax
mov    %rax,0x18(%rsp)
lea    0x18(%rsp),%r12
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
xor    %eax,%eax
call   1040 <searchLeftMost@plt>
mov    %eax,%ebp
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
xor    %eax,%eax
call   1050 <searchRightMost@plt>
mov    %eax,%ebx
mov    %ebp,%edi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <getNumOf@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x1,%edx
xor    %ecx,%ecx
xor    %eax,%eax
call   1050 <searchRightMost@plt>
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xde9(%rip),%eax
mov    %eax,0x10(%rsp)
mov    0xdd6(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%r12
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x2,%edx
mov    $0x1,%ecx
xor    %eax,%eax
call   1040 <searchLeftMost@plt>
mov    %eax,%ebp
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x2,%edx
mov    $0x1,%ecx
xor    %eax,%eax
call   1050 <searchRightMost@plt>
mov    %eax,%ebx
mov    %ebp,%edi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <getNumOf@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x2,%edx
xor    %ecx,%ecx
xor    %eax,%eax
call   1050 <searchRightMost@plt>
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
movaps 0xe1b(%rip),%xmm0
movaps %xmm0,0xa0(%rsp)
lea    0xa0(%rsp),%r12
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x3,%edx
mov    $0x1,%ecx
xor    %eax,%eax
call   1040 <searchLeftMost@plt>
mov    %eax,%ebp
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x3,%edx
mov    $0x1,%ecx
xor    %eax,%eax
call   1050 <searchRightMost@plt>
mov    %eax,%ebx
mov    %ebp,%edi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <getNumOf@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x3,%edx
xor    %ecx,%ecx
xor    %eax,%eax
call   1050 <searchRightMost@plt>
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xcfb(%rip),%eax
mov    %eax,0x70(%rsp)
movaps 0xce0(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
lea    0x60(%rsp),%r12
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x4,%edx
mov    $0x1,%ecx
xor    %eax,%eax
call   1040 <searchLeftMost@plt>
mov    %eax,%ebp
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x4,%edx
mov    $0x1,%ecx
xor    %eax,%eax
call   1050 <searchRightMost@plt>
mov    %eax,%ebx
mov    %ebp,%edi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <getNumOf@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x4,%edx
xor    %ecx,%ecx
xor    %eax,%eax
call   1050 <searchRightMost@plt>
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc96(%rip),%eax
mov    %eax,0x50(%rsp)
movaps 0xc7b(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
lea    0x40(%rsp),%r12
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x4,%edx
mov    $0x2,%ecx
xor    %eax,%eax
call   1040 <searchLeftMost@plt>
mov    %eax,%ebp
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x4,%edx
mov    $0x2,%ecx
xor    %eax,%eax
call   1050 <searchRightMost@plt>
mov    %eax,%ebx
mov    %ebp,%edi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <getNumOf@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x4,%edx
mov    $0x6,%ecx
xor    %eax,%eax
call   1050 <searchRightMost@plt>
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc2d(%rip),%rax
mov    %rax,0x90(%rsp)
movaps 0xc0e(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
lea    0x80(%rsp),%r12
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x5,%edx
mov    $0x2,%ecx
xor    %eax,%eax
call   1040 <searchLeftMost@plt>
mov    %eax,%ebp
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x5,%edx
mov    $0x2,%ecx
xor    %eax,%eax
call   1050 <searchRightMost@plt>
mov    %eax,%ebx
mov    %ebp,%edi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <getNumOf@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x5,%edx
mov    $0x6,%ecx
xor    %eax,%eax
call   1050 <searchRightMost@plt>
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xbbb(%rip),%eax
mov    %eax,0x30(%rsp)
movaps 0xba0(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
lea    0x20(%rsp),%r12
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x4,%edx
mov    $0x3,%ecx
xor    %eax,%eax
call   1040 <searchLeftMost@plt>
mov    %eax,%ebp
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x4,%edx
mov    $0x3,%ecx
xor    %eax,%eax
call   1050 <searchRightMost@plt>
mov    %eax,%ebx
mov    %ebp,%edi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <getNumOf@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x4,%edx
mov    $0xffffffff,%ecx
xor    %eax,%eax
call   1050 <searchRightMost@plt>
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
movaps 0xb92(%rip),%xmm0
movaps %xmm0,0xf0(%rsp)
movaps 0xb73(%rip),%xmm0
movaps %xmm0,0xe0(%rsp)
lea    0xe0(%rsp),%r12
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x7,%edx
mov    $0x1,%ecx
xor    %eax,%eax
call   1040 <searchLeftMost@plt>
mov    %eax,%ebp
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x7,%edx
mov    $0x1,%ecx
xor    %eax,%eax
call   1050 <searchRightMost@plt>
mov    %eax,%ebx
mov    %ebp,%edi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <getNumOf@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x7,%edx
mov    $0xffffffff,%ecx
xor    %eax,%eax
call   1050 <searchRightMost@plt>
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xacf(%rip),%rax
mov    %rax,0xd0(%rsp)
movaps 0xab0(%rip),%xmm0
movaps %xmm0,0xc0(%rsp)
movaps 0xa91(%rip),%xmm0
movaps %xmm0,0xb0(%rsp)
lea    0xb0(%rsp),%r12
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x9,%edx
mov    $0x8,%ecx
xor    %eax,%eax
call   1040 <searchLeftMost@plt>
mov    %eax,%ebp
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x9,%edx
mov    $0x8,%ecx
xor    %eax,%eax
call   1050 <searchRightMost@plt>
mov    %eax,%ebx
mov    %ebp,%edi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <getNumOf@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x9,%edx
mov    $0xffffffff,%ecx
xor    %eax,%eax
call   1050 <searchRightMost@plt>
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.list1 = [1 x i32] [i32 1]
@.str = [36 x i8] c"leftmost: %2d , rightmost: %2d[%d]\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
@__const.main.list2 = [2 x i32] [i32 1, i32 1]
@__const.main.list3 = [3 x i32] [i32 1, i32 1, i32 1]
@__const.main.list4 = [4 x i32] [i32 1, i32 1, i32 1, i32 1]
@__const.main.list5 = [5 x i32] [i32 1, i32 1, i32 1, i32 1, i32 1]
@__const.main.list6 = [5 x i32] [i32 1, i32 2, i32 2, i32 3, i32 5]
@__const.main.list7 = [6 x i32] [i32 1, i32 2, i32 2, i32 2, i32 3, i32 5]
@__const.main.list8 = [5 x i32] [i32 1, i32 2, i32 3, i32 3, i32 6]
@__const.main.list9 = [8 x i32] [i32 1, i32 1, i32 1, i32 3, i32 4, i32 5, i32 6, i32 7]
@__const.main.list10 = [10 x i32] [i32 1, i32 2, i32 4, i32 6, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8]
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [1 x i32]
%7 = alloca [2 x i32]
%8 = alloca [3 x i32]
%9 = alloca [4 x i32]
%10 = alloca [5 x i32]
%11 = alloca [5 x i32]
%12 = alloca [6 x i32]
%13 = alloca [5 x i32]
%14 = alloca [8 x i32]
%15 = alloca [10 x i32]
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
%16 = bitcast [1 x i32]* %6 to i8*
store i32 1, i32* %4
%17 = getelementptr inbounds [1 x i32], [1 x i32]* %6, i64 0, i64 0
%18 = load i32, i32* %4
%19 = sub nsw i32 %18, 1
%20 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchLeftMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %17, i32 0, i32 %19, i32 1)
store i32 %20, i32* %2
%21 = getelementptr inbounds [1 x i32], [1 x i32]* %6, i64 0, i64 0
%22 = load i32, i32* %4
%23 = sub nsw i32 %22, 1
%24 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %21, i32 0, i32 %23, i32 1)
store i32 %24, i32* %3
%25 = load i32, i32* %2
%26 = load i32, i32* %3
%27 = call i32 (i32, i32, ...) bitcast (i32 (...)* @getNumOf to i32 (i32, i32, ...)*)(i32 %25, i32 %26)
store i32 %27, i32* %5
%28 = load i32, i32* %2
%29 = load i32, i32* %3
%30 = load i32, i32* %5
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %28, i32 %29, i32 %30)
%32 = getelementptr inbounds [1 x i32], [1 x i32]* %6, i64 0, i64 0
%33 = load i32, i32* %4
%34 = sub nsw i32 %33, 1
%35 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %32, i32 0, i32 %34, i32 0)
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %35)
%37 = bitcast [2 x i32]* %7 to i8*
store i32 2, i32* %4
%38 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%39 = load i32, i32* %4
%40 = sub nsw i32 %39, 1
%41 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchLeftMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %38, i32 0, i32 %40, i32 1)
store i32 %41, i32* %2
%42 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%43 = load i32, i32* %4
%44 = sub nsw i32 %43, 1
%45 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %42, i32 0, i32 %44, i32 1)
store i32 %45, i32* %3
%46 = load i32, i32* %2
%47 = load i32, i32* %3
%48 = call i32 (i32, i32, ...) bitcast (i32 (...)* @getNumOf to i32 (i32, i32, ...)*)(i32 %46, i32 %47)
store i32 %48, i32* %5
%49 = load i32, i32* %2
%50 = load i32, i32* %3
%51 = load i32, i32* %5
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %49, i32 %50, i32 %51)
%53 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%54 = load i32, i32* %4
%55 = sub nsw i32 %54, 1
%56 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %53, i32 0, i32 %55, i32 0)
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %56)
%58 = bitcast [3 x i32]* %8 to i8*
store i32 3, i32* %4
%59 = getelementptr inbounds [3 x i32], [3 x i32]* %8, i64 0, i64 0
%60 = load i32, i32* %4
%61 = sub nsw i32 %60, 1
%62 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchLeftMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %59, i32 0, i32 %61, i32 1)
store i32 %62, i32* %2
%63 = getelementptr inbounds [3 x i32], [3 x i32]* %8, i64 0, i64 0
%64 = load i32, i32* %4
%65 = sub nsw i32 %64, 1
%66 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %63, i32 0, i32 %65, i32 1)
store i32 %66, i32* %3
%67 = load i32, i32* %2
%68 = load i32, i32* %3
%69 = call i32 (i32, i32, ...) bitcast (i32 (...)* @getNumOf to i32 (i32, i32, ...)*)(i32 %67, i32 %68)
store i32 %69, i32* %5
%70 = load i32, i32* %2
%71 = load i32, i32* %3
%72 = load i32, i32* %5
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %70, i32 %71, i32 %72)
%74 = getelementptr inbounds [3 x i32], [3 x i32]* %8, i64 0, i64 0
%75 = load i32, i32* %4
%76 = sub nsw i32 %75, 1
%77 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %74, i32 0, i32 %76, i32 0)
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %77)
%79 = bitcast [4 x i32]* %9 to i8*
store i32 4, i32* %4
%80 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 0
%81 = load i32, i32* %4
%82 = sub nsw i32 %81, 1
%83 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchLeftMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %80, i32 0, i32 %82, i32 1)
store i32 %83, i32* %2
%84 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 0
%85 = load i32, i32* %4
%86 = sub nsw i32 %85, 1
%87 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %84, i32 0, i32 %86, i32 1)
store i32 %87, i32* %3
%88 = load i32, i32* %2
%89 = load i32, i32* %3
%90 = call i32 (i32, i32, ...) bitcast (i32 (...)* @getNumOf to i32 (i32, i32, ...)*)(i32 %88, i32 %89)
store i32 %90, i32* %5
%91 = load i32, i32* %2
%92 = load i32, i32* %3
%93 = load i32, i32* %5
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %91, i32 %92, i32 %93)
%95 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 0
%96 = load i32, i32* %4
%97 = sub nsw i32 %96, 1
%98 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %95, i32 0, i32 %97, i32 0)
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %98)
%100 = bitcast [5 x i32]* %10 to i8*
store i32 5, i32* %4
%101 = getelementptr inbounds [5 x i32], [5 x i32]* %10, i64 0, i64 0
%102 = load i32, i32* %4
%103 = sub nsw i32 %102, 1
%104 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchLeftMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %101, i32 0, i32 %103, i32 1)
store i32 %104, i32* %2
%105 = getelementptr inbounds [5 x i32], [5 x i32]* %10, i64 0, i64 0
%106 = load i32, i32* %4
%107 = sub nsw i32 %106, 1
%108 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %105, i32 0, i32 %107, i32 1)
store i32 %108, i32* %3
%109 = load i32, i32* %2
%110 = load i32, i32* %3
%111 = call i32 (i32, i32, ...) bitcast (i32 (...)* @getNumOf to i32 (i32, i32, ...)*)(i32 %109, i32 %110)
store i32 %111, i32* %5
%112 = load i32, i32* %2
%113 = load i32, i32* %3
%114 = load i32, i32* %5
%115 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %112, i32 %113, i32 %114)
%116 = getelementptr inbounds [5 x i32], [5 x i32]* %10, i64 0, i64 0
%117 = load i32, i32* %4
%118 = sub nsw i32 %117, 1
%119 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %116, i32 0, i32 %118, i32 0)
%120 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %119)
%121 = bitcast [5 x i32]* %11 to i8*
store i32 5, i32* %4
%122 = getelementptr inbounds [5 x i32], [5 x i32]* %11, i64 0, i64 0
%123 = load i32, i32* %4
%124 = sub nsw i32 %123, 1
%125 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchLeftMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %122, i32 0, i32 %124, i32 2)
store i32 %125, i32* %2
%126 = getelementptr inbounds [5 x i32], [5 x i32]* %11, i64 0, i64 0
%127 = load i32, i32* %4
%128 = sub nsw i32 %127, 1
%129 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %126, i32 0, i32 %128, i32 2)
store i32 %129, i32* %3
%130 = load i32, i32* %2
%131 = load i32, i32* %3
%132 = call i32 (i32, i32, ...) bitcast (i32 (...)* @getNumOf to i32 (i32, i32, ...)*)(i32 %130, i32 %131)
store i32 %132, i32* %5
%133 = load i32, i32* %2
%134 = load i32, i32* %3
%135 = load i32, i32* %5
%136 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %133, i32 %134, i32 %135)
%137 = getelementptr inbounds [5 x i32], [5 x i32]* %11, i64 0, i64 0
%138 = load i32, i32* %4
%139 = sub nsw i32 %138, 1
%140 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %137, i32 0, i32 %139, i32 6)
%141 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %140)
%142 = bitcast [6 x i32]* %12 to i8*
store i32 6, i32* %4
%143 = getelementptr inbounds [6 x i32], [6 x i32]* %12, i64 0, i64 0
%144 = load i32, i32* %4
%145 = sub nsw i32 %144, 1
%146 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchLeftMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %143, i32 0, i32 %145, i32 2)
store i32 %146, i32* %2
%147 = getelementptr inbounds [6 x i32], [6 x i32]* %12, i64 0, i64 0
%148 = load i32, i32* %4
%149 = sub nsw i32 %148, 1
%150 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %147, i32 0, i32 %149, i32 2)
store i32 %150, i32* %3
%151 = load i32, i32* %2
%152 = load i32, i32* %3
%153 = call i32 (i32, i32, ...) bitcast (i32 (...)* @getNumOf to i32 (i32, i32, ...)*)(i32 %151, i32 %152)
store i32 %153, i32* %5
%154 = load i32, i32* %2
%155 = load i32, i32* %3
%156 = load i32, i32* %5
%157 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %154, i32 %155, i32 %156)
%158 = getelementptr inbounds [6 x i32], [6 x i32]* %12, i64 0, i64 0
%159 = load i32, i32* %4
%160 = sub nsw i32 %159, 1
%161 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %158, i32 0, i32 %160, i32 6)
%162 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %161)
%163 = bitcast [5 x i32]* %13 to i8*
store i32 5, i32* %4
%164 = getelementptr inbounds [5 x i32], [5 x i32]* %13, i64 0, i64 0
%165 = load i32, i32* %4
%166 = sub nsw i32 %165, 1
%167 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchLeftMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %164, i32 0, i32 %166, i32 3)
store i32 %167, i32* %2
%168 = getelementptr inbounds [5 x i32], [5 x i32]* %13, i64 0, i64 0
%169 = load i32, i32* %4
%170 = sub nsw i32 %169, 1
%171 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %168, i32 0, i32 %170, i32 3)
store i32 %171, i32* %3
%172 = load i32, i32* %2
%173 = load i32, i32* %3
%174 = call i32 (i32, i32, ...) bitcast (i32 (...)* @getNumOf to i32 (i32, i32, ...)*)(i32 %172, i32 %173)
store i32 %174, i32* %5
%175 = load i32, i32* %2
%176 = load i32, i32* %3
%177 = load i32, i32* %5
%178 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %175, i32 %176, i32 %177)
%179 = getelementptr inbounds [5 x i32], [5 x i32]* %13, i64 0, i64 0
%180 = load i32, i32* %4
%181 = sub nsw i32 %180, 1
%182 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %179, i32 0, i32 %181, i32 -1)
%183 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %182)
%184 = bitcast [8 x i32]* %14 to i8*
store i32 8, i32* %4
%185 = getelementptr inbounds [8 x i32], [8 x i32]* %14, i64 0, i64 0
%186 = load i32, i32* %4
%187 = sub nsw i32 %186, 1
%188 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchLeftMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %185, i32 0, i32 %187, i32 1)
store i32 %188, i32* %2
%189 = getelementptr inbounds [8 x i32], [8 x i32]* %14, i64 0, i64 0
%190 = load i32, i32* %4
%191 = sub nsw i32 %190, 1
%192 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %189, i32 0, i32 %191, i32 1)
store i32 %192, i32* %3
%193 = load i32, i32* %2
%194 = load i32, i32* %3
%195 = call i32 (i32, i32, ...) bitcast (i32 (...)* @getNumOf to i32 (i32, i32, ...)*)(i32 %193, i32 %194)
store i32 %195, i32* %5
%196 = load i32, i32* %2
%197 = load i32, i32* %3
%198 = load i32, i32* %5
%199 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %196, i32 %197, i32 %198)
%200 = getelementptr inbounds [8 x i32], [8 x i32]* %14, i64 0, i64 0
%201 = load i32, i32* %4
%202 = sub nsw i32 %201, 1
%203 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %200, i32 0, i32 %202, i32 -1)
%204 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %203)
%205 = bitcast [10 x i32]* %15 to i8*
store i32 10, i32* %4
%206 = getelementptr inbounds [10 x i32], [10 x i32]* %15, i64 0, i64 0
%207 = load i32, i32* %4
%208 = sub nsw i32 %207, 1
%209 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchLeftMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %206, i32 0, i32 %208, i32 8)
store i32 %209, i32* %2
%210 = getelementptr inbounds [10 x i32], [10 x i32]* %15, i64 0, i64 0
%211 = load i32, i32* %4
%212 = sub nsw i32 %211, 1
%213 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %210, i32 0, i32 %212, i32 8)
store i32 %213, i32* %3
%214 = load i32, i32* %2
%215 = load i32, i32* %3
%216 = call i32 (i32, i32, ...) bitcast (i32 (...)* @getNumOf to i32 (i32, i32, ...)*)(i32 %214, i32 %215)
store i32 %216, i32* %5
%217 = load i32, i32* %2
%218 = load i32, i32* %3
%219 = load i32, i32* %5
%220 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %217, i32 %218, i32 %219)
%221 = getelementptr inbounds [10 x i32], [10 x i32]* %15, i64 0, i64 0
%222 = load i32, i32* %4
%223 = sub nsw i32 %222, 1
%224 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %221, i32 0, i32 %223, i32 -1)
%225 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %224)
ret i32 0
}

LLVM IR (-O2):
@.str = [36 x i8] c"leftmost: %2d , rightmost: %2d[%d]\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
@__const.main.list3 = [3 x i32] [i32 1, i32 1, i32 1]
@__const.main.list4 = [4 x i32] [i32 1, i32 1, i32 1, i32 1]
@__const.main.list5 = [5 x i32] [i32 1, i32 1, i32 1, i32 1, i32 1]
@__const.main.list6 = [5 x i32] [i32 1, i32 2, i32 2, i32 3, i32 5]
@__const.main.list7 = [6 x i32] [i32 1, i32 2, i32 2, i32 2, i32 3, i32 5]
@__const.main.list8 = [5 x i32] [i32 1, i32 2, i32 3, i32 3, i32 6]
@__const.main.list9 = [8 x i32] [i32 1, i32 1, i32 1, i32 3, i32 4, i32 5, i32 6, i32 7]
@__const.main.list10 = [10 x i32] [i32 1, i32 2, i32 4, i32 6, i32 8, i32 8, i32 8, i32 8, i32 8, i32 8]
define i32 @main() {
%1 = alloca [1 x i32]
%2 = alloca i64
%3 = alloca [3 x i32]
%4 = alloca [4 x i32]
%5 = alloca [5 x i32]
%6 = alloca [5 x i32]
%7 = alloca [6 x i32]
%8 = alloca [5 x i32]
%9 = alloca [8 x i32]
%10 = alloca [10 x i32]
%11 = bitcast [1 x i32]* %1 to i8*
%12 = getelementptr inbounds [1 x i32], [1 x i32]* %1, i64 0, i64 0
store i32 1, i32* %12
%13 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchLeftMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %12, i32 0, i32 0, i32 1)
%14 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %12, i32 0, i32 0, i32 1)
%15 = call i32 (i32, i32, ...) bitcast (i32 (...)* @getNumOf to i32 (i32, i32, ...)*)(i32 %13, i32 %14)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %14, i32 %15)
%17 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %12, i32 0, i32 0, i32 0)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%19 = bitcast i64* %2 to i8*
store i64 4294967297, i64* %2
%20 = bitcast i64* %2 to i32*
%21 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchLeftMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %20, i32 0, i32 1, i32 1)
%22 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %20, i32 0, i32 1, i32 1)
%23 = call i32 (i32, i32, ...) bitcast (i32 (...)* @getNumOf to i32 (i32, i32, ...)*)(i32 %21, i32 %22)
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %21, i32 %22, i32 %23)
%25 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %20, i32 0, i32 1, i32 0)
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %25)
%27 = bitcast [3 x i32]* %3 to i8*
%28 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%29 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchLeftMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %28, i32 0, i32 2, i32 1)
%30 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %28, i32 0, i32 2, i32 1)
%31 = call i32 (i32, i32, ...) bitcast (i32 (...)* @getNumOf to i32 (i32, i32, ...)*)(i32 %29, i32 %30)
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %29, i32 %30, i32 %31)
%33 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %28, i32 0, i32 2, i32 0)
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %33)
%35 = bitcast [4 x i32]* %4 to i8*
%36 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 0
%37 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchLeftMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %36, i32 0, i32 3, i32 1)
%38 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %36, i32 0, i32 3, i32 1)
%39 = call i32 (i32, i32, ...) bitcast (i32 (...)* @getNumOf to i32 (i32, i32, ...)*)(i32 %37, i32 %38)
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %37, i32 %38, i32 %39)
%41 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %36, i32 0, i32 3, i32 0)
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %41)
%43 = bitcast [5 x i32]* %5 to i8*
%44 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 0
%45 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchLeftMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %44, i32 0, i32 4, i32 1)
%46 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %44, i32 0, i32 4, i32 1)
%47 = call i32 (i32, i32, ...) bitcast (i32 (...)* @getNumOf to i32 (i32, i32, ...)*)(i32 %45, i32 %46)
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %45, i32 %46, i32 %47)
%49 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %44, i32 0, i32 4, i32 0)
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %49)
%51 = bitcast [5 x i32]* %6 to i8*
%52 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 0
%53 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchLeftMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %52, i32 0, i32 4, i32 2)
%54 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %52, i32 0, i32 4, i32 2)
%55 = call i32 (i32, i32, ...) bitcast (i32 (...)* @getNumOf to i32 (i32, i32, ...)*)(i32 %53, i32 %54)
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %53, i32 %54, i32 %55)
%57 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %52, i32 0, i32 4, i32 6)
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %57)
%59 = bitcast [6 x i32]* %7 to i8*
%60 = getelementptr inbounds [6 x i32], [6 x i32]* %7, i64 0, i64 0
%61 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchLeftMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %60, i32 0, i32 5, i32 2)
%62 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %60, i32 0, i32 5, i32 2)
%63 = call i32 (i32, i32, ...) bitcast (i32 (...)* @getNumOf to i32 (i32, i32, ...)*)(i32 %61, i32 %62)
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %61, i32 %62, i32 %63)
%65 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %60, i32 0, i32 5, i32 6)
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %65)
%67 = bitcast [5 x i32]* %8 to i8*
%68 = getelementptr inbounds [5 x i32], [5 x i32]* %8, i64 0, i64 0
%69 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchLeftMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %68, i32 0, i32 4, i32 3)
%70 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %68, i32 0, i32 4, i32 3)
%71 = call i32 (i32, i32, ...) bitcast (i32 (...)* @getNumOf to i32 (i32, i32, ...)*)(i32 %69, i32 %70)
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %69, i32 %70, i32 %71)
%73 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %68, i32 0, i32 4, i32 -1)
%74 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %73)
%75 = bitcast [8 x i32]* %9 to i8*
%76 = getelementptr inbounds [8 x i32], [8 x i32]* %9, i64 0, i64 0
%77 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchLeftMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %76, i32 0, i32 7, i32 1)
%78 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %76, i32 0, i32 7, i32 1)
%79 = call i32 (i32, i32, ...) bitcast (i32 (...)* @getNumOf to i32 (i32, i32, ...)*)(i32 %77, i32 %78)
%80 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %77, i32 %78, i32 %79)
%81 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %76, i32 0, i32 7, i32 -1)
%82 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %81)
%83 = bitcast [10 x i32]* %10 to i8*
%84 = getelementptr inbounds [10 x i32], [10 x i32]* %10, i64 0, i64 0
%85 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchLeftMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %84, i32 0, i32 9, i32 8)
%86 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %84, i32 0, i32 9, i32 8)
%87 = call i32 (i32, i32, ...) bitcast (i32 (...)* @getNumOf to i32 (i32, i32, ...)*)(i32 %85, i32 %86)
%88 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %85, i32 %86, i32 %87)
%89 = call i32 (i32*, i32, i32, i32, ...) bitcast (i32 (...)* @searchRightMost to i32 (i32*, i32, i32, i32, ...)*)(i32* %84, i32 0, i32 9, i32 -1)
%90 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %89)
ret i32 0
}