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

```asm
<avg_422_downsample_first_ag_rb_vectors_n_save_previous_sse2>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  movl   $0x0,-0x30(%rbp)
  movl   $0x0,-0x2c(%rbp)
  movl   $0x0,-0x28(%rbp)
  movl   $0x0,-0x24(%rbp)
  movl   $0x0,-0x20(%rbp)
  movl   $0x0,-0x1c(%rbp)
  movl   $0x0,-0x18(%rbp)
  movl   $0x0,-0x14(%rbp)
  mov    -0x38(%rbp),%rax
  mov    $0x8d,%esi
  mov    (%rax),%rdi
  call   <_mm_shuffle_epi32@plt>
  mov    %rax,-0x18(%rbp)
  mov    -0x38(%rbp),%rax
  add    $0x10,%rax
  mov    $0x8d,%esi
  mov    (%rax),%rdi
  call   <_mm_shuffle_epi32@plt>
  mov    %rax,-0x28(%rbp)
  mov    -0x28(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <_mm_unpacklo_epi64@plt>
  mov    %rax,-0x30(%rbp)
  mov    -0x28(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <_mm_unpackhi_epi64@plt>
  mov    %rax,-0x18(%rbp)
  mov    D19(%rip),%rax
  mov    -0x38(%rbp),%rdx
  mov    %rax,%rsi
  mov    (%rdx),%rdi
  call   <_mm_and_si128@plt>
  mov    %rax,-0x28(%rbp)
  mov    -0x30(%rbp),%rax
  mov    $0x4,%esi
  mov    %rax,%rdi
  call   <_mm_slli_si128@plt>
  mov    %rax,-0x20(%rbp)
  mov    -0x20(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <_mm_or_si128@plt>
  mov    %rax,-0x28(%rbp)
  mov    -0x30(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <_mm_avg_epu16@plt>
  mov    %rax,-0x28(%rbp)
  mov    -0x28(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <_mm_avg_epu16@plt>
  mov    %rax,%rdx
  mov    -0x48(%rbp),%rax
  mov    %rdx,(%rax)
  mov    -0x38(%rbp),%rax
  add    $0x8,%rax
  mov    $0x8d,%esi
  mov    (%rax),%rdi
  call   <_mm_shuffle_epi32@plt>
  mov    %rax,-0x18(%rbp)
  mov    -0x38(%rbp),%rax
  add    $0x18,%rax
  mov    $0x8d,%esi
  mov    (%rax),%rdi
  call   <_mm_shuffle_epi32@plt>
  mov    %rax,-0x28(%rbp)
  mov    -0x28(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <_mm_unpacklo_epi64@plt>
  mov    %rax,-0x30(%rbp)
  mov    -0x28(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <_mm_unpackhi_epi64@plt>
  mov    %rax,-0x18(%rbp)
  mov    -0x38(%rbp),%rax
  lea    0x8(%rax),%rdx
  mov    D19(%rip),%rax
  mov    %rax,%rsi
  mov    (%rdx),%rdi
  call   <_mm_and_si128@plt>
  mov    %rax,-0x28(%rbp)
  mov    -0x30(%rbp),%rax
  mov    $0x4,%esi
  mov    %rax,%rdi
  call   <_mm_slli_si128@plt>
  mov    %rax,-0x20(%rbp)
  mov    -0x20(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <_mm_or_si128@plt>
  mov    %rax,-0x28(%rbp)
  mov    -0x30(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <_mm_avg_epu16@plt>
  mov    %rax,-0x28(%rbp)
  mov    -0x48(%rbp),%rax
  lea    0x8(%rax),%rbx
  mov    -0x28(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <_mm_avg_epu16@plt>
  mov    %rax,(%rbx)
  mov    -0x38(%rbp),%rax
  add    $0x10,%rax
  mov    %rax,%rdi
  call   <_mm_load_si128@plt>
  mov    %rax,%rdx
  mov    -0x40(%rbp),%rax
  mov    %rdx,(%rax)
  mov    -0x38(%rbp),%rax
  add    $0x18,%rax
  mov    -0x40(%rbp),%rdx
  lea    0x8(%rdx),%rbx
  mov    %rax,%rdi
  call   <_mm_load_si128@plt>
  mov    %rax,(%rbx)
  nop
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

tool_calls: name: unpack_data
arguments: tag: D19
data_type: byte[8]

tool: {"D19": [0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00]}

assistant: ```c
extern void avg_422_downsample_first_ag_rb_vectors_n_save_previous_sse2(__m128i *in_4_v16i_current_ag_rb_vectors, __m128i *previous, __m128i *out_2_v16i_avg_422_ag_rb_vectors) {
  static const __m128i keep_1st = {0x00000000FFFFFFFFLL, 0x0000000000000000LL};
  __m128i scratch1 = {0x0LL, 0x0LL};
  __m128i scratch2 = {0x0LL, 0x0LL};
  __m128i scratch3 = {0x0LL, 0x0LL};
  __m128i scratch4 = {0x0LL, 0x0LL};
  (scratch4) = _mm_shuffle_epi32(in_4_v16i_current_ag_rb_vectors[0], 0x8D);
  (scratch2) = _mm_shuffle_epi32(in_4_v16i_current_ag_rb_vectors[2], 0x8D);
  (scratch1) = _mm_unpacklo_epi64((scratch4), (scratch2));
  (scratch4) = _mm_unpackhi_epi64((scratch4), (scratch2));
  (scratch2) = _mm_and_si128(in_4_v16i_current_ag_rb_vectors[0], (keep_1st));
  (scratch3) = _mm_slli_si128((scratch1), 4);
  (scratch2) = _mm_or_si128((scratch2), (scratch3));
  (scratch2) = _mm_avg_epu16((scratch2), (scratch1));
  out_2_v16i_avg_422_ag_rb_vectors[0] = _mm_avg_epu16((scratch4), (scratch2));
  (scratch4) = _mm_shuffle_epi32(in_4_v16i_current_ag_rb_vectors[1], 0x8D);
  (scratch2) = _mm_shuffle_epi32(in_4_v16i_current_ag_rb_vectors[3], 0x8D);
  (scratch1) = _mm_unpacklo_epi64((scratch4), (scratch2));
  (scratch4) = _mm_unpackhi_epi64((scratch4), (scratch2));
  (scratch2) = _mm_and_si128(in_4_v16i_current_ag_rb_vectors[1], (keep_1st));
  (scratch3) = _mm_slli_si128((scratch1), 4);
  (scratch2) = _mm_or_si128((scratch2), (scratch3));
  (scratch2) = _mm_avg_epu16((scratch2), (scratch1));
  out_2_v16i_avg_422_ag_rb_vectors[1] = _mm_avg_epu16((scratch4), (scratch2));
  previous[0] = _mm_load_si128(&in_4_v16i_current_ag_rb_vectors[2]);
  previous[1] = _mm_load_si128(&in_4_v16i_current_ag_rb_vectors[3]);
}
```