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

```asm
<check_sql_for_select>:
  endbr64
  push   %rbp
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  movabs $0x205443454c4553,%rax
  movl   $0x4f524620,0x9(%rsp)
  movb   $0x0,0xf(%rsp)
  movl   $0x20534120,0x4(%rsp)
  movb   $0x0,0x8(%rsp)
  mov    %rax,0x10(%rsp)
  mov    $0x204d,%eax
  mov    %ax,0xd(%rsp)
  test   %rdi,%rdi
  je     L66
  mov    %rdi,%rbp
  call   <strlen@plt>
  cmp    $0xc,%eax
  jle    L99
  mov    %rbp,%rdi
  lea    D59(%rip),%rsi
  call   <strstr@plt>
  mov    %rax,%rdi
  test   %rax,%rax
  je     L107
  lea    0x10(%rsp),%rsi
  mov    $0x7,%edx
  call   <strncpy@plt>
L107:
  mov    %rbp,%rdi
  lea    D10(%rip),%rsi
  call   <strstr@plt>
  mov    %rax,%rdi
  test   %rax,%rax
  je     L108
  lea    0x10(%rsp),%rsi
  mov    $0x7,%edx
  call   <strncpy@plt>
L108:
  mov    %rbp,%rdi
  lea    D50(%rip),%rsi
  call   <strstr@plt>
  mov    %rax,%rdi
  test   %rax,%rax
  je     L52
  lea    0x9(%rsp),%rsi
  mov    $0x6,%edx
  call   <strncpy@plt>
L52:
  mov    %rbp,%rdi
  lea    D51(%rip),%rsi
  call   <strstr@plt>
  mov    %rax,%rdi
  test   %rax,%rax
  je     L58
  lea    0x9(%rsp),%rsi
  mov    $0x6,%edx
  call   <strncpy@plt>
L58:
  mov    %rbp,%rdi
  lea    D54(%rip),%rsi
  call   <strstr@plt>
  mov    %rax,%rdi
  test   %rax,%rax
  je     L44
  lea    0x4(%rsp),%rsi
  mov    $0x4,%edx
  call   <strncpy@plt>
L44:
  mov    %rbp,%rdi
  lea    D29(%rip),%rsi
  call   <strstr@plt>
  mov    %rax,%rdi
  test   %rax,%rax
  je     L99
  lea    0x4(%rsp),%rsi
  mov    $0x4,%edx
  call   <strncpy@plt>
L99:
  mov    %rbp,%rdi
  call   <strlen@plt>
  mov    %eax,%r8d
  xor    %eax,%eax
  cmp    $0xc,%r8d
  jle    L66
L1:
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L51
  add    $0x20,%rsp
  pop    %rbp
  ret
  nopl   0x0(%rax)
L66:
  lea    D49(%rip),%rdi
  call   <printf@plt>
  mov    $0x1,%eax
  jmp    L1
L51:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: label: D59
data_type: string
name: unpack_data
arguments: label: D10
data_type: string
name: unpack_data
arguments: label: D50
data_type: string
name: unpack_data
arguments: label: D51
data_type: string
name: unpack_data
arguments: label: D54
data_type: string
name: unpack_data
arguments: label: D29
data_type: string
name: unpack_data
arguments: label: D49
data_type: string

tool: D59: select 

tool: D10: Select 

tool: D50:  from 

tool: D51:  From 

tool: D54:  As 

tool: D29:  as 

tool: D49: The SQL statement needs SELECT and FROM keywords with fields and tables.


assistant: ```c
int check_sql_for_select(char *sql) {
  int check = 0;
  char replace1[] = "SELECT ";
  char replace2[] = " FROM ";
  char replace3[] = " AS ";
  char *sp = NULL;
  char *fp = NULL;
  char *ap = NULL;
  if (sql != NULL && strlen(sql) > 12) {
    if ((sp = strstr(sql, "select "))) {
      strncpy(sp, replace1, 7);
    }
    if ((sp = strstr(sql, "Select "))) {
      strncpy(sp, replace1, 7);
    }
    if ((fp = strstr(sql, " from "))) {
      strncpy(fp, replace2, 6);
    }
    if ((fp = strstr(sql, " From "))) {
      strncpy(fp, replace2, 6);
    }
    if ((ap = strstr(sql, " As "))) {
      strncpy(ap, replace3, 4);
    }
    if ((ap = strstr(sql, " as "))) {
      strncpy(ap, replace3, 4);
    }
  }
  if (sql != NULL && strlen(sql) > 12) {
    if (strstr(sql, "SELECT ") && strstr(sql, " FROM")) {
      check = 0;
    }
  } else {
    check = 1;
    printf("The SQL statement needs SELECT and FROM keywords with fields and tables.\n");
  }
  return check;
}
```