test_cases:
  -
    input:
      bytes: [ 0x73, 0x23, 0x00, 0xc8 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t1, cycleh, zero"

  -
    input:
      bytes: [ 0xf3, 0x23, 0x00, 0xc8 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t2, cycleh, zero"

  -
    input:
      bytes: [ 0x73, 0x23, 0x10, 0xc8 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t1, timeh, zero"

  -
    input:
      bytes: [ 0xf3, 0x23, 0x10, 0xc8 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t2, timeh, zero"

  -
    input:
      bytes: [ 0x73, 0x23, 0x20, 0xc8 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t1, instreth, zero"

  -
    input:
      bytes: [ 0xf3, 0x23, 0x20, 0xc8 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t2, instreth, zero"

  -
    input:
      bytes: [ 0x73, 0x23, 0x30, 0xc8 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t1, hpmcounter3h, zero"

  -
    input:
      bytes: [ 0xf3, 0x23, 0x30, 0xc8 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t2, hpmcounter3h, zero"

  -
    input:
      bytes: [ 0x73, 0x23, 0x40, 0xc8 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t1, hpmcounter4h, zero"

  -
    input:
      bytes: [ 0xf3, 0x23, 0x40, 0xc8 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t2, hpmcounter4h, zero"

  -
    input:
      bytes: [ 0x73, 0x23, 0x50, 0xc8 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t1, hpmcounter5h, zero"

  -
    input:
      bytes: [ 0xf3, 0x23, 0x50, 0xc8 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t2, hpmcounter5h, zero"

  -
    input:
      bytes: [ 0x73, 0x23, 0x60, 0xc8 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t1, hpmcounter6h, zero"

  -
    input:
      bytes: [ 0xf3, 0x23, 0x60, 0xc8 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t2, hpmcounter6h, zero"

  -
    input:
      bytes: [ 0x73, 0x23, 0x70, 0xc8 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t1, hpmcounter7h, zero"

  -
    input:
      bytes: [ 0xf3, 0x23, 0x70, 0xc8 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t2, hpmcounter7h, zero"

  -
    input:
      bytes: [ 0x73, 0x23, 0x80, 0xc8 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t1, hpmcounter8h, zero"

  -
    input:
      bytes: [ 0xf3, 0x23, 0x80, 0xc8 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t2, hpmcounter8h, zero"

  -
    input:
      bytes: [ 0x73, 0x23, 0x90, 0xc8 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t1, hpmcounter9h, zero"

  -
    input:
      bytes: [ 0xf3, 0x23, 0x90, 0xc8 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t2, hpmcounter9h, zero"

  -
    input:
      bytes: [ 0x73, 0x23, 0xa0, 0xc8 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t1, hpmcounter10h, zero"

  -
    input:
      bytes: [ 0xf3, 0x23, 0xa0, 0xc8 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t2, hpmcounter10h, zero"

  -
    input:
      bytes: [ 0x73, 0x23, 0xb0, 0xc8 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t1, hpmcounter11h, zero"

  -
    input:
      bytes: [ 0xf3, 0x23, 0xb0, 0xc8 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t2, hpmcounter11h, zero"

  -
    input:
      bytes: [ 0x73, 0x23, 0xc0, 0xc8 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t1, hpmcounter12h, zero"

  -
    input:
      bytes: [ 0xf3, 0x23, 0xc0, 0xc8 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t2, hpmcounter12h, zero"

  -
    input:
      bytes: [ 0x73, 0x23, 0xd0, 0xc8 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t1, hpmcounter13h, zero"

  -
    input:
      bytes: [ 0xf3, 0x23, 0xd0, 0xc8 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t2, hpmcounter13h, zero"

  -
    input:
      bytes: [ 0x73, 0x23, 0xe0, 0xc8 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t1, hpmcounter14h, zero"

  -
    input:
      bytes: [ 0xf3, 0x23, 0xe0, 0xc8 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t2, hpmcounter14h, zero"

  -
    input:
      bytes: [ 0x73, 0x23, 0xf0, 0xc8 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t1, hpmcounter15h, zero"

  -
    input:
      bytes: [ 0xf3, 0x23, 0xf0, 0xc8 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t2, hpmcounter15h, zero"

  -
    input:
      bytes: [ 0x73, 0x23, 0x00, 0xc9 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t1, hpmcounter16h, zero"

  -
    input:
      bytes: [ 0xf3, 0x23, 0x00, 0xc9 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t2, hpmcounter16h, zero"

  -
    input:
      bytes: [ 0x73, 0x23, 0x10, 0xc9 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t1, hpmcounter17h, zero"

  -
    input:
      bytes: [ 0xf3, 0x23, 0x10, 0xc9 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t2, hpmcounter17h, zero"

  -
    input:
      bytes: [ 0x73, 0x23, 0x20, 0xc9 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t1, hpmcounter18h, zero"

  -
    input:
      bytes: [ 0xf3, 0x23, 0x20, 0xc9 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t2, hpmcounter18h, zero"

  -
    input:
      bytes: [ 0x73, 0x23, 0x30, 0xc9 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t1, hpmcounter19h, zero"

  -
    input:
      bytes: [ 0xf3, 0x23, 0x30, 0xc9 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t2, hpmcounter19h, zero"

  -
    input:
      bytes: [ 0x73, 0x23, 0x40, 0xc9 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t1, hpmcounter20h, zero"

  -
    input:
      bytes: [ 0xf3, 0x23, 0x40, 0xc9 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t2, hpmcounter20h, zero"

  -
    input:
      bytes: [ 0x73, 0x23, 0x50, 0xc9 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t1, hpmcounter21h, zero"

  -
    input:
      bytes: [ 0xf3, 0x23, 0x50, 0xc9 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t2, hpmcounter21h, zero"

  -
    input:
      bytes: [ 0x73, 0x23, 0x60, 0xc9 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t1, hpmcounter22h, zero"

  -
    input:
      bytes: [ 0xf3, 0x23, 0x60, 0xc9 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t2, hpmcounter22h, zero"

  -
    input:
      bytes: [ 0x73, 0x23, 0x70, 0xc9 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t1, hpmcounter23h, zero"

  -
    input:
      bytes: [ 0xf3, 0x23, 0x70, 0xc9 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t2, hpmcounter23h, zero"

  -
    input:
      bytes: [ 0x73, 0x23, 0x80, 0xc9 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t1, hpmcounter24h, zero"

  -
    input:
      bytes: [ 0xf3, 0x23, 0x80, 0xc9 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t2, hpmcounter24h, zero"

  -
    input:
      bytes: [ 0x73, 0x23, 0x90, 0xc9 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t1, hpmcounter25h, zero"

  -
    input:
      bytes: [ 0xf3, 0x23, 0x90, 0xc9 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t2, hpmcounter25h, zero"

  -
    input:
      bytes: [ 0x73, 0x23, 0xa0, 0xc9 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t1, hpmcounter26h, zero"

  -
    input:
      bytes: [ 0xf3, 0x23, 0xa0, 0xc9 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t2, hpmcounter26h, zero"

  -
    input:
      bytes: [ 0x73, 0x23, 0xb0, 0xc9 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t1, hpmcounter27h, zero"

  -
    input:
      bytes: [ 0xf3, 0x23, 0xb0, 0xc9 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t2, hpmcounter27h, zero"

  -
    input:
      bytes: [ 0x73, 0x23, 0xc0, 0xc9 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t1, hpmcounter28h, zero"

  -
    input:
      bytes: [ 0xf3, 0x23, 0xc0, 0xc9 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t2, hpmcounter28h, zero"

  -
    input:
      bytes: [ 0x73, 0x23, 0xd0, 0xc9 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t1, hpmcounter29h, zero"

  -
    input:
      bytes: [ 0xf3, 0x23, 0xd0, 0xc9 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t2, hpmcounter29h, zero"

  -
    input:
      bytes: [ 0x73, 0x23, 0xe0, 0xc9 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t1, hpmcounter30h, zero"

  -
    input:
      bytes: [ 0xf3, 0x23, 0xe0, 0xc9 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t2, hpmcounter30h, zero"

  -
    input:
      bytes: [ 0x73, 0x23, 0xf0, 0xc9 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t1, hpmcounter31h, zero"

  -
    input:
      bytes: [ 0xf3, 0x23, 0xf0, 0xc9 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV32", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "csrrs t2, hpmcounter31h, zero"
