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

```asm
<check_sql_for_select>:
  endbr64
  push   %rbx
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  movabs $0x205443454c4553,%rax
  mov    %rax,0x10(%rsp)
  movl   $0x4f524620,0x9(%rsp)
  movw   $0x204d,0xd(%rsp)
  movb   $0x0,0xf(%rsp)
  movl   $0x20534120,0x4(%rsp)
  movb   $0x0,0x8(%rsp)
  test   %rdi,%rdi
  je     L51
  mov    %rdi,%rbx
  call   <strlen@plt>
  cmp    $0xc,%eax
  jle    L8
  lea    D23(%rip),%rsi
  mov    %rbx,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L1
  lea    0x10(%rsp),%rsi
  mov    $0x7,%edx
  mov    %rax,%rdi
  call   <strncpy@plt>
L1:
  lea    D42(%rip),%rsi
  mov    %rbx,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L81
  lea    0x10(%rsp),%rsi
  mov    $0x7,%edx
  mov    %rax,%rdi
  call   <strncpy@plt>
L81:
  lea    D2(%rip),%rsi
  mov    %rbx,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L20
  lea    0x9(%rsp),%rsi
  mov    $0x6,%edx
  mov    %rax,%rdi
  call   <strncpy@plt>
L20:
  lea    D51(%rip),%rsi
  mov    %rbx,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L58
  lea    0x9(%rsp),%rsi
  mov    $0x6,%edx
  mov    %rax,%rdi
  call   <strncpy@plt>
L58:
  lea    D33(%rip),%rsi
  mov    %rbx,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L45
  lea    0x4(%rsp),%rsi
  mov    $0x4,%edx
  mov    %rax,%rdi
  call   <strncpy@plt>
L45:
  lea    D47(%rip),%rsi
  mov    %rbx,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L8
  lea    0x4(%rsp),%rsi
  mov    $0x4,%edx
  mov    %rax,%rdi
  call   <strncpy@plt>
L8:
  mov    %rbx,%rdi
  call   <strlen@plt>
  mov    %eax,%edx
  mov    $0x0,%eax
  cmp    $0xc,%edx
  jg     L44
L51:
  lea    D60(%rip),%rdi
  call   <printf@plt>
  mov    $0x1,%eax
L44:
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L90
  add    $0x20,%rsp
  pop    %rbx
  ret
L90:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_label: D23
data_type: string
name: retrieve_data
arguments: data_label: D42
data_type: string
name: retrieve_data
arguments: data_label: D2
data_type: string
name: retrieve_data
arguments: data_label: D51
data_type: string
name: retrieve_data
arguments: data_label: D33
data_type: string
name: retrieve_data
arguments: data_label: D47
data_type: string
name: retrieve_data
arguments: data_label: D60
data_type: string

tool: D23: select 

tool: D42: Select 

tool: D2:  from 

tool: D51:  From 

tool: D33:  As 

tool: D47:  as 

tool: D60: 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;
}
```