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

```asm
<storesetting>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x840,%rsp
  mov    %rdi,-0x838(%rbp)
  mov    %rsi,-0x840(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  cmpq   $0x0,-0x838(%rbp)
  je     L18
  lea    D42(%rip),%rax
  mov    %rax,%rdi
  call   <getenv@plt>
  mov    %rax,-0x828(%rbp)
  mov    -0x828(%rbp),%rdx
  lea    -0x810(%rbp),%rax
  lea    D40(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <sprintf@plt>
  mov    -0x828(%rbp),%rdx
  lea    -0x410(%rbp),%rax
  lea    D51(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <sprintf@plt>
  lea    -0x810(%rbp),%rdx
  lea    -0x410(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <rename@plt>
  lea    -0x810(%rbp),%rax
  lea    D6(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x820(%rbp)
  cmpq   $0x0,-0x820(%rbp)
  je     L75
  lea    -0x410(%rbp),%rax
  lea    D9(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x818(%rbp)
  cmpq   $0x0,-0x818(%rbp)
  jne    L116
  mov    -0x818(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  jmp    L83
L116:
  mov    -0x838(%rbp),%rdx
  lea    -0x410(%rbp),%rax
  lea    D21(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <sprintf@plt>
  jmp    L111
L40:
  lea    -0x410(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%edx
  lea    -0x410(%rbp),%rcx
  lea    -0x810(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L111
  lea    -0x810(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cmp    $0x2,%eax
  jle    L111
  lea    -0x810(%rbp),%rdx
  mov    -0x818(%rbp),%rax
  lea    D34(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
L111:
  mov    -0x820(%rbp),%rdx
  lea    -0x810(%rbp),%rax
  mov    $0x400,%esi
  mov    %rax,%rdi
  call   <fgets@plt>
  test   %rax,%rax
  jne    L40
  cmpq   $0x0,-0x840(%rbp)
  je     L92
  mov    -0x840(%rbp),%rcx
  mov    -0x838(%rbp),%rdx
  mov    -0x818(%rbp),%rax
  lea    D46(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
L92:
  mov    -0x820(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    -0x818(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  jmp    L83
L18:
  nop
  jmp    L83
L75:
  nop
L83:
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L76
  call   <__stack_chk_fail@plt>
L76:
  leave
  ret
```

tool_calls: name: parse_data
arguments: tag: D42
type: string
name: parse_data
arguments: tag: D40
type: string
name: parse_data
arguments: tag: D51
type: string
name: parse_data
arguments: tag: D6
type: string
name: parse_data
arguments: tag: D9
type: string
name: parse_data
arguments: tag: D21
type: string
name: parse_data
arguments: tag: D34
type: string
name: parse_data
arguments: tag: D46
type: string

tool: D42: HOME

tool: D40: %s/.libufs.bak

tool: D51: %s/.libufs

tool: D6: r

tool: D9: w

tool: D21: %s=

tool: D34: %s

tool: D46: %s=%s


assistant: ```c
void storesetting(char *setting, char *value) {
  FILE *f1;
  FILE *f2;
  char *home;
  char temp1[1024];
  char temp2[1024];
  if (!setting) {
    return;
  }
  home = getenv("HOME");
  sprintf(temp1, "%s/.libufs.bak", home);
  sprintf(temp2, "%s/.libufs", home);
  rename(temp2, temp1);
  f1 = fopen(temp1, "r");
  if (!f1) {
    return;
  }
  f2 = fopen(temp2, "w");
  if (!f2) {
    fclose(f2);
    return;
  }
  sprintf(temp2, "%s=", setting);
  while (fgets(temp1, 1024, f1)) {
    if (strncmp(temp1, temp2, strlen(temp2)) != 0) {
      if (strlen(temp1) > 2) {
        fprintf(f2, "%s", temp1);
      }
    }
  }
  if (value) {
    fprintf(f2, "%s=%s\n", setting, value);
  }
  fclose(f1);
  fclose(f2);
}
```