// File: /workspace/github_c_makefile_star2_O0/kobolt[P]curses-collection/cavescroll/cavescroll.c
// Function: objects_move
static void objects_move(void)
{
  object_t *curr;
  action_t action;

  if (objects == NULL)
    return;

  for (curr = objects; curr != NULL; curr = curr->next) {
    if (curr->removed)
      continue;

    if (curr->type == GRAPHICS_ENEMY) {
      action = ACTION_NONE;
      switch (random() % 5) {
      case 0:
        action = ACTION_MOVE_DOWN;
        break;
      case 1:
        action = ACTION_MOVE_UP;
        break;
      case 2:
        action = ACTION_NONE;
        break;
      default:
        if (curr->y > player_y) {
          action = ACTION_MOVE_UP;
        } else if (curr->y < player_y) {
          action = ACTION_MOVE_DOWN;
        }
        break;
      }

      if (curr->x < 0 || curr->x > (CAVE_WIDTH - 1))
        continue;

      if (action == ACTION_MOVE_DOWN) {
        curr->y++;
        if (curr->y >= cave[curr->x].bottom)
          curr->y--;
      } else if (action == ACTION_MOVE_UP) {
        curr->y--;
        if (curr->y < cave[curr->x].top)
          curr->y++;
      }
    }

    if (curr->type == GRAPHICS_SHOT) {
      curr->x++;
      objects_col_detect();
      curr->x++;
    }
  }

  objects_col_detect();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
cmpq $0x0, 0x3900(%rip)      # 0x5380
jne 0x1a87
jmp 0x1c3c
movq 0x38f2(%rip), %rax      # 0x5380
movq %rax, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x1c37
movq -0x8(%rbp), %rax
cmpl $0x0, 0xc(%rax)
je 0x1aac
jmp 0x1c26
movq -0x8(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x40, %eax
jne 0x1bf9
movl $0x0, -0xc(%rbp)
callq 0x1100
movq %rax, -0x20(%rbp)
movabsq $0x6666666666666667, %rcx # imm = 0x6666666666666667
imulq %rcx
movq -0x20(%rbp), %rax
movq %rdx, %rcx
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq %rcx
addq %rdx, %rcx
leaq (%rcx,%rcx,4), %rcx
subq %rcx, %rax
movq %rax, -0x18(%rbp)
je 0x1b14
jmp 0x1afc
movq -0x18(%rbp), %rax
subq $0x1, %rax
je 0x1b1d
jmp 0x1b08
movq -0x18(%rbp), %rax
subq $0x2, %rax
je 0x1b26
jmp 0x1b2f
movl $0x2, -0xc(%rbp)
jmp 0x1b61
movl $0x1, -0xc(%rbp)
jmp 0x1b61
movl $0x0, -0xc(%rbp)
jmp 0x1b61
movq -0x8(%rbp), %rax
movl 0x8(%rax), %eax
cmpl 0x35b4(%rip), %eax      # 0x50f0
jle 0x1b47
movl $0x1, -0xc(%rbp)
jmp 0x1b5f
movq -0x8(%rbp), %rax
movl 0x8(%rax), %eax
cmpl 0x359c(%rip), %eax      # 0x50f0
jge 0x1b5d
movl $0x2, -0xc(%rbp)
jmp 0x1b5f
jmp 0x1b61
movq -0x8(%rbp), %rax
cmpl $0x0, 0x4(%rax)
jl 0x1b75
movq -0x8(%rbp), %rax
cmpl $0x4f, 0x4(%rax)
jle 0x1b7a
jmp 0x1c26
cmpl $0x2, -0xc(%rbp)
jne 0x1bb8
movq -0x8(%rbp), %rax
movl 0x8(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x8(%rax)
movq -0x8(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x8(%rbp), %rcx
movslq 0x4(%rcx), %rdx
leaq 0x355d(%rip), %rcx      # 0x5100
cmpl 0x4(%rcx,%rdx,8), %eax
jl 0x1bb6
movq -0x8(%rbp), %rax
movl 0x8(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x8(%rax)
jmp 0x1bf7
cmpl $0x1, -0xc(%rbp)
jne 0x1bf5
movq -0x8(%rbp), %rax
movl 0x8(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x8(%rax)
movq -0x8(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x8(%rbp), %rcx
movslq 0x4(%rcx), %rdx
leaq 0x351f(%rip), %rcx      # 0x5100
cmpl (%rcx,%rdx,8), %eax
jge 0x1bf3
movq -0x8(%rbp), %rax
movl 0x8(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x8(%rax)
jmp 0x1bf5
jmp 0x1bf7
jmp 0x1bf9
movq -0x8(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x1c24
movq -0x8(%rbp), %rax
movl 0x4(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x4(%rax)
callq 0x1de0
movq -0x8(%rbp), %rax
movl 0x4(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x4(%rax)
jmp 0x1c26
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0x1a92
callq 0x1de0
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)