user: Translate the below assembly code into C programming language:

```asm
<parse_sfo_content>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x58,%rsp
  mov    %esi,0x8(%rsp)
  mov    %rdx,0x28(%rsp)
  mov    %rcx,0x40(%rsp)
  mov    %r8,0x20(%rsp)
  mov    %r9,0x18(%rsp)
  call   <get32le@plt>
  cmp    $0x46535000,%eax
  je     L243
  lea    D66(%rip),%rdi
  call   <sys_error@plt>
L243:
  lea    0x20(%rbx),%rdi
  lea    0x40(%rbx),%rbp
  call   <get32le@plt>
  lea    0x30(%rbx),%rdi
  mov    %eax,%r13d
  call   <get32le@plt>
  mov    %rbp,%rdi
  mov    %eax,0x48(%rsp)
  call   <get32le@plt>
  cmpq   $0x0,0x20(%rsp)
  setne  0x4d(%rsp)
  cmpq   $0x0,0x18(%rsp)
  setne  0x4e(%rsp)
  cmpq   $0x0,0x90(%rsp)
  mov    %eax,(%rsp)
  setne  0x4f(%rsp)
  test   %eax,%eax
  jle    L150
  movslq %r13d,%rax
  movl   $0xffffffff,0x38(%rsp)
  lea    0x50(%rbx),%rbp
  xor    %r13d,%r13d
  mov    %rax,0x10(%rsp)
  mov    $0xffffffff,%r12d
  lea    D60(%rip),%r15
  movl   $0xffffffff,0x34(%rsp)
  movl   $0xffffffff,0x3c(%rsp)
  movl   $0xffffffff,0x30(%rsp)
  jmp    L159
  nopw   0x0(%rax,%rax,1)
L457:
  mov    %rbp,%rdi
  call   <get16le@plt>
  mov    %r15,%rsi
  movslq %eax,%rdi
  add    0x10(%rsp),%rdi
  lea    (%rbx,%rdi,1),%r14
  mov    %r14,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L217
  cmp    $0xffffffff,%r12d
  cmove  %r13d,%r12d
L216:
  add    $0x1,%r13d
  add    $0x40,%rbp
  cmp    %r13d,(%rsp)
  je     L203
L159:
  mov    %r13d,%eax
  shl    $0x4,%eax
  add    $0x15,%eax
  cmp    %eax,0x8(%rsp)
  jg     L457
  lea    D52(%rip),%rdi
  call   <sys_error@plt>
  jmp    L457
  nopw   0x0(%rax,%rax,1)
L217:
  lea    D8(%rip),%rsi
  mov    %r14,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L464
  mov    %r13d,%r12d
  add    $0x40,%rbp
  add    $0x1,%r13d
  cmp    %r13d,(%rsp)
  jne    L159
L203:
  mov    %r12d,%eax
  movzbl 0x4f(%rsp),%r14d
  shl    $0x4,%eax
  cltq
  lea    0x80(%rbx,%rax,4),%rbp
  mov    0x30(%rsp),%eax
  not    %eax
  shr    $0x1f,%eax
  and    0x4d(%rsp),%al
  mov    %al,0x10(%rsp)
  mov    0x34(%rsp),%eax
  not    %eax
  shr    $0x1f,%eax
  and    0x4e(%rsp),%al
  mov    %al,0x4d(%rsp)
  mov    0x38(%rsp),%eax
  not    %eax
  shr    $0x1f,%eax
  and    %eax,%r14d
  cmp    $0xffffffff,%r12d
  je     L253
L68:
  movslq 0x48(%rsp),%r15
  mov    %rbp,%rdi
  xor    %r12d,%r12d
  lea    D13(%rip),%r13
  mov    %r15,(%rsp)
  call   <get32le@plt>
  mov    %rbx,0x8(%rsp)
  movslq %eax,%rdx
  add    %r15,%rdx
  mov    $0xff,%r15d
  lea    (%rbx,%rdx,1),%rbp
  mov    %r15,%rbx
  mov    0x40(%rsp),%r15
  jmp    L415
  nopl   0x0(%rax)
L163:
  cmp    $0xa,%sil
  jne    L295
  movb   $0x20,(%r15)
  add    $0x1,%r15
L295:
  add    $0x1,%r12
  cmp    %r12,%rbx
  jbe    L345
L415:
  movsbl 0x0(%rbp,%r12,1),%esi
  test   %sil,%sil
  je     L345
  lea    -0x20(%rsi),%eax
  cmp    $0x5e,%al
  ja     L163
  mov    %r13,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L421
  movzbl 0x0(%rbp,%r12,1),%esi
  jmp    L163
  nopw   0x0(%rax,%rax,1)
L345:
  cmpb   $0x0,0x10(%rsp)
  mov    0x8(%rsp),%rbx
  movb   $0x0,(%r15)
  jne    L402
L271:
  mov    0x3c(%rsp),%eax
  cmp    $0xffffffff,%eax
  jne    L49
L365:
  mov    0x28(%rsp),%rax
  cmpb   $0x0,0x4d(%rsp)
  movb   $0x0,(%rax)
  jne    L188
L90:
  test   %r14b,%r14b
  jne    L228
L311:
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L464:
  lea    D69(%rip),%rsi
  mov    %r14,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L305
  mov    %r13d,0x30(%rsp)
  jmp    L216
  nopw   0x0(%rax,%rax,1)
L421:
  movzbl 0x0(%rbp,%r12,1),%eax
  cmp    $0x3a,%al
  je     L219
  mov    %al,(%r15)
  add    $0x1,%r15
  jmp    L295
  nopw   0x0(%rax,%rax,1)
L49:
  shl    $0x4,%eax
  cltq
  lea    0x80(%rbx,%rax,4),%rdi
  call   <get32le@plt>
  cltq
  add    (%rsp),%rax
  add    %rbx,%rax
  movzbl (%rax),%edx
  test   %dl,%dl
  je     L365
  mov    0x28(%rsp),%rcx
  nopl   0x0(%rax,%rax,1)
L334:
  add    $0x1,%rax
  mov    %dl,(%rcx)
  add    $0x1,%rcx
  movzbl (%rax),%edx
  test   %dl,%dl
  jne    L334
  mov    %rcx,0x28(%rsp)
  mov    0x28(%rsp),%rax
  cmpb   $0x0,0x4d(%rsp)
  movb   $0x0,(%rax)
  je     L90
L188:
  mov    0x34(%rsp),%eax
  shl    $0x4,%eax
  cltq
  lea    0x80(%rbx,%rax,4),%rdi
  call   <get32le@plt>
  movslq %eax,%rdx
  add    (%rsp),%rdx
  add    %rbx,%rdx
  movzbl (%rdx),%eax
  cmp    $0x30,%al
  jne    L268
  movzbl 0x1(%rdx),%eax
  add    $0x1,%rdx
L268:
  test   %al,%al
  je     L425
  mov    0x18(%rsp),%rsi
  nopl   (%rax)
L230:
  add    $0x1,%rdx
  mov    %eax,%ecx
  mov    %al,(%rsi)
  add    $0x1,%rsi
  movzbl (%rdx),%eax
  test   %al,%al
  jne    L230
  mov    %rsi,0x18(%rsp)
L373:
  mov    0x18(%rsp),%rax
  cmp    $0x30,%cl
  je     L136
  movb   $0x0,(%rax)
  test   %r14b,%r14b
  je     L311
L228:
  mov    0x38(%rsp),%eax
  shl    $0x4,%eax
  cltq
  lea    0x80(%rbx,%rax,4),%rdi
  call   <get32le@plt>
  cltq
  add    (%rsp),%rax
  add    %rax,%rbx
  movzbl (%rbx),%eax
  cmp    $0x30,%al
  jne    L39
  movzbl 0x1(%rbx),%eax
  add    $0x1,%rbx
L39:
  test   %al,%al
  je     L428
  mov    0x90(%rsp),%rdx
  nopl   0x0(%rax)
L149:
  add    $0x1,%rbx
  mov    %al,(%rdx)
  add    $0x1,%rdx
  movzbl (%rbx),%eax
  test   %al,%al
  jne    L149
  mov    %rdx,0x90(%rsp)
L428:
  mov    0x90(%rsp),%rax
  movb   $0x0,(%rax)
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L402:
  mov    0x30(%rsp),%eax
  shl    $0x4,%eax
  cltq
  lea    0x80(%rbx,%rax,4),%rdi
  call   <get32le@plt>
  cltq
  add    (%rsp),%rax
  add    %rbx,%rax
  movzbl (%rax),%edx
  test   %dl,%dl
  je     L427
  mov    0x20(%rsp),%rcx
  nopl   0x0(%rax,%rax,1)
L179:
  add    $0x1,%rax
  mov    %dl,(%rcx)
  add    $0x1,%rcx
  movzbl (%rax),%edx
  test   %dl,%dl
  jne    L179
  mov    %rcx,0x20(%rsp)
L427:
  mov    0x20(%rsp),%rax
  movb   $0x0,(%rax)
  jmp    L271
  nopl   0x0(%rax,%rax,1)
L305:
  lea    D41(%rip),%rsi
  mov    %r14,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L146
  mov    %r13d,0x3c(%rsp)
  jmp    L216
  xchg   %ax,%ax
L219:
  mov    $0x2d20,%eax
  sub    $0x1,%rbx
  add    $0x2,%r15
  mov    %ax,-0x2(%r15)
  jmp    L295
  nopw   0x0(%rax,%rax,1)
L150:
  movb   $0x0,0x4d(%rsp)
  xor    %r14d,%r14d
  movb   $0x0,0x10(%rsp)
  movl   $0xffffffff,0x30(%rsp)
  movl   $0xffffffff,0x38(%rsp)
  movl   $0xffffffff,0x3c(%rsp)
  movl   $0xffffffff,0x34(%rsp)
L253:
  lea    D59(%rip),%rdi
  call   <sys_error@plt>
  jmp    L68
  xchg   %ax,%ax
L146:
  lea    D56(%rip),%rsi
  mov    %r14,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L470
  mov    %r13d,0x34(%rsp)
  jmp    L216
  xchg   %ax,%ax
L136:
  movb   $0x0,-0x1(%rax)
  jmp    L90
L425:
  mov    0x18(%rsp),%rax
  movzbl -0x1(%rax),%ecx
  jmp    L373
L470:
  lea    D26(%rip),%rsi
  mov    %r14,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  mov    0x38(%rsp),%eax
  cmove  %r13d,%eax
  mov    %eax,0x38(%rsp)
  jmp    L216
```

tool_calls: name: read_data
arguments: label: D66
datatype: string
name: read_data
arguments: label: D60
datatype: string
name: read_data
arguments: label: D52
datatype: string
name: read_data
arguments: label: D8
datatype: string
name: read_data
arguments: label: D13
datatype: string
name: read_data
arguments: label: D69
datatype: string
name: read_data
arguments: label: D41
datatype: string
name: read_data
arguments: label: D59
datatype: string
name: read_data
arguments: label: D56
datatype: string
name: read_data
arguments: label: D26
datatype: string

tool: D66: ERROR: incorrect sfo signature


tool: D60: TITLE

tool: D52: ERROR: sfo information is too small


tool: D8: STITLE

tool: D13: <>"/\|?*

tool: D69: CONTENT_ID

tool: D41: CATEGORY

tool: D59: ERROR: cannot find title from sfo file, pkg is probably corrupted


tool: D56: PSP2_DISP_VER

tool: D26: APP_VER

assistant: ```c
void parse_sfo_content(const uint8_t *sfo, uint32_t sfo_size, char *category, char *title, char *content, char *min_version, char *pkg_version) {
  if (get32le(sfo) != 0x46535000) {
    sys_error("ERROR: incorrect sfo signature\n");
  }
  uint32_t keys = get32le(sfo + 8);
  uint32_t values = get32le(sfo + 12);
  uint32_t count = get32le(sfo + 16);
  int title_index = -1;
  int content_index = -1;
  int category_index = -1;
  int minver_index = -1;
  int pkgver_index = -1;
  for (uint32_t i = 0; i < count; i++) {
    if (i * 16 + 20 + 2 > sfo_size) {
      sys_error("ERROR: sfo information is too small\n");
    }
    char *key = (char *)sfo + keys + get16le(sfo + i * 16 + 20);
    if (strcmp(key, "TITLE") == 0) {
      if (title_index < 0) {
        title_index = (int)i;
      }
    } else if (strcmp(key, "STITLE") == 0) {
      title_index = (int)i;
    } else if (strcmp(key, "CONTENT_ID") == 0) {
      content_index = (int)i;
    } else if (strcmp(key, "CATEGORY") == 0) {
      category_index = (int)i;
    } else if (strcmp(key, "PSP2_DISP_VER") == 0) {
      minver_index = (int)i;
    } else if (strcmp(key, "APP_VER") == 0) {
      pkgver_index = (int)i;
    }
  }
  if (title_index < 0) {
    sys_error("ERROR: cannot find title from sfo file, pkg is probably corrupted\n");
  }
  char *value = (char *)sfo + values + get32le(sfo + title_index * 16 + 20 + 12);
  size_t i;
  size_t max = 255;
  for (i = 0; i < max && *value; i++, value++) {
    if ((*value >= 32 && *value < 127 && strchr("<>\"/\\|?*", *value) == NULL) || (uint8_t)*value >= 128) {
      if (*value == ':') {
        *title++ = ' ';
        *title++ = '-';
        max--;
      } else {
        *title++ = *value;
      }
    } else if (*value == 10) {
      *title++ = ' ';
    }
  }
  *title = 0;
  if (content_index >= 0 && content) {
    value = (char *)sfo + values + get32le(sfo + content_index * 16 + 20 + 12);
    while (*value) {
      *content++ = *value++;
    }
    *content = 0;
  }
  if (category_index >= 0) {
    value = (char *)sfo + values + get32le(sfo + category_index * 16 + 20 + 12);
    while (*value) {
      *category++ = *value++;
    }
  }
  *category = 0;
  if (minver_index >= 0 && min_version) {
    value = (char *)sfo + values + get32le(sfo + minver_index * 16 + 20 + 12);
    if (*value == '0') {
      value++;
    }
    while (*value) {
      *min_version++ = *value++;
    }
    if (min_version[-1] == '0') {
      min_version[-1] = 0;
    } else {
      *min_version = 0;
    }
  }
  if (pkgver_index >= 0 && pkg_version) {
    value = (char *)sfo + values + get32le(sfo + pkgver_index * 16 + 20 + 12);
    if (*value == '0') {
      value++;
    }
    while (*value) {
      *pkg_version++ = *value++;
    }
    *pkg_version = 0;
  }
}
```