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

```asm
<Call_C_Arg_Foreign_L>:
  endbr64
  push   %r13
  push   %r12
  mov    %edx,%r12d
  push   %rbp
  mov    %esi,%ebp
  push   %rbx
  mov    %edi,%ebx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  cmp    $0x7,%edi
  jg     L13
  lea    0x4(%rsp),%r13
  lea    0x3(%rdi),%edx
  lea    D98(%rip),%rsi
  mov    %r13,%rdi
  call   <sprintf@plt>
L27:
  shl    $0x2,%r12d
  xor    %eax,%eax
  lea    D35(%rip),%rsi
  mov    %r13,%rdx
  mov    %r12d,%ecx
  lea    D18(%rip),%rdi
  call   <Inst_Printf@plt>
  test   %ebp,%ebp
  je     L15
  xor    %eax,%eax
  mov    %r12d,%r8d
  mov    %r13,%rcx
  mov    %r13,%rdx
  lea    D72(%rip),%rsi
  lea    D39(%rip),%rdi
  call   <Inst_Printf@plt>
  cmp    $0x7,%ebx
  jg     L20
L52:
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L56
  add    $0x18,%rsp
  mov    $0x1,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax,%rax,1)
L13:
  lea    0x4(%rsp),%r13
  lea    D77(%rip),%rsi
  mov    %r13,%rdi
  call   <strcpy@plt>
  jmp    L27
  nopl   0x0(%rax)
L15:
  xor    %eax,%eax
  mov    %r13,%r8
  mov    %r12d,%ecx
  mov    %r13,%rdx
  lea    D79(%rip),%rsi
  lea    D60(%rip),%rdi
  call   <Inst_Printf@plt>
  cmp    $0x7,%ebx
  jle    L52
L20:
  lea    0x18(,%rbx,4),%ecx
  mov    %r13,%rdx
  lea    D2(%rip),%rsi
  xor    %eax,%eax
  lea    D85(%rip),%rdi
  call   <Inst_Printf@plt>
  jmp    L52
L56:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_tag: D98
data_type: string
name: read_data
arguments: data_tag: D35
data_type: string
name: read_data
arguments: data_tag: D18
data_type: string
name: read_data
arguments: data_tag: D72
data_type: string
name: read_data
arguments: data_tag: D39
data_type: string
name: read_data
arguments: data_tag: D77
data_type: string
name: read_data
arguments: data_tag: D79
data_type: string
name: read_data
arguments: data_tag: D60
data_type: string
name: read_data
arguments: data_tag: D2
data_type: string
name: read_data
arguments: data_tag: D85
data_type: string

tool: D98: r%d

tool: D35: %s,0,ha16(_pl_foreign_long+%d)

tool: D18: addis

tool: D72: %s,%s,lo16(_pl_foreign_long+%d)

tool: D39: addi

tool: D77: r11

tool: D79: %s,lo16(_pl_foreign_long+%d)(%s)

tool: D60: lwz

tool: D2: %s,%d(r1)

tool: D85: stw

assistant: ```c
int Call_C_Arg_Foreign_L(int offset, int adr_of, int index) {
  {
    char r[4];
    if (offset < 8)
      sprintf(r,
              "r"
              "%d",
              offset + 3);
    else
      strcpy(r, "r"
                "11");
    ;
    Inst_Printf("addis",
                "%s,0,"
                "ha16("
                "_"
                "pl_foreign_long+%d"
                ")",
                r, index * 4);
    if (adr_of)
      Inst_Printf("addi",
                  "%s,%s,"
                  "lo16("
                  "_"
                  "pl_foreign_long+%d"
                  ")",
                  r, r, index * 4);
    else
      Inst_Printf("lwz",
                  "%s,"
                  "lo16("
                  "_"
                  "pl_foreign_long+%d"
                  ")"
                  "(%s)",
                  r, index * 4, r);
    if (offset >= 8)
      Inst_Printf("stw",
                  "%s,%d("
                  "r"
                  "1"
                  ")",
                  r, offset * 4 + 24);
  };
  return 1;
}
```