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

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0xf0,%rsp
  mov    %edi,-0xe4(%rbp)
  mov    %rsi,-0xf0(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  cmpl   $0x3,-0xe4(%rbp)
  jg     L41
  lea    D41(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0xa,%edi
  call   <putchar@plt>
  lea    D48(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x0,%edi
  call   <exit@plt>
L41:
  mov    -0xf0(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rdx
  lea    -0xb0(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  mov    -0xf0(%rbp),%rax
  add    $0x10,%rax
  mov    (%rax),%rdx
  lea    -0x60(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  mov    -0xf0(%rbp),%rax
  add    $0x18,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <atoi@plt>
  mov    %ax,-0xda(%rbp)
  lea    -0xb0(%rbp),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <does_not_exist@plt>
  test   %eax,%eax
  je     L66
  lea    -0xb0(%rbp),%rax
  mov    %rax,%rsi
  lea    D14(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x0,%edi
  call   <exit@plt>
L66:
  lea    -0x60(%rbp),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <does_not_exist@plt>
  test   %eax,%eax
  je     L16
  lea    -0x60(%rbp),%rax
  mov    %rax,%rsi
  lea    D26(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x0,%edi
  call   <exit@plt>
L16:
  lea    -0x60(%rbp),%rdx
  lea    -0xb0(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <are_not_same_size@plt>
  test   %eax,%eax
  je     L25
  lea    D0(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x0,%edi
  call   <exit@plt>
L25:
  lea    -0xc8(%rbp),%rdx
  lea    -0xd0(%rbp),%rcx
  lea    -0xb0(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <get_image_size@plt>
  mov    -0xc8(%rbp),%rdx
  mov    -0xd0(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <allocate_image_array@plt>
  cltq
  mov    %rax,-0xc0(%rbp)
  mov    -0xc8(%rbp),%rdx
  mov    -0xd0(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <allocate_image_array@plt>
  cltq
  mov    %rax,-0xb8(%rbp)
  mov    -0xc0(%rbp),%rdx
  lea    -0xb0(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <read_image_array@plt>
  mov    -0xb8(%rbp),%rdx
  lea    -0x60(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <read_image_array@plt>
  movl   $0x0,-0xd8(%rbp)
  jmp    L24
L22:
  movl   $0x0,-0xd4(%rbp)
  jmp    L83
L80:
  mov    -0xd8(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0xb8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0xd4(%rbp),%eax
  cltq
  add    %rax,%rax
  add    %rdx,%rax
  movzwl (%rax),%eax
  test   %ax,%ax
  je     L89
  mov    -0xd8(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0xc0(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0xd4(%rbp),%eax
  cltq
  add    %rax,%rax
  add    %rdx,%rax
  movzwl (%rax),%eax
  mov    %eax,%edx
  movzwl -0xda(%rbp),%eax
  add    %eax,%edx
  mov    -0xd8(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0xc0(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%rcx
  mov    -0xd4(%rbp),%eax
  cltq
  add    %rax,%rax
  add    %rcx,%rax
  mov    %dx,(%rax)
  mov    -0xd8(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0xc0(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0xd4(%rbp),%eax
  cltq
  add    %rax,%rax
  add    %rdx,%rax
  movzwl (%rax),%eax
  cmp    $0xff,%ax
  jle    L89
  mov    -0xd8(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0xc0(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0xd4(%rbp),%eax
  cltq
  add    %rax,%rax
  add    %rdx,%rax
  movw   $0xff,(%rax)
L89:
  addl   $0x1,-0xd4(%rbp)
L83:
  mov    -0xd4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0xc8(%rbp),%rax
  cmp    %rax,%rdx
  jl     L80
  addl   $0x1,-0xd8(%rbp)
L24:
  mov    -0xd8(%rbp),%eax
  movslq %eax,%rdx
  mov    -0xd0(%rbp),%rax
  cmp    %rax,%rdx
  jl     L22
  mov    -0xc0(%rbp),%rdx
  lea    -0xb0(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <write_image_array@plt>
  mov    -0xd0(%rbp),%rdx
  mov    -0xc0(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <free_image_array@plt>
  mov    -0xd0(%rbp),%rdx
  mov    -0xb8(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <free_image_array@plt>
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L91
  call   <__stack_chk_fail@plt>
L91:
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D41
type: string
name: extract_symbolic_data
arguments: data_label: D48
type: string
name: extract_symbolic_data
arguments: data_label: D14
type: string
name: extract_symbolic_data
arguments: data_label: D26
type: string
name: extract_symbolic_data
arguments: data_label: D0
type: string

tool: D41: 

Not enough parameters:

tool: D48: 
   usage: hidet image-file text-file-image factor  

tool: D14: 
ERROR input file %s does not exist

tool: D26: 
ERROR output file %s does not exist

tool: D0: 
ERROR images are not same size

assistant: ```c
int main(argc, argv)
int argc;
char *argv[];
{
  char image_name[80], water_name[80];
  int i, j;
  long length, width;
  short factor;
  short **the_image;
  short **out_image;
  if (argc < 4) {
    printf("\n\nNot enough parameters:");
    printf("\n");
    printf("\n   usage: hidet image-file text-file-image factor  ");
    exit(0);
  }
  strcpy(image_name, argv[1]);
  strcpy(water_name, argv[2]);
  factor = atoi(argv[3]);
  if (does_not_exist(image_name)) {
    printf("\nERROR input file %s does not exist", image_name);
    exit(0);
  }
  if (does_not_exist(water_name)) {
    printf("\nERROR output file %s does not exist", water_name);
    exit(0);
  }
  if (are_not_same_size(image_name, water_name)) {
    printf("\nERROR images are not same size");
    exit(0);
  }
  get_image_size(image_name, &length, &width);
  the_image = allocate_image_array(length, width);
  out_image = allocate_image_array(length, width);
  read_image_array(image_name, the_image);
  read_image_array(water_name, out_image);
  for (i = 0; i < length; i++) {
    for (j = 0; j < width; j++) {
      if (out_image[i][j] != 0) {
        the_image[i][j] = the_image[i][j] + factor;
        if (the_image[i][j] > 255)
          the_image[i][j] = 255;
      }
    }
  }
  write_image_array(image_name, the_image);
  free_image_array(the_image, length);
  free_image_array(out_image, length);
}
```