user: 请将以下的汇编代码转换成C语言代码：

```asm
<vote_week_num>:
  endbr64
  push   %r14
  xor    %eax,%eax
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  call   <channel_get_count@plt>
  test   %eax,%eax
  je     L151
  lea    0x0(,%rax,4),%r12d
  mov    %eax,%r13d
  mov    %r12d,%edi
  call   <malloc@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L151
  mov    %r12d,%edi
  call   <malloc@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L146
  test   %r13d,%r13d
  jle    L95
  mov    %r13d,%edx
  lea    0x0(,%rdx,4),%rbx
  lea    0x0(%rbp,%rbx,1),%rax
  cmp    %rax,%r12
  jae    L166
  lea    (%r12,%rbx,1),%rax
  cmp    %rax,%rbp
  jb     L97
L166:
  mov    %rbx,%rdx
  mov    $0xff,%esi
  mov    %rbp,%rdi
  call   <memset@plt>
  mov    %rbx,%rdx
  xor    %esi,%esi
  mov    %r12,%rdi
  call   <memset@plt>
L78:
  xor    %r14d,%r14d
  nopl   0x0(%rax)
L21:
  mov    %r14d,%edi
  call   <channel_get_sv_id@plt>
  mov    %eax,%edi
  test   %eax,%eax
  je     L125
  call   <nav_week_num@plt>
  cmp    $0xffffffff,%eax
  je     L125
  xor    %edx,%edx
  jmp    L11
  nopl   0x0(%rax)
L87:
  cmp    %eax,%ecx
  je     L7
  add    $0x4,%rdx
  cmp    %rdx,%rbx
  je     L125
L11:
  mov    0x0(%rbp,%rdx,1),%ecx
  lea    0x0(%rbp,%rdx,1),%rsi
  cmp    $0xffffffff,%ecx
  jne    L87
  mov    %eax,(%rsi)
  addl   $0x1,(%r12,%rdx,1)
  cs nopw 0x0(%rax,%rax,1)
L125:
  add    $0x1,%r14d
  cmp    %r14d,%r13d
  jne    L21
L95:
  mov    (%r12),%ecx
  mov    0x0(%rbp),%r14d
  cmp    $0x1,%r13d
  jle    L116
  lea    -0x2(%r13),%esi
  mov    $0x1,%eax
  add    $0x2,%rsi
  nopl   0x0(%rax)
L84:
  mov    (%r12,%rax,4),%edx
  cmp    %ecx,%edx
  jle    L44
  mov    0x0(%rbp,%rax,4),%r14d
  mov    %edx,%ecx
L44:
  add    $0x1,%rax
  cmp    %rax,%rsi
  jne    L84
L116:
  mov    %rbp,%rdi
  call   <free@plt>
  mov    %r12,%rdi
  call   <free@plt>
L56:
  pop    %rbx
  mov    %r14d,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax)
L7:
  addl   $0x1,(%r12,%rdx,1)
  jmp    L125
L97:
  xor    %eax,%eax
  nopl   0x0(%rax)
L168:
  movl   $0xffffffff,0x0(%rbp,%rax,4)
  movl   $0x0,(%r12,%rax,4)
  add    $0x1,%rax
  cmp    %rax,%rdx
  jne    L168
  jmp    L78
L146:
  mov    %rbp,%rdi
  call   <free@plt>
L151:
  mov    $0xffffffff,%r14d
  jmp    L56
```

assistant: ```c
int vote_week_num(void) {
  int *week_nums;
  int *votes;
  int count = channel_get_count();
  int i, c;
  int max_week, max_votes;
  if (count == 0)
    return -1;
  week_nums = malloc(sizeof(int) * count);
  if (week_nums == NULL)
    return -1;
  votes = malloc(sizeof(int) * count);
  if (votes == NULL) {
    free(week_nums);
    return -1;
  }
  for (i = 0; i < count; i++) {
    week_nums[i] = -1;
    votes[i] = 0;
  }
  for (c = 0; c < count; c++) {
    int sv, week;
    sv = channel_get_sv_id(c);
    if (sv == 0)
      continue;
    week = nav_week_num(sv);
    if (week == -1)
      continue;
    for (i = 0; i < count; i++) {
      if (week_nums[i] == -1) {
        week_nums[i] = week;
        votes[i] = votes[i] + 1;
        break;
      } else if (week_nums[i] == week) {
        votes[i] = votes[i] + 1;
        break;
      }
    }
  }
  max_votes = votes[0];
  max_week = week_nums[0];
  for (i = 1; i < count; i++) {
    if (votes[i] > max_votes) {
      max_votes = votes[i];
      max_week = week_nums[i];
    }
  }
  free(week_nums);
  free(votes);
  return max_week;
}
```