user: 请将以下的汇编代码转换成C语言代码：

```asm
<AddAttributesToDisplayOfCurrentMetaMode>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x368,%rsp
  mov    %rdi,-0x358(%rbp)
  mov    %esi,-0x35c(%rbp)
  mov    %edx,-0x360(%rbp)
  mov    %rcx,-0x368(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x18(%rbp)
  xor    %eax,%eax
  movq   $0x0,-0x340(%rbp)
  movq   $0x0,-0x328(%rbp)
  movq   $0x0,-0x330(%rbp)
  movl   $0x1,-0x350(%rbp)
  lea    -0x340(%rbp),%rdx
  mov    -0x35c(%rbp),%esi
  mov    -0x358(%rbp),%rax
  mov    %rdx,%r8
  mov    $0x2d,%ecx
  mov    $0x0,%edx
  mov    %rax,%rdi
  call   <XNVCTRLQueryStringAttribute@plt>
  mov    -0x340(%rbp),%rax
  lea    D56(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  mov    %rax,-0x328(%rbp)
  addq   $0x2,-0x328(%rbp)
  mov    -0x360(%rbp),%edx
  lea    -0x220(%rbp),%rax
  lea    D51(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  lea    -0x220(%rbp),%rdx
  mov    -0x328(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  mov    %rax,-0x338(%rbp)
  cmpq   $0x0,-0x338(%rbp)
  je     L45
  movl   $0x0,-0x34c(%rbp)
  movl   $0x1,-0x348(%rbp)
  jmp    L180
L130:
  mov    -0x338(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x7b,%al
  jne    L147
  movl   $0x1,-0x34c(%rbp)
L147:
  mov    -0x338(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x7d,%al
  jne    L35
  movl   $0x0,-0x348(%rbp)
  jmp    L6
L35:
  mov    -0x338(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2c,%al
  jne    L180
  cmpl   $0x0,-0x34c(%rbp)
  jne    L180
  movl   $0x0,-0x348(%rbp)
  jmp    L6
L180:
  addq   $0x1,-0x338(%rbp)
  mov    -0x338(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L130
L6:
  cmpl   $0x0,-0x348(%rbp)
  jne    L2
  mov    -0x338(%rbp),%rax
  movb   $0x0,(%rax)
  addq   $0x1,-0x338(%rbp)
L2:
  cmpl   $0x0,-0x348(%rbp)
  je     L148
  mov    -0x368(%rbp),%rdx
  lea    -0x320(%rbp),%rax
  lea    D37(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
L148:
  cmpl   $0x0,-0x34c(%rbp)
  je     L186
  mov    -0x368(%rbp),%rdx
  lea    -0x320(%rbp),%rax
  lea    D48(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  jmp    L22
L186:
  mov    -0x368(%rbp),%rdx
  lea    -0x320(%rbp),%rax
  lea    D15(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
L22:
  mov    -0x328(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%ebx
  lea    -0x320(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    %eax,%ebx
  mov    -0x338(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    %ebx,%eax
  mov    %eax,-0x344(%rbp)
  mov    -0x344(%rbp),%eax
  add    $0x3,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x330(%rbp)
  cmpq   $0x0,-0x330(%rbp)
  je     L77
  mov    -0x338(%rbp),%rsi
  lea    -0x320(%rbp),%rcx
  mov    -0x328(%rbp),%rdx
  mov    -0x330(%rbp),%rax
  mov    %rsi,%r8
  lea    D49(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  mov    -0x330(%rbp),%rdx
  mov    -0x35c(%rbp),%esi
  mov    -0x358(%rbp),%rax
  mov    %rdx,%r8
  mov    $0x2d,%ecx
  mov    $0x0,%edx
  mov    %rax,%rdi
  call   <XNVCTRLSetStringAttribute@plt>
  mov    -0x358(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <XSync@plt>
  movl   $0x0,-0x350(%rbp)
  jmp    L154
L45:
  nop
  jmp    L154
L77:
  nop
L154:
  cmpq   $0x0,-0x330(%rbp)
  je     L96
  mov    -0x330(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
L96:
  mov    -0x340(%rbp),%rax
  test   %rax,%rax
  je     L131
  mov    -0x340(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
L131:
  mov    -0x350(%rbp),%eax
  mov    -0x18(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L87
  call   <__stack_chk_fail@plt>
L87:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

tool_calls: name: parse_data
arguments: data_label: D56
data_type: string
name: parse_data
arguments: data_label: D51
data_type: string
name: parse_data
arguments: data_label: D37
data_type: string
name: parse_data
arguments: data_label: D48
data_type: string
name: parse_data
arguments: data_label: D15
data_type: string
name: parse_data
arguments: data_label: D49
data_type: string

tool: D56: ::

tool: D51: DPY-%i

tool: D37:  {%s}

tool: D48: , %s}

tool: D15:  {%s},

tool: D49: %s%s%s

assistant: ```c
int AddAttributesToDisplayOfCurrentMetaMode(Display *xDpy, int screenId, int nvDpyId, const char *attributes) {
  char *pOldCurrentMetaMode = NULL;
  char *pCurrentMetaMode = NULL;
  char displayName[512];
  char *pDisplay;
  char *newMetaMode = NULL;
  int error = 1;
  XNVCTRLQueryStringAttribute(xDpy, screenId, 0, 45, &pOldCurrentMetaMode);
  pCurrentMetaMode = strstr(pOldCurrentMetaMode, "::");
  pCurrentMetaMode += 2;
  sprintf(displayName, "DPY-%i", nvDpyId);
  pDisplay = strstr(pCurrentMetaMode, displayName);
  if (pDisplay) {
    int foundBeginAttr = 0;
    char newAttribute[256];
    int endOfString = 1;
    int neededLength;
    while (*(++pDisplay)) {
      if (*pDisplay == '{') {
        foundBeginAttr = 1;
      }
      if (*pDisplay == '}') {
        endOfString = 0;
        break;
      }
      if (*pDisplay == ',' && !foundBeginAttr) {
        endOfString = 0;
        break;
      }
    }
    if (!endOfString) {
      *pDisplay = 0;
      pDisplay++;
    }
    if (endOfString) {
      sprintf(newAttribute, " {%s}", attributes);
    }
    if (foundBeginAttr) {
      sprintf(newAttribute, ", %s}", attributes);
    } else {
      sprintf(newAttribute, " {%s},", attributes);
    }
    neededLength = strlen(pCurrentMetaMode) + strlen(newAttribute) + strlen(pDisplay);
    newMetaMode = malloc(neededLength + 3);
    if (!newMetaMode) {
      goto cleanup;
    }
    sprintf(newMetaMode, "%s%s%s", pCurrentMetaMode, newAttribute, pDisplay);
  } else {
    goto cleanup;
  }
  XNVCTRLSetStringAttribute(xDpy, screenId, 0, 45, newMetaMode);
  XSync(xDpy, 0);
  error = 0;
cleanup:
  if (newMetaMode) {
    free(newMetaMode);
  }
  if (pOldCurrentMetaMode) {
    free(pOldCurrentMetaMode);
  }
  return error;
}
```