user: Converte this assembly snippet into its equivalent C code:

```asm
<xor_image>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    %rcx,-0x30(%rbp)
  movl   $0x0,-0x8(%rbp)
  jmp    L118
L36:
  mov    -0x8(%rbp),%ecx
  movslq %ecx,%rax
  imul   $0x66666667,%rax,%rax
  shr    $0x20,%rax
  sar    $0x2,%eax
  mov    %ecx,%esi
  sar    $0x1f,%esi
  sub    %esi,%eax
  mov    %eax,%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  add    %eax,%eax
  sub    %eax,%ecx
  mov    %ecx,%edx
  test   %edx,%edx
  jne    L102
  mov    -0x8(%rbp),%eax
  mov    %eax,%esi
  lea    D4(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L102:
  movl   $0x0,-0x4(%rbp)
  jmp    L76
L69:
  mov    -0x8(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x4(%rbp),%eax
  cltq
  add    %rax,%rax
  add    %rdx,%rax
  movzwl (%rax),%eax
  test   %ax,%ax
  je     L40
  mov    -0x8(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x4(%rbp),%eax
  cltq
  add    %rax,%rax
  add    %rdx,%rax
  movzwl (%rax),%eax
  test   %ax,%ax
  jne    L40
  mov    -0x8(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x4(%rbp),%eax
  cltq
  add    %rax,%rax
  add    %rdx,%rax
  movzwl (%rax),%eax
  mov    %ax,-0xa(%rbp)
L40:
  mov    -0x8(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x4(%rbp),%eax
  cltq
  add    %rax,%rax
  add    %rdx,%rax
  movzwl (%rax),%eax
  test   %ax,%ax
  jne    L6
  mov    -0x8(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x4(%rbp),%eax
  cltq
  add    %rax,%rax
  add    %rdx,%rax
  movzwl (%rax),%eax
  test   %ax,%ax
  je     L6
  mov    -0x8(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x4(%rbp),%eax
  cltq
  add    %rax,%rax
  add    %rdx,%rax
  movzwl (%rax),%eax
  mov    %ax,-0xa(%rbp)
L6:
  mov    -0x8(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x4(%rbp),%eax
  cltq
  add    %rax,%rax
  add    %rdx,%rax
  movzwl (%rax),%eax
  test   %ax,%ax
  jne    L62
  mov    -0x8(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x4(%rbp),%eax
  cltq
  add    %rax,%rax
  add    %rdx,%rax
  movzwl (%rax),%eax
  test   %ax,%ax
  jne    L62
  movw   $0x0,-0xa(%rbp)
L62:
  mov    -0x8(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x4(%rbp),%eax
  cltq
  add    %rax,%rax
  add    %rdx,%rax
  movzwl (%rax),%eax
  test   %ax,%ax
  je     L73
  mov    -0x8(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x4(%rbp),%eax
  cltq
  add    %rax,%rax
  add    %rdx,%rax
  movzwl (%rax),%eax
  test   %ax,%ax
  je     L73
  movw   $0x0,-0xa(%rbp)
L73:
  mov    -0x8(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x4(%rbp),%eax
  cltq
  add    %rax,%rax
  add    %rax,%rdx
  movzwl -0xa(%rbp),%eax
  mov    %ax,(%rdx)
  addl   $0x1,-0x4(%rbp)
L76:
  mov    -0x4(%rbp),%eax
  cltq
  cmp    %rax,-0x30(%rbp)
  jg     L69
  addl   $0x1,-0x8(%rbp)
L118:
  mov    -0x8(%rbp),%eax
  cltq
  cmp    %rax,-0x28(%rbp)
  jg     L36
  mov    $0x1,%eax
  leave
  ret
```

tool_calls: name: read_data
arguments: label: D4
type: string

tool: D4:  %d

assistant: ```c
int xor_image(the_image, out_image, rows, cols)
short **the_image, **out_image;
long cols, rows;
{
  int i, j;
  short answer;
  for (i = 0; i < rows; i++) {
    if ((i % 10) == 0)
      printf(" %d", i);
    for (j = 0; j < cols; j++) {
      if ((the_image[i][j] != 0 && out_image[i][j] == 0))
        answer = the_image[i][j];
      if ((the_image[i][j] == 0 && out_image[i][j] != 0))
        answer = out_image[i][j];
      if ((the_image[i][j] == 0 && out_image[i][j] == 0))
        answer = 0;
      if ((the_image[i][j] != 0 && out_image[i][j] != 0))
        answer = 0;
      out_image[i][j] = answer;
    }
  }
  return (1);
}
```