// File: /workspace/github_c_makefile_star2_O1/simh[P]simtools/converters/fsio/dos11.c
// Function: dos11Set
static void dos11Set(
  struct mountedFS *mount,
  uint8_t UNUSED(unit),
  uint8_t UNUSED(present)
)
{
  struct DOS11data *data = &mount->dos11data;
  int idx = 0;
  uint8_t user, group;

  while (setCmds[idx] != NULL) {
    if (strcmp(words[1], setCmds[idx]) == 0) {
      switch (idx) {
        case DOS11SET_UIC:
          if (args == 3) {
            if (sscanf(words[2], "[%hho,%hho]", &group, &user) == 2) {
              data->group = group;
              data->user = user;
            } else fprintf(stderr,
                           "dos11: UIC syntax error \"%s\"\n", words[2]);
          } else fprintf(stderr, "dos11: Invalid syntax for \"set uic\"\n");
          return;

        case DOS11SET_UFD:
          if (args == 3) {
            if (sscanf(words[2], "[%hho,%hho]", &group, &user) == 2) {
              if (dos11CreateUFD(mount, group, user) != 0) {
                data->group = group;
                data->user = user;
              }
            } else fprintf(stderr,
                           "dos11: UIC syntax error \"%s\"\n", words[2]);
          } else fprintf(stderr, "dos11: Invalid syntax for \"set ufd\"\n");
          return;

        default:
          fprintf(stderr, "dos11: \"%s\" not implemented\n", words[1]);
          return;
      }
    }
    idx++;
  }
  fprintf(stderr, "dos11: Unknown set command \"%s\"\n", words[1]);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x418, %rsp            # imm = 0x418
movq %rdi, %rbx
leaq 0x106c8(%rip), %rax     # 0x190a8
movq (%rax), %r15
movq 0x8(%r15), %r14
leaq 0xf332(%rip), %r13      # 0x17d20
xorl %r12d, %r12d
movq (%r13), %rsi
movq %r14, %rdi
callq 0x31c0
testl %eax, %eax
je 0x8a15
incq %r12
addq $0x8, %r13
cmpq $0x2, %r12
jne 0x89f1
callq 0x3a53
jmp 0x8a6d
cmpl $0x1, %r12d
je 0x8a7f
testl %r12d, %r12d
jne 0x8c10
leaq 0x10675(%rip), %rax     # 0x190a0
cmpl $0x3, (%rax)
jne 0x8c3c
movq 0x10(%r15), %rdi
leaq 0x9131(%rip), %rsi      # 0x11b70
leaq 0xe(%rsp), %rdx
leaq 0xf(%rsp), %rcx
xorl %eax, %eax
callq 0x3220
cmpl $0x2, %eax
jne 0x8c50
movb 0xe(%rsp), %al
movb %al, 0x954(%rbx)
movb 0xf(%rsp), %al
movb %al, 0x955(%rbx)
addq $0x418, %rsp            # imm = 0x418
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1061a(%rip), %rax     # 0x190a0
cmpl $0x3, (%rax)
jne 0x8c46
movq 0x10(%r15), %rdi
leaq 0x90d6(%rip), %rsi      # 0x11b70
leaq 0xe(%rsp), %rdx
leaq 0xf(%rsp), %rcx
xorl %eax, %eax
callq 0x3220
cmpl $0x2, %eax
jne 0x8c5a
movzbl 0xf(%rsp), %ebp
movzbl 0xe(%rsp), %r13d
movq %rbx, %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x78a2
testl %eax, %eax
je 0x8a6d
shll $0x8, %r13d
orl %ebp, %r13d
movzwl 0x554(%rbx), %eax
movzwl %ax, %ebp
movzwl %ax, %esi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x78a2
testl %eax, %eax
je 0x8a6d
movq 0x28(%rbx), %rax
shrq %rax
addq $-0x3, %rax
cmpq $0x2, %rax
jb 0x8b34
movl $0x1, %edx
movl $0x5, %ecx
movzwl 0x554(%rbx,%rdx,2), %edx
testw %dx, %dx
je 0x8b2a
cmpw %r13w, %dx
je 0x8a59
movl %ecx, %edx
addl $0x4, %ecx
cmpq %rdx, %rax
ja 0x8b13
movzwl 0x554(%rbx), %eax
testw %ax, %ax
jne 0x8ae3
movq %rbx, %rdi
movl %ebp, %esi
xorl %edx, %edx
callq 0x78a2
testl %eax, %eax
je 0x8a6d
leaq 0x10(%rsp), %r14
movq 0x28(%rbx), %rcx
shrq %rcx
addq $-0x3, %rcx
cmpq $0x2, %rcx
jb 0x8b8d
movl $0x1, %edx
movl $0x5, %eax
cmpw $0x0, 0x554(%rbx,%rdx,2)
je 0x8c64
movl %eax, %edx
addl $0x4, %eax
cmpq %rdx, %rcx
ja 0x8b74
cmpw $0x0, 0x554(%rbx)
jne 0x8bf0
movq %rbx, %rdi
callq 0x7d7f
testw %ax, %ax
je 0x8ca2
movl %eax, %r15d
movzwl %ax, %r12d
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
xorl %esi, %esi
callq 0x3170
movq %rbx, %rdi
movl %r12d, %esi
movq %r14, %rdx
callq 0x7983
testl %eax, %eax
je 0x8a6d
movw %r15w, 0x554(%rbx)
movq %rbx, %rdi
movl %ebp, %esi
xorl %edx, %edx
callq 0x7983
testl %eax, %eax
je 0x8a6d
movzwl 0x554(%rbx), %ebp
movq %rbx, %rdi
movl %ebp, %esi
xorl %edx, %edx
callq 0x78a2
testl %eax, %eax
jne 0x8b59
jmp 0x8a6d
movq 0xf3d9(%rip), %rax      # 0x17ff0
movq (%rax), %rdi
leaq 0x8fc3(%rip), %rsi      # 0x11be4
movq %r14, %rdx
xorl %eax, %eax
addq $0x418, %rsp            # imm = 0x418
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x31d0
callq 0x3b12
jmp 0x8a6d
callq 0x3a79
jmp 0x8a6d
callq 0x3b2e
jmp 0x8a6d
callq 0x3a95
jmp 0x8a6d
movw %r13w, 0x554(%rbx,%rdx,2)
leal -0x3(%rax), %ecx
xorl %edx, %edx
movw %dx, 0x554(%rbx,%rcx,2)
leal -0x2(%rax), %ecx
movw $0x9, 0x554(%rbx,%rcx,2)
decl %eax
movw %dx, 0x554(%rbx,%rax,2)
movq %rbx, %rdi
movl %ebp, %esi
xorl %edx, %edx
callq 0x7983
jmp 0x8a59
movq %rbx, %rdi
callq 0x3ac1
jmp 0x8a6d