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

```asm
<WildComp2>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,(%rsp)
  mov    %rsi,%r14
  call   <strlen@plt>
  mov    %rax,%r13
  mov    %eax,%ebx
  mov    %r14,%rdi
  call   <strlen@plt>
  test   %r13d,%r13d
  je     L325
  test   %eax,%eax
  je     L325
  cmp    %eax,%r13d
  cmovl  %eax,%r13d
  test   %r13d,%r13d
  jle    L108
  mov    $0x0,%r15d
  mov    $0x0,%r12d
  jmp    L558
L268:
  add    $0x1,%r15d
  jmp    L526
L354:
  cmp    $0x2a,%eax
  jne    L25
  lea    0x1(%r15),%eax
  cltq
  cmpb   $0x0,(%r14,%rax,1)
  sete   %bl
  movzbl %bl,%ebx
  jmp    L25
L175:
  cmp    $0x2a,%ebx
  je     L453
  mov    %eax,%ebx
  jmp    L25
L453:
  add    $0x1,%r12d
  movslq %r12d,%rax
  mov    (%rsp),%rcx
  cmpb   $0x0,(%rcx,%rax,1)
  sete   %bl
  movzbl %bl,%ebx
  jmp    L25
L402:
  add    $0x1,%r12d
  movslq %r12d,%rax
  mov    (%rsp),%rcx
  movzbl (%rcx,%rax,1),%edi
  test   %dil,%dil
  je     L287
  movsbl %dil,%edi
  call   <toupper@plt>
  mov    %eax,0xc(%rsp)
  add    $0x1,%r15d
  movslq %r15d,%rbx
  cmpb   $0x0,(%r14,%rbx,1)
  je     L472
  cmp    %r15d,%r13d
  jle    L427
L296:
  mov    %ebx,%r15d
  movsbl (%r14,%rbx,1),%edi
  call   <toupper@plt>
  mov    %eax,%ebp
  test   %eax,%eax
  je     L427
  cmp    %eax,0xc(%rsp)
  je     L427
  add    $0x1,%rbx
  cmp    %ebx,%r13d
  jg     L296
  mov    $0x0,%ebx
  jmp    L25
L427:
  cmp    0xc(%rsp),%ebp
  je     L405
  mov    $0x0,%ebx
L25:
  test   %ebx,%ebx
  jne    L4
  cmp    %r12d,%r13d
  mov    $0x1,%eax
  cmove  %eax,%ebx
L4:
  mov    %ebx,%eax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L405:
  add    $0x1,%r15d
  jmp    L526
L192:
  lea    0x1(%r15),%eax
  cltq
  movzbl (%r14,%rax,1),%edi
  test   %dil,%dil
  je     L19
  movsbl %dil,%edi
  call   <toupper@plt>
  mov    %eax,0xc(%rsp)
  add    $0x1,%r12d
  movslq %r12d,%rbp
  add    (%rsp),%rbp
  cmpb   $0x0,0x0(%rbp)
  je     L197
  cmp    %r12d,%r13d
  jle    L364
L403:
  movsbl 0x0(%rbp),%edi
  call   <toupper@plt>
  mov    %eax,%ebx
  test   %eax,%eax
  je     L364
  cmp    %eax,0xc(%rsp)
  je     L364
  add    $0x1,%r12d
  add    $0x1,%rbp
  cmp    %r12d,%r13d
  jne    L403
  mov    $0x1,%ebx
  jmp    L4
L364:
  cmp    0xc(%rsp),%ebx
  je     L297
  mov    $0x0,%ebx
  jmp    L25
L297:
  add    $0x2,%r15d
  jmp    L526
L574:
  add    $0x1,%r15d
L526:
  add    $0x1,%r12d
  cmp    %r12d,%r13d
  jle    L153
L558:
  movslq %r12d,%rax
  mov    (%rsp),%rdx
  movsbl (%rdx,%rax,1),%edi
  call   <toupper@plt>
  mov    %eax,%ebx
  movslq %r15d,%rax
  movsbl (%r14,%rax,1),%edi
  call   <toupper@plt>
  mov    %eax,%ebp
  cmp    %eax,%ebx
  je     L268
  test   %ebx,%ebx
  je     L354
  test   %eax,%eax
  je     L175
  cmp    $0x2a,%ebx
  je     L402
  cmp    $0x2a,%eax
  je     L192
  cmp    $0x3f,%ebx
  je     L574
  cmp    $0x3f,%eax
  je     L574
  mov    %ebx,%edi
  call   <toupper@plt>
  mov    %eax,%ebx
  mov    %ebp,%edi
  call   <toupper@plt>
  cmp    %eax,%ebx
  je     L574
  mov    $0x0,%ebx
  jmp    L25
L153:
  mov    $0x0,%ebx
  jmp    L25
L472:
  mov    $0x0,%ebx
  jmp    L25
L197:
  mov    $0x0,%ebx
  jmp    L25
L325:
  test   %r13d,%r13d
  jne    L432
  cmp    $0x1,%eax
  je     L180
  cmp    $0x2,%eax
  jne    L4
  cmpb   $0x2e,(%r14)
  jne    L4
  cmpb   $0x2a,0x1(%r14)
  sete   %bl
  movzbl %bl,%ebx
  jmp    L4
L180:
  cmpb   $0x2a,(%r14)
  sete   %bl
  movzbl %bl,%ebx
  jmp    L4
L432:
  mov    $0x0,%ebx
  test   %eax,%eax
  jne    L4
  cmp    $0x1,%r13d
  je     L81
  mov    %eax,%ebx
  cmp    $0x2,%r13d
  jne    L4
  mov    (%rsp),%rax
  cmpb   $0x2e,(%rax)
  jne    L4
  cmpb   $0x2a,0x1(%rax)
  sete   %bl
  movzbl %bl,%ebx
  jmp    L4
L81:
  mov    (%rsp),%rax
  cmpb   $0x2a,(%rax)
  sete   %bl
  movzbl %bl,%ebx
  jmp    L4
L108:
  mov    $0x0,%ebx
  jmp    L4
L287:
  mov    $0x1,%ebx
  jmp    L4
L19:
  mov    $0x1,%ebx
  jmp    L4
```

assistant: ```c
int WildComp2(char *lp1, char *lp2) {
  int flg;
  int i1, i2, j1, j2, ilen;
  int c, d;
  flg = 0;
  i1 = (int)strlen(lp1);
  i2 = (int)strlen(lp2);
  if (i1 && i2) {
    ilen = i1;
    if (i2 > i1)
      ilen = i2;
    j2 = 0;
    for (j1 = 0; j1 < ilen; j1++) {
      c = toupper(lp1[j1]);
      d = toupper(lp2[j2]);
      if (c == d) {
        j2++;
        continue;
      }
      if (c == 0) {
        if (d == '*') {
          j2++;
          if (lp2[j2] == 0) {
            flg = 1;
          }
        }
        break;
      }
      if (d == 0) {
        if (c == '*') {
          j1++;
          if (lp1[j1] == 0) {
            flg = 1;
          }
        }
        break;
      }
      {
        if (c == '*') {
          j1++;
          if (lp1[j1] == 0) {
            flg = 1;
            break;
          }
          c = toupper(lp1[j1]);
          j2++;
          if (lp2[j2] == 0)
            break;
          for (; j2 < ilen; j2++) {
            d = toupper(lp2[j2]);
            if (c == d)
              break;
            if (d == 0)
              break;
          }
          if (c == d) {
            j2++;
            continue;
          }
          break;
        }
        if (d == '*') {
          j2++;
          if (lp2[j2] == 0) {
            flg = 1;
            break;
          }
          d = toupper(lp2[j2]);
          j1++;
          if (lp1[j1] == 0)
            break;
          for (; j1 < ilen; j1++) {
            c = toupper(lp1[j1]);
            if (c == d)
              break;
            if (c == 0)
              break;
          }
          if (c == d) {
            j2++;
            continue;
          }
          break;
        }
        if ((c == '?') || (d == '?')) {
        } else {
          if (toupper(c) != toupper(d))
            break;
        }
      }
      j2++;
    }
    if (!flg && (j1 == ilen))
      flg = 1;
  } else {
    if (i1 == 0) {
      if ((i2 == 1) && (*lp2 == '*')) {
        flg = 1;
      } else if ((i2 == 2) && (lp2[0] == '.') && (lp2[1] == '*')) {
        flg = 1;
      }
    } else if (i2 == 0) {
      if ((i1 == 1) && (*lp1 == '*')) {
        flg = 1;
      } else if ((i1 == 2) && (lp1[0] == '.') && (lp1[1] == '*')) {
        flg = 1;
      }
    }
  }
  return flg;
}
```