user: Translate the below assembly code into C programming language:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x680,%rsp
  mov    %edi,-0x2674(%rbp)
  mov    %rsi,-0x2680(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x2410(%rbp),%rdx
  mov    $0x0,%eax
  mov    $0x7f,%ecx
  mov    %rdx,%rdi
  rep stos %rax,%es:(%rdi)
  mov    %rdi,%rdx
  mov    %eax,(%rdx)
  add    $0x4,%rdx
  lea    -0x24a0(%rbp),%rdx
  mov    $0x0,%eax
  mov    $0x11,%ecx
  mov    %rdx,%rdi
  rep stos %rax,%es:(%rdi)
  lea    -0x1810(%rbp),%rdx
  mov    $0x0,%eax
  mov    $0x7f,%ecx
  mov    %rdx,%rdi
  rep stos %rax,%es:(%rdi)
  mov    %rdi,%rdx
  mov    %eax,(%rdx)
  add    $0x4,%rdx
  lea    -0x1410(%rbp),%rdx
  mov    $0x0,%eax
  mov    $0x7f,%ecx
  mov    %rdx,%rdi
  rep stos %rax,%es:(%rdi)
  mov    %rdi,%rdx
  mov    %eax,(%rdx)
  add    $0x4,%rdx
  lea    -0x1010(%rbp),%rdx
  mov    $0x0,%eax
  mov    $0x7f,%ecx
  mov    %rdx,%rdi
  rep stos %rax,%es:(%rdi)
  mov    %rdi,%rdx
  mov    %eax,(%rdx)
  add    $0x4,%rdx
  lea    -0xc10(%rbp),%rdx
  mov    $0x0,%eax
  mov    $0x7f,%ecx
  mov    %rdx,%rdi
  rep stos %rax,%es:(%rdi)
  mov    %rdi,%rdx
  mov    %eax,(%rdx)
  add    $0x4,%rdx
  lea    -0x810(%rbp),%rdx
  mov    $0x0,%eax
  mov    $0x7f,%ecx
  mov    %rdx,%rdi
  rep stos %rax,%es:(%rdi)
  mov    %rdi,%rdx
  mov    %eax,(%rdx)
  add    $0x4,%rdx
  movl   $0x0,-0x265c(%rbp)
  movq   $0x0,-0x2580(%rbp)
  movq   $0x0,-0x2578(%rbp)
  movq   $0x0,-0x2570(%rbp)
  movq   $0x0,-0x2568(%rbp)
  movq   $0x0,-0x2560(%rbp)
  movq   $0x0,-0x2558(%rbp)
  movq   $0x0,-0x2550(%rbp)
  movq   $0x0,-0x2548(%rbp)
  movl   $0x0,-0x2540(%rbp)
  lea    D199(%rip),%rax
  mov    %rax,%rsi
  lea    D128(%rip),%rax
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x2648(%rbp)
  cmpq   $0x0,-0x2648(%rbp)
  jne    L26
  lea    D178(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    $0x1,%eax
  jmp    L267
L532:
  mov    -0x410(%rbp),%eax
  cmp    $0x23,%eax
  je     L26
  cmpl   $0x3,-0x265c(%rbp)
  jg     L43
  lea    -0x410(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x266c(%rbp)
  mov    -0x266c(%rbp),%eax
  sub    $0x1,%eax
  cltq
  mov    -0x410(%rbp,%rax,4),%eax
  cmp    $0xa,%eax
  jne    L432
  mov    -0x266c(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,-0x266c(%rbp)
  cltq
  movl   $0x0,-0x410(%rbp,%rax,4)
L432:
  mov    -0x266c(%rbp),%eax
  cltq
  movl   $0x0,-0x410(%rbp,%rax,4)
L43:
  cmpl   $0x4,-0x265c(%rbp)
  ja     L183
  mov    -0x265c(%rbp),%eax
  lea    0x0(,%rax,4),%rdx
  lea    D190(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  cltq
  lea    D190(%rip),%rdx
  add    %rdx,%rax
  notrack jmp *%rax
  mov    -0x266c(%rbp),%eax
  lea    0x1(%rax),%edx
  lea    -0x410(%rbp),%rcx
  lea    -0x1410(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  jmp    L115
  mov    -0x266c(%rbp),%eax
  lea    0x1(%rax),%edx
  lea    -0x410(%rbp),%rcx
  lea    -0x1010(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  jmp    L115
  mov    -0x266c(%rbp),%eax
  lea    0x1(%rax),%edx
  lea    -0x410(%rbp),%rcx
  lea    -0xc10(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  jmp    L115
  mov    -0x266c(%rbp),%eax
  lea    0x1(%rax),%edx
  lea    -0x410(%rbp),%rcx
  lea    -0x810(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  jmp    L115
  lea    -0x410(%rbp),%rax
  mov    %rax,%rdi
  call   <atoi@plt>
  mov    %eax,-0x2660(%rbp)
  jmp    L115
L183:
  nop
L115:
  addl   $0x1,-0x265c(%rbp)
L26:
  mov    -0x2648(%rbp),%rdx
  lea    -0x410(%rbp),%rax
  mov    $0xff,%esi
  mov    %rax,%rdi
  call   <fgets@plt>
  test   %rax,%rax
  jne    L532
  mov    -0x2648(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  cmpl   $0x4,-0x265c(%rbp)
  jg     L531
  lea    D346(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    $0x1,%eax
  jmp    L267
L531:
  mov    $0x0,%edi
  call   <mysql_init@plt>
  mov    %rax,-0x2640(%rbp)
  cmpq   $0x0,-0x2640(%rbp)
  je     L49
  mov    -0x2660(%rbp),%edi
  lea    -0xc10(%rbp),%rcx
  lea    -0x1010(%rbp),%rdx
  lea    -0x1410(%rbp),%rsi
  mov    -0x2640(%rbp),%rax
  push   $0x0
  push   $0x0
  mov    %edi,%r9d
  mov    $0x0,%r8d
  mov    %rax,%rdi
  call   <mysql_real_connect@plt>
  add    $0x10,%rsp
  test   %rax,%rax
  je     L49
  lea    -0x810(%rbp),%rdx
  mov    -0x2640(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <mysql_select_db@plt>
  test   %rax,%rax
  jns    L38
  lea    -0x810(%rbp),%rax
  mov    %rax,%rsi
  lea    D300(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    -0x2640(%rbp),%rax
  mov    %rax,%rdi
  call   <mysql_close@plt>
  mov    $0x2,%eax
  jmp    L267
L49:
  mov    -0x2640(%rbp),%rax
  mov    %rax,%rdi
  call   <mysql_error@plt>
  mov    %rax,%rcx
  mov    -0x2660(%rbp),%edx
  lea    -0x1410(%rbp),%rax
  mov    %rax,%rsi
  lea    D207(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    -0x2640(%rbp),%rax
  mov    %rax,%rdi
  call   <mysql_close@plt>
  mov    $0x1,%eax
  jmp    L267
L38:
  lea    D238(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  lea    D368(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  movl   $0x0,-0x2668(%rbp)
  jmp    L387
L87:
  lea    D411(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    -0x2410(%rbp),%rax
  mov    %rax,%rsi
  lea    D36(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  lea    -0x2410(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    $0x10,%eax
  jg     L583
  lea    -0x2410(%rbp),%rdx
  lea    -0x1810(%rbp),%rax
  lea    D162(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  lea    -0x1810(%rbp),%rdx
  mov    -0x2640(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <mysql_query@plt>
  test   %eax,%eax
  jne    L534
  mov    -0x2640(%rbp),%rax
  mov    %rax,%rdi
  call   <mysql_store_result@plt>
  mov    %rax,-0x2630(%rbp)
  mov    -0x2630(%rbp),%rax
  mov    %rax,%rdi
  call   <mysql_num_rows@plt>
  mov    %eax,-0x2658(%rbp)
  cmpl   $0x0,-0x2658(%rbp)
  je     L152
  lea    D46(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    -0x2630(%rbp),%rax
  mov    %rax,%rdi
  call   <mysql_fetch_row@plt>
  mov    %rax,-0x2628(%rbp)
  mov    -0x2630(%rbp),%rax
  mov    %rax,%rdi
  call   <mysql_num_fields@plt>
  mov    %eax,-0x264c(%rbp)
  lea    D195(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  lea    D310(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  movl   $0x0,-0x266c(%rbp)
  jmp    L390
L198:
  mov    -0x266c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x2628(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x266c(%rbp),%eax
  mov    %eax,%esi
  lea    D352(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  addl   $0x1,-0x266c(%rbp)
L390:
  mov    -0x266c(%rbp),%eax
  cmp    -0x264c(%rbp),%eax
  jl     L198
  jmp    L54
L152:
  movl   $0x1,-0x2668(%rbp)
L54:
  mov    -0x2630(%rbp),%rax
  mov    %rax,%rdi
  call   <mysql_free_result@plt>
  jmp    L387
L534:
  lea    D256(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    $0x1,%eax
  jmp    L267
L583:
  lea    D275(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
L387:
  cmpl   $0x0,-0x2668(%rbp)
  je     L87
  lea    -0x2410(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  lea    0x1(%rax),%edx
  lea    -0x2410(%rbp),%rcx
  lea    -0x2620(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    $0x0,%edi
  call   <time@plt>
  mov    %rax,-0x2638(%rbp)
  movl   $0x0,-0x2668(%rbp)
  jmp    L380
L595:
  lea    D317(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    -0x2410(%rbp),%rax
  mov    %rax,%rsi
  lea    D36(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  lea    -0x2410(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    $0x10,%eax
  jle    L491
  lea    -0x2410(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    $0x7,%eax
  jg     L220
L491:
  lea    -0x2410(%rbp),%rcx
  lea    -0x2530(%rbp),%rax
  mov    $0x11,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  lea    D381(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    -0x2410(%rbp),%rax
  mov    %rax,%rsi
  lea    D36(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  lea    -0x2410(%rbp),%rcx
  lea    -0x25d0(%rbp),%rax
  mov    $0x11,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  movl   $0x1,-0x2664(%rbp)
  movl   $0x0,-0x266c(%rbp)
  jmp    L339
L111:
  mov    -0x266c(%rbp),%eax
  cltq
  mov    -0x2530(%rbp,%rax,4),%edx
  mov    -0x266c(%rbp),%eax
  cltq
  mov    -0x25d0(%rbp,%rax,4),%eax
  cmp    %eax,%edx
  je     L125
  movl   $0x0,-0x2664(%rbp)
L125:
  addl   $0x1,-0x266c(%rbp)
L339:
  cmpl   $0xf,-0x266c(%rbp)
  jle    L111
  cmpl   $0x0,-0x2664(%rbp)
  je     L468
  movl   $0x1,-0x2668(%rbp)
  jmp    L380
L468:
  lea    D166(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  jmp    L380
L220:
  lea    D168(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
L380:
  cmpl   $0x0,-0x2668(%rbp)
  je     L595
  movl   $0x0,-0x2668(%rbp)
  jmp    L18
L162:
  lea    D91(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    -0x2410(%rbp),%rax
  mov    %rax,%rsi
  lea    D36(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  lea    -0x2410(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  lea    0x1(%rax),%edx
  lea    -0x2410(%rbp),%rcx
  lea    -0x2010(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  lea    -0x2010(%rbp),%rdx
  lea    -0x1810(%rbp),%rax
  lea    D23(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  lea    -0x1810(%rbp),%rdx
  mov    -0x2640(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <mysql_query@plt>
  test   %eax,%eax
  jne    L199
  mov    -0x2640(%rbp),%rax
  mov    %rax,%rdi
  call   <mysql_store_result@plt>
  mov    %rax,-0x2630(%rbp)
  mov    -0x2630(%rbp),%rax
  mov    %rax,%rdi
  call   <mysql_num_rows@plt>
  mov    %eax,-0x2658(%rbp)
  mov    -0x2630(%rbp),%rax
  mov    %rax,%rdi
  call   <mysql_free_result@plt>
  cmpl   $0x0,-0x2658(%rbp)
  je     L148
  lea    D121(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  jmp    L148
L199:
  lea    D256(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    $0x1,%eax
  jmp    L267
L148:
  cmpl   $0x0,-0x2658(%rbp)
  jne    L18
  lea    D5(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    -0x2410(%rbp),%rax
  mov    %rax,%rsi
  lea    D36(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  lea    -0x2410(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  lea    0x1(%rax),%edx
  lea    -0x2410(%rbp),%rcx
  lea    -0x1c10(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  movl   $0x1,-0x2664(%rbp)
  movl   $0x0,-0x266c(%rbp)
  jmp    L396
L214:
  mov    -0x266c(%rbp),%eax
  cltq
  mov    -0x2010(%rbp,%rax,4),%edx
  mov    -0x266c(%rbp),%eax
  cltq
  mov    -0x1c10(%rbp,%rax,4),%eax
  cmp    %eax,%edx
  je     L317
  movl   $0x0,-0x2664(%rbp)
L317:
  addl   $0x1,-0x266c(%rbp)
L396:
  lea    -0x2010(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    %eax,-0x266c(%rbp)
  jl     L214
  cmpl   $0x0,-0x2664(%rbp)
  je     L335
  movl   $0x1,-0x2668(%rbp)
  jmp    L18
L335:
  lea    D363(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
L18:
  cmpl   $0x0,-0x2668(%rbp)
  je     L162
  lea    -0x1810(%rbp),%rax
  lea    D383(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  lea    -0x1810(%rbp),%rdx
  mov    -0x2640(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <mysql_query@plt>
  test   %eax,%eax
  jne    L365
  mov    -0x2640(%rbp),%rax
  mov    %rax,%rdi
  call   <mysql_store_result@plt>
  mov    %rax,-0x2630(%rbp)
  mov    -0x2630(%rbp),%rax
  mov    %rax,%rdi
  call   <mysql_num_rows@plt>
  mov    %eax,-0x2658(%rbp)
  mov    -0x2630(%rbp),%rax
  mov    %rax,%rdi
  call   <mysql_free_result@plt>
  mov    -0x2658(%rbp),%eax
  mov    %eax,%esi
  lea    D424(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    -0x2638(%rbp),%rax
  mov    %eax,%edx
  mov    $0x91a2b3c5,%eax
  imul   %rdx,%rax
  shr    $0x20,%rax
  shr    $0xb,%eax
  mov    %eax,-0x2654(%rbp)
  lea    -0x2530(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x266c(%rbp)
  mov    -0x2654(%rbp),%edx
  lea    -0x410(%rbp),%rax
  lea    D421(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  lea    -0x2530(%rbp),%rdx
  mov    -0x266c(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    (%rdx,%rax,1),%rcx
  lea    -0x410(%rbp),%rax
  mov    %rax,%rdx
  lea    D402(%rip),%rax
  mov    %rax,%rsi
  mov    %rcx,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  lea    -0x2580(%rbp),%rdx
  lea    -0x2530(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <MDString@plt>
  movl   $0x0,-0x266c(%rbp)
  jmp    L486
L365:
  lea    D256(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    $0x1,%eax
  jmp    L267
L156:
  mov    -0x266c(%rbp),%eax
  cltq
  mov    -0x2580(%rbp,%rax,4),%eax
  mov    -0x266c(%rbp),%edx
  add    %edx,%edx
  lea    -0x24a0(%rbp),%rcx
  movslq %edx,%rdx
  shl    $0x2,%rdx
  add    %rdx,%rcx
  mov    %eax,%edx
  lea    D42(%rip),%rax
  mov    %rax,%rsi
  mov    %rcx,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  addl   $0x1,-0x266c(%rbp)
L486:
  cmpl   $0xf,-0x266c(%rbp)
  jle    L156
  movl   $0x0,-0x2420(%rbp)
  cmpl   $0x0,-0x2658(%rbp)
  jne    L203
  movl   $0x280de81,-0x2650(%rbp)
  mov    -0x2654(%rbp),%r8d
  lea    -0x2010(%rbp),%rdi
  lea    -0x24a0(%rbp),%rcx
  lea    -0x2620(%rbp),%rdx
  lea    -0x1810(%rbp),%rax
  sub    $0x8,%rsp
  mov    -0x2650(%rbp),%esi
  push   %rsi
  mov    %r8d,%r9d
  mov    %rdi,%r8
  lea    D141(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  add    $0x10,%rsp
  jmp    L263
L203:
  mov    -0x2654(%rbp),%edi
  lea    -0x2010(%rbp),%rsi
  lea    -0x24a0(%rbp),%rcx
  lea    -0x2620(%rbp),%rdx
  lea    -0x1810(%rbp),%rax
  mov    %edi,%r9d
  mov    %rsi,%r8
  lea    D92(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
L263:
  lea    -0x1810(%rbp),%rdx
  mov    -0x2640(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <mysql_query@plt>
  test   %eax,%eax
  jne    L165
  lea    D358(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    -0x2640(%rbp),%rax
  mov    %rax,%rdi
  call   <mysql_close@plt>
  mov    $0x0,%eax
  jmp    L267
L165:
  lea    D256(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    $0x1,%eax
L267:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L254
  call   <__stack_chk_fail@plt>
L254:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: tag: D199
type_infered: string
name: retrieve_data
arguments: tag: D128
type_infered: string
name: retrieve_data
arguments: tag: D178
type_infered: string
name: retrieve_data
arguments: tag: D346
type_infered: string
name: retrieve_data
arguments: tag: D300
type_infered: string
name: retrieve_data
arguments: tag: D207
type_infered: string
name: retrieve_data
arguments: tag: D238
type_infered: string
name: retrieve_data
arguments: tag: D368
type_infered: string
name: retrieve_data
arguments: tag: D411
type_infered: string
name: retrieve_data
arguments: tag: D36
type_infered: string
name: retrieve_data
arguments: tag: D162
type_infered: string
name: retrieve_data
arguments: tag: D46
type_infered: string
name: retrieve_data
arguments: tag: D195
type_infered: string
name: retrieve_data
arguments: tag: D310
type_infered: string
name: retrieve_data
arguments: tag: D352
type_infered: string
name: retrieve_data
arguments: tag: D256
type_infered: string
name: retrieve_data
arguments: tag: D275
type_infered: string
name: retrieve_data
arguments: tag: D317
type_infered: string
name: retrieve_data
arguments: tag: D381
type_infered: string
name: retrieve_data
arguments: tag: D166
type_infered: string
name: retrieve_data
arguments: tag: D168
type_infered: string
name: retrieve_data
arguments: tag: D91
type_infered: string
name: retrieve_data
arguments: tag: D23
type_infered: string
name: retrieve_data
arguments: tag: D121
type_infered: string
name: retrieve_data
arguments: tag: D5
type_infered: string
name: retrieve_data
arguments: tag: D363
type_infered: string
name: retrieve_data
arguments: tag: D383
type_infered: string
name: retrieve_data
arguments: tag: D424
type_infered: string
name: retrieve_data
arguments: tag: D421
type_infered: string
name: retrieve_data
arguments: tag: D402
type_infered: string
name: retrieve_data
arguments: tag: D42
type_infered: string
name: retrieve_data
arguments: tag: D141
type_infered: string
name: retrieve_data
arguments: tag: D92
type_infered: string
name: retrieve_data
arguments: tag: D358
type_infered: string

tool: D199: r

tool: D128: tethealla.ini

tool: D178: The configuration file tethealla.ini appears to be missing.

tool: D346: tethealla.ini seems to be corrupted.

tool: D300: Can't select the %s database !


tool: D207: Can't connect to the mysql server (%s) on port %d !
mysql_error = %s


tool: D238: Tethealla Server Account Addition

tool: D368: -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

tool: D411: New account's username: 

tool: D36: %s

tool: D162: SELECT * from account_data WHERE username='%s'

tool: D46: There is already an account by that name on the server.

tool: D195: Row data:

tool: D310: -=-=-=-=-

tool: D352: column %u = %s


tool: D256: Couldn't query the MySQL server.

tool: D275: Desired account name length should be 16 characters or less.

tool: D317: New account's password: 

tool: D381: Verify password: 

tool: D166: The input passwords did not match.

tool: D168: Desired password length should be 16 characters or less.

tool: D91: New account's e-mail address: 

tool: D23: SELECT * from account_data WHERE email='%s'

tool: D121: That e-mail address has already been registered to an account.

tool: D5: Verify e-mail address: 

tool: D363: The input e-mail addresses did not match.

tool: D383: SELECT * from account_data

tool: D424: There are %i accounts already registered on the server.


tool: D421: %d

tool: D402: _%s_salt

tool: D42: %02x

tool: D141: INSERT into account_data (username,password,email,regtime,guildcard,isgm,isactive) VALUES ('%s','%s','%s','%u','%u','1','1')

tool: D92: INSERT into account_data (username,password,email,regtime,isactive) VALUES ('%s','%s','%s','%u','1')

tool: D358: Account successfully added to the database!

assistant: ```c
int main(int32_t argc, int8_t *argv[]) {
  int8_t inputstr[255] = {0};
  int8_t username[17];
  int8_t password[34];
  int8_t password_check[17];
  int8_t md5password[34] = {0};
  int8_t email[255];
  int8_t email_check[255];
  uint8_t ch;
  time_t regtime;
  uint32_t reg_seconds;
  uint8_t max_fields;
  MYSQL *myData;
  int8_t myQuery[255] = {0};
  MYSQL_ROW myRow;
  MYSQL_RES *myResult;
  int32_t num_rows, pw_ok, pw_same;
  uint32_t guildcard_number;
  int8_t mySQL_Host[255] = {0};
  int8_t mySQL_Username[255] = {0};
  int8_t mySQL_Password[255] = {0};
  int8_t mySQL_Database[255] = {0};
  uint32_t mySQL_Port;
  int32_t config_index = 0;
  int8_t config_data[255];
  uint8_t MDBuffer[17] = {0};
  FILE *fp;
  if ((fp = fopen("tethealla.ini", "r")) == NULL) {
    printf("The configuration file tethealla.ini appears to be missing.\n");
    return 1;
  } else
    while (fgets(&config_data[0], 255, fp) != NULL) {
      if (config_data[0] != 0x23) {
        if (config_index < 0x04) {
          ch = strlen(&config_data[0]);
          if (config_data[ch - 1] == 0x0A)
            config_data[ch--] = 0x00;
          config_data[ch] = 0;
        }
        switch (config_index) {
        case 0x00:
          memcpy(&mySQL_Host[0], &config_data[0], ch + 1);
          break;
        case 0x01:
          memcpy(&mySQL_Username[0], &config_data[0], ch + 1);
          break;
        case 0x02:
          memcpy(&mySQL_Password[0], &config_data[0], ch + 1);
          break;
        case 0x03:
          memcpy(&mySQL_Database[0], &config_data[0], ch + 1);
          break;
        case 0x04:
          mySQL_Port = atoi(&config_data[0]);
          break;
        default:
          break;
        }
        config_index++;
      }
    }
  fclose(fp);
  if (config_index < 5) {
    printf("tethealla.ini seems to be corrupted.\n");
    return 1;
  }
  if ((myData = mysql_init((MYSQL *)0)) && mysql_real_connect(myData, &mySQL_Host[0], &mySQL_Username[0], &mySQL_Password[0], NULL, mySQL_Port, NULL, 0)) {
    if (mysql_select_db(myData, &mySQL_Database[0]) < 0) {
      printf("Can't select the %s database !\n", mySQL_Database);
      mysql_close(myData);
      return 2;
    }
  } else {
    printf("Can't connect to the mysql server (%s) on port %d !\nmysql_error = %s\n", mySQL_Host, mySQL_Port, mysql_error(myData));
    mysql_close(myData);
    return 1;
  }
  printf("Tethealla Server Account Addition\n");
  printf("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n");
  pw_ok = 0;
  while (!pw_ok) {
    printf("New account's username: ");
    scanf("%s", inputstr);
    if (strlen(inputstr) < 17) {
      sprintf(&myQuery[0], "SELECT * from account_data WHERE username='%s'", inputstr);
      if (!mysql_query(myData, &myQuery[0])) {
        myResult = mysql_store_result(myData);
        num_rows = (int)mysql_num_rows(myResult);
        if (num_rows) {
          printf("There is already an account by that name on the server.\n");
          myRow = mysql_fetch_row(myResult);
          max_fields = mysql_num_fields(myResult);
          printf("Row data:\n");
          printf("-=-=-=-=-\n");
          for (ch = 0; ch < max_fields; ch++)
            printf("column %u = %s\n", ch, myRow[ch]);
        } else
          pw_ok = 1;
        mysql_free_result(myResult);
      } else {
        printf("Couldn't query the MySQL server.\n");
        return 1;
      }
    } else
      printf("Desired account name length should be 16 characters or less.\n");
  }
  memcpy(&username[0], &inputstr[0], strlen(inputstr) + 1);
  regtime = time(NULL);
  pw_ok = 0;
  while (!pw_ok) {
    printf("New account's password: ");
    scanf("%s", inputstr);
    if ((strlen(inputstr) < 17) || (strlen(inputstr) < 8)) {
      memcpy(&password[0], &inputstr[0], 17);
      printf("Verify password: ");
      scanf("%s", inputstr);
      memcpy(&password_check[0], &inputstr[0], 17);
      pw_same = 1;
      for (ch = 0; ch < 16; ch++) {
        if (password[ch] != password_check[ch])
          pw_same = 0;
      }
      if (pw_same)
        pw_ok = 1;
      else
        printf("The input passwords did not match.\n");
    } else
      printf("Desired password length should be 16 characters or less.\n");
  }
  pw_ok = 0;
  while (!pw_ok) {
    printf("New account's e-mail address: ");
    scanf("%s", inputstr);
    memcpy(&email[0], &inputstr[0], strlen(inputstr) + 1);
    sprintf(&myQuery[0], "SELECT * from account_data WHERE email='%s'", email);
    if (!mysql_query(myData, &myQuery[0])) {
      myResult = mysql_store_result(myData);
      num_rows = (int)mysql_num_rows(myResult);
      mysql_free_result(myResult);
      if (num_rows)
        printf("That e-mail address has already been registered to an account.\n");
    } else {
      printf("Couldn't query the MySQL server.\n");
      return 1;
    }
    if (!num_rows) {
      printf("Verify e-mail address: ");
      scanf("%s", inputstr);
      memcpy(&email_check[0], &inputstr[0], strlen(inputstr) + 1);
      pw_same = 1;
      for (ch = 0; ch < strlen(email); ch++) {
        if (email[ch] != email_check[ch])
          pw_same = 0;
      }
      if (pw_same)
        pw_ok = 1;
      else
        printf("The input e-mail addresses did not match.\n");
    }
  }
  sprintf(&myQuery[0], "SELECT * from account_data");
  if (!mysql_query(myData, &myQuery[0])) {
    myResult = mysql_store_result(myData);
    num_rows = (int)mysql_num_rows(myResult);
    mysql_free_result(myResult);
    printf("There are %i accounts already registered on the server.\n", num_rows);
  } else {
    printf("Couldn't query the MySQL server.\n");
    return 1;
  }
  reg_seconds = (unsigned)regtime / 3600L;
  ch = strlen(&password[0]);
  sprintf(&config_data[0], "%d", reg_seconds);
  sprintf(&password[ch], "_%s_salt", &config_data[0]);
  MDString(&password[0], &MDBuffer[0]);
  for (ch = 0; ch < 16; ch++)
    sprintf(&md5password[ch * 2], "%02x", (uint8_t)MDBuffer[ch]);
  md5password[32] = 0;
  if (!num_rows) {
    guildcard_number = 42000001;
    sprintf(&myQuery[0], "INSERT into account_data (username,password,email,regtime,guildcard,isgm,isactive) VALUES ('%s','%s','%s','%u','%u','1','1')", username, md5password, email, reg_seconds, guildcard_number);
  } else {
    sprintf(&myQuery[0], "INSERT into account_data (username,password,email,regtime,isactive) VALUES ('%s','%s','%s','%u','1')", username, md5password, email, reg_seconds);
  }
  if (!mysql_query(myData, &myQuery[0]))
    printf("Account successfully added to the database!");
  else {
    printf("Couldn't query the MySQL server.\n");
    return 1;
  }
  mysql_close(myData);
  return 0;
}
```