// File: /workspace/github_c_makefile_star2_O2/mabdi[P]bunney/bunny-main.c
// Function: valset_rand_walk
static _u8 valset_rand_walk(struct bunny_traceitem* t, _u8 size) {
  _u32 val;
  _s32 pos;

  if (reg_execs > cycle_branch_limit && (zero_range || reg_params > cycle_value_limit)) return 1;

  for (val=0;val < rand_val_walks; val++) 
    for (pos=0;pos < (_s32)t->fuzzable - size ;pos++) {
      struct bunny_traceitem* n;
      _s32 rval = 0;
      _u8  rne = 0;

      flow_command(FLOW_RESET,0,0,0);

      switch (size) {
        case 1: flow_command(FLOW_SETBYTE , pos, (rval = (_s8)random()) , 0); break;
        case 2: flow_command(FLOW_SETWORD , pos, (rval = (_s16)random()), 0); break;
        case 4: flow_command(FLOW_SETDWORD, pos, (rval = R32()), 0); break;
      }

      n = run_program();

      if (check_crash(n)) {
        outf("setting offset #%u to %d (%s).\n\n",pos, rval,
             (size == 1) ? "byte" : (size == 2) ? "word" : "dword" );
        if (keep_fault) continue;
        return 1;
      }

      if (reg_execs > cycle_branch_limit) epath_ign++;
        else if ((rne=register_new_exec(n,1))) {
        outf("      Triggered by setting offset #%u to %d (%s).\n",pos, rval,
             (size == 1) ? "byte" : (size == 2) ? "word" : "dword" );
        reg_execs++;
        if (reg_execs > cycle_branch_limit) 
          outf("      >>> Per-cycle call path limit of %u exceeded (use -N to adjust).\n",cycle_branch_limit);
      }

      if (reg_params > cycle_value_limit) ppath_ign++;
        else if (register_new_param(n,pos,size,1,rne)) {
          outf("      Triggered by setting offset #%u to %d (%s).\n",pos, rval,
               (size == 1) ? "byte" : (size == 2) ? "word" : "dword" );
          reg_params++;
          if (reg_params > cycle_value_limit) 
            outf("      >>> Per-cycle function parameter limit of %u exceeded (use -P to adjust).\n",cycle_value_limit);
        }
    
      /* Context not saved */
      if (!rne) discard_context(n,1);
    
    }

  return 0;
  
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, %r14d
movq %rdi, 0x10(%rsp)
movl 0x742d(%rip), %eax      # 0x10358
cmpl 0x72f7(%rip), %eax      # 0x10228
jbe 0x8f55
movb $0x1, %r12b
cmpb $0x0, 0x7358(%rip)      # 0x10295
jne 0x91fd
movl 0x7413(%rip), %eax      # 0x1035c
cmpl 0x72dd(%rip), %eax      # 0x1022c
ja 0x91fd
movzbl %r14b, %ebp
cmpb $0x2, %bpl
leaq 0x4362(%rip), %rax      # 0xd2c6
leaq 0x435a(%rip), %rcx      # 0xd2c5
cmoveq %rax, %rcx
cmpb $0x1, %bpl
leaq 0x4346(%rip), %r15      # 0xd2c0
cmovneq %rcx, %r15
xorl %eax, %eax
movl %r14d, 0xc(%rsp)
xorl %r12d, %r12d
cmpl 0x728e(%rip), %eax      # 0x1021c
jae 0x91fd
movl %eax, 0x8(%rsp)
movq 0x10(%rsp), %rax
movl 0x4(%rax), %eax
subl %ebp, %eax
cmpl %eax, %r12d
jge 0x91ef
xorl %r13d, %r13d
pushq $0x2
popq %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x713e
cmpb $0x4, %r14b
je 0x8fe6
cmpl $0x2, %ebp
je 0x8fd9
cmpl $0x1, %ebp
jne 0x900c
callq 0x2110
movsbl %al, %r13d
pushq $0x65
jmp 0x8ffe
callq 0x2110
movswl %ax, %r13d
pushq $0x66
jmp 0x8ffe
callq 0x2110
movq %rax, %rbx
shll $0x10, %ebx
callq 0x2110
movq %rax, %r13
xorl %ebx, %r13d
pushq $0x67
popq %rdi
movl %r12d, %esi
movl %r13d, %edx
xorl %ecx, %ecx
callq 0x713e
callq 0x7471
movq %rax, %rbx
movq %rax, %rdi
callq 0x9e9c
testb %al, %al
je 0x906b
leaq 0x4278(%rip), %rbx      # 0xd29f
movq %rbx, %rdi
movl %r12d, %esi
movl %r13d, %edx
movq %r15, %rcx
xorl %eax, %eax
callq 0x2030
movq 0x7227(%rip), %rdi      # 0x10268
testq %rdi, %rdi
je 0x9059
movq %rbx, %rsi
movl %r12d, %edx
movl %r13d, %ecx
movq %r15, %r8
xorl %eax, %eax
callq 0x22d0
cmpb $0x0, 0x7232(%rip)      # 0x10292
jne 0x91e7
jmp 0x91fa
movl 0x72e7(%rip), %eax      # 0x10358
cmpl 0x71b1(%rip), %eax      # 0x10228
jbe 0x9084
incl 0x7271(%rip)            # 0x102f0
jmp 0x911e
movq %rbx, %rdi
pushq $0x1
popq %rsi
callq 0x82d0
testb %al, %al
je 0x911e
leaq 0x422d(%rip), %r14      # 0xd2cb
movq %r14, %rdi
movl %r12d, %esi
movl %r13d, %edx
movq %r15, %rcx
xorl %eax, %eax
callq 0x2030
movq 0x71b0(%rip), %rdi      # 0x10268
testq %rdi, %rdi
je 0x90d0
movq %r14, %rsi
movl %r12d, %edx
movl %r13d, %ecx
movq %r15, %r8
xorl %eax, %eax
callq 0x22d0
movl 0x7282(%rip), %eax      # 0x10358
incl %eax
movl %eax, 0x727a(%rip)      # 0x10358
movl 0x7144(%rip), %esi      # 0x10228
xorl %r14d, %r14d
cmpl %esi, %eax
jbe 0x9121
leaq 0x420c(%rip), %rdi      # 0xd2fe
xorl %eax, %eax
callq 0x2030
movq 0x7168(%rip), %rdi      # 0x10268
testq %rdi, %rdi
je 0x9121
movl 0x711d(%rip), %edx      # 0x10228
xorl %r14d, %r14d
leaq 0x41e9(%rip), %rsi      # 0xd2fe
xorl %eax, %eax
callq 0x22d0
jmp 0x9121
movb $0x1, %r14b
movl 0x7235(%rip), %eax      # 0x1035c
cmpl 0x70ff(%rip), %eax      # 0x1022c
jbe 0x913a
incl 0x71c3(%rip)            # 0x102f8
jmp 0x91d2
movq %rbx, %rdi
movl %r12d, %esi
movl %ebp, %edx
pushq $0x1
popq %rcx
callq 0x859d
testb %al, %al
je 0x91d2
leaq 0x4172(%rip), %rdi      # 0xd2cb
movl %r12d, %esi
movl %r13d, %edx
movq %r15, %rcx
xorl %eax, %eax
callq 0x2030
movq 0x70f8(%rip), %rdi      # 0x10268
testq %rdi, %rdi
je 0x918c
leaq 0x414f(%rip), %rsi      # 0xd2cb
movl %r12d, %edx
movl %r13d, %ecx
movq %r15, %r8
xorl %eax, %eax
callq 0x22d0
movl 0x71ca(%rip), %eax      # 0x1035c
incl %eax
movl %eax, 0x71c2(%rip)      # 0x1035c
movl 0x708c(%rip), %esi      # 0x1022c
cmpl %esi, %eax
jbe 0x91d2
leaq 0x419b(%rip), %rdi      # 0xd346
xorl %eax, %eax
callq 0x2030
movq 0x70af(%rip), %rdi      # 0x10268
testq %rdi, %rdi
je 0x91d2
movl 0x7068(%rip), %edx      # 0x1022c
leaq 0x417b(%rip), %rsi      # 0xd346
xorl %eax, %eax
callq 0x22d0
testb %r14b, %r14b
movl 0xc(%rsp), %r14d
je 0x91e7
movq %rbx, %rdi
pushq $0x1
popq %rsi
callq 0x8190
incl %r12d
jmp 0x8f98
movl 0x8(%rsp), %eax
incl %eax
jmp 0x8f85
movb $0x1, %r12b
movl %r12d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq