user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<byte_extract>:
  endbr64
  cmp    $0x1,%edi
  ja     L23
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %edi,%r15d
  mov    %esi,%ebx
  mov    %rdx,%rbp
  mov    %rcx,%r12
  mov    %r8,%r13
  mov    %r9,%r14
  movslq %esi,%rax
  lea    -0x4(%rdx,%rax,4),%rdx
  mov    %r8,%rsi
  mov    %rcx,%rdi
  call   <inBounds@plt>
  test   %eax,%eax
  je     L96
  mov    %rbp,%rdx
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <inBounds@plt>
  test   %eax,%eax
  je     L45
  cmp    $0x2,%ebx
  je     L118
  cmp    $0x4,%ebx
  je     L18
  mov    $0xffffffff,%eax
  cmp    $0x1,%ebx
  je     L87
L13:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L87:
  movzbl 0x0(%rbp),%eax
  mov    %eax,(%r14)
  mov    $0x0,%eax
  jmp    L13
L118:
  cmp    $0x1,%r15d
  je     L85
  mov    0x0(%rbp),%eax
  shl    $0x8,%eax
  movzwl %ax,%eax
  mov    %eax,(%r14)
  movzbl 0x4(%rbp),%edx
  or     %edx,%eax
  mov    %eax,(%r14)
  mov    $0x0,%eax
  jmp    L13
L85:
  movzbl 0x0(%rbp),%edx
  mov    %edx,(%r14)
  mov    0x4(%rbp),%eax
  shl    $0x8,%eax
  movzwl %ax,%eax
  or     %edx,%eax
  mov    %eax,(%r14)
  mov    $0x0,%eax
  jmp    L13
L18:
  cmp    $0x1,%r15d
  je     L106
  mov    0x0(%rbp),%eax
  shl    $0x18,%eax
  mov    %eax,(%r14)
  mov    0x4(%rbp),%edx
  shl    $0x10,%edx
  and    $0xff0000,%edx
  or     %eax,%edx
  mov    %edx,(%r14)
  mov    0x8(%rbp),%eax
  shl    $0x8,%eax
  movzwl %ax,%eax
  or     %edx,%eax
  mov    %eax,(%r14)
  movzbl 0xc(%rbp),%edx
  or     %edx,%eax
  mov    %eax,(%r14)
  mov    $0x0,%eax
  jmp    L13
L106:
  movzbl 0x0(%rbp),%eax
  mov    %eax,(%r14)
  mov    0x4(%rbp),%edx
  shl    $0x8,%edx
  movzwl %dx,%edx
  or     %eax,%edx
  mov    %edx,(%r14)
  mov    0x8(%rbp),%eax
  shl    $0x10,%eax
  and    $0xff0000,%eax
  or     %edx,%eax
  mov    %eax,(%r14)
  mov    0xc(%rbp),%edx
  shl    $0x18,%edx
  or     %edx,%eax
  mov    %eax,(%r14)
  mov    $0x0,%eax
  jmp    L13
L23:
  mov    $0xfffffffe,%eax
  ret
L96:
  mov    $0xfffffffd,%eax
  jmp    L13
L45:
  mov    $0xfffffffd,%eax
  jmp    L13
```

assistant: ```c
int byte_extract(int endianess, int bytes_to_grab, u_int8_t *ptr, u_int8_t *start, u_int8_t *end, u_int32_t *value) {
  if (endianess != 1 && endianess != 0) {
    return -2;
  }
  if (!inBounds(start, end, ptr + (bytes_to_grab - 1))) {
    return -3;
  }
  if (!inBounds(start, end, ptr)) {
    return -3;
  }
  switch (bytes_to_grab) {
  case 1:
    *value = (*ptr) & 0xFF;
    break;
  case 2:
    if (endianess == 1) {
      *value = (*ptr) & 0xFF;
      *value |= (*(ptr + 1) & 0xFF) << 8;
    } else {
      *value = ((*ptr) & 0xFF) << 8;
      *value |= (*(ptr + 1)) & 0xFF;
    }
    break;
  case 4:
    if (endianess == 1) {
      *value = (*ptr) & 0xFF;
      *value |= ((*(ptr + 1)) & 0xFF) << 8;
      *value |= ((*(ptr + 2)) & 0xFF) << 16;
      *value |= ((*(ptr + 3)) & 0xFF) << 24;
    } else {
      *value = ((*ptr) & 0xFF) << 24;
      *value |= ((*(ptr + 1)) & 0xFF) << 16;
      *value |= ((*(ptr + 2)) & 0xFF) << 8;
      *value |= (*(ptr + 3)) & 0xFF;
    }
    break;
  default:
    return -1;
  }
  return 0;
}
```