// File: ChanTsune[P]py_string/./py_string.hpp
// Function: py::basic_string<char>::slice(py::null_allow::null_allow<int>, py::null_allow::null_allow<int>, py::null_allow::null_allow<int>) const
basic_string<_Elme> basic_string<_Elme>::slice(optional_int start,
                                               optional_int end,
                                               optional_int step) const
{
  if (step == 0)
    return "";
  if (!step.has_value() || step == 1)
    return this->slice(start, end);

  int start_i, step_i, len_i;
  basic_string<_Elme> str = "";
  std::tie(start_i, std::ignore, step_i, len_i)
    = util::adjust_index<int>(start, end, step, this->size());

  for (int i = 0; i < len_i; i += 1) {
    str.push_back(this->at(start_i));
    start_i += step_i;
  }
  return str;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0xc8(%rbp)
movq %rdi, %rax
movq %rax, -0xc0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movq %r8, -0x20(%rbp)
movq %rsi, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0xb8(%rbp)
movl $0x0, -0x2c(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
callq 0x2ae50
testb $0x1, %al
jne 0x7e85
jmp 0x7ed9
leaq -0x2d(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
callq 0x67f0
movq -0xc8(%rbp), %rdi
movq -0xd0(%rbp), %rdx
leaq 0x35413(%rip), %rsi     # 0x3d2bd
callq 0x7c70
jmp 0x7eb1
leaq -0x2d(%rbp), %rdi
callq 0x6510
jmp 0x80a6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x2d(%rbp), %rdi
callq 0x6510
jmp 0x80b6
leaq -0x20(%rbp), %rdi
callq 0x2ae70
movb %al, %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, -0xd1(%rbp)
jne 0x7ef3
jmp 0x7f0d
movl $0x1, -0x40(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x2ae50
movb %al, -0xd1(%rbp)
movb -0xd1(%rbp), %al
testb $0x1, %al
jne 0x7f19
jmp 0x7f49
movq -0xb8(%rbp), %rsi
movq -0xc8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rdx
movq -0x50(%rbp), %rcx
callq 0x2ae90
jmp 0x80a6
movb $0x0, -0x5d(%rbp)
leaq -0x5e(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
callq 0x67f0
movq -0xc8(%rbp), %rdi
movq -0xe0(%rbp), %rdx
leaq 0x3534b(%rip), %rsi     # 0x3d2bd
callq 0x7c70
jmp 0x7f79
leaq -0x5e(%rbp), %rdi
callq 0x6510
movq -0xb8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x88(%rbp)
callq 0x6350
movl %eax, %r8d
movq -0x78(%rbp), %rsi
movq -0x80(%rbp), %rdx
movq -0x88(%rbp), %rcx
leaq -0x70(%rbp), %rdi
callq 0x2af30
jmp 0x7fc6
leaq 0x35c04(%rip), %rdx     # 0x3dbd1
leaq -0xa8(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
leaq -0x54(%rbp), %rsi
leaq -0x58(%rbp), %rcx
leaq -0x5c(%rbp), %r8
callq 0x2b100
movq -0xe8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x2b150
jmp 0x7ffe
movl $0x0, -0xac(%rbp)
movl -0xac(%rbp), %eax
cmpl -0x5c(%rbp), %eax
jge 0x808e
movq -0xb8(%rbp), %rdi
movl -0x54(%rbp), %esi
callq 0x2b180
movq %rax, -0xf0(%rbp)
jmp 0x802b
movq -0xc8(%rbp), %rdi
movq -0xf0(%rbp), %rax
movsbl (%rax), %esi
callq 0x6400
jmp 0x8043
movl -0x58(%rbp), %eax
addl -0x54(%rbp), %eax
movl %eax, -0x54(%rbp)
movl -0xac(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xac(%rbp)
jmp 0x8008
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x5e(%rbp), %rdi
callq 0x6510
jmp 0x80b6
movq -0xc8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
callq 0x7db0
jmp 0x80b6
movb $0x1, -0x5d(%rbp)
testb $0x1, -0x5d(%rbp)
jne 0x80a4
movq -0xc8(%rbp), %rdi
callq 0x7db0
jmp 0x80a6
movq -0xc0(%rbp), %rax
addq $0xf0, %rsp
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x67e0
nop