user: Converte this assembly snippet into its equivalent C code:

```asm
<comtyp>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  lea    0x1(%rdi),%rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  movzbl 0x1(%rdi),%eax
  test   %al,%al
  jne    L1313
  jmp    L1127
  cs nopw 0x0(%rax,%rax,1)
L98:
  movzbl 0x1(%rbx),%eax
  add    $0x1,%rbx
  test   %al,%al
  je     L1127
L1313:
  cmp    $0x20,%al
  je     L98
  cmp    $0x9,%al
  je     L98
  lea    0x1e(%rsp),%r12
  mov    %rbx,%rdi
  xor    %eax,%eax
  mov    %r12,%rsi
  call   <getwrd@plt>
  xor    %eax,%eax
  mov    %r12,%rdi
  movb   $0x0,0x20(%rsp)
  call   <getmac@plt>
  test   %eax,%eax
  jne    L836
  movzbl (%rbx),%ecx
  movzbl 0x1(%rbx),%edx
  cmp    $0x5c,%cl
  jne    L339
  cmp    $0x22,%dl
  je     L1127
L339:
  cmp    $0x61,%cl
  sete   %dil
  cmp    $0x66,%dl
  sete   %sil
  test   %dil,%dil
  je     L518
  mov    $0x30,%eax
  test   %sil,%sil
  jne    L321
L518:
  cmp    $0x64,%dl
  jne    L1070
  mov    $0x31,%eax
  test   %dil,%dil
  jne    L321
L1070:
  cmp    $0x62,%cl
  sete   %r9b
  cmp    $0x6f,%dl
  sete   %dil
  test   %r9b,%r9b
  je     L776
  mov    $0x1a,%eax
  test   %dil,%dil
  jne    L321
L776:
  cmp    $0x70,%dl
  sete   %r8b
  test   %r9b,%r9b
  je     L410
  mov    $0x1,%eax
  test   %r8b,%r8b
  jne    L321
L410:
  cmp    $0x72,%dl
  sete   %r10b
  test   %r9b,%r9b
  je     L1019
  mov    $0x2,%eax
  test   %r10b,%r10b
  jne    L321
L1019:
  cmp    $0x73,%dl
  sete   %r11b
  test   %r9b,%r9b
  je     L220
  mov    $0x15,%eax
  test   %r11b,%r11b
  jne    L321
L220:
  cmp    $0x63,%cl
  sete   %r9b
  cmp    $0x63,%dl
  sete   %bl
  test   %r9b,%r9b
  je     L811
  mov    $0x18,%eax
  test   %bl,%bl
  jne    L321
L811:
  cmp    $0x65,%dl
  sete   %bpl
  test   %r9b,%r9b
  je     L1161
  mov    $0x3,%eax
  test   %bpl,%bpl
  jne    L321
L1161:
  cmp    $0x75,%dl
  sete   %r12b
  test   %r9b,%r9b
  je     L1137
  mov    $0x20,%eax
  test   %r12b,%r12b
  jne    L321
L1137:
  cmp    $0x64,%cl
  sete   %r13b
  test   %bpl,%bpl
  je     L1015
  mov    $0x21,%eax
  test   %r13b,%r13b
  jne    L321
L1015:
  test   %r11b,%r11b
  je     L400
  mov    $0x33,%eax
  test   %r13b,%r13b
  jne    L321
L400:
  cmp    $0x65,%cl
  sete   %r13b
  test   %sil,%sil
  je     L1354
  mov    $0x1d,%eax
  test   %r13b,%r13b
  jne    L321
L1354:
  test   %bl,%bl
  je     L150
  mov    $0x24,%eax
  test   %r13b,%r13b
  jne    L321
L150:
  cmp    $0x68,%dl
  sete   0xd(%rsp)
  movzbl 0xd(%rsp),%r15d
  test   %r13b,%r13b
  je     L1115
  mov    $0x1b,%eax
  test   %r15b,%r15b
  jne    L321
L1115:
  cmp    $0x6e,%dl
  sete   %r15b
  test   %r15b,%r13b
  jne    L1049
  cmp    $0x2e,%cl
  je     L1049
  test   %dil,%dil
  je     L671
  mov    $0x26,%eax
  test   %r13b,%r13b
  jne    L321
L671:
  cmp    $0x66,%cl
  sete   %r13b
  cmp    $0x69,%dl
  sete   0xe(%rsp)
  movzbl 0xe(%rsp),%r14d
  test   %r13b,%r13b
  je     L448
  mov    $0x4,%eax
  test   %r14b,%r14b
  jne    L321
L448:
  cmp    $0x6c,%dl
  sete   %r14b
  test   %r13b,%r13b
  je     L1180
  mov    $0x28,%eax
  test   %r14b,%r14b
  jne    L321
L1180:
  test   %dil,%dil
  je     L469
  mov    $0x5,%eax
  test   %r13b,%r13b
  jne    L321
L469:
  cmp    $0x74,%dl
  sete   0xf(%rsp)
  test   %r13b,%r13b
  je     L1392
  cmpb   $0x0,0xf(%rsp)
  mov    $0x25,%eax
  jne    L321
L1392:
  cmp    $0x68,%cl
  jne    L365
  mov    $0x6,%eax
  test   %bpl,%bpl
  jne    L321
L365:
  cmp    $0x69,%cl
  jne    L950
  mov    $0x7,%eax
  test   %r15b,%r15b
  jne    L321
L950:
  cmp    $0x6a,%cl
  jne    L1134
  test   %r12b,%r12b
  jne    L1225
L1134:
  cmp    $0x6c,%cl
  sete   %al
  test   %r14b,%r14b
  je     L491
  test   %al,%al
  jne    L691
L491:
  test   %r11b,%r11b
  je     L1451
  test   %al,%al
  jne    L773
L1451:
  cmp    $0x6d,%cl
  sete   %r11b
  cmp    $0x31,%dl
  jne    L1040
  test   %r11b,%r11b
  jne    L573
L1040:
  cmp    $0x32,%dl
  sete   %r12b
  test   %r11b,%r11b
  je     L730
  test   %r12b,%r12b
  jne    L145
L730:
  cmp    $0x33,%dl
  jne    L122
  test   %r11b,%r11b
  jne    L101
L122:
  cmp    $0x34,%dl
  jne    L199
  test   %r11b,%r11b
  jne    L621
L199:
  cmp    $0x6e,%cl
  sete   %r11b
  cmp    $0x61,%dl
  jne    L846
  test   %r11b,%r11b
  jne    L1228
L846:
  test   %bpl,%bpl
  je     L506
  test   %r11b,%r11b
  jne    L717
L506:
  test   %sil,%sil
  je     L867
  test   %r11b,%r11b
  jne    L243
L867:
  cmp    $0x6a,%dl
  jne    L1416
  test   %r11b,%r11b
  jne    L1305
L1416:
  test   %r10b,%r10b
  je     L1247
  test   %r11b,%r11b
  jne    L982
L1247:
  cmp    $0x6f,%cl
  sete   %r11b
  test   %sil,%sil
  je     L964
  test   %r11b,%r11b
  jne    L928
L964:
  cmpb   $0x0,0xd(%rsp)
  je     L190
  test   %r11b,%r11b
  jne    L34
L190:
  cmp    $0x70,%cl
  sete   %sil
  test   %bl,%bl
  je     L936
  test   %sil,%sil
  jne    L1135
L936:
  test   %r14b,%r14b
  je     L306
  test   %sil,%sil
  jne    L467
L306:
  cmp    $0x6d,%dl
  sete   %r11b
  test   %sil,%sil
  je     L373
  test   %r11b,%r11b
  jne    L1386
L373:
  test   %dil,%dil
  je     L1428
  test   %sil,%sil
  jne    L1254
L1428:
  cmp    $0x72,%cl
  sete   %dl
  test   %r11b,%r11b
  je     L509
  test   %dl,%dl
  jne    L159
L509:
  test   %r10b,%r10b
  je     L99
  test   %dl,%dl
  jne    L468
L99:
  cmp    $0x73,%cl
  sete   %dl
  test   %dil,%dil
  je     L555
  test   %dl,%dl
  jne    L447
L555:
  test   %r8b,%r8b
  je     L978
  test   %dl,%dl
  jne    L872
L978:
  cmp    $0x74,%cl
  sete   %dl
  cmpb   $0x0,0xe(%rsp)
  je     L991
  test   %dl,%dl
  jne    L1116
L991:
  test   %r14b,%r14b
  je     L664
  test   %dl,%dl
  jne    L54
L664:
  cmp    $0x75,%cl
  jne    L945
  test   %r14b,%r14b
  jne    L113
L945:
  test   %r15b,%r15b
  je     L259
  test   %sil,%sil
  jne    L1291
L259:
  test   %r9b,%r9b
  je     L1126
  test   %r12b,%r12b
  jne    L1301
L1126:
  test   %r10b,%r10b
  je     L1264
  test   %dl,%dl
  jne    L774
L1264:
  cmpb   $0x0,0xf(%rsp)
  je     L1288
  test   %al,%al
  jne    L300
L1288:
  test   %bl,%bl
  je     L1355
  test   %r13b,%r13b
  je     L1355
  mov    $0x2e,%eax
  jmp    L321
  nopl   (%rax)
L1127:
  mov    $0x3e8,%eax
L321:
  mov    0x28(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L254
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L836:
  movslq %eax,%rsi
  mov    %rbp,%rdi
  call   <strcpy@plt>
  xor    %eax,%eax
  jmp    L321
L1049:
  mov    $0x22,%eax
  jmp    L321
L300:
  mov    $0x2d,%eax
  jmp    L321
L1301:
  mov    $0x2b,%eax
  jmp    L321
L774:
  mov    $0x2c,%eax
  jmp    L321
L1116:
  mov    $0xd,%eax
  jmp    L321
L54:
  mov    $0x2f,%eax
  jmp    L321
L113:
  mov    $0xe,%eax
  jmp    L321
L1291:
  mov    $0x29,%eax
  jmp    L321
L1135:
  mov    $0x17,%eax
  jmp    L321
L467:
  mov    $0xa,%eax
  jmp    L321
L1386:
  mov    $0x34,%eax
  jmp    L321
L1254:
  mov    $0x19,%eax
  jmp    L321
L159:
  mov    $0xb,%eax
  jmp    L321
L468:
  mov    $0x2a,%eax
  jmp    L321
L447:
  mov    $0x1f,%eax
  jmp    L321
L872:
  mov    $0xc,%eax
  jmp    L321
L621:
  mov    $0x14,%eax
  jmp    L321
L1228:
  mov    $0x32,%eax
  jmp    L321
L717:
  mov    $0x16,%eax
  jmp    L321
L243:
  mov    $0x9,%eax
  jmp    L321
L1305:
  mov    $0x10,%eax
  jmp    L321
L982:
  mov    $0x23,%eax
  jmp    L321
L928:
  mov    $0x1e,%eax
  jmp    L321
L34:
  mov    $0x1c,%eax
  jmp    L321
L773:
  mov    $0x8,%eax
  jmp    L321
L573:
  mov    $0x11,%eax
  jmp    L321
L145:
  mov    $0x12,%eax
  jmp    L321
L101:
  mov    $0x13,%eax
  jmp    L321
L1225:
  mov    $0xf,%eax
  jmp    L321
L691:
  mov    $0x27,%eax
  jmp    L321
L254:
  call   <__stack_chk_fail@plt>
L1355:
  or     $0xffffffff,%eax
  jmp    L321
```

assistant: ```c
comtyp(p, m) char *p;
char *m;
{
  char c1;
  char c2;
  char *s;
  char macnam[10];
  p++;
  while (*p && (*p == ' ' || *p == '\t'))
    p++;
  if (*p == '\0')
    return (1000);
  getwrd(p, macnam);
  macnam[2] = '\0';
  if ((s = getmac(macnam)) != (char *)0) {
    strcpy(m, s);
    return (0);
  }
  c1 = *p++;
  c2 = *p;
  if (c1 == '\\' && c2 == '\"')
    return (1000);
  if (c1 == 'a' && c2 == 'f')
    return (48);
  if (c1 == 'a' && c2 == 'd')
    return (49);
  if (c1 == 'b' && c2 == 'o')
    return (26);
  if (c1 == 'b' && c2 == 'p')
    return (1);
  if (c1 == 'b' && c2 == 'r')
    return (2);
  if (c1 == 'b' && c2 == 's')
    return (21);
  if (c1 == 'c' && c2 == 'c')
    return (24);
  if (c1 == 'c' && c2 == 'e')
    return (3);
  if (c1 == 'c' && c2 == 'u')
    return (32);
  if (c1 == 'd' && c2 == 'e')
    return (33);
  if (c1 == 'd' && c2 == 's')
    return (51);
  if (c1 == 'e' && c2 == 'f')
    return (29);
  if (c1 == 'e' && c2 == 'c')
    return (36);
  if (c1 == 'e' && c2 == 'h')
    return (27);
  if (c1 == 'e' && c2 == 'n')
    return (34);
  if (c1 == '.')
    return (34);
  if (c1 == 'e' && c2 == 'o')
    return (38);
  if (c1 == 'f' && c2 == 'i')
    return (4);
  if (c1 == 'f' && c2 == 'l')
    return (40);
  if (c1 == 'f' && c2 == 'o')
    return (5);
  if (c1 == 'f' && c2 == 't')
    return (37);
  if (c1 == 'h' && c2 == 'e')
    return (6);
  if (c1 == 'i' && c2 == 'n')
    return (7);
  if (c1 == 'j' && c2 == 'u')
    return (15);
  if (c1 == 'l' && c2 == 'l')
    return (39);
  if (c1 == 'l' && c2 == 's')
    return (8);
  if (c1 == 'm' && c2 == '1')
    return (17);
  if (c1 == 'm' && c2 == '2')
    return (18);
  if (c1 == 'm' && c2 == '3')
    return (19);
  if (c1 == 'm' && c2 == '4')
    return (20);
  if (c1 == 'n' && c2 == 'a')
    return (50);
  if (c1 == 'n' && c2 == 'e')
    return (22);
  if (c1 == 'n' && c2 == 'f')
    return (9);
  if (c1 == 'n' && c2 == 'j')
    return (16);
  if (c1 == 'n' && c2 == 'r')
    return (35);
  if (c1 == 'o' && c2 == 'f')
    return (30);
  if (c1 == 'o' && c2 == 'h')
    return (28);
  if (c1 == 'p' && c2 == 'c')
    return (23);
  if (c1 == 'p' && c2 == 'l')
    return (10);
  if (c1 == 'p' && c2 == 'm')
    return (52);
  if (c1 == 'p' && c2 == 'o')
    return (25);
  if (c1 == 'r' && c2 == 'm')
    return (11);
  if (c1 == 'r' && c2 == 'r')
    return (42);
  if (c1 == 's' && c2 == 'o')
    return (31);
  if (c1 == 's' && c2 == 'p')
    return (12);
  if (c1 == 't' && c2 == 'i')
    return (13);
  if (c1 == 't' && c2 == 'l')
    return (47);
  if (c1 == 'u' && c2 == 'l')
    return (14);
  if (c1 == 'p' && c2 == 'n')
    return (41);
  if (c1 == 'r' && c2 == 'r')
    return (42);
  if (c1 == 'c' && c2 == '2')
    return (43);
  if (c1 == 't' && c2 == 'r')
    return (44);
  if (c1 == 'l' && c2 == 't')
    return (45);
  if (c1 == 'f' && c2 == 'c')
    return (46);
  return (-1);
}
```