// File: jkingan[P]ladyheather/heathui.cpp
// Function: rpn_digits(int)
void rpn_digits(int sign)
{
int count;
int digits;

   // set output format digits

   count = IABS(rpn_format);
   if(isdigit(msg_field[3])) count = atoi(&msg_field[3]);
   else if(msg_field[3] == '-') count = atoi(&msg_field[3]);
   else if(msg_field[3] == '+') count = atoi(&msg_field[3]);
   count *= sign;

   if(hex_mode == 2) {
      digits = ISIZE;
      if(IABS(count) > ISIZE) {  // binary
         sprintf(out, "Decimal place count must be 0..%d", digits);
         rpn_error(out);
         return;
      }
   }
   else if(hex_mode == 8) {  // octal
      digits = (ISIZE+2) / 3;
      if(IABS(count) > digits) {
         sprintf(out, "Decimal place count must be 0..%d", digits);
         rpn_error(out);
         return;
      }
   }
   else if(hex_mode == 16) {  // hex
      digits = (ISIZE+3) / 4;
      if(IABS(count) > digits) {
         sprintf(out, "Decimal place count must be 0..%d", digits);
         rpn_error(out);
         return;
      }
   }
   else {  // decimal
      if(IABS(count) > 16) {
         sprintf(out, "Decimal place count must be 0..16");
         rpn_error(out);
         return;
      }
   }
   rpn_format = count;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x4(%rbp)
cmpl $0x0, 0x19889e(%rip)    # 0x1c9050
jge 0x307c1
xorl %eax, %eax
subl 0x198894(%rip), %eax    # 0x1c9050
movl %eax, -0x10(%rbp)
jmp 0x307ca
movl 0x198889(%rip), %eax    # 0x1c9050
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
movl %eax, -0x8(%rbp)
leaq 0x36a449(%rip), %rax    # 0x39ac20
movsbl 0x3(%rax), %edi
callq 0x9330
cmpl $0x0, %eax
je 0x307fa
leaq 0x36a434(%rip), %rdi    # 0x39ac20
addq $0x3, %rdi
callq 0x95c0
movl %eax, -0x8(%rbp)
jmp 0x30846
leaq 0x36a41f(%rip), %rax    # 0x39ac20
movsbl 0x3(%rax), %eax
cmpl $0x2d, %eax
jne 0x3081f
leaq 0x36a40f(%rip), %rdi    # 0x39ac20
addq $0x3, %rdi
callq 0x95c0
movl %eax, -0x8(%rbp)
jmp 0x30844
leaq 0x36a3fa(%rip), %rax    # 0x39ac20
movsbl 0x3(%rax), %eax
cmpl $0x2b, %eax
jne 0x30842
leaq 0x36a3ea(%rip), %rdi    # 0x39ac20
addq $0x3, %rdi
callq 0x95c0
movl %eax, -0x8(%rbp)
jmp 0x30844
jmp 0x30846
movl -0x4(%rbp), %eax
imull -0x8(%rbp), %eax
movl %eax, -0x8(%rbp)
cmpl $0x2, 0x3716c9(%rip)    # 0x3a1f20
jne 0x308ac
movl $0x40, -0xc(%rbp)
cmpl $0x0, -0x8(%rbp)
jge 0x30870
xorl %eax, %eax
subl -0x8(%rbp), %eax
movl %eax, -0x14(%rbp)
jmp 0x30876
movl -0x8(%rbp), %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl $0x40, %eax
jle 0x308a7
movl -0xc(%rbp), %edx
leaq 0x36ab78(%rip), %rdi    # 0x39b400
leaq 0x14160d(%rip), %rsi    # 0x171e9c
movb $0x0, %al
callq 0x9060
leaq 0x36ab63(%rip), %rdi    # 0x39b400
callq 0x2e640
jmp 0x309ae
jmp 0x309a5
cmpl $0x8, 0x37166d(%rip)    # 0x3a1f20
jne 0x30908
movl $0x16, -0xc(%rbp)
cmpl $0x0, -0x8(%rbp)
jge 0x308cc
xorl %eax, %eax
subl -0x8(%rbp), %eax
movl %eax, -0x18(%rbp)
jmp 0x308d2
movl -0x8(%rbp), %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0xc(%rbp), %eax
jle 0x30903
movl -0xc(%rbp), %edx
leaq 0x36ab1c(%rip), %rdi    # 0x39b400
leaq 0x1415b1(%rip), %rsi    # 0x171e9c
movb $0x0, %al
callq 0x9060
leaq 0x36ab07(%rip), %rdi    # 0x39b400
callq 0x2e640
jmp 0x309ae
jmp 0x309a3
cmpl $0x10, 0x371611(%rip)   # 0x3a1f20
jne 0x3095e
movl $0x10, -0xc(%rbp)
cmpl $0x0, -0x8(%rbp)
jge 0x30928
xorl %eax, %eax
subl -0x8(%rbp), %eax
movl %eax, -0x1c(%rbp)
jmp 0x3092e
movl -0x8(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jle 0x3095c
movl -0xc(%rbp), %edx
leaq 0x36aac0(%rip), %rdi    # 0x39b400
leaq 0x141555(%rip), %rsi    # 0x171e9c
movb $0x0, %al
callq 0x9060
leaq 0x36aaab(%rip), %rdi    # 0x39b400
callq 0x2e640
jmp 0x309ae
jmp 0x309a1
cmpl $0x0, -0x8(%rbp)
jge 0x3096e
xorl %eax, %eax
subl -0x8(%rbp), %eax
movl %eax, -0x20(%rbp)
jmp 0x30974
movl -0x8(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl $0x10, %eax
jle 0x3099f
leaq 0x36aa7d(%rip), %rdi    # 0x39b400
leaq 0x141534(%rip), %rsi    # 0x171ebe
movb $0x0, %al
callq 0x9060
leaq 0x36aa68(%rip), %rdi    # 0x39b400
callq 0x2e640
jmp 0x309ae
jmp 0x309a1
jmp 0x309a3
jmp 0x309a5
movl -0x8(%rbp), %eax
movl %eax, 0x1986a2(%rip)    # 0x1c9050
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)