// File: /workspace/github_c_makefile_star2_O0/theck01[P]offbrand_lib/src/tests/obstring_test.c
// Function: main
int main (){

  obstring *str1, *str2, *str3, *null_str;
  obvector *tokens;
  const char *contents;

  str1 = obstring_new("Hello, World!");

  /* Test obstring_new and obstring_cstring */
  contents = obstring_cstring(str1);
  assert(strcmp(contents, "Hello, World!") == 0);


  /* Test obstring_copy_substring and obstring_length */
  str2 = obstring_copy_substring(str1, 0, 5);
  contents = obstring_cstring(str2);
  assert(strcmp(contents, "Hello") == 0);

  ob_release((obj *)str2);

  str2 = obstring_copy_substring(str1, -15, 7);
  contents = obstring_cstring(str2);
  assert(strcmp(contents, "Hello") == 0);

  ob_release((obj *)str2);

  str2 = obstring_copy_substring(str1, 0, obstring_length(str1));
  contents = obstring_cstring(str2);
  assert(strcmp(contents, "Hello, World!") == 0);

  ob_release((obj *)str2);

  null_str = obstring_copy_substring(str1, 20, 2);
  assert(obstring_length(null_str) == 0);

  /* Test obstring_char_at_index */
  assert(obstring_char_at_index(str1, 0) == 'H');
  assert(obstring_char_at_index(str1, -5) == 'o');
  assert(obstring_char_at_index(str1, -20) == '\0');
  assert(obstring_char_at_index(str1, 20) == '\0');
  assert(obstring_char_at_index(null_str, 0) == '\0');

  /* Test String Concatenation */
  str2 = obstring_new(" And hello again!");
  str3 = obstring_concat(str1, str2);
  contents = obstring_cstring(str3);
  assert(strcmp(contents, "Hello, World! And hello again!") == 0);

  ob_release((obj *)str2);

  str2 = obstring_concat(null_str, str1);
  contents = obstring_cstring(str2);
  assert(strcmp(contents, "Hello, World!") == 0);

  /* Test String Comparision */
  assert(ob_compare((obj *)str1, (obj *)str2) == OB_EQUAL_TO);
  assert(ob_compare((obj *)str1, (obj *)str3) == OB_LESS_THAN);
  assert(ob_compare((obj *)str1, (obj *)null_str) == OB_GREATER_THAN);

  ob_release((obj *)str2);
  ob_release((obj *)str3);

  /* Test String Splits */
  str2 = obstring_new("Testing string split   into#!many");
  tokens = obstring_split(str2, " ");
  assert(strcmp(obstring_cstring((obstring *)obvector_obj_at_index(tokens, 0)), "Testing")
         == 0);
  assert(strcmp(obstring_cstring((obstring *)obvector_obj_at_index(tokens, 3)),
                           "into#!many") == 0);

  ob_release((obj *)tokens);

  tokens = obstring_split(str2, "#!");
  assert(strcmp(obstring_cstring((obstring *)obvector_obj_at_index(tokens, 0)),
                           "Testing string split   into") == 0);
  assert(strcmp(obstring_cstring((obstring *)obvector_obj_at_index(tokens, 1)), "many")
         == 0);

  ob_release((obj *)tokens);

  /* Test String Search */

  assert(obstring_find_substring(str2, "Testing") != 0);
  assert(obstring_find_substring(str2, "#!many") != 0);
  assert(obstring_find_substring(str2, "Hello World") == 0);

  /* Test Regex Match */
  str3 = obstring_match_regex(str1, "[Hh]el{1,2}.");
  assert(strcmp(obstring_cstring(str3), "Hello") == 0);
  ob_release((obj *)str3);

  str3 = obstring_match_regex(str2, " *into[#!]{2,2}.*$");
  assert(strcmp(obstring_cstring(str3), "   into#!many") == 0);

  ob_release((obj *)str3);
  ob_release((obj *)str2);
  ob_release((obj *)str1);
  ob_release((obj *)null_str);

  /* TESTS COMPLETE */
  printf("obstring: TESTS PASSED\n");

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl $0x0, -0x4(%rbp)
leaq 0x2d9e(%rip), %rdi      # 0x4004
callq 0x19c0
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1f00
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
leaq 0x2d7d(%rip), %rsi      # 0x4004
callq 0x10d0
cmpl $0x0, %eax
jne 0x1293
jmp 0x12b2
leaq 0x2d78(%rip), %rdi      # 0x4012
leaq 0x2d98(%rip), %rsi      # 0x4039
movl $0x17, %edx
leaq 0x2da6(%rip), %rcx      # 0x4053
callq 0x10a0
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x5, %edx
callq 0x1b50
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x1f00
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
leaq 0x2d7e(%rip), %rsi      # 0x405e
callq 0x10d0
cmpl $0x0, %eax
jne 0x12ec
jmp 0x130b
leaq 0x2d71(%rip), %rdi      # 0x4064
leaq 0x2d3f(%rip), %rsi      # 0x4039
movl $0x1d, %edx
leaq 0x2d4d(%rip), %rcx      # 0x4053
callq 0x10a0
movq -0x18(%rbp), %rdi
callq 0x3ab0
movq -0x10(%rbp), %rdi
movq $-0xf, %rsi
movl $0x7, %edx
callq 0x1b50
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x1f00
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
leaq 0x2d19(%rip), %rsi      # 0x405e
callq 0x10d0
cmpl $0x0, %eax
jne 0x1351
jmp 0x1370
leaq 0x2d0c(%rip), %rdi      # 0x4064
leaq 0x2cda(%rip), %rsi      # 0x4039
movl $0x23, %edx
leaq 0x2ce8(%rip), %rcx      # 0x4053
callq 0x10a0
movq -0x18(%rbp), %rdi
callq 0x3ab0
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1cd0
movq -0x40(%rbp), %rdi
movl %eax, %edx
xorl %eax, %eax
movl %eax, %esi
callq 0x1b50
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x1f00
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
leaq 0x2c4f(%rip), %rsi      # 0x4004
callq 0x10d0
cmpl $0x0, %eax
jne 0x13c1
jmp 0x13e0
leaq 0x2c4a(%rip), %rdi      # 0x4012
leaq 0x2c6a(%rip), %rsi      # 0x4039
movl $0x29, %edx
leaq 0x2c78(%rip), %rcx      # 0x4053
callq 0x10a0
movq -0x18(%rbp), %rdi
callq 0x3ab0
movq -0x10(%rbp), %rdi
movl $0x14, %esi
movl $0x2, %edx
callq 0x1b50
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0x1cd0
cmpl $0x0, %eax
jne 0x1410
jmp 0x142f
leaq 0x2c6c(%rip), %rdi      # 0x4083
leaq 0x2c1b(%rip), %rsi      # 0x4039
movl $0x2e, %edx
leaq 0x2c29(%rip), %rcx      # 0x4053
callq 0x10a0
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1d20
movsbl %al, %eax
cmpl $0x48, %eax
jne 0x1446
jmp 0x1465
leaq 0x2c55(%rip), %rdi      # 0x40a2
leaq 0x2be5(%rip), %rsi      # 0x4039
movl $0x31, %edx
leaq 0x2bf3(%rip), %rcx      # 0x4053
callq 0x10a0
movq -0x10(%rbp), %rdi
movq $-0x5, %rsi
callq 0x1d20
movsbl %al, %eax
cmpl $0x6f, %eax
jne 0x147f
jmp 0x149e
leaq 0x2c43(%rip), %rdi      # 0x40c9
leaq 0x2bac(%rip), %rsi      # 0x4039
movl $0x32, %edx
leaq 0x2bba(%rip), %rcx      # 0x4053
callq 0x10a0
movq -0x10(%rbp), %rdi
movq $-0x14, %rsi
callq 0x1d20
movsbl %al, %eax
cmpl $0x0, %eax
jne 0x14b8
jmp 0x14d7
leaq 0x2c32(%rip), %rdi      # 0x40f1
leaq 0x2b73(%rip), %rsi      # 0x4039
movl $0x33, %edx
leaq 0x2b81(%rip), %rcx      # 0x4053
callq 0x10a0
movq -0x10(%rbp), %rdi
movl $0x14, %esi
callq 0x1d20
movsbl %al, %eax
cmpl $0x0, %eax
jne 0x14ef
jmp 0x150e
leaq 0x2c25(%rip), %rdi      # 0x411b
leaq 0x2b3c(%rip), %rsi      # 0x4039
movl $0x34, %edx
leaq 0x2b4a(%rip), %rcx      # 0x4053
callq 0x10a0
movq -0x28(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1d20
movsbl %al, %eax
cmpl $0x0, %eax
jne 0x1525
jmp 0x1544
leaq 0x2c18(%rip), %rdi      # 0x4144
leaq 0x2b06(%rip), %rsi      # 0x4039
movl $0x35, %edx
leaq 0x2b14(%rip), %rcx      # 0x4053
callq 0x10a0
leaq 0x2c32(%rip), %rdi      # 0x417d
callq 0x19c0
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x1db0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x1f00
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
leaq 0x2bf3(%rip), %rsi      # 0x4170
callq 0x10d0
cmpl $0x0, %eax
jne 0x1589
jmp 0x15a8
leaq 0x2bff(%rip), %rdi      # 0x418f
leaq 0x2aa2(%rip), %rsi      # 0x4039
movl $0x3b, %edx
leaq 0x2ab0(%rip), %rcx      # 0x4053
callq 0x10a0
movq -0x18(%rbp), %rdi
callq 0x3ab0
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x1db0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x1f00
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
leaq 0x2a2a(%rip), %rsi      # 0x4004
callq 0x10d0
cmpl $0x0, %eax
jne 0x15e6
jmp 0x1605
leaq 0x2a25(%rip), %rdi      # 0x4012
leaq 0x2a45(%rip), %rsi      # 0x4039
movl $0x41, %edx
leaq 0x2a53(%rip), %rcx      # 0x4053
callq 0x10a0
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x3990
movsbl %al, %eax
cmpl $0x0, %eax
jne 0x161c
jmp 0x163b
leaq 0x2ba4(%rip), %rdi      # 0x41c7
leaq 0x2a0f(%rip), %rsi      # 0x4039
movl $0x44, %edx
leaq 0x2a1d(%rip), %rcx      # 0x4053
callq 0x10a0
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x3990
movsbl %al, %eax
cmpl $-0x1, %eax
jne 0x1652
jmp 0x1671
leaq 0x2ba2(%rip), %rdi      # 0x41fb
leaq 0x29d9(%rip), %rsi      # 0x4039
movl $0x45, %edx
leaq 0x29e7(%rip), %rcx      # 0x4053
callq 0x10a0
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x3990
movsbl %al, %eax
cmpl $0x1, %eax
jne 0x1688
jmp 0x16a7
leaq 0x2ba1(%rip), %rdi      # 0x4230
leaq 0x29a3(%rip), %rsi      # 0x4039
movl $0x46, %edx
leaq 0x29b1(%rip), %rcx      # 0x4053
callq 0x10a0
movq -0x18(%rbp), %rdi
callq 0x3ab0
movq -0x20(%rbp), %rdi
callq 0x3ab0
leaq 0x2bac(%rip), %rdi      # 0x426c
callq 0x19c0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x2bba(%rip), %rsi      # 0x428e
callq 0x1f50
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2c90
movq %rax, %rdi
callq 0x1f00
movq %rax, %rdi
leaq 0x2b94(%rip), %rsi      # 0x4290
callq 0x10d0
cmpl $0x0, %eax
jne 0x1708
jmp 0x1727
leaq 0x2b89(%rip), %rdi      # 0x4298
leaq 0x2923(%rip), %rsi      # 0x4039
movl $0x4f, %edx
leaq 0x2931(%rip), %rcx      # 0x4053
callq 0x10a0
movq -0x30(%rbp), %rdi
movl $0x3, %esi
callq 0x2c90
movq %rax, %rdi
callq 0x1f00
movq %rax, %rdi
leaq 0x2b3c(%rip), %rsi      # 0x4283
callq 0x10d0
cmpl $0x0, %eax
jne 0x1753
jmp 0x1772
leaq 0x2b95(%rip), %rdi      # 0x42ef
leaq 0x28d8(%rip), %rsi      # 0x4039
movl $0x51, %edx
leaq 0x28e6(%rip), %rcx      # 0x4053
callq 0x10a0
movq -0x30(%rbp), %rdi
callq 0x3ab0
movq -0x18(%rbp), %rdi
leaq 0x2bc3(%rip), %rsi      # 0x4349
callq 0x1f50
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2c90
movq %rax, %rdi
callq 0x1f00
movq %rax, %rdi
leaq 0x2b9e(%rip), %rsi      # 0x434c
callq 0x10d0
cmpl $0x0, %eax
jne 0x17ba
jmp 0x17d9
leaq 0x2ba7(%rip), %rdi      # 0x4368
leaq 0x2871(%rip), %rsi      # 0x4039
movl $0x57, %edx
leaq 0x287f(%rip), %rcx      # 0x4053
callq 0x10a0
movq -0x30(%rbp), %rdi
movl $0x1, %esi
callq 0x2c90
movq %rax, %rdi
callq 0x1f00
movq %rax, %rdi
leaq 0x2a90(%rip), %rsi      # 0x4289
callq 0x10d0
cmpl $0x0, %eax
jne 0x1805
jmp 0x1824
leaq 0x2bc7(%rip), %rdi      # 0x43d3
leaq 0x2826(%rip), %rsi      # 0x4039
movl $0x59, %edx
leaq 0x2834(%rip), %rcx      # 0x4053
callq 0x10a0
movq -0x30(%rbp), %rdi
callq 0x3ab0
movq -0x18(%rbp), %rdi
leaq 0x2a58(%rip), %rsi      # 0x4290
callq 0x2140
movzbl %al, %eax
cmpl $0x0, %eax
je 0x1847
jmp 0x1866
leaq 0x2bd9(%rip), %rdi      # 0x4427
leaq 0x27e4(%rip), %rsi      # 0x4039
movl $0x5f, %edx
leaq 0x27f2(%rip), %rcx      # 0x4053
callq 0x10a0
movq -0x18(%rbp), %rdi
leaq 0x2a16(%rip), %rsi      # 0x4287
callq 0x2140
movzbl %al, %eax
cmpl $0x0, %eax
je 0x1880
jmp 0x189f
leaq 0x2bce(%rip), %rdi      # 0x4455
leaq 0x27ab(%rip), %rsi      # 0x4039
movl $0x60, %edx
leaq 0x27b9(%rip), %rcx      # 0x4053
callq 0x10a0
movq -0x18(%rbp), %rdi
leaq 0x2bd8(%rip), %rsi      # 0x4482
callq 0x2140
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x18b9
jmp 0x18d8
leaq 0x2bce(%rip), %rdi      # 0x448e
leaq 0x2772(%rip), %rsi      # 0x4039
movl $0x61, %edx
leaq 0x2780(%rip), %rcx      # 0x4053
callq 0x10a0
movq -0x10(%rbp), %rdi
leaq 0x2bdd(%rip), %rsi      # 0x44c0
callq 0x2220
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x1f00
movq %rax, %rdi
leaq 0x275f(%rip), %rsi      # 0x405e
callq 0x10d0
cmpl $0x0, %eax
jne 0x190b
jmp 0x192a
leaq 0x2bbb(%rip), %rdi      # 0x44cd
leaq 0x2720(%rip), %rsi      # 0x4039
movl $0x65, %edx
leaq 0x272e(%rip), %rcx      # 0x4053
callq 0x10a0
movq -0x20(%rbp), %rdi
callq 0x3ab0
movq -0x18(%rbp), %rdi
leaq 0x2bbc(%rip), %rsi      # 0x44fa
callq 0x2220
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x1f00
movq %rax, %rdi
leaq 0x2926(%rip), %rsi      # 0x4280
callq 0x10d0
cmpl $0x0, %eax
jne 0x1966
jmp 0x1985
leaq 0x2ba0(%rip), %rdi      # 0x450d
leaq 0x26c5(%rip), %rsi      # 0x4039
movl $0x69, %edx
leaq 0x26d3(%rip), %rcx      # 0x4053
callq 0x10a0
movq -0x20(%rbp), %rdi
callq 0x3ab0
movq -0x18(%rbp), %rdi
callq 0x3ab0
movq -0x10(%rbp), %rdi
callq 0x3ab0
movq -0x28(%rbp), %rdi
callq 0x3ab0
leaq 0x2b92(%rip), %rdi      # 0x4542
movb $0x0, %al
callq 0x1090
xorl %eax, %eax
addq $0x40, %rsp
popq %rbp
retq
nop