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    $0x438,%rsp
  mov    %edi,%r14d
  mov    %rsi,%rbp
  mov    %fs:0x28,%rax
  mov    %rax,0x428(%rsp)
  xor    %eax,%eax
  lea    D76(%rip),%rdi
  call   <getsetting@plt>
  mov    %rax,0x8(%rsp)
  test   %rax,%rax
  je     L55
  cmp    $0x2,%r14d
  jle    L121
  lea    0x1c(%rsp),%rdx
  mov    0x8(%rbp),%rdi
  lea    D62(%rip),%rsi
  call   <sscanf@plt>
  mov    0x8(%rsp),%rdi
  call   <fsopen@plt>
  mov    %rax,%r13
  test   %rax,%rax
  je     L105
  lea    D9(%rip),%rdi
  call   <getsetting@plt>
  mov    %rax,%r12
  lea    0x10(%rbp),%rbx
  lea    -0x3(%r14),%eax
  lea    0x18(%rbp,%rax,8),%r14
  lea    0x20(%rsp),%rbp
  lea    D56(%rip),%r15
  jmp    L59
L55:
  lea    D77(%rip),%rdi
  call   <puts@plt>
  mov    $0xa,%eax
  jmp    L107
L121:
  mov    0x0(%rbp),%rsi
  lea    D73(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0xa,%eax
  jmp    L107
L105:
  mov    0x8(%rsp),%rsi
  lea    D24(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0xa,%eax
  jmp    L107
L51:
  mov    0x1c(%rsp),%edx
  mov    %rcx,%rsi
  mov    %r13,%rdi
  call   <uchgrp@plt>
  jmp    L139
L11:
  mov    %rcx,%rdx
  lea    D28(%rip),%rsi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
L94:
  mov    %rbp,%rdi
  call   <compresspath@plt>
  mov    0x1c(%rsp),%edx
  mov    %rbp,%rsi
  mov    %r13,%rdi
  call   <uchgrp@plt>
L139:
  add    $0x8,%rbx
  cmp    %r14,%rbx
  je     L38
L59:
  mov    (%rbx),%rcx
  cmpb   $0x2f,(%rcx)
  je     L51
  test   %r12,%r12
  je     L11
  mov    %r12,%rdx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  jmp    L94
L38:
  mov    %r13,%rdi
  call   <fsclose@plt>
  test   %r12,%r12
  je     L29
  mov    %r12,%rdi
  call   <free@plt>
L29:
  mov    0x8(%rsp),%rdi
  call   <free@plt>
  mov    $0x0,%eax
L107:
  mov    0x428(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L60
  add    $0x438,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L60:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: label: D76
data_type: string
name: unpack_data
arguments: label: D62
data_type: string
name: unpack_data
arguments: label: D9
data_type: string
name: unpack_data
arguments: label: D56
data_type: string
name: unpack_data
arguments: label: D77
data_type: string
name: unpack_data
arguments: label: D73
data_type: string
name: unpack_data
arguments: label: D24
data_type: string
name: unpack_data
arguments: label: D28
data_type: string

tool: D76: imagefile

tool: D62: %o

tool: D9: cwd

tool: D56: %s/%s

tool: D77: Have you run ulogin?

tool: D73: Usage: %s <gid> <file> ...


tool: D24: Unable to open %s


tool: D28: /%s

assistant: ```c
int main(int argc, char *argv[]) {
  struct filesystem *f;
  int i;
  int mode;
  char temp[1024];
  char *cwd;
  char *fsname = getsetting("imagefile");
  ;
  if (!fsname) {
    printf("Have you run ulogin?\n");
    return 10;
  }
  if (argc < 3) {
    printf("Usage: %s <gid> <file> ...\n", argv[0]);
    return 10;
  }
  sscanf(argv[1], "%o", &mode);
  f = fsopen(fsname);
  if (!f) {
    printf("Unable to open %s\n", fsname);
    return 10;
  }
  cwd = getsetting("cwd");
  for (i = 2; i < argc; i++) {
    if (argv[i][0] == '/') {
      uchgrp(f, argv[i], mode);
    } else {
      if (!cwd) {
        sprintf(temp, "/%s", argv[i]);
      } else {
        sprintf(temp, "%s/%s", cwd, argv[i]);
      }
      compresspath(temp);
      uchgrp(f, temp, mode);
    }
  }
  fsclose(f);
  if (cwd)
    free(cwd);
  free(fsname);
  return 0;
}
```