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

```asm
<edge_matrix_left>:
  endbr64
  push   %r15
  mov    %esi,%eax
  mov    %r8d,%r15d
  push   %r14
  push   %r13
  mov    %edx,%r13d
  push   %r12
  mov    %rdi,%r12
  mov    %r8d,%edi
  push   %rbp
  mov    %r8d,%ebp
  imul   %r8d,%edi
  shr    $0x1f,%ebp
  push   %rbx
  mov    %esi,%ebx
  add    %r8d,%ebp
  sar    %ebp
  add    %ebp,%eax
  sub    $0x58,%rsp
  lea    0x0(%rbp,%rdx,1),%r14d
  sub    %ebp,%ebx
  imul   %ecx,%eax
  mov    %ecx,0x4(%rsp)
  imul   %ecx,%ebx
  mov    %eax,(%rsp)
  call   <malloc@plt>
  mov    %rax,%r9
  test   %rax,%rax
  je     L196
  cmp    (%rsp),%ebx
  jg     L196
  movslq 0x4(%rsp),%rax
  movslq %r13d,%rsi
  mov    $0x4,%ecx
  lea    0x1(%rbp),%r8d
  mov    %rsi,0x40(%rsp)
  shl    $0x2,%rax
  mov    %rax,0x8(%rsp)
  movslq %ebx,%rax
  add    %rsi,%rax
  lea    (%r12,%rax,4),%rdx
  mov    %ebp,%eax
  shl    $0x2,%rax
  cmp    $0x1,%r15d
  cmovg  %rax,%rcx
  mov    $0x1,%eax
  cmovg  %ebp,%eax
  mov    %rcx,0x10(%rsp)
  mov    %eax,%edi
  mov    %eax,0x1c(%rsp)
  shr    $0x2,%eax
  and    $0xfffffffc,%edi
  sub    $0x1,%eax
  lea    0x1(%rdi),%ecx
  mov    %edi,0x28(%rsp)
  add    $0x2,%edi
  add    $0x1,%rax
  mov    %ecx,0x34(%rsp)
  mov    %r8d,%ecx
  shl    $0x4,%rax
  shr    $0x2,%ecx
  mov    %edi,0x3c(%rsp)
  lea    -0x1(%rcx),%edi
  mov    %r8d,%ecx
  mov    %rax,0x20(%rsp)
  and    $0xfffffffc,%ecx
  add    $0x1,%rdi
  mov    %ecx,0x18(%rsp)
  add    %r13d,%ecx
  shl    $0x4,%rdi
  lea    0x1(%rcx),%r11d
  mov    %ecx,0x30(%rsp)
  add    $0x2,%ecx
  mov    %ecx,0x38(%rsp)
  mov    %rsi,%rcx
  neg    %rcx
  mov    %r11d,0x2c(%rsp)
  shl    $0x2,%rcx
  mov    %rcx,0x48(%rsp)
  xor    %ecx,%ecx
  cs nopw 0x0(%rax,%rax,1)
L130:
  cmp    $0x1,%r15d
  jle    L100
  lea    (%rbx,%r13,1),%eax
  movslq %ecx,%r10
  shl    $0x2,%r10
  cltq
  lea    (%r12,%rax,4),%rsi
  lea    (%r9,%r10,1),%rax
  add    0x10(%rsp),%r10
  add    %r9,%r10
  cmp    %rdx,%r10
  lea    0x4(%rdx),%r10
  setbe  %r11b
  cmp    %r10,%rax
  setae  %r10b
  or     %r11b,%r10b
  je     L138
  cmp    $0x7,%r15d
  jle    L138
  movd   (%rsi),%xmm2
  mov    0x20(%rsp),%r11
  pshufd $0x0,%xmm2,%xmm0
  lea    (%rax,%r11,1),%r10
  xchg   %ax,%ax
L50:
  movups %xmm0,(%rax)
  add    $0x10,%rax
  cmp    %rax,%r10
  jne    L50
  mov    0x28(%rsp),%r11d
  lea    (%rcx,%r11,1),%eax
  cmp    %r11d,0x1c(%rsp)
  je     L3
  mov    (%rsi),%r10d
  movslq %eax,%r11
  add    $0x1,%eax
  mov    %r10d,(%r9,%r11,4)
  cmp    0x34(%rsp),%ebp
  jle    L3
  cltq
  mov    %r10d,(%r9,%rax,4)
  lea    0x0(,%rax,4),%r11
  cmp    0x3c(%rsp),%ebp
  jle    L3
  mov    (%rsi),%eax
  mov    %eax,0x4(%r9,%r11,1)
L3:
  xor    %esi,%esi
  lea    -0x1(%rbp),%eax
  cmp    $0x1,%r15d
  cmovle %esi,%eax
  lea    0x1(%rcx,%rax,1),%ecx
L100:
  cmp    %r14d,%r13d
  jg     L174
  movslq %ecx,%rsi
  lea    0x4(%rdx),%r11
  shl    $0x2,%rsi
  lea    (%r9,%rsi,1),%rax
  mov    %rax,%r10
  sub    %r11,%r10
  cmp    $0x8,%r10
  jbe    L160
  cmp    $0x2,%ebp
  jbe    L160
  xor    %esi,%esi
  nopl   (%rax)
L42:
  movdqu (%rdx,%rsi,1),%xmm1
  movups %xmm1,(%rax,%rsi,1)
  add    $0x10,%rsi
  cmp    %rsi,%rdi
  jne    L42
  mov    0x18(%rsp),%esi
  lea    (%rcx,%rsi,1),%eax
  cmp    %esi,%r8d
  je     L114
  mov    0x30(%rsp),%esi
  add    %ebx,%esi
  movslq %esi,%rsi
  mov    (%r12,%rsi,4),%r10d
  movslq %eax,%rsi
  add    $0x1,%eax
  mov    %r10d,(%r9,%rsi,4)
  mov    0x2c(%rsp),%esi
  cmp    %r14d,%esi
  jg     L114
  add    %ebx,%esi
  cltq
  movslq %esi,%rsi
  lea    0x0(,%rax,4),%r10
  mov    (%r12,%rsi,4),%esi
  mov    %esi,(%r9,%rax,4)
  mov    0x38(%rsp),%eax
  cmp    %eax,%r14d
  jl     L114
  add    %ebx,%eax
  cltq
  mov    (%r12,%rax,4),%eax
  mov    %eax,0x4(%r9,%r10,1)
L114:
  add    %r8d,%ecx
L174:
  add    0x4(%rsp),%ebx
  add    0x8(%rsp),%rdx
  cmp    %ebx,(%rsp)
  jge    L130
L196:
  add    $0x58,%rsp
  mov    %r9,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L138:
  xor    %r10d,%r10d
  nopl   0x0(%rax,%rax,1)
L143:
  mov    (%rsi),%r11d
  mov    %r11d,(%rax,%r10,4)
  add    $0x1,%r10
  cmp    %r10d,%ebp
  jg     L143
  jmp    L3
  nopl   (%rax)
L160:
  mov    0x48(%rsp),%rax
  add    %rax,%rsi
  lea    (%rdx,%rax,1),%r10
  mov    0x40(%rsp),%rax
  add    %r9,%rsi
  nopl   0x0(%rax)
L91:
  mov    (%r10,%rax,4),%r11d
  mov    %r11d,(%rsi,%rax,4)
  add    $0x1,%rax
  cmp    %eax,%r14d
  jge    L91
  jmp    L114
```

assistant: ```c
uint8_t *edge_matrix_left(uint8_t *data, int y, int x, int width, int size) {
  int median = size / 2;
  int index = 0;
  int yl = (y - median) * width;
  int yh = (y + median) * width;
  int xl = x;
  int xh = x + median;
  uint8_t *matrix = malloc(size * size);
  if (!matrix) {
    return NULL;
  }
  for (int row = yl; row <= yh; row += width) {
    for (int i = 0; i < median; ++i) {
      matrix[index] = data[row + xl];
      index++;
    }
    for (int col = xl; col <= xh; ++col) {
      matrix[index] = data[row + col];
      index++;
    }
  }
  return matrix;
}
```