// c1891c btl__timer_06_expire_st1f_b7_hp0 ok 68 ms, 38 lines, 1123 chars

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* Battle timer channel 6 (table $C1B34B): per-unit countdown; bit $0040 of $B186 marks it pending.
    */

void btl__timer_06_expire_st1f_b7_hp0(void)

{
  byte bVar1;
  char cVar2;
  ushort uVar3;
  
  cVar2 = cRam7eb19e;
  if (cRam7eb19e == '\0') {
    cVar2 = DAT_7eaee6;
  }
  bVar1 = (&DAT_7eb182)[(byte)(cVar2 - 1)];
  uVar3 = (ushort)bVar1;
  (&DAT_7eb017)[uVar3] = 1;
  (&DAT_7eaf88)[uVar3] = (&DAT_7eb135)[uVar3];
  if ((btl__unit[bVar1].status[3] & 0x80) != 0) {
    (&DAT_7eaf88)[uVar3] = (byte)(&DAT_7eb135)[uVar3] >> 1;
  }
  if ((btl__unit[bVar1].status[1] & 0x20) != 0) {
    (&DAT_7eaf88)[uVar3] = (&DAT_7eb135)[uVar3] << 1;
  }
  _DAT_7eb1a5 = _DAT_7eb1a5 & 0x1fbf;
  cVar2 = (&DAT_7eb0a6)[uVar3];
  (&DAT_7eb0a6)[uVar3] = cVar2 + -1;
  if ((char)(cVar2 + -1) == '\0') {
    (&DAT_7eb0a6)[uVar3] = 10;
    btl__unit[bVar1].status[2] = btl__unit[bVar1].status[2] & 0x7f;
    (&DAT_7eb017)[uVar3] = 0;
    *(undefined1 *)&btl__unit[bVar1].hp = 0;
    *(undefined1 *)((int3)&btl__unit[bVar1].hp + 1) = 0;
  }
  return;
}
