user: Demonstrate the C code that generates the assembly output below:

```asm
<submask_sub>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0xc(%rbp)
  movl   $0x0,-0x20(%rbp)
  movl   $0x0,-0x1c(%rbp)
  movl   $0x0,-0x20(%rbp)
  movl   $0x0,-0x1c(%rbp)
  jmp    L167
L8:
  mov    -0x20(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  jne    L30
  mov    -0x1c(%rbp),%eax
  cltq
  mov    -0x20(%rbp),%edx
  mov    %edx,-0x18(%rbp,%rax,4)
  addl   $0x1,-0x1c(%rbp)
L30:
  cmpl   $0x3,-0x1c(%rbp)
  je     L50
  addl   $0x1,-0x20(%rbp)
L167:
  cmpl   $0xf,-0x20(%rbp)
  jle    L8
  jmp    L19
L50:
  nop
L19:
  cmpl   $0x1,-0x2c(%rbp)
  jne    L104
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <atoi@plt>
  jmp    L55
L104:
  cmpl   $0x2,-0x2c(%rbp)
  jne    L31
  movl   $0x0,-0x1c(%rbp)
  mov    -0x18(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x20(%rbp)
  jmp    L150
L58:
  mov    -0x20(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%edx
  mov    -0x1c(%rbp),%eax
  cltq
  mov    %dl,-0xc(%rbp,%rax,1)
  addl   $0x1,-0x20(%rbp)
  addl   $0x1,-0x1c(%rbp)
L150:
  mov    -0x14(%rbp),%eax
  cmp    %eax,-0x20(%rbp)
  jl     L58
  jmp    L47
L31:
  cmpl   $0x3,-0x2c(%rbp)
  jne    L1
  movl   $0x0,-0x1c(%rbp)
  mov    -0x14(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x20(%rbp)
  jmp    L24
L176:
  mov    -0x20(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%edx
  mov    -0x1c(%rbp),%eax
  cltq
  mov    %dl,-0xc(%rbp,%rax,1)
  addl   $0x1,-0x20(%rbp)
  addl   $0x1,-0x1c(%rbp)
L24:
  mov    -0x10(%rbp),%eax
  cmp    %eax,-0x20(%rbp)
  jl     L176
  jmp    L47
L1:
  movl   $0x0,-0x1c(%rbp)
  mov    -0x10(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x20(%rbp)
  jmp    L78
L63:
  mov    -0x20(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%edx
  mov    -0x1c(%rbp),%eax
  cltq
  mov    %dl,-0xc(%rbp,%rax,1)
  addl   $0x1,-0x20(%rbp)
  addl   $0x1,-0x1c(%rbp)
L78:
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    %eax,-0x20(%rbp)
  jl     L63
L47:
  lea    -0xc(%rbp),%rax
  mov    %rax,%rdi
  call   <atoi@plt>
L55:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L161
  call   <__stack_chk_fail@plt>
L161:
  leave
  ret
```

assistant: ```c
int submask_sub(char ip[16], int n) {
  int daoat[3];
  char ippart[4] = "";
  int i = 0;
  int j = 0;
  for (i = 0, j = 0; i < 16; i++) {
    if (ip[i] == '.') {
      daoat[j] = i;
      j++;
    }
    if (j == 3) {
      break;
    }
  }
  if (n == 1) {
    return atoi(ip);
  } else if (n == 2) {
    for (j = 0, i = 1 + daoat[0]; i < daoat[1]; i++, j++) {
      ippart[j] = ip[i];
    }
  } else if (n == 3) {
    for (j = 0, i = 1 + daoat[1]; i < daoat[2]; i++, j++) {
      ippart[j] = ip[i];
    }
  } else {
    for (j = 0, i = 1 + daoat[2]; i < (int)strlen(ip); i++, j++) {
      ippart[j] = ip[i];
    }
  }
  return atoi(ippart);
}
```