user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x2c8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x22b8(%rsp)
  xor    %eax,%eax
  mov    $0x1,%edi
  call   <mksfs@plt>
  test   %rax,%rax
  jne    L94
L108:
  lea    D4(%rip),%rdi
  call   <puts@plt>
  lea    D235(%rip),%rdi
  call   <puts@plt>
  mov    $0x0,%eax
  call   <sfs_ls@plt>
  lea    0x50(%rsp),%rax
  lea    0x867(%rsp),%rdx
L91:
  movb   $0x61,(%rax)
  add    $0x1,%rax
  cmp    %rdx,%rax
  jne    L91
  lea    0x870(%rsp),%rax
  lea    0x12a7(%rsp),%rdx
L48:
  movb   $0x62,(%rax)
  add    $0x1,%rax
  cmp    %rdx,%rax
  jne    L48
  lea    D46(%rip),%rdi
  call   <sfs_fopen@plt>
  mov    %eax,%ebp
  lea    D296(%rip),%rdi
  call   <sfs_fopen@plt>
  mov    %eax,%ebx
  lea    D215(%rip),%rdi
  call   <sfs_fopen@plt>
  mov    %eax,%r13d
  lea    D373(%rip),%rdi
  call   <puts@plt>
  mov    %r13d,%ecx
  mov    %ebx,%edx
  mov    %ebp,%esi
  lea    D67(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D220(%rip),%rdi
  call   <puts@plt>
  mov    $0x0,%eax
  call   <sfs_ls@plt>
  mov    $0x817,%esi
  lea    D316(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    0x50(%rsp),%rsi
  mov    $0x817,%edx
  mov    %ebx,%edi
  call   <sfs_fwrite@plt>
  mov    %eax,%esi
  lea    D175(%rip),%r12
  mov    %r12,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0xa37,%esi
  lea    D323(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    0x870(%rsp),%rsi
  mov    $0xa37,%edx
  mov    %ebp,%edi
  call   <sfs_fwrite@plt>
  mov    %eax,%esi
  mov    %r12,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D130(%rip),%rdi
  call   <puts@plt>
  mov    $0x0,%eax
  call   <sfs_ls@plt>
  lea    D35(%rip),%rdi
  call   <puts@plt>
  mov    %ebp,%edi
  call   <sfs_fclose@plt>
  test   %eax,%eax
  je     L44
  lea    D314(%rip),%rdi
  call   <puts@plt>
L30:
  lea    D318(%rip),%rdi
  call   <puts@plt>
  mov    $0x0,%eax
  call   <sfs_ls@plt>
  lea    D306(%rip),%rdi
  call   <puts@plt>
  lea    D46(%rip),%rdi
  call   <sfs_fopen@plt>
  mov    %eax,%ebp
  mov    %eax,%esi
  lea    D104(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D21(%rip),%rdi
  call   <puts@plt>
  mov    %ebx,%edi
  call   <sfs_fclose@plt>
  test   %eax,%eax
  je     L64
  lea    D314(%rip),%rdi
  call   <puts@plt>
L14:
  lea    D296(%rip),%rdi
  call   <sfs_remove@plt>
  test   %eax,%eax
  je     L60
  mov    %eax,%esi
  lea    D364(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L23:
  lea    D376(%rip),%rdi
  call   <puts@plt>
  mov    $0x0,%eax
  call   <sfs_ls@plt>
  lea    D198(%rip),%rdi
  call   <puts@plt>
  lea    D149(%rip),%rdi
  call   <puts@plt>
  lea    D131(%rip),%rdi
  call   <puts@plt>
  lea    0x12b0(%rsp),%r12
  mov    $0x3e8,%edx
  mov    %r12,%rsi
  mov    %ebp,%edi
  call   <sfs_fread@plt>
  mov    %eax,%ebx
  mov    %eax,%esi
  lea    D222(%rip),%r14
  mov    %r14,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movslq %ebx,%rsi
  add    %r12,%rsi
  mov    $0x4b0,%edx
  mov    %ebp,%edi
  call   <sfs_fread@plt>
  mov    %eax,%r15d
  mov    %eax,%esi
  mov    %r14,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  add    %r15d,%ebx
  movslq %ebx,%rsi
  add    %r12,%rsi
  mov    $0x258,%edx
  mov    %ebp,%edi
  call   <sfs_fread@plt>
  mov    %eax,%ebp
  mov    %eax,%esi
  mov    %r14,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  add    %ebp,%ebx
  movslq %ebx,%rax
  movb   $0x0,0x12b0(%rsp,%rax,1)
  mov    %r12,%rsi
  lea    D405(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D320(%rip),%rdi
  call   <puts@plt>
  lea    D24(%rip),%rdi
  call   <puts@plt>
  mov    %ebx,%edx
  mov    %r12,%rsi
  mov    %r13d,%edi
  call   <sfs_fwrite@plt>
  lea    D309(%rip),%rdi
  call   <puts@plt>
  mov    $0x0,%eax
  call   <sfs_ls@plt>
  lea    D337(%rip),%rdi
  call   <puts@plt>
  mov    $0x0,%eax
  call   <sfs_clean@plt>
  lea    D236(%rip),%rdi
  call   <puts@plt>
  lea    D300(%rip),%rdi
  call   <puts@plt>
  mov    $0x0,%edi
  call   <mksfs@plt>
  lea    D117(%rip),%rdi
  call   <puts@plt>
  mov    $0x0,%eax
  call   <sfs_ls@plt>
  lea    D46(%rip),%rdi
  call   <sfs_fopen@plt>
  mov    %eax,%ebx
  test   %eax,%eax
  jns    L135
L87:
  mov    %rsp,%rax
  lea    0x50(%rsp),%rdx
L88:
  movb   $0x30,(%rax)
  add    $0x1,%rax
  cmp    %rdx,%rax
  jne    L88
  mov    %rsp,%rsi
  mov    $0x4f,%edx
  mov    %ebx,%edi
  call   <sfs_fwrite@plt>
  mov    %eax,%esi
  lea    D56(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x0,%eax
  call   <sfs_ls@plt>
  lea    0x12b0(%rsp),%rbp
  mov    $0xffe,%edx
  mov    %rbp,%rsi
  mov    %ebx,%edi
  call   <sfs_fread@plt>
  mov    %eax,%esi
  cltq
  movb   $0x0,0x12b0(%rsp,%rax,1)
  lea    D140(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    %rbp,%rdi
  call   <puts@plt>
  mov    0x22b8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L118
  mov    $0x0,%eax
  add    $0x22c8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L94:
  lea    D70(%rip),%rdi
  call   <puts@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L108
L44:
  lea    D263(%rip),%rdi
  call   <puts@plt>
  jmp    L30
L64:
  lea    D263(%rip),%rdi
  call   <puts@plt>
  jmp    L14
L60:
  lea    D353(%rip),%rdi
  call   <puts@plt>
  jmp    L23
L135:
  mov    %eax,%esi
  lea    D102(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L87
L118:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: tag: D4
type_infered: string
name: extract_symbolic_data
arguments: tag: D235
type_infered: string
name: extract_symbolic_data
arguments: tag: D46
type_infered: string
name: extract_symbolic_data
arguments: tag: D296
type_infered: string
name: extract_symbolic_data
arguments: tag: D215
type_infered: string
name: extract_symbolic_data
arguments: tag: D373
type_infered: string
name: extract_symbolic_data
arguments: tag: D67
type_infered: string
name: extract_symbolic_data
arguments: tag: D220
type_infered: string
name: extract_symbolic_data
arguments: tag: D316
type_infered: string
name: extract_symbolic_data
arguments: tag: D175
type_infered: string
name: extract_symbolic_data
arguments: tag: D323
type_infered: string
name: extract_symbolic_data
arguments: tag: D130
type_infered: string
name: extract_symbolic_data
arguments: tag: D35
type_infered: string
name: extract_symbolic_data
arguments: tag: D314
type_infered: string
name: extract_symbolic_data
arguments: tag: D318
type_infered: string
name: extract_symbolic_data
arguments: tag: D306
type_infered: string
name: extract_symbolic_data
arguments: tag: D104
type_infered: string
name: extract_symbolic_data
arguments: tag: D21
type_infered: string
name: extract_symbolic_data
arguments: tag: D364
type_infered: string
name: extract_symbolic_data
arguments: tag: D376
type_infered: string
name: extract_symbolic_data
arguments: tag: D198
type_infered: string
name: extract_symbolic_data
arguments: tag: D149
type_infered: string
name: extract_symbolic_data
arguments: tag: D131
type_infered: string
name: extract_symbolic_data
arguments: tag: D222
type_infered: string
name: extract_symbolic_data
arguments: tag: D405
type_infered: string
name: extract_symbolic_data
arguments: tag: D320
type_infered: string
name: extract_symbolic_data
arguments: tag: D24
type_infered: string
name: extract_symbolic_data
arguments: tag: D309
type_infered: string
name: extract_symbolic_data
arguments: tag: D337
type_infered: string
name: extract_symbolic_data
arguments: tag: D236
type_infered: string
name: extract_symbolic_data
arguments: tag: D300
type_infered: string
name: extract_symbolic_data
arguments: tag: D117
type_infered: string
name: extract_symbolic_data
arguments: tag: D56
type_infered: string
name: extract_symbolic_data
arguments: tag: D140
type_infered: string
name: extract_symbolic_data
arguments: tag: D70
type_infered: string
name: extract_symbolic_data
arguments: tag: D263
type_infered: string
name: extract_symbolic_data
arguments: tag: D353
type_infered: string
name: extract_symbolic_data
arguments: tag: D102
type_infered: string

tool: D4: Currently no files have been created.

tool: D235: We run ls() : 

tool: D46: File1

tool: D296: File2

tool: D215: big_file_number3.txt

tool: D373: Now, 3 files have been created.


tool: D67: The file descriptor ids are : %d %d %d


tool: D220: We run ls():


tool: D316: 
 Now we will write %d a's into the second file


tool: D175: Result : %d bytes written


tool: D323: And we will write %d b's into the 1st file


tool: D130: And now, ls() : 


tool: D35: Now, I will close file 'File1'. sfs_fclose returns -1 on error and 0 on success

tool: D314: Invalid filedescriptor

tool: D318: We do ls() : 


tool: D306: Now we open the file that we just closed.

tool: D104: The new file descriptor is %d 


tool: D21: Now we close and then remove File2 from the disk

tool: D364: %d Error in removal

tool: D376: 
Now we do ls() : 

tool: D198: Now it's time to read stuff that was copied inside File1

tool: D149: First let's read 1000 bytes, then 1200, and then 600

tool: D131: sfs_fread return the number of bytes that were read.

tool: D222: %d bytes read.


tool: D405: What we have read: 
%s


tool: D320: It doesn't read past EOF.

tool: D24: We will now write what we have read into big_file_number3.txt

tool: D309: And now, we ls() : 

tool: D337: Now we reset the filesystem

tool: D236: FileSystem Reset

tool: D300: We want to reload the disk

tool: D117: Filesystem reloaded. We do ls 

tool: D56: %d bytes written to file File1.


tool: D140: Print what we have read : %d bytes


tool: D70: Error in initializing the disk

tool: D263: Success!

tool: D353: Success! file was removed

tool: D102: File File1 opened with success, fdesc id: %d


assistant: ```c
int main(void) {
  int i;
  char as[2048 + 23];
  char bs[2048 + 567];
  if (mksfs(1)) {
    printf("Error in initializing the disk\n");
    exit(1);
  }
  printf("Currently no files have been created.\n");
  printf("We run ls() : \n");
  sfs_ls();
  for (i = 0; i < 2048 + 23; i++) {
    as[i] = 'a';
  }
  for (i = 0; i < 2048 + 567; i++) {
    bs[i] = 'b';
  }
  int file1 = sfs_fopen("File1");
  int file2 = sfs_fopen("File2");
  int file3 = sfs_fopen("big_file_number3.txt");
  printf("Now, 3 files have been created.\n\n");
  printf("The file descriptor ids are : %d %d %d\n", file1, file2, file3);
  printf("We run ls():\n\n");
  sfs_ls();
  printf("\n Now we will write %d a's into the second file\n", 2048 + 23);
  int wr_result = sfs_fwrite(file2, &as[0], 2048 + 23);
  printf("Result : %d bytes written\n", wr_result);
  printf("And we will write %d b's into the 1st file\n", 2048 + 567);
  wr_result = sfs_fwrite(file1, &bs[0], 2048 + 567);
  printf("Result : %d bytes written\n", wr_result);
  printf("And now, ls() : \n\n");
  sfs_ls();
  printf("Now, I will close file 'File1'. sfs_fclose returns -1 on error and 0 on success\n");
  int fclosereturn = sfs_fclose(file1);
  if (fclosereturn) {
    printf("Invalid filedescriptor\n");
  } else {
    printf("Success!\n");
  }
  printf("We do ls() : \n\n");
  sfs_ls();
  printf("Now we open the file that we just closed.\n");
  file1 = sfs_fopen("File1");
  printf("The new file descriptor is %d \n", file1);
  printf("Now we close and then remove File2 from the disk\n");
  fclosereturn = sfs_fclose(file2);
  if (fclosereturn) {
    printf("Invalid filedescriptor\n");
  } else {
    printf("Success!\n");
  }
  int removeres = sfs_remove("File2");
  if (removeres) {
    printf("%d Error in removal", removeres);
  } else {
    printf("Success! file was removed\n");
  }
  printf("\nNow we do ls() : \n");
  sfs_ls();
  char scrap_book[2 * 2048];
  printf("Now it's time to read stuff that was copied inside File1\n");
  printf("First let's read 1000 bytes, then 1200, and then 600\n");
  printf("sfs_fread return the number of bytes that were read.\n");
  int pos;
  int read_res = sfs_fread(file1, &scrap_book[0], 1000);
  printf("%d bytes read.\n", read_res);
  pos = pos + read_res;
  read_res = sfs_fread(file1, &scrap_book[pos], 1200);
  printf("%d bytes read.\n", read_res);
  pos = pos + read_res;
  read_res = sfs_fread(file1, &scrap_book[pos], 600);
  printf("%d bytes read.\n", read_res);
  pos = pos + read_res;
  scrap_book[pos] = '\0';
  printf("What we have read: \n%s\n", &scrap_book[0]);
  printf("It doesn't read past EOF.\n");
  printf("We will now write what we have read into big_file_number3.txt\n");
  sfs_fwrite(file3, &scrap_book[0], pos);
  printf("And now, we ls() : \n");
  sfs_ls();
  printf("Now we reset the filesystem\n");
  sfs_clean();
  printf("FileSystem Reset\n");
  printf("We want to reload the disk\n");
  mksfs(0);
  printf("Filesystem reloaded. We do ls \n");
  sfs_ls();
  int open_result = sfs_fopen("File1");
  if (open_result >= 0) {
    printf("File File1 opened with success, fdesc id: %d\n", open_result);
  }
  char test5[80];
  for (i = 0; i < 80; i++) {
    test5[i] = '0';
  }
  wr_result = sfs_fwrite(open_result, &test5[0], 79);
  printf("%d bytes written to file File1.\n", wr_result);
  sfs_ls();
  read_res = sfs_fread(open_result, &scrap_book[0], 2 * 2048 - 2);
  scrap_book[read_res] = '\0';
  printf("Print what we have read : %d bytes\n", read_res);
  printf("%s\n", &scrap_book[0]);
}
```