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

```asm
<generate_char_data_set>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %edi,%r15d
  mov    %esi,0x3c(%rsp)
  mov    %edx,%edi
  mov    %ecx,%r12d
  mov    %r8d,%ebp
  mov    %r9d,%ebx
  mov    0x80(%rsp),%r14d
  cmp    0x90(%rsp),%r14d
  jg     L292
  test   %r14d,%r14d
  js     L292
L118:
  mov    $0xf,%ecx
  mov    $0x0,%edx
  mov    $0x8,%esi
  call   <offset_and_clip_value@plt>
  mov    %eax,%r13d
  mov    $0xf,%ecx
  mov    $0x0,%edx
  mov    $0x8,%esi
  mov    %r12d,%edi
  call   <offset_and_clip_value@plt>
  mov    %eax,%r12d
  mov    $0xf,%ecx
  mov    $0x0,%edx
  mov    $0x8,%esi
  mov    %ebp,%edi
  call   <offset_and_clip_value@plt>
  mov    %eax,%ebp
  mov    %eax,0x20(%rsp)
  mov    $0xf,%ecx
  mov    $0x0,%edx
  mov    $0x8,%esi
  mov    %ebx,%edi
  call   <offset_and_clip_value@plt>
  mov    %eax,0x24(%rsp)
  mov    %r13b,0x1a(%rsp)
  mov    %r12b,0x1b(%rsp)
  mov    %bpl,0x18(%rsp)
  mov    %al,0x19(%rsp)
  cmp    $0x4,%r15d
  je     L198
L227:
  cmpl   $0x0,0x88(%rsp)
  jle    L153
  shl    $0x4,%r13d
  and    $0xf,%r12d
  lea    (%r12,%r13,1),%eax
  mov    %al,0x17(%rsp)
  mov    0x90(%rsp),%eax
  imul   0x98(%rsp),%eax
  mov    %eax,0x38(%rsp)
  movl   $0x0,0x34(%rsp)
  movl   $0x0,0x30(%rsp)
  mov    0x98(%rsp),%eax
  lea    -0x1(%rax),%eax
  mov    0xa8(%rsp),%rsi
  lea    0x1(%rsi,%rax,1),%rax
  mov    %rax,0x28(%rsp)
  jmp    L52
L292:
  mov    $0xffffffff,%r14d
  jmp    L118
L198:
  mov    0x3c(%rsp),%edi
  call   <srand@plt>
  jmp    L227
L209:
  mov    0x3c(%rsp),%edi
  call   <srand@plt>
  jmp    L122
L35:
  movzbl 0x1b(%rsp),%eax
  movzbl 0x1a(%rsp),%ebx
  jmp    L130
L22:
  cmp    $0x4,%r15d
  jne    L43
  mov    $0x0,%eax
  call   <rand@plt>
  cltd
  shr    $0x1c,%edx
  lea    (%rax,%rdx,1),%ebx
  and    $0xf,%ebx
  sub    %edx,%ebx
  mov    $0x0,%eax
  call   <rand@plt>
  cltd
  shr    $0x1c,%edx
  add    %edx,%eax
  and    $0xf,%eax
  sub    %edx,%eax
  jmp    L130
L43:
  movzbl 0x1b(%rsp),%eax
  movzbl 0x1a(%rsp),%ebx
  jmp    L130
L192:
  mov    %r13d,%edx
  sar    $0x1f,%edx
  shr    $0x1c,%edx
  lea    0x0(%r13,%rdx,1),%eax
  and    $0xf,%eax
  sub    %edx,%eax
  mov    $0xf,%ebx
  sub    %eax,%ebx
  mov    %r12d,%eax
  sar    $0x1f,%eax
  shr    $0x1c,%eax
  lea    (%r12,%rax,1),%edx
  and    $0xf,%edx
  sub    %eax,%edx
  mov    $0xf,%eax
  sub    %edx,%eax
  jmp    L130
L51:
  movzbl 0x19(%rsp),%eax
  movzbl 0x18(%rsp),%ebx
L130:
  cmp    $0xffffffff,%r14d
  je     L250
  movzbl 0x17(%rsp),%edx
  cmp    0x10(%rsp),%r14d
  je     L229
L272:
  mov    %dl,0x0(%rbp)
L244:
  add    $0x1,%rbp
  add    $0x1,%r13d
  add    $0x1,%r12d
  cmp    0x8(%rsp),%rbp
  je     L193
L211:
  cmp    $0x3,%r15d
  je     L192
  jg     L22
  cmp    $0x1,%r15d
  je     L51
  cmp    $0x2,%r15d
  jne    L35
  mov    %r13d,%eax
  sar    $0x1f,%eax
  shr    $0x1c,%eax
  lea    0x0(%r13,%rax,1),%ebx
  and    $0xf,%ebx
  sub    %eax,%ebx
  mov    %r12d,%edx
  sar    $0x1f,%edx
  shr    $0x1c,%edx
  lea    (%r12,%rdx,1),%eax
  and    $0xf,%eax
  sub    %edx,%eax
  jmp    L130
L250:
  shl    $0x4,%ebx
  and    $0xf,%eax
  add    %eax,%ebx
  mov    %bl,0x0(%rbp)
  jmp    L244
L229:
  shl    $0x4,%ebx
  and    $0xf,%eax
  lea    (%rbx,%rax,1),%edx
  jmp    L272
L193:
  addl   $0x1,0x10(%rsp)
  mov    0x10(%rsp),%eax
  mov    0x98(%rsp),%edi
  add    %edi,0x1c(%rsp)
  cmp    %eax,0x90(%rsp)
  je     L194
L308:
  cmpl   $0x0,0x98(%rsp)
  jle    L193
  movslq 0x1c(%rsp),%rax
  mov    %rax,%rbp
  add    0xa8(%rsp),%rbp
  movzbl 0x20(%rsp),%r13d
  mov    0x10(%rsp),%edi
  add    %edi,%r13d
  movzbl 0x24(%rsp),%r12d
  add    %edi,%r12d
  add    0x28(%rsp),%rax
  mov    %rax,0x8(%rsp)
  jmp    L211
L194:
  addl   $0x1,0x30(%rsp)
  mov    0x30(%rsp),%eax
  mov    0x38(%rsp),%edi
  add    %edi,0x34(%rsp)
  cmp    %eax,0x88(%rsp)
  je     L153
L52:
  cmp    $0x4,%r15d
  jne    L122
  cmpl   $0x0,0xa0(%rsp)
  je     L209
L122:
  mov    0x34(%rsp),%eax
  mov    %eax,0x1c(%rsp)
  movl   $0x0,0x10(%rsp)
  cmpl   $0x0,0x90(%rsp)
  jg     L308
  jmp    L194
L153:
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void generate_char_data_set(int generation_Type, int random_seed, int default_real, int default_imaginary, int initial_real, int initial_imaginary, int single_frequency, int num_timesteps, int num_frequencies, int num_elements, int no_repeat_random, unsigned char *packed_data_set) {
  if (single_frequency > num_frequencies || single_frequency < 0)
    single_frequency = -1;
  default_real = offset_and_clip_value(default_real, 8, 0, 15);
  default_imaginary = offset_and_clip_value(default_imaginary, 8, 0, 15);
  initial_real = offset_and_clip_value(initial_real, 8, 0, 15);
  initial_imaginary = offset_and_clip_value(initial_imaginary, 8, 0, 15);
  unsigned char clipped_offset_default_real = (unsigned char)default_real;
  unsigned char clipped_offset_default_imaginary = (unsigned char)default_imaginary;
  unsigned char clipped_offset_initial_real = (unsigned char)initial_real;
  unsigned char clipped_offset_initial_imaginary = (unsigned char)initial_imaginary;
  unsigned char temp_output;
  if (generation_Type == 4u) {
    srand(random_seed);
  }
  for (int k = 0; k < num_timesteps; k++) {
    if (generation_Type == 4u && !no_repeat_random) {
      srand(random_seed);
    }
    for (int j = 0; j < num_frequencies; j++) {
      for (int i = 0; i < num_elements; i++) {
        int currentAddress = k * num_frequencies * num_elements + j * num_elements + i;
        unsigned char new_real;
        unsigned char new_imaginary;
        switch (generation_Type) {
        case 1u:
          new_real = clipped_offset_initial_real;
          new_imaginary = clipped_offset_initial_imaginary;
          break;
        case 2u:
          new_real = (j + clipped_offset_initial_real + i) % 16;
          new_imaginary = (j + clipped_offset_initial_imaginary + i) % 16;
          break;
        case 3u:
          new_real = 15 - ((j + clipped_offset_initial_real + i) % 16);
          new_imaginary = 15 - ((j + clipped_offset_initial_imaginary + i) % 16);
          break;
        case 4u:
          new_real = (unsigned char)(rand() % 16);
          new_imaginary = (unsigned char)(rand() % 16);
          break;
        default:
          new_real = clipped_offset_default_real;
          new_imaginary = clipped_offset_default_imaginary;
          break;
        }
        if (single_frequency == -1) {
          temp_output = ((new_real << 4) & 0xF0) + (new_imaginary & 0x0F);
          packed_data_set[currentAddress] = temp_output;
        } else {
          if (j == single_frequency) {
            temp_output = ((new_real << 4) & 0xF0) + (new_imaginary & 0x0F);
          } else {
            temp_output = ((clipped_offset_default_real << 4) & 0xF0) + (clipped_offset_default_imaginary & 0x0F);
          }
          packed_data_set[currentAddress] = temp_output;
        }
      }
    }
  }
  return;
}
```