// File: /workspace/github_c_makefile_star2_O0/theck01[P]offbrand_lib/src/classes/obstring.c
// Function: obstring_split
obvector * obstring_split(const obstring *s, const char *delim){

  obvector *tokens;
  obstring *copy, *substring;
  char *marker;
  uint32_t i, delim_len, substrs;


  assert(s);
  assert(delim);

  tokens = obvector_new(1);
  copy = obstring_copy_substring(s, 0, s->length);
  delim_len = strlen(delim);
  marker = copy->str;

  /* overwrite all instance of delimeter with NUL character(s) */
  while(marker <= copy->str+(copy->length - delim_len)){
    if(strncmp(marker, delim, delim_len) == 0)
      for(i=0; i<delim_len; i++) *(marker++) = '\0';
    else
      marker++;
  }

  marker = copy->str;

  /* copy all found substrings into new obstrings for Vector */
  substrs=0;
  while(marker < copy->str+copy->length){
    substring = obstring_new(marker);
    marker += substring->length;
    obvector_store_at_index(tokens, (obj *)substring, substrs++);
    ob_release((obj *)substring); /* only tokens vector needs a reference */
    while(*marker == '\0' && marker < copy->str + copy->length) marker++;
  }

  ob_release((obj *)copy);
  return tokens;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x4939
jmp 0x4958
leaq 0x27e5(%rip), %rdi      # 0x7125
leaq 0x2feb(%rip), %rsi      # 0x7932
movl $0x79, %edx
leaq 0x3146(%rip), %rcx      # 0x7a99
callq 0x10a0
cmpq $0x0, -0x10(%rbp)
je 0x4961
jmp 0x4980
leaq 0x316a(%rip), %rdi      # 0x7ad2
leaq 0x2fc3(%rip), %rsi      # 0x7932
movl $0x7a, %edx
leaq 0x311e(%rip), %rcx      # 0x7a99
callq 0x10a0
movl $0x1, %edi
callq 0x5140
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0x10(%rax), %edx
xorl %eax, %eax
movl %eax, %esi
callq 0x4520
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1080
movl %eax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x20(%rbp), %rcx
movq 0x8(%rcx), %rcx
movq -0x20(%rbp), %rdx
movl 0x10(%rdx), %edx
subl -0x38(%rbp), %edx
movl %edx, %edx
addq %rdx, %rcx
cmpq %rcx, %rax
ja 0x4a31
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x38(%rbp), %eax
movl %eax, %edx
callq 0x1050
cmpl $0x0, %eax
jne 0x4a23
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x38(%rbp), %eax
jae 0x4a21
movq -0x30(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x30(%rbp)
movb $0x0, (%rax)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x49fc
jmp 0x4a2f
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x49be
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
movl $0x0, -0x3c(%rbp)
movq -0x30(%rbp), %rax
movq -0x20(%rbp), %rcx
movq 0x8(%rcx), %rcx
movq -0x20(%rbp), %rdx
movl 0x10(%rdx), %edx
addq %rdx, %rcx
cmpq %rcx, %rax
jae 0x4af5
movq -0x30(%rbp), %rdi
callq 0x4390
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movl 0x10(%rax), %ecx
movq -0x30(%rbp), %rax
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl -0x3c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x3c(%rbp)
movl %eax, %eax
movl %eax, %edx
callq 0x53a0
movq -0x28(%rbp), %rdi
callq 0x6480
movq -0x30(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x3d(%rbp)
jne 0x4ad9
movq -0x30(%rbp), %rax
movq -0x20(%rbp), %rcx
movq 0x8(%rcx), %rcx
movq -0x20(%rbp), %rdx
movl 0x10(%rdx), %edx
addq %rdx, %rcx
cmpq %rcx, %rax
setb %al
movb %al, -0x3d(%rbp)
movb -0x3d(%rbp), %al
testb $0x1, %al
jne 0x4ae2
jmp 0x4af0
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x4aa9
jmp 0x4a44
movq -0x20(%rbp), %rdi
callq 0x6480
movq -0x18(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)