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

```asm
<f_set_hex>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    0x70(%rsp),%rax
  mov    0x78(%rsp),%rbp
  mov    0x80(%rsp),%r13
  mov    %rax,0x10(%rsp)
  mov    %rax,%rbx
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  test   %edi,%edi
  js     L2
  mov    %rbx,%rdi
  mov    %rsi,%r14
  call   <atoi@plt>
  mov    %rbp,%rdi
  mov    %eax,%r15d
  call   <atoi@plt>
  mov    %eax,%ebx
  cmp    $0x8,%r15d
  ja     L55
  test   %eax,%eax
  jle    L138
L34:
  movl   $0x10,0xc(%rsp)
  test   %r15d,%r15d
  jne    L202
L109:
  mov    %r13,%rax
  jmp    L215
  nopl   0x0(%rax)
L63:
  add    $0x1,%rax
  cmp    $0x3a,%dl
  je     L48
L215:
  movzbl (%rax),%edx
  test   %dl,%dl
  jne    L63
  lea    0x20(%rsp),%r12
  lea    0x24(%rsp),%rbp
  mov    %r13,%rdi
  mov    %r12,%rcx
  mov    %rbp,%rdx
  lea    D46(%rip),%rsi
  call   <sscanf@plt>
  cmp    $0x1,%eax
  jne    L2
  movslq %r15d,%rax
  lea    (%r14,%rax,8),%r15
  movslq %ebx,%rax
  sub    $0x1,%rax
  mov    %rax,0x18(%rsp)
  mov    %rax,%r14
  jmp    L223
  nopl   0x0(%rax,%rax,1)
L227:
  mov    (%r15),%rax
  mov    0x24(%rsp),%edx
  mov    %r12,%rcx
  lea    D46(%rip),%rsi
  mov    %dl,(%rax,%r14,1)
  movslq 0x20(%rsp),%rax
  mov    %rbp,%rdx
  add    $0x1,%r14
  add    %rax,%r13
  mov    %r13,%rdi
  call   <sscanf@plt>
  cmp    $0x1,%eax
  jne    L2
L223:
  mov    %ebx,%eax
  sub    0x18(%rsp),%eax
  add    %r14d,%eax
  cmp    %eax,0xc(%rsp)
  jge    L227
  mov    0x10(%rsp),%rsi
  lea    D35(%rip),%rdi
  call   <fatal_error@plt>
  jmp    L227
  nopl   0x0(%rax,%rax,1)
L2:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L98
  add    $0x38,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L48:
  lea    0x20(%rsp),%r12
  lea    0x24(%rsp),%rbp
  mov    %r13,%rdi
  mov    %r12,%rcx
  mov    %rbp,%rdx
  lea    D89(%rip),%rsi
  call   <sscanf@plt>
  cmp    $0x1,%eax
  jne    L2
  movslq %r15d,%rax
  lea    (%r14,%rax,8),%r14
  movslq %ebx,%rax
  sub    $0x1,%rax
  mov    %rax,0x18(%rsp)
  mov    %rax,%r15
  jmp    L209
  nopl   0x0(%rax)
L201:
  mov    (%r14),%rax
  mov    0x24(%rsp),%edx
  mov    %r12,%rcx
  lea    D2(%rip),%rsi
  mov    %dl,(%rax,%r15,1)
  movslq 0x20(%rsp),%rax
  mov    %rbp,%rdx
  add    $0x1,%r15
  add    %rax,%r13
  mov    %r13,%rdi
  call   <sscanf@plt>
  cmp    $0x1,%eax
  jne    L2
L209:
  mov    %ebx,%eax
  sub    0x18(%rsp),%eax
  add    %r15d,%eax
  cmp    %eax,0xc(%rsp)
  jge    L201
  mov    0x10(%rsp),%rsi
  lea    D35(%rip),%rdi
  call   <fatal_error@plt>
  jmp    L201
  nopw   0x0(%rax,%rax,1)
L55:
  mov    0x10(%rsp),%rsi
  lea    D75(%rip),%rdi
  call   <fatal_error@plt>
  test   %ebx,%ebx
  jle    L138
L111:
  movslq %r15d,%rax
  mov    (%r14,%rax,8),%rdi
  call   <uint4@plt>
  mov    %eax,0xc(%rsp)
  jmp    L109
  nopw   0x0(%rax,%rax,1)
L202:
  cmp    $0x8,%r15d
  jne    L111
  movl   $0x4,0xc(%rsp)
  jmp    L109
  nopl   0x0(%rax,%rax,1)
L138:
  lea    D27(%rip),%rsi
  lea    D51(%rip),%rdi
  call   <fatal_error@plt>
  jmp    L34
L98:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_tag: D46
type_guessed: string
name: read_data
arguments: data_tag: D35
type_guessed: string
name: read_data
arguments: data_tag: D89
type_guessed: string
name: read_data
arguments: data_tag: D2
type_guessed: string
name: read_data
arguments: data_tag: D75
type_guessed: string
name: read_data
arguments: data_tag: D27
type_guessed: string
name: read_data
arguments: data_tag: D51
type_guessed: string

tool: D46: %2x%n

tool: D35: set_byte out of bounds section %s

tool: D89: %x%n

tool: D2: :%x%n

tool: D75: set_byte: bad section number %s

tool: 

tool: D51: set_hex: octet number must >= 1

assistant: ```c
int f_set_hex(int mode, unsigned char **sec, float *data, unsigned int ndata, char *inv_out, void **local, const char *arg1, const char *arg2, const char *arg3) {
  int i, j, k, m, seclen, has_colon;
  unsigned int val;
  const char *str;
  if (mode < 0)
    return 0;
  i = atoi(arg1);
  j = atoi(arg2);
  if (i < 0 || i > 8)
    fatal_error("set_byte: bad section number %s", arg1);
  if (j <= 0)
    fatal_error("set_hex: octet number must >= 1", "");
  if (i == 0)
    seclen = 16;
  else if (i == 8)
    seclen = 4;
  else
    seclen = uint4(sec[i]);
  str = arg3;
  has_colon = 0;
  while (*str) {
    if (*str++ == ':') {
      has_colon = 1;
      break;
    }
  }
  if (has_colon) {
    k = sscanf(arg3, "%x%n", &val, &m);
    while (k == 1) {
      if (j > seclen)
        fatal_error("set_byte out of bounds section %s", arg1);
      sec[i][j++ - 1] = val;
      arg3 += m;
      k = sscanf(arg3, ":%x%n", &val, &m);
    }
  } else {
    k = sscanf(arg3, "%2x%n", &val, &m);
    while (k == 1) {
      if (j > seclen)
        fatal_error("set_byte out of bounds section %s", arg1);
      sec[i][j++ - 1] = val;
      arg3 += m;
      k = sscanf(arg3, "%2x%n", &val, &m);
    }
  }
  return 0;
}
```