user: What is the c source code of the assembly code below?

```asm
<check_ipmask>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x58,%rsp
  mov    %edi,-0x54(%rbp)
  mov    %rsi,-0x60(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x18(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x48(%rbp)
  movl   $0x0,-0x44(%rbp)
  lea    -0x3c(%rbp),%rax
  mov    %rax,-0x28(%rbp)
  lea    -0x48(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  lea    -0x2c(%rbp),%r8
  lea    -0x30(%rbp),%rdi
  lea    -0x34(%rbp),%rcx
  lea    -0x38(%rbp),%rdx
  mov    -0x60(%rbp),%rax
  sub    $0x8,%rsp
  lea    -0x44(%rbp),%rsi
  push   %rsi
  mov    %r8,%r9
  mov    %rdi,%r8
  lea    D0(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sscanf@plt>
  add    $0x10,%rsp
  cmp    $0x4,%eax
  jne    L56
  mov    -0x44(%rbp),%eax
  test   %eax,%eax
  jne    L106
L56:
  mov    $0x0,%eax
  jmp    L6
L106:
  mov    -0x38(%rbp),%eax
  mov    %eax,%edx
  mov    -0x28(%rbp),%rax
  mov    %dl,(%rax)
  mov    -0x34(%rbp),%edx
  mov    -0x28(%rbp),%rax
  add    $0x1,%rax
  mov    %dl,(%rax)
  mov    -0x30(%rbp),%edx
  mov    -0x28(%rbp),%rax
  add    $0x2,%rax
  mov    %dl,(%rax)
  mov    -0x2c(%rbp),%edx
  mov    -0x28(%rbp),%rax
  add    $0x3,%rax
  mov    %dl,(%rax)
  mov    -0x44(%rbp),%eax
  mov    %eax,%edx
  mov    -0x60(%rbp),%rax
  lea    (%rdx,%rax,1),%rdi
  lea    -0x2c(%rbp),%rsi
  lea    -0x30(%rbp),%rcx
  lea    -0x34(%rbp),%rdx
  lea    -0x38(%rbp),%rax
  mov    %rsi,%r9
  mov    %rcx,%r8
  mov    %rdx,%rcx
  mov    %rax,%rdx
  lea    D2(%rip),%rax
  mov    %rax,%rsi
  mov    $0x0,%eax
  call   <sscanf@plt>
  cmp    $0x4,%eax
  jne    L45
  mov    -0x38(%rbp),%eax
  mov    %eax,%edx
  mov    -0x20(%rbp),%rax
  mov    %dl,(%rax)
  mov    -0x34(%rbp),%edx
  mov    -0x20(%rbp),%rax
  add    $0x1,%rax
  mov    %dl,(%rax)
  mov    -0x30(%rbp),%edx
  mov    -0x20(%rbp),%rax
  add    $0x2,%rax
  mov    %dl,(%rax)
  mov    -0x2c(%rbp),%edx
  mov    -0x20(%rbp),%rax
  add    $0x3,%rax
  mov    %dl,(%rax)
  mov    -0x48(%rbp),%eax
  mov    %eax,%edi
  call   <ntohl@plt>
  mov    %eax,-0x48(%rbp)
  jmp    L40
L45:
  mov    -0x44(%rbp),%eax
  mov    %eax,%edx
  mov    -0x60(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  lea    -0x40(%rbp),%rax
  mov    %rax,%rdx
  lea    D27(%rip),%rax
  mov    %rax,%rsi
  mov    %rcx,%rdi
  mov    $0x0,%eax
  call   <sscanf@plt>
  cmp    $0x1,%eax
  jne    L76
  movl   $0x0,-0x44(%rbp)
  jmp    L99
L80:
  mov    -0x48(%rbp),%eax
  shr    %eax
  or     $0x80000000,%eax
  mov    %eax,-0x48(%rbp)
  mov    -0x44(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x44(%rbp)
L99:
  mov    -0x44(%rbp),%edx
  mov    -0x40(%rbp),%eax
  cmp    %eax,%edx
  jb     L80
  jmp    L40
L76:
  mov    $0x0,%eax
  jmp    L6
L40:
  mov    -0x54(%rbp),%eax
  mov    %eax,%edi
  call   <ntohl@plt>
  mov    %eax,%ebx
  mov    -0x3c(%rbp),%eax
  mov    %eax,%edi
  call   <ntohl@plt>
  xor    %eax,%ebx
  mov    %ebx,%edx
  mov    -0x48(%rbp),%eax
  and    %edx,%eax
  test   %eax,%eax
  sete   %al
  movzbl %al,%eax
L6:
  mov    -0x18(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L58
  call   <__stack_chk_fail@plt>
L58:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: data_label: D0
datatype: string
name: retrieve_data
arguments: data_label: D2
datatype: string
name: retrieve_data
arguments: data_label: D27
datatype: string

tool: D0: %d.%d.%d.%d/%n

tool: D2: %d.%d.%d.%d

tool: D27: %d

assistant: ```c
int check_ipmask(unsigned int ip, const unsigned char *str) {
  unsigned int mask = 0, i = 0, m, ip2, a0, a1, a2, a3;
  unsigned char *p = (unsigned char *)&ip2, *p2 = (unsigned char *)&mask;
  if (sscanf(str, "%d.%d.%d.%d/%n", &a0, &a1, &a2, &a3, &i) != 4 || i == 0)
    return 0;
  p[0] = a0;
  p[1] = a1;
  p[2] = a2;
  p[3] = a3;
  if (sscanf(str + i, "%d.%d.%d.%d", &a0, &a1, &a2, &a3) == 4) {
    p2[0] = a0;
    p2[1] = a1;
    p2[2] = a2;
    p2[3] = a3;
    mask = ntohl(mask);
  } else if (sscanf(str + i, "%d", &m) == 1) {
    for (i = 0; i < m; i++)
      mask = (mask >> 1) | 0x80000000;
  } else
    return 0;
  return ((ntohl(ip) & mask) == (ntohl(ip2) & mask));
}
```