// File: /workspace/github_c_makefile_star2_O0/hamsternz[P]emulate-risc-v/riscv.c
// Function: decode
static int decode(void) {
  int32_t broffset_12_12, broffset_11_11, broffset_10_05, broffset_04_01;
  int32_t jmpoffset_20_20, jmpoffset_19_12, jmpoffset_11_11, jmpoffset_10_01;
  int valid = 1;
  if((current_instr & 0x3) != 3) {
    valid = 0;
  }
  csrid   = (current_instr >> 20);
  rs1     = (current_instr >> 15) & 0x1f ;
  rs2     = (current_instr >> 20) & 0x1F;
  rd      = (current_instr >>  7) & 0x1f;
  uimm    = (current_instr >> 15) & 0x1f;
  shamt   = (current_instr >> 20) & 0x1f;
  upper20 = current_instr & 0xFFFFF000;
  imm12   = ((int32_t)current_instr) >> 20;
  upper7  = (current_instr >> 25) & 0x7F;
  func3   = (current_instr >> 12) & 0x7;

  jmpoffset_20_20 = (int32_t)(current_instr & 0x80000000)>>11;
  jmpoffset_19_12 = (current_instr & 0x000FF000);
  jmpoffset_11_11 = (current_instr & 0x00100000) >>  9;
  jmpoffset_10_01 = (current_instr & 0x7FE00000) >> 20;
  jmpoffset       = jmpoffset_20_20 | jmpoffset_19_12 | jmpoffset_11_11 | jmpoffset_10_01;

  broffset_12_12 = (int)(current_instr & 0x80000000) >> 19;
  broffset_11_11 = (current_instr & 0x00000080) << 4;
  broffset_10_05 = (current_instr & 0x7E000000) >> 20;
  broffset_04_01 = (current_instr & 0x00000F00) >> 7;
  broffset       = broffset_12_12 | broffset_11_11 | broffset_10_05 | broffset_04_01;

  imm12wr   =  current_instr; /* Note - becomes signed */
  imm12wr >>= 20;
  imm12wr  &= 0xFFFFFFE0;
  imm12wr  |= (current_instr >> 7)  & 0x1f;
  read_dispatched = 0;

  return valid;
}

// Assembly:
movl $0x1, -0x24(%rsp)
movl 0xeb72(%rip), %eax      # 0x12aa0
andl $0x3, %eax
cmpl $0x3, %eax
je 0x3f3e
movl $0x0, -0x24(%rsp)
movl 0xeb5c(%rip), %eax      # 0x12aa0
shrl $0x14, %eax
movl %eax, 0xeb83(%rip)      # 0x12ad0
movl 0xeb4d(%rip), %eax      # 0x12aa0
shrl $0xf, %eax
andl $0x1f, %eax
movb %al, 0xeb65(%rip)       # 0x12ac4
movl 0xeb3b(%rip), %eax      # 0x12aa0
shrl $0x14, %eax
andl $0x1f, %eax
movb %al, 0xeb5b(%rip)       # 0x12acc
movl 0xeb29(%rip), %eax      # 0x12aa0
shrl $0x7, %eax
andl $0x1f, %eax
movb %al, 0xeb2d(%rip)       # 0x12ab0
movl 0xeb17(%rip), %eax      # 0x12aa0
shrl $0xf, %eax
andl $0x1f, %eax
movl %eax, 0xeb3f(%rip)      # 0x12ad4
movl 0xeb05(%rip), %eax      # 0x12aa0
shrl $0x14, %eax
andl $0x1f, %eax
movl %eax, 0xeb39(%rip)      # 0x12ae0
movl 0xeaf3(%rip), %eax      # 0x12aa0
andl $0xfffff000, %eax       # imm = 0xFFFFF000
movl %eax, 0xeafc(%rip)      # 0x12ab4
movl 0xeae2(%rip), %eax      # 0x12aa0
sarl $0x14, %eax
movl %eax, 0xeb01(%rip)      # 0x12ac8
movl 0xead3(%rip), %eax      # 0x12aa0
shrl $0x19, %eax
andl $0x7f, %eax
movl %eax, 0xeb0f(%rip)      # 0x12ae8
movl 0xeac1(%rip), %eax      # 0x12aa0
shrl $0xc, %eax
andl $0x7, %eax
movb %al, 0xeb01(%rip)       # 0x12aec
movl 0xeaaf(%rip), %eax      # 0x12aa0
andl $0x80000000, %eax       # imm = 0x80000000
sarl $0xb, %eax
movl %eax, -0x14(%rsp)
movl 0xea9d(%rip), %eax      # 0x12aa0
andl $0xff000, %eax          # imm = 0xFF000
movl %eax, -0x18(%rsp)
movl 0xea8e(%rip), %eax      # 0x12aa0
andl $0x100000, %eax         # imm = 0x100000
shrl $0x9, %eax
movl %eax, -0x1c(%rsp)
movl 0xea7c(%rip), %eax      # 0x12aa0
andl $0x7fe00000, %eax       # imm = 0x7FE00000
shrl $0x14, %eax
movl %eax, -0x20(%rsp)
movl -0x14(%rsp), %eax
orl -0x18(%rsp), %eax
orl -0x1c(%rsp), %eax
orl -0x20(%rsp), %eax
movl %eax, 0xea7a(%rip)      # 0x12ac0
movl 0xea54(%rip), %eax      # 0x12aa0
andl $0x80000000, %eax       # imm = 0x80000000
sarl $0x13, %eax
movl %eax, -0x4(%rsp)
movl 0xea42(%rip), %eax      # 0x12aa0
andl $0x80, %eax
shll $0x4, %eax
movl %eax, -0x8(%rsp)
movl 0xea30(%rip), %eax      # 0x12aa0
andl $0x7e000000, %eax       # imm = 0x7E000000
shrl $0x14, %eax
movl %eax, -0xc(%rsp)
movl 0xea1e(%rip), %eax      # 0x12aa0
andl $0xf00, %eax            # imm = 0xF00
shrl $0x7, %eax
movl %eax, -0x10(%rsp)
movl -0x4(%rsp), %eax
orl -0x8(%rsp), %eax
orl -0xc(%rsp), %eax
orl -0x10(%rsp), %eax
movl %eax, 0xea18(%rip)      # 0x12abc
movl 0xe9f6(%rip), %eax      # 0x12aa0
movl %eax, 0xea28(%rip)      # 0x12ad8
movl 0xea22(%rip), %eax      # 0x12ad8
sarl $0x14, %eax
movl %eax, 0xea19(%rip)      # 0x12ad8
movl 0xea13(%rip), %eax      # 0x12ad8
andl $-0x20, %eax
movl %eax, 0xea0a(%rip)      # 0x12ad8
movl 0xe9cc(%rip), %eax      # 0x12aa0
shrl $0x7, %eax
andl $0x1f, %eax
orl 0xe9f8(%rip), %eax      # 0x12ad8
movl %eax, 0xe9f2(%rip)      # 0x12ad8
movb $0x0, 0xe9ef(%rip)      # 0x12adc
movl -0x24(%rsp), %eax
retq
nopw %cs:(%rax,%rax)
nopl (%rax)