user: Please show me the C implementation that matches the assembly code listed below:

```asm
<f_set_byte>:
  endbr64
  push   %r15
  push   %r14
  mov    %rsi,%r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    0x70(%rsp),%rax
  mov    0x78(%rsp),%r12
  mov    0x80(%rsp),%r13
  mov    %rax,0x18(%rsp)
  mov    %rax,%rsi
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  test   %edi,%edi
  js     L74
  mov    %rsi,%rdi
  call   <atoi@plt>
  mov    %r12,%rdi
  movslq %eax,%rbp
  call   <atoi@plt>
  mov    %eax,0x8(%rsp)
  cmp    $0x8,%ebp
  ja     L40
  mov    0x8(%rsp),%eax
  test   %eax,%eax
  jle    L51
L109:
  movl   $0x10,0xc(%rsp)
  test   %ebp,%ebp
  jne    L34
L131:
  lea    0x24(%rsp),%rax
  lea    0x20(%rsp),%r12
  mov    %r13,%rdi
  mov    %r12,%rcx
  mov    %rax,%rdx
  mov    %rax,0x10(%rsp)
  lea    D24(%rip),%rsi
  call   <sscanf@plt>
  cmp    $0x1,%eax
  jne    L74
  lea    (%r14,%rbp,8),%r15
  movslq 0x8(%rsp),%rbp
  lea    D11(%rip),%r14
  sub    $0x1,%rbp
  mov    %rbp,%rbx
  jmp    L149
  nopl   (%rax)
L117:
  mov    (%r15),%rax
  mov    0x24(%rsp),%edx
  mov    %r12,%rcx
  mov    %r14,%rsi
  mov    %dl,(%rax,%rbx,1)
  movslq 0x20(%rsp),%rax
  add    $0x1,%rbx
  mov    0x10(%rsp),%rdx
  add    %rax,%r13
  mov    %r13,%rdi
  call   <sscanf@plt>
  cmp    $0x1,%eax
  jne    L74
L149:
  mov    0x8(%rsp),%eax
  sub    %ebp,%eax
  add    %ebx,%eax
  cmp    %eax,0xc(%rsp)
  jge    L117
  mov    0x18(%rsp),%rsi
  lea    D48(%rip),%rdi
  call   <fatal_error@plt>
  jmp    L117
  nopw   0x0(%rax,%rax,1)
L74:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L76
  add    $0x38,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L40:
  mov    0x18(%rsp),%rsi
  lea    D36(%rip),%rdi
  call   <fatal_error@plt>
  mov    0x8(%rsp),%edx
  test   %edx,%edx
  jle    L51
L85:
  movslq %ebp,%rax
  mov    (%r14,%rax,8),%rdi
  call   <uint4@plt>
  mov    %eax,0xc(%rsp)
  jmp    L131
  cs nopw 0x0(%rax,%rax,1)
L34:
  cmp    $0x8,%ebp
  jne    L85
  movl   $0x4,0xc(%rsp)
  jmp    L131
  nopw   0x0(%rax,%rax,1)
L51:
  lea    D25(%rip),%rsi
  lea    D45(%rip),%rdi
  call   <fatal_error@plt>
  jmp    L109
L76:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: label: D24
type_guessed: string
name: read_data
arguments: label: D11
type_guessed: string
name: read_data
arguments: label: D48
type_guessed: string
name: read_data
arguments: label: D36
type_guessed: string
name: read_data
arguments: label: D25
type_guessed: string
name: read_data
arguments: label: D45
type_guessed: string

tool: D24: %u%n

tool: D11: :%u%n

tool: D48: set_byte out of bounds section %s

tool: D36: set_byte: bad section number %s

tool: 

tool: D45: set_byte: octet number must >= 1

assistant: ```c
int f_set_byte(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;
  unsigned int val;
  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_byte: octet number must >= 1", "");
  if (i == 0)
    seclen = 16;
  else if (i == 8)
    seclen = 4;
  else
    seclen = uint4(sec[i]);
  k = sscanf(arg3, "%u%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, ":%u%n", &val, &m);
  }
  return 0;
}
```