user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<main>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    D37(%rip),%rbx
  mov    %rbx,%rdi
  call   <print_text@plt>
  mov    $0xe,%esi
  mov    %rbx,%rdi
  call   <buf1@plt>
  mov    %rax,%rbp
  mov    $0xe,%esi
  mov    %rbx,%rdi
  call   <buf2@plt>
  mov    %rax,%rbx
  mov    %rbp,%rsi
  lea    D40(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    %rbx,%rsi
  lea    D27(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x3,%esi
  lea    D39(%rip),%rbx
  mov    %rbx,%rdi
  call   <ptr@plt>
  mov    %rax,%rsi
  lea    D47(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    %rsp,%r13
  mov    $0x3,%edx
  mov    %rbx,%rsi
  mov    %r13,%rdi
  call   <strncpy@plt>
  movb   $0x0,0x3(%rsp)
  lea    0x4(%rsp),%r12
  mov    $0x3,%edx
  lea    0x3(%rbx),%rbp
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <strncpy@plt>
  movb   $0x0,0x7(%rsp)
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <index@plt>
  mov    %eax,%esi
  lea    D50(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    %rbx,%rsi
  lea    D23(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    %rbp,%rsi
  lea    D32(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    %r13,%rsi
  lea    D93(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    %r12,%rsi
  lea    D43(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L1
  mov    $0x0,%eax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L1:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: label: D37
type_infered: string
name: read_data
arguments: label: D40
type_infered: string
name: read_data
arguments: label: D27
type_infered: string
name: read_data
arguments: label: D39
type_infered: string
name: read_data
arguments: label: D47
type_infered: string
name: read_data
arguments: label: D50
type_infered: string
name: read_data
arguments: label: D23
type_infered: string
name: read_data
arguments: label: D32
type_infered: string
name: read_data
arguments: label: D93
type_infered: string
name: read_data
arguments: label: D43
type_infered: string

tool: D37: Mary had a little lamb, its fleece was white as snow.

tool: D40: Buffer1: %s 


tool: D27: Buffer2: %s 


tool: D39: obsidian

tool: D47: Ptr: %s 


tool: D50: Index: %d 


tool: D23: Foo: %s 


tool: D32: Bar: %s 


tool: D93: Baz: %s 


tool: D43: Middle: %s 


assistant: ```c
int main() {
  char *text = "Mary had a little lamb, its fleece was white as snow.";
  print_text(text);
  char *buffer1 = buf1(text, 14);
  char *buffer2 = buf2(text, 14);
  printf("Buffer1: %s \n", buffer1);
  printf("Buffer2: %s \n", buffer2);
  char *test = ptr("obsidian", 3);
  printf("Ptr: %s \n", test);
  char *foo = "obsidian";
  char *bar = foo + 3;
  char baz[4];
  strncpy(baz, foo, 3);
  baz[3] = 0;
  char middle[4];
  strncpy(middle, bar, 3);
  middle[3] = 0;
  int myindex = index(foo, bar);
  printf("Index: %d \n", myindex);
  printf("Foo: %s \n", foo);
  printf("Bar: %s \n", bar);
  printf("Baz: %s \n", baz);
  printf("Middle: %s \n", middle);
  return 0;
}
```