ylfeng/ReF-Decompile-dataset huggingface dataset:
user: What would the C source look like for the assembly code provided here:

```asm
<in_cksum>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x2c(%rbp),%eax
  mov    %eax,-0x18(%rbp)
  movl   $0x0,-0x14(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  movw   $0x0,-0x1a(%rbp)
  jmp    L25
L14:
  mov    -0x10(%rbp),%rax
  lea    0x2(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movzwl (%rax),%eax
  movzwl %ax,%eax
  add    %eax,-0x14(%rbp)
  subl   $0x2,-0x18(%rbp)
L25:
  cmpl   $0x1,-0x18(%rbp)
  jg     L14
  cmpl   $0x1,-0x18(%rbp)
  jne    L0
  lea    -0x1a(%rbp),%rax
  mov    -0x10(%rbp),%rdx
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  movzwl -0x1a(%rbp),%eax
  movzwl %ax,%eax
  add    %eax,-0x14(%rbp)
L0:
  mov    -0x14(%rbp),%eax
  sar    $0x10,%eax
  mov    %eax,%edx
  mov    -0x14(%rbp),%eax
  movzwl %ax,%eax
  add    %edx,%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x14(%rbp),%eax
  sar    $0x10,%eax
  add    %eax,-0x14(%rbp)
  mov    -0x14(%rbp),%eax
  not    %eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L12
  call   <__stack_chk_fail@plt>
L12:
  leave
  ret
```

assistant: ```c
unsigned short in_cksum(unsigned short *addr, int len) {
  int nleft = len, sum = 0;
  unsigned short *w = addr, answer = 0;
  while (nleft > 1) {
    sum += *w++;
    nleft -= 2;
  }
  if (nleft == 1) {
    *(unsigned char *)&answer = *(u_char *)w;
    sum += answer;
  }
  sum = (sum >> 16) + (sum & 0xffff);
  sum += sum >> 16;
  return ~sum;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<in_cksum>:
  endbr64
  mov    $0x0,%r9d
  cmp    $0x1,%esi
  jle    L36
  lea    -0x2(%rsi),%r8d
  shr    %r8d
  lea    0x1(%r8),%eax
  lea    (%rdi,%rax,2),%rcx
  mov    $0x0,%eax
L39:
  add    $0x2,%rdi
  movzwl -0x2(%rdi),%edx
  add    %edx,%eax
  cmp    %rcx,%rdi
  jne    L39
  neg    %r8d
  lea    -0x2(%rsi,%r8,2),%esi
L46:
  cmp    $0x1,%esi
  je     L17
L21:
  mov    %eax,%edx
  sar    $0x10,%edx
  movzwl %ax,%eax
  add    %eax,%edx
  mov    %edx,%eax
  sar    $0x10,%eax
  add    %edx,%eax
  not    %eax
  ret
L36:
  mov    %rdi,%rcx
  mov    $0x0,%eax
  jmp    L46
L17:
  mov    (%rcx),%r9b
  movzwl %r9w,%r9d
  add    %r9d,%eax
  jmp    L21
```

assistant: ```c
unsigned short in_cksum(unsigned short *addr, int len) {
  int nleft = len, sum = 0;
  unsigned short *w = addr, answer = 0;
  while (nleft > 1) {
    sum += *w++;
    nleft -= 2;
  }
  if (nleft == 1) {
    *(unsigned char *)&answer = *(u_char *)w;
    sum += answer;
  }
  sum = (sum >> 16) + (sum & 0xffff);
  sum += sum >> 16;
  return ~sum;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<in_cksum>:
  endbr64
  xor    %r9d,%r9d
  cmp    $0x1,%esi
  jle    L23
  sub    $0x2,%esi
  mov    %esi,%r8d
  shr    %r8d
  lea    0x1(%r8),%eax
  lea    (%rdi,%rax,2),%rcx
  xor    %eax,%eax
  nop
L30:
  movzwl (%rdi),%edx
  add    $0x2,%rdi
  add    %edx,%eax
  cmp    %rcx,%rdi
  jne    L30
  neg    %r8d
  lea    (%rsi,%r8,2),%esi
L14:
  cmp    $0x1,%esi
  jne    L18
  mov    (%rcx),%r9b
  movzwl %r9w,%r9d
  add    %r9d,%eax
L18:
  mov    %eax,%edx
  movzwl %ax,%eax
  sar    $0x10,%edx
  add    %eax,%edx
  mov    %edx,%eax
  sar    $0x10,%eax
  add    %edx,%eax
  not    %eax
  ret
  nopl   0x0(%rax,%rax,1)
L23:
  mov    %rdi,%rcx
  xor    %eax,%eax
  jmp    L14
```

assistant: ```c
unsigned short in_cksum(unsigned short *addr, int len) {
  int nleft = len, sum = 0;
  unsigned short *w = addr, answer = 0;
  while (nleft > 1) {
    sum += *w++;
    nleft -= 2;
  }
  if (nleft == 1) {
    *(unsigned char *)&answer = *(u_char *)w;
    sum += answer;
  }
  sum = (sum >> 16) + (sum & 0xffff);
  sum += sum >> 16;
  return ~sum;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<in_cksum>:
  endbr64
  mov    %rdi,%rdx
  xor    %r10d,%r10d
  cmp    $0x1,%esi
  jle    L63
  lea    -0x2(%rsi),%r9d
  mov    %r9d,%r11d
  shr    %r11d
  lea    0x1(%r11),%ecx
  cmp    $0xd,%r9d
  jbe    L56
  mov    %rdi,%rax
  pxor   %xmm0,%xmm0
  pxor   %xmm2,%xmm2
  mov    %ecx,%edi
  shr    $0x3,%edi
  sub    $0x1,%edi
  shl    $0x4,%rdi
  lea    0x10(%rdx,%rdi,1),%rdi
  nopw   0x0(%rax,%rax,1)
L111:
  movdqu (%rax),%xmm1
  add    $0x10,%rax
  movdqa %xmm1,%xmm3
  punpckhwd %xmm2,%xmm1
  punpcklwd %xmm2,%xmm3
  paddd  %xmm3,%xmm0
  paddd  %xmm1,%xmm0
  cmp    %rdi,%rax
  jne    L111
  movdqa %xmm0,%xmm1
  mov    %ecx,%r8d
  psrldq $0x8,%xmm1
  and    $0xfffffff8,%r8d
  paddd  %xmm1,%xmm0
  mov    %r8d,%edi
  movdqa %xmm0,%xmm1
  neg    %edi
  psrldq $0x4,%xmm1
  lea    (%rsi,%rdi,2),%esi
  mov    %r8d,%edi
  paddd  %xmm1,%xmm0
  lea    (%rdx,%rdi,2),%rdi
  movd   %xmm0,%eax
  cmp    %r8d,%ecx
  je     L65
L109:
  movzwl (%rdi),%r8d
  add    %r8d,%eax
  lea    -0x2(%rsi),%r8d
  cmp    $0x1,%r8d
  jle    L65
  movzwl 0x2(%rdi),%r8d
  add    %r8d,%eax
  lea    -0x4(%rsi),%r8d
  cmp    $0x1,%r8d
  jle    L65
  movzwl 0x4(%rdi),%r8d
  add    %r8d,%eax
  lea    -0x6(%rsi),%r8d
  cmp    $0x1,%r8d
  jle    L65
  movzwl 0x6(%rdi),%r8d
  add    %r8d,%eax
  lea    -0x8(%rsi),%r8d
  cmp    $0x1,%r8d
  jle    L65
  movzwl 0x8(%rdi),%r8d
  add    %r8d,%eax
  lea    -0xa(%rsi),%r8d
  cmp    $0x1,%r8d
  jle    L65
  movzwl 0xa(%rdi),%r8d
  add    %r8d,%eax
  cmp    $0xd,%esi
  jle    L65
  movzwl 0xc(%rdi),%esi
  add    %esi,%eax
L65:
  mov    %ecx,%esi
  mov    %r11d,%ecx
  neg    %ecx
  lea    (%rdx,%rsi,2),%rdx
  lea    (%r9,%rcx,2),%esi
L103:
  cmp    $0x1,%esi
  jne    L97
  mov    (%rdx),%r10b
  movzwl %r10w,%edx
  add    %edx,%eax
L97:
  mov    %eax,%edx
  movzwl %ax,%eax
  sar    $0x10,%edx
  add    %eax,%edx
  mov    %edx,%eax
  sar    $0x10,%eax
  add    %edx,%eax
  not    %eax
  ret
  nopw   0x0(%rax,%rax,1)
L63:
  xor    %eax,%eax
  jmp    L103
L56:
  xor    %eax,%eax
  jmp    L109
```

assistant: ```c
unsigned short in_cksum(unsigned short *addr, int len) {
  int nleft = len, sum = 0;
  unsigned short *w = addr, answer = 0;
  while (nleft > 1) {
    sum += *w++;
    nleft -= 2;
  }
  if (nleft == 1) {
    *(unsigned char *)&answer = *(u_char *)w;
    sum += answer;
  }
  sum = (sum >> 16) + (sum & 0xffff);
  sum += sum >> 16;
  return ~sum;
}
```
user: What is the c source code of the assembly code below?

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  mov    %rsp,%r12
  mov    $0x10,%edx
  mov    $0x58,%esi
  mov    %r12,%rdi
  call   <memset@plt>
  mov    $0x0,%r14d
  lea    0x10(%rsp),%rbp
  jmp    L79
L28:
  mov    %ebx,%eax
  and    $0xf,%eax
  mov    $0x10,%r14d
  sub    %eax,%r14d
  cmp    $0xf,%rbx
  ja     L22
  add    %rbp,%rbx
  lea    0x10(%rbp),%rax
L32:
  mov    %r14b,(%rbx)
  add    $0x1,%rbx
  cmp    %rax,%rbx
  jne    L32
  mov    $0x1,%r15d
L44:
  mov    $0x0,%eax
L128:
  movzbl (%r12,%rax,1),%edx
  xor    %dl,0x0(%rbp,%rax,1)
  add    $0x1,%rax
  cmp    $0x10,%rax
  jne    L128
  mov    %rbp,%rdi
  call   <aes_encrypt@plt>
  mov    %rbp,%rbx
  lea    0x10(%rbp),%r13
L50:
  movsbl (%rbx),%edi
  call   <putc@plt>
  add    $0x1,%rbx
  cmp    %r13,%rbx
  jne    L50
  cmp    $0x1,%r15b
  je     L111
  mov    %r12,%rax
  mov    %rbp,%r12
  mov    %rax,%rbp
L79:
  mov    $0x0,%ebx
L121:
  mov    $0x0,%eax
  call   <getc@plt>
  mov    %al,0x0(%rbp,%rbx,1)
  cmp    $0xa,%al
  je     L28
  add    $0x1,%rbx
  cmp    $0x10,%rbx
  jne    L121
  mov    $0x0,%r15d
  jmp    L44
L22:
  mov    $0x1,%r15d
  jmp    L44
L111:
  test   %r14b,%r14b
  jne    L133
  mov    $0x0,%eax
L69:
  movzbl 0x0(%rbp,%rax,1),%edx
  xor    $0x10,%edx
  mov    %dl,(%r12,%rax,1)
  add    $0x1,%rax
  cmp    $0x10,%rax
  jne    L69
  mov    %r12,%rdi
  call   <aes_encrypt@plt>
  mov    %r12,%rbx
  add    $0x10,%r12
L47:
  movsbl (%rbx),%edi
  call   <putc@plt>
  add    $0x1,%rbx
  cmp    %rbx,%r12
  jne    L47
L133:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L77
  mov    $0x0,%eax
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L77:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int main() {
  uint8_t block1[16];
  uint8_t block2[16];
  uint8_t *block_prev = block1;
  uint8_t *block_cur = block2;
  uint8_t last = 0;
  uint8_t pad = 0;
  memset(block1, 'X', 16);
  while (1) {
    size_t num_input = 0;
    for (num_input = 0; num_input < 16; num_input++) {
      block_cur[num_input] = getc();
      if (block_cur[num_input] == '\n') {
        last = 1;
        break;
      }
    }
    if (last == 1) {
      pad = 16 - (num_input % 16);
      for (; num_input < 16; num_input++) {
        block_cur[num_input] = pad;
      }
    }
    for (size_t i = 0; i < 16; i++) {
      block_cur[i] ^= block_prev[i];
    }
    aes_encrypt(block_cur);
    for (size_t i = 0; i < 16; i++) {
      putc(block_cur[i]);
    }
    uint8_t *tmp = block_prev;
    block_prev = block_cur;
    block_cur = tmp;
    if (last == 1) {
      break;
    }
  }
  if (pad == 0) {
    for (size_t i = 0; i < 16; i++) {
      block_cur[i] = block_prev[i] ^ 0x10;
    }
    aes_encrypt(block_cur);
    for (size_t i = 0; i < 16; i++) {
      putc(block_cur[i]);
    }
  }
  return 0;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<_uiRcMifCard>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    $0x14,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    $0x7d1,%edx
  lea    D4(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <sprintf@plt>
  mov    %eax,-0x10(%rbp)
  mov    -0x10(%rbp),%ecx
  mov    -0x8(%rbp),%rax
  mov    $0x1,%edx
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <iDoRemoteFunc@plt>
  mov    %eax,-0xc(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  cmpl   $0x0,-0xc(%rbp)
  je     L16
  mov    -0xc(%rbp),%eax
  mov    %eax,%esi
  lea    D17(%rip),%rax
  mov    %rax,%rdi
  call   <vWriteLogTxt@plt>
  mov    $0x0,%eax
  jmp    L18
L16:
  mov    $0x0,%edi
  call   <iGetParaInt@plt>
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  je     L6
  mov    $0x2,%edi
  call   <psGetParaBuf@plt>
  mov    %eax,%ecx
  mov    -0xc(%rbp),%edx
  mov    -0x18(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <memcpy@plt>
L6:
  mov    -0xc(%rbp),%eax
L18:
  leave
  ret
```

tool_calls: name: parse_data
arguments: data_label: D4
type: string
name: parse_data
arguments: data_label: D17
type: string

tool: D4: %u(b000)

tool: D17: _uiRcMifCard iDoRemoteFunc ret = %d

assistant: ```c
unsigned int _uiRcMifCard(unsigned char *psSerialNo) {
  unsigned int uiDataLen, uiRet;
  char *psFunCall = malloc(20);
  uiDataLen = sprintf(psFunCall, "%u(b000)", 2001);
  uiRet = iDoRemoteFunc((unsigned char *)psFunCall, uiDataLen, 1);
  free(psFunCall);
  if (uiRet) {
    vWriteLogTxt("_uiRcMifCard iDoRemoteFunc ret = %d", uiRet);
    return 0;
  }
  uiRet = iGetParaInt(0);
  if (uiRet > 0)
    memcpy(psSerialNo, psGetParaBuf(2), uiRet);
  return uiRet;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<_uiRcMifCard>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%r12
  mov    $0x14,%edi
  call   <malloc@plt>
  mov    %rax,%rbx
  mov    $0x7d1,%edx
  lea    D6(%rip),%rsi
  mov    %rax,%rdi
  call   <sprintf@plt>
  mov    %eax,%esi
  mov    $0x1,%edx
  mov    %rbx,%rdi
  call   <iDoRemoteFunc@plt>
  mov    %eax,%ebp
  mov    %rbx,%rdi
  call   <free@plt>
  test   %ebp,%ebp
  jne    L26
  mov    $0x0,%edi
  call   <iGetParaInt@plt>
  mov    %eax,%ebx
  test   %eax,%eax
  jne    L23
L18:
  mov    %ebx,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L26:
  mov    %ebp,%esi
  lea    D14(%rip),%rdi
  call   <vWriteLogTxt@plt>
  mov    $0x0,%ebx
  jmp    L18
L23:
  mov    $0x2,%edi
  call   <psGetParaBuf@plt>
  mov    %eax,%esi
  mov    %ebx,%edx
  mov    %r12,%rdi
  call   <memcpy@plt>
  jmp    L18
```

tool_calls: name: disassemble_data
arguments: data_tag: D6
type_infered: string
name: disassemble_data
arguments: data_tag: D14
type_infered: string

tool: D6: %u(b000)

tool: D14: _uiRcMifCard iDoRemoteFunc ret = %d

assistant: ```c
unsigned int _uiRcMifCard(unsigned char *psSerialNo) {
  unsigned int uiDataLen, uiRet;
  char *psFunCall = malloc(20);
  uiDataLen = sprintf(psFunCall, "%u(b000)", 2001);
  uiRet = iDoRemoteFunc((unsigned char *)psFunCall, uiDataLen, 1);
  free(psFunCall);
  if (uiRet) {
    vWriteLogTxt("_uiRcMifCard iDoRemoteFunc ret = %d", uiRet);
    return 0;
  }
  uiRet = iGetParaInt(0);
  if (uiRet > 0)
    memcpy(psSerialNo, psGetParaBuf(2), uiRet);
  return uiRet;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<_uiRcMifCard>:
  endbr64
  push   %r13
  mov    %rdi,%r13
  mov    $0x14,%edi
  push   %r12
  push   %rbp
  call   <malloc@plt>
  mov    $0x7d1,%edx
  lea    D15(%rip),%rsi
  mov    %rax,%rdi
  mov    %rax,%rbp
  call   <sprintf@plt>
  mov    %rbp,%rdi
  mov    $0x1,%edx
  mov    %eax,%esi
  call   <iDoRemoteFunc@plt>
  mov    %rbp,%rdi
  mov    %eax,%r12d
  call   <free@plt>
  test   %r12d,%r12d
  jne    L1
  xor    %edi,%edi
  call   <iGetParaInt@plt>
  mov    %eax,%r12d
  test   %eax,%eax
  jne    L9
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax,%rax,1)
L9:
  mov    $0x2,%edi
  call   <psGetParaBuf@plt>
  mov    %r12d,%edx
  mov    %r13,%rdi
  mov    %eax,%esi
  call   <memcpy@plt>
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax,%rax,1)
L1:
  mov    %r12d,%esi
  lea    D11(%rip),%rdi
  xor    %r12d,%r12d
  call   <vWriteLogTxt@plt>
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

tool_calls: name: parse_data
arguments: data_tag: D15
type_infered: string
name: parse_data
arguments: data_tag: D11
type_infered: string

tool: D15: %u(b000)

tool: D11: _uiRcMifCard iDoRemoteFunc ret = %d

assistant: ```c
unsigned int _uiRcMifCard(unsigned char *psSerialNo) {
  unsigned int uiDataLen, uiRet;
  char *psFunCall = malloc(20);
  uiDataLen = sprintf(psFunCall, "%u(b000)", 2001);
  uiRet = iDoRemoteFunc((unsigned char *)psFunCall, uiDataLen, 1);
  free(psFunCall);
  if (uiRet) {
    vWriteLogTxt("_uiRcMifCard iDoRemoteFunc ret = %d", uiRet);
    return 0;
  }
  uiRet = iGetParaInt(0);
  if (uiRet > 0)
    memcpy(psSerialNo, psGetParaBuf(2), uiRet);
  return uiRet;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<_uiRcMifCard>:
  endbr64
  push   %r13
  mov    %rdi,%r13
  mov    $0x14,%edi
  push   %r12
  push   %rbp
  call   <malloc@plt>
  mov    $0x7d1,%edx
  lea    D16(%rip),%rsi
  mov    %rax,%rdi
  mov    %rax,%rbp
  call   <sprintf@plt>
  mov    %rbp,%rdi
  mov    $0x1,%edx
  mov    %eax,%esi
  call   <iDoRemoteFunc@plt>
  mov    %rbp,%rdi
  mov    %eax,%r12d
  call   <free@plt>
  test   %r12d,%r12d
  jne    L7
  xor    %edi,%edi
  call   <iGetParaInt@plt>
  mov    %eax,%r12d
  test   %eax,%eax
  jne    L18
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax,%rax,1)
L18:
  mov    $0x2,%edi
  call   <psGetParaBuf@plt>
  mov    %r12d,%edx
  mov    %r13,%rdi
  mov    %eax,%esi
  call   <memcpy@plt>
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax,%rax,1)
L7:
  mov    %r12d,%esi
  lea    D12(%rip),%rdi
  xor    %r12d,%r12d
  call   <vWriteLogTxt@plt>
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

tool_calls: name: disassemble_data
arguments: data_tag: D16
type_infered: string
name: disassemble_data
arguments: data_tag: D12
type_infered: string

tool: D16: %u(b000)

tool: D12: _uiRcMifCard iDoRemoteFunc ret = %d

assistant: ```c
unsigned int _uiRcMifCard(unsigned char *psSerialNo) {
  unsigned int uiDataLen, uiRet;
  char *psFunCall = malloc(20);
  uiDataLen = sprintf(psFunCall, "%u(b000)", 2001);
  uiRet = iDoRemoteFunc((unsigned char *)psFunCall, uiDataLen, 1);
  free(psFunCall);
  if (uiRet) {
    vWriteLogTxt("_uiRcMifCard iDoRemoteFunc ret = %d", uiRet);
    return 0;
  }
  uiRet = iGetParaInt(0);
  if (uiRet > 0)
    memcpy(psSerialNo, psGetParaBuf(2), uiRet);
  return uiRet;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<CompressedSize>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  movl   $0x0,-0x1c(%rbp)
  movl   $0x0,-0x18(%rbp)
  movl   $0x0,-0x14(%rbp)
  movl   $0x0,-0x10(%rbp)
  movl   $0x0,-0xc(%rbp)
  jmp    L48
L91:
  cmpl   $0x0,-0x1c(%rbp)
  jne    L59
  mov    -0x14(%rbp),%eax
  mov    %eax,-0x4(%rbp)
  addl   $0x1,-0x14(%rbp)
  movl   $0x1,-0x10(%rbp)
  jmp    L34
L82:
  addl   $0x1,-0x14(%rbp)
  addl   $0x1,-0x18(%rbp)
  mov    -0x18(%rbp),%eax
  cmp    -0x2c(%rbp),%eax
  je     L31
  mov    -0x18(%rbp),%eax
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x18(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,%eax
  lea    0x0(,%rax,4),%rcx
  mov    -0x28(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  je     L31
  addl   $0x1,-0x10(%rbp)
L34:
  mov    -0x18(%rbp),%eax
  cmp    -0x2c(%rbp),%eax
  jb     L82
L31:
  movl   $0x1,-0x1c(%rbp)
  jmp    L48
L59:
  cmpl   $0x1,-0x1c(%rbp)
  jne    L48
  mov    -0x18(%rbp),%eax
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x8(%rbp)
  movl   $0x1,-0x10(%rbp)
  addl   $0x1,-0x18(%rbp)
  jmp    L113
L116:
  addl   $0x1,-0x10(%rbp)
  addl   $0x1,-0x18(%rbp)
L113:
  mov    -0x18(%rbp),%eax
  cmp    -0x2c(%rbp),%eax
  jae    L58
  mov    -0x18(%rbp),%eax
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    %eax,-0x8(%rbp)
  je     L116
L58:
  addl   $0x2,-0x14(%rbp)
  movl   $0x0,-0x1c(%rbp)
L48:
  mov    -0x18(%rbp),%eax
  cmp    -0x2c(%rbp),%eax
  jb     L91
  mov    -0x14(%rbp),%eax
  pop    %rbp
  ret
```

assistant: ```c
int CompressedSize(int *source_data, unsigned int total_size) {
  unsigned int mode = 0;
  unsigned int index = 0;
  unsigned int write_index = 0;
  int lengthRep = 0;
  int copy_value = 0;
  while (index < total_size) {
    if (mode == 0) {
      unsigned int counter_loc = write_index;
      write_index++;
      lengthRep = 1;
      while (index < total_size) {
        write_index++;
        index++;
        if (index == total_size || source_data[index] == source_data[index - 1]) {
          break;
        }
        lengthRep++;
      }
      mode = 1;
    } else if (mode == 1) {
      unsigned int repeat_value;
      repeat_value = source_data[index];
      lengthRep = 1;
      index++;
      while (index < total_size && source_data[index] == repeat_value) {
        lengthRep++;
        index++;
      }
      write_index += 2;
      mode = 0;
    }
  }
  return write_index;
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<CompressedSize>:
  endbr64
  mov    %rdi,%r8
  test   %esi,%esi
  je     L47
  mov    $0x0,%ecx
  mov    $0x0,%eax
  mov    $0x0,%edx
  mov    $0x0,%r9d
  mov    $0x1,%r10d
  jmp    L41
L22:
  add    $0x1,%ecx
  mov    %eax,%edx
  lea    (%r8,%rdx,4),%rdx
L43:
  cmp    %esi,%eax
  jae    L2
  add    $0x1,%ecx
  add    $0x1,%eax
  cmp    %eax,%esi
  je     L2
  add    $0x4,%rdx
  mov    %eax,%edi
  mov    -0x4(%rdx),%r11d
  cmp    %r11d,(%r8,%rdi,4)
  jne    L43
  mov    %r10d,%edx
  jmp    L52
L85:
  add    $0x2,%ecx
  mov    %r9d,%edx
L52:
  cmp    %esi,%eax
  jae    L2
L41:
  test   %edx,%edx
  je     L22
  mov    %eax,%edx
  mov    (%r8,%rdx,4),%edi
  add    $0x1,%eax
  cmp    %eax,%esi
  jbe    L85
  mov    %eax,%edx
  lea    (%r8,%rdx,4),%rdx
L75:
  cmp    (%rdx),%edi
  jne    L85
  add    $0x1,%eax
  add    $0x4,%rdx
  cmp    %eax,%esi
  ja     L75
  jmp    L85
L47:
  mov    %esi,%ecx
L2:
  mov    %ecx,%eax
  ret
```

assistant: ```c
int CompressedSize(int *source_data, unsigned int total_size) {
  unsigned int mode = 0;
  unsigned int index = 0;
  unsigned int write_index = 0;
  int lengthRep = 0;
  int copy_value = 0;
  while (index < total_size) {
    if (mode == 0) {
      unsigned int counter_loc = write_index;
      write_index++;
      lengthRep = 1;
      while (index < total_size) {
        write_index++;
        index++;
        if (index == total_size || source_data[index] == source_data[index - 1]) {
          break;
        }
        lengthRep++;
      }
      mode = 1;
    } else if (mode == 1) {
      unsigned int repeat_value;
      repeat_value = source_data[index];
      lengthRep = 1;
      index++;
      while (index < total_size && source_data[index] == repeat_value) {
        lengthRep++;
        index++;
      }
      write_index += 2;
      mode = 0;
    }
  }
  return write_index;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<CompressedSize>:
  endbr64
  xor    %r8d,%r8d
  test   %esi,%esi
  je     L86
  xor    %eax,%eax
L30:
  mov    %eax,%edx
  add    $0x1,%r8d
  lea    (%rdi,%rdx,4),%rcx
  jmp    L42
  nopl   0x0(%rax)
L45:
  lea    0x1(%rax),%edx
  lea    0x1(%r8),%r10d
  cmp    %edx,%esi
  je     L48
  mov    %edx,%r9d
  add    $0x4,%rcx
  mov    (%rdi,%r9,4),%r9d
  cmp    -0x4(%rcx),%r9d
  je     L60
  mov    %r10d,%r8d
  mov    %edx,%eax
L42:
  cmp    %esi,%eax
  jb     L45
L86:
  mov    %r8d,%eax
  ret
  nopl   0x0(%rax)
L60:
  cmp    %edx,%esi
  jbe    L48
  add    $0x2,%eax
  cmp    %eax,%esi
  jbe    L43
  mov    %eax,%edx
  lea    (%rdi,%rdx,4),%rdx
  jmp    L63
  nopl   0x0(%rax,%rax,1)
L0:
  add    $0x1,%eax
  add    $0x4,%rdx
  cmp    %eax,%esi
  jbe    L43
L63:
  cmp    (%rdx),%r9d
  je     L0
  add    $0x3,%r8d
  cmp    %eax,%esi
  ja     L30
  jmp    L86
  nopw   0x0(%rax,%rax,1)
L48:
  mov    %r10d,%r8d
  mov    %r8d,%eax
  ret
  nop
L43:
  add    $0x3,%r8d
  mov    %r8d,%eax
  ret
```

assistant: ```c
int CompressedSize(int *source_data, unsigned int total_size) {
  unsigned int mode = 0;
  unsigned int index = 0;
  unsigned int write_index = 0;
  int lengthRep = 0;
  int copy_value = 0;
  while (index < total_size) {
    if (mode == 0) {
      unsigned int counter_loc = write_index;
      write_index++;
      lengthRep = 1;
      while (index < total_size) {
        write_index++;
        index++;
        if (index == total_size || source_data[index] == source_data[index - 1]) {
          break;
        }
        lengthRep++;
      }
      mode = 1;
    } else if (mode == 1) {
      unsigned int repeat_value;
      repeat_value = source_data[index];
      lengthRep = 1;
      index++;
      while (index < total_size && source_data[index] == repeat_value) {
        lengthRep++;
        index++;
      }
      write_index += 2;
      mode = 0;
    }
  }
  return write_index;
}
```