test_cases:
  -
    input:
      bytes: [ 0xa2, 0xac ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV64", "CS_MODE_RISCV_ZCMP", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "cm.mvsa01 s1, s0"

  -
    input:
      bytes: [ 0xe2, 0xac ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV64", "CS_MODE_RISCV_ZCMP", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "cm.mva01s s1, s0"

  -
    input:
      bytes: [ 0x42, 0xbe ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV64", "CS_MODE_RISCV_ZCMP", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "cm.popret {ra}, 16"

  -
    input:
      bytes: [ 0x46, 0xbe ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV64", "CS_MODE_RISCV_ZCMP", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "cm.popret {ra}, 32"

  -
    input:
      bytes: [ 0x5e, 0xbe ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV64", "CS_MODE_RISCV_ZCMP", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "cm.popret {ra, s0}, 64"

  -
    input:
      bytes: [ 0x62, 0xbe ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV64", "CS_MODE_RISCV_ZCMP", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "cm.popret {ra, s0-s1}, 32"

  -
    input:
      bytes: [ 0x72, 0xbe ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV64", "CS_MODE_RISCV_ZCMP", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "cm.popret {ra, s0-s2}, 32"

  -
    input:
      bytes: [ 0x86, 0xbe ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV64", "CS_MODE_RISCV_ZCMP", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "cm.popret {ra, s0-s3}, 64"

  -
    input:
      bytes: [ 0xa2, 0xbe ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV64", "CS_MODE_RISCV_ZCMP", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "cm.popret {ra, s0-s5}, 64"

  -
    input:
      bytes: [ 0xc2, 0xbe ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV64", "CS_MODE_RISCV_ZCMP", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "cm.popret {ra, s0-s7}, 80"

  -
    input:
      bytes: [ 0xf2, 0xbe ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV64", "CS_MODE_RISCV_ZCMP", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "cm.popret {ra, s0-s11}, 112"

  -
    input:
      bytes: [ 0x42, 0xbc ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV64", "CS_MODE_RISCV_ZCMP", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "cm.popretz {ra}, 16"

  -
    input:
      bytes: [ 0x46, 0xbc ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV64", "CS_MODE_RISCV_ZCMP", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "cm.popretz {ra}, 32"

  -
    input:
      bytes: [ 0x5e, 0xbc ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV64", "CS_MODE_RISCV_ZCMP", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "cm.popretz {ra, s0}, 64"

  -
    input:
      bytes: [ 0x62, 0xbc ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV64", "CS_MODE_RISCV_ZCMP", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "cm.popretz {ra, s0-s1}, 32"

  -
    input:
      bytes: [ 0x72, 0xbc ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV64", "CS_MODE_RISCV_ZCMP", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "cm.popretz {ra, s0-s2}, 32"

  -
    input:
      bytes: [ 0x86, 0xbc ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV64", "CS_MODE_RISCV_ZCMP", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "cm.popretz {ra, s0-s3}, 64"

  -
    input:
      bytes: [ 0xa2, 0xbc ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV64", "CS_MODE_RISCV_ZCMP", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "cm.popretz {ra, s0-s5}, 64"

  -
    input:
      bytes: [ 0xc2, 0xbc ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV64", "CS_MODE_RISCV_ZCMP", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "cm.popretz {ra, s0-s7}, 80"

  -
    input:
      bytes: [ 0xf2, 0xbc ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV64", "CS_MODE_RISCV_ZCMP", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "cm.popretz {ra, s0-s11}, 112"

  -
    input:
      bytes: [ 0x42, 0xba ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV64", "CS_MODE_RISCV_ZCMP", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "cm.pop {ra}, 16"

  -
    input:
      bytes: [ 0x46, 0xba ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV64", "CS_MODE_RISCV_ZCMP", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "cm.pop {ra}, 32"

  -
    input:
      bytes: [ 0x52, 0xba ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV64", "CS_MODE_RISCV_ZCMP", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "cm.pop {ra, s0}, 16"

  -
    input:
      bytes: [ 0x62, 0xba ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV64", "CS_MODE_RISCV_ZCMP", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "cm.pop {ra, s0-s1}, 32"

  -
    input:
      bytes: [ 0x72, 0xba ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV64", "CS_MODE_RISCV_ZCMP", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "cm.pop {ra, s0-s2}, 32"

  -
    input:
      bytes: [ 0xa2, 0xba ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV64", "CS_MODE_RISCV_ZCMP", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "cm.pop {ra, s0-s5}, 64"

  -
    input:
      bytes: [ 0xc2, 0xba ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV64", "CS_MODE_RISCV_ZCMP", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "cm.pop {ra, s0-s7}, 80"

  -
    input:
      bytes: [ 0xf2, 0xba ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV64", "CS_MODE_RISCV_ZCMP", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "cm.pop {ra, s0-s11}, 112"

  -
    input:
      bytes: [ 0x42, 0xb8 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV64", "CS_MODE_RISCV_ZCMP", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "cm.push {ra}, -16"

  -
    input:
      bytes: [ 0x56, 0xb8 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV64", "CS_MODE_RISCV_ZCMP", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "cm.push {ra, s0}, -32"

  -
    input:
      bytes: [ 0x62, 0xb8 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV64", "CS_MODE_RISCV_ZCMP", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "cm.push {ra, s0-s1}, -32"

  -
    input:
      bytes: [ 0x86, 0xb8 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV64", "CS_MODE_RISCV_ZCMP", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "cm.push {ra, s0-s3}, -64"

  -
    input:
      bytes: [ 0xc2, 0xb8 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV64", "CS_MODE_RISCV_ZCMP", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "cm.push {ra, s0-s7}, -80"

  -
    input:
      bytes: [ 0xf2, 0xb8 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV64", "CS_MODE_RISCV_ZCMP", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "cm.push {ra, s0-s11}, -112"

  -
    input:
      bytes: [ 0xf6, 0xb8 ]
      arch: "CS_ARCH_RISCV"
      options: [ "CS_MODE_RISCV64", "CS_MODE_RISCV_ZCMP", "CS_OPT_SYNTAX_NO_ALIAS_TEXT" ]
    expected:
      insns:
        -
          asm_text: "cm.push {ra, s0-s11}, -128"
