user: Demonstrate the C code that generates the assembly output below:

```asm
<byte_extract>:
  endbr64
  cmp    $0x1,%edi
  ja     L52
  push   %r15
  movslq %esi,%rax
  mov    %r9,%r15
  push   %r14
  mov    %edi,%r14d
  mov    %rcx,%rdi
  push   %r13
  mov    %r8,%r13
  push   %r12
  mov    %rcx,%r12
  push   %rbp
  mov    %rdx,%rbp
  lea    -0x4(%rdx,%rax,4),%rdx
  push   %rbx
  mov    %esi,%ebx
  mov    %r8,%rsi
  sub    $0x8,%rsp
  call   <inBounds@plt>
  test   %eax,%eax
  je     L17
  mov    %rbp,%rdx
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <inBounds@plt>
  test   %eax,%eax
  je     L17
  cmp    $0x2,%ebx
  je     L69
  cmp    $0x4,%ebx
  je     L29
  mov    $0xffffffff,%eax
  cmp    $0x1,%ebx
  je     L21
L75:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L69:
  mov    0x0(%rbp),%eax
  cmp    $0x1,%r14d
  je     L20
  shl    $0x8,%eax
  movzwl %ax,%eax
  mov    %eax,(%r15)
  movzbl 0x4(%rbp),%edx
  or     %edx,%eax
  mov    %eax,(%r15)
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L21:
  movzbl 0x0(%rbp),%eax
  mov    %eax,(%r15)
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L29:
  mov    0x0(%rbp),%eax
  cmp    $0x1,%r14d
  je     L8
  shl    $0x18,%eax
  mov    %eax,(%r15)
  mov    0x4(%rbp),%edx
  shl    $0x10,%edx
  and    $0xff0000,%edx
  or     %eax,%edx
  mov    %edx,(%r15)
  mov    0x8(%rbp),%eax
  shl    $0x8,%eax
  movzwl %ax,%eax
  or     %edx,%eax
  mov    %eax,(%r15)
  movzbl 0xc(%rbp),%edx
  or     %edx,%eax
  mov    %eax,(%r15)
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L8:
  movzbl %al,%eax
  mov    %eax,(%r15)
  mov    0x4(%rbp),%edx
  shl    $0x8,%edx
  movzwl %dx,%edx
  or     %eax,%edx
  mov    %edx,(%r15)
  mov    0x8(%rbp),%eax
  shl    $0x10,%eax
  and    $0xff0000,%eax
  or     %edx,%eax
  mov    %eax,(%r15)
  mov    0xc(%rbp),%edx
  shl    $0x18,%edx
  or     %edx,%eax
  mov    %eax,(%r15)
  xor    %eax,%eax
  jmp    L75
  cs nopw 0x0(%rax,%rax,1)
L20:
  movzbl %al,%eax
  mov    %eax,(%r15)
  mov    0x4(%rbp),%edx
  shl    $0x8,%edx
  movzwl %dx,%edx
  or     %edx,%eax
  mov    %eax,(%r15)
  xor    %eax,%eax
  jmp    L75
  nopl   0x0(%rax,%rax,1)
L17:
  mov    $0xfffffffd,%eax
  jmp    L75
  nopw   0x0(%rax,%rax,1)
L52:
  mov    $0xfffffffe,%eax
  ret
```

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;
}
```