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

  int i;
  obtest *test_obj, *a, *b;
  test_obj = obtest_new(1);
  a = obtest_new(3);
  b = obtest_new(3);

  /* ob_retain object, reference count should be 4 */
  for(i=0; i<3; i++){
    ob_retain((obj *)test_obj);
  }

  if(ob_reference_count((obj *)test_obj) != 4){
    fprintf(stderr, "obtest_test: reference count not incrememted correctly by "
                    "ob_retain\nTEST FAILED\n");
    exit(1);
  }

  /* ob_release object until test_obj is deallocated or until ob_release has been
   * called more than 4 times */
  i=0;
  while(++i < 5 && ob_release((obj *)test_obj) != NULL){}

  if(i<4){
    fprintf(stderr, "obtest_test: test_obj ob_released before reference count "
                    "reached zero, TEST FAILED\n");
    exit(1);
	}
  else if(i>4){
    fprintf(stderr, "obtest_test: test_obj not ob_released when reference count "
                    "reached zero\n");
    exit(1);
	}

  if(!ob_has_same_class((obj *)a, (obj *)b)){
    fprintf(stderr, "obtest_test: Two obtest objects were not of the same "
                    "class, TEST FAILED\n");
    exit(1);
  }

  if(!ob_has_class((obj *)a, "obtest")){
    fprintf(stderr, "obtest_test: An obtest object was not considered to be an "
                    "obtest object during check, TEST FAILED\n");
    exit(1);
  }

  ob_hash((obj *)a);

  printf("obtest: TEST PASSED\n");
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl $0x0, -0x4(%rbp)
movl $0x1, %edi
callq 0x1340
movq %rax, -0x10(%rbp)
movl $0x3, %edi
callq 0x1340
movq %rax, -0x18(%rbp)
movl $0x3, %edi
callq 0x1340
movq %rax, -0x20(%rbp)
movl $0x0, -0x8(%rbp)
cmpl $0x3, -0x8(%rbp)
jge 0x11fa
movq -0x10(%rbp), %rdi
callq 0x19d0
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x11e0
movq -0x10(%rbp), %rdi
callq 0x1a40
cmpl $0x4, %eax
je 0x122a
movq 0x2de9(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0xdeb(%rip), %rsi       # 0x2004
movb $0x0, %al
callq 0x1070
movl $0x1, %edi
callq 0x1090
movl $0x0, -0x8(%rbp)
movl -0x8(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x8(%rbp)
xorl %eax, %eax
cmpl $0x5, %ecx
movb %al, -0x21(%rbp)
jge 0x1257
movq -0x10(%rbp), %rdi
callq 0x1950
cmpq $0x0, %rax
setne %al
movb %al, -0x21(%rbp)
movb -0x21(%rbp), %al
testb $0x1, %al
jne 0x1260
jmp 0x1262
jmp 0x1231
cmpl $0x4, -0x8(%rbp)
jge 0x128a
movq 0x2d89(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0xddc(%rip), %rsi       # 0x2055
movb $0x0, %al
callq 0x1070
movl $0x1, %edi
callq 0x1090
cmpl $0x4, -0x8(%rbp)
jle 0x12b2
movq 0x2d61(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0xe08(%rip), %rsi       # 0x20a9
movb $0x0, %al
callq 0x1070
movl $0x1, %edi
callq 0x1090
jmp 0x12b4
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x1ae0
cmpb $0x0, %al
jne 0x12e7
movq 0x2d2c(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0xe1c(%rip), %rsi       # 0x20f2
movb $0x0, %al
callq 0x1070
movl $0x1, %edi
callq 0x1090
movq -0x18(%rbp), %rdi
leaq 0xe49(%rip), %rsi       # 0x213b
callq 0x1a70
cmpb $0x0, %al
jne 0x131d
movq 0x2cf6(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0xe36(%rip), %rsi       # 0x2142
movb $0x0, %al
callq 0x1070
movl $0x1, %edi
callq 0x1090
movq -0x18(%rbp), %rdi
callq 0x1790
leaq 0xe78(%rip), %rdi       # 0x21a5
movb $0x0, %al
callq 0x1040
xorl %eax, %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)