// File: /workspace/github_c_makefile_star2_O0/felipelouza[P]lyndon-array/external/sacak-lyndon.c
// Function: getLengthOfLMS
int_t getLengthOfLMS(int_t *s, 
  int_t n, int level, int_t x, int cs) {
  if(x==n-1) return 1;  
  
  int_t dist=0, i=1;  
  while(1) {
    if(chr(x+i)<chr(x+i-1)) break;
    i++;
  }  
  while(1) {
    if(x+i>n-1 || chr(x+i)>chr(x+i-1)) break;
    if(x+i==n-1 || chr(x+i)<chr(x+i-1)) dist=i;
    i++;
  }
  
  return dist+1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movl -0x1c(%rbp), %eax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0xa3ee
movl $0x1, -0x4(%rbp)
jmp 0xa5c4
movl $0x0, -0x24(%rbp)
movl $0x1, -0x28(%rbp)
movslq -0x20(%rbp), %rax
cmpq $0x4, %rax
jne 0xa41b
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl -0x28(%rbp), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x2c(%rbp)
jmp 0xa42f
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl -0x28(%rbp), %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, -0x30(%rbp)
movslq -0x20(%rbp), %rax
cmpq $0x4, %rax
jne 0xa457
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl -0x28(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x34(%rbp)
jmp 0xa46e
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl -0x28(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x34(%rbp)
movl -0x30(%rbp), %eax
movl -0x34(%rbp), %ecx
cmpl %ecx, %eax
jge 0xa47a
jmp 0xa488
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0xa3fc
jmp 0xa48a
movl -0x1c(%rbp), %eax
addl -0x28(%rbp), %eax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jg 0xa516
movslq -0x20(%rbp), %rax
cmpq $0x4, %rax
jne 0xa4b9
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl -0x28(%rbp), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x38(%rbp)
jmp 0xa4cd
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl -0x28(%rbp), %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
movl %eax, -0x3c(%rbp)
movslq -0x20(%rbp), %rax
cmpq $0x4, %rax
jne 0xa4f5
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl -0x28(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x40(%rbp)
jmp 0xa50c
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl -0x28(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x40(%rbp)
movl -0x3c(%rbp), %eax
movl -0x40(%rbp), %ecx
cmpl %ecx, %eax
jle 0xa51b
jmp 0xa5bb
movl -0x1c(%rbp), %eax
addl -0x28(%rbp), %eax
movl -0x14(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
je 0xa5a7
movslq -0x20(%rbp), %rax
cmpq $0x4, %rax
jne 0xa54a
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl -0x28(%rbp), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x44(%rbp)
jmp 0xa55e
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl -0x28(%rbp), %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
movl %eax, -0x48(%rbp)
movslq -0x20(%rbp), %rax
cmpq $0x4, %rax
jne 0xa586
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl -0x28(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x4c(%rbp)
jmp 0xa59d
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl -0x28(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x4c(%rbp)
movl -0x48(%rbp), %eax
movl -0x4c(%rbp), %ecx
cmpl %ecx, %eax
jge 0xa5ad
movl -0x28(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0xa48a
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopl (%rax)