ylfeng/ReF-Decompile-dataset huggingface dataset:
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<U_Latin1ToUtf8>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %rdi,-0x48(%rbp)
  mov    %rsi,-0x50(%rbp)
  mov    %rdx,-0x58(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x48(%rbp),%rax
  mov    %rax,-0x38(%rbp)
  cmpq   $0x0,-0x50(%rbp)
  je     L15
  mov    -0x50(%rbp),%rax
  mov    %rax,-0x30(%rbp)
  jmp    L66
L15:
  mov    -0x48(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    $0x1,%eax
  cltq
  mov    %rax,-0x30(%rbp)
L66:
  mov    -0x30(%rbp),%rax
  add    %rax,%rax
  add    $0x1,%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x28(%rbp),%rax
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <calloc@plt>
  mov    %rax,-0x40(%rbp)
  mov    -0x40(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  mov    -0x40(%rbp),%rax
  test   %rax,%rax
  je     L65
  lea    D16(%rip),%rax
  mov    %rax,%rsi
  lea    D2(%rip),%rax
  mov    %rax,%rdi
  call   <iconv_open@plt>
  mov    %rax,-0x18(%rbp)
  cmpq   $0xffffffffffffffff,-0x18(%rbp)
  jne    L67
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  movq   $0x0,-0x20(%rbp)
  jmp    L65
L67:
  lea    -0x28(%rbp),%rdi
  lea    -0x40(%rbp),%rcx
  lea    -0x30(%rbp),%rdx
  lea    -0x38(%rbp),%rsi
  mov    -0x18(%rbp),%rax
  mov    %rdi,%r8
  mov    %rax,%rdi
  call   <iconv@plt>
  mov    %rax,-0x10(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <iconv_close@plt>
  cmpq   $0xffffffffffffffff,-0x10(%rbp)
  jne    L81
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  movq   $0x0,-0x20(%rbp)
  jmp    L65
L81:
  cmpq   $0x0,-0x58(%rbp)
  je     L65
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  movslq %eax,%rdx
  mov    -0x58(%rbp),%rax
  mov    %rdx,(%rax)
L65:
  mov    -0x20(%rbp),%rax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L38
  call   <__stack_chk_fail@plt>
L38:
  leave
  ret
```

tool_calls: name: read_data
arguments: tag: D16
datatype: string
name: read_data
arguments: tag: D2
datatype: string

tool: D16: LATIN1

tool: D2: UTF-8

assistant: ```c
char *U_Latin1ToUtf8(const char *src, size_t max, size_t *len) {
  char *dst, *dst2;
  char *src2 = (char *)src;
  size_t srclen, dstlen, status;
  if (max) {
    srclen = max;
  } else {
    srclen = strlen(src) + 1;
  }
  dstlen = (1 + 2 * srclen);
  dst2 = dst = calloc(dstlen, 1);
  if (dst) {
    iconv_t conv = iconv_open("UTF-8", "LATIN1");
    if (conv == (iconv_t)-1) {
      free(dst2);
      dst2 = NULL;
    } else {
      status = iconv(conv, (char **)&src2, &srclen, &dst, &dstlen);
      iconv_close(conv);
      if (status == (size_t)-1) {
        free(dst2);
        dst2 = NULL;
      } else if (len) {
        *len = strlen(dst2);
      }
    }
  }
  return ((char *)dst2);
}
```
user: What is the c source code of the assembly code below:

```asm
<U_Latin1ToUtf8>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdx,%rbp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  mov    %rdi,0x10(%rsp)
  test   %rsi,%rsi
  je     L41
L35:
  mov    %rsi,0x18(%rsp)
  lea    0x1(%rsi,%rsi,1),%rdi
  mov    %rdi,0x20(%rsp)
  mov    $0x1,%esi
  call   <calloc@plt>
  mov    %rax,%rbx
  mov    %rax,0x8(%rsp)
  test   %rax,%rax
  je     L7
  lea    D10(%rip),%rsi
  lea    D13(%rip),%rdi
  call   <iconv_open@plt>
  mov    %rax,%r12
  cmp    $0xffffffffffffffff,%rax
  je     L72
  lea    0x8(%rsp),%rcx
  lea    0x18(%rsp),%rdx
  lea    0x10(%rsp),%rsi
  lea    0x20(%rsp),%r8
  mov    %rax,%rdi
  call   <iconv@plt>
  mov    %rax,%r13
  mov    %r12,%rdi
  call   <iconv_close@plt>
  cmp    $0xffffffffffffffff,%r13
  je     L36
  test   %rbp,%rbp
  je     L7
  mov    %rbx,%rdi
  call   <strlen@plt>
  cltq
  mov    %rax,0x0(%rbp)
L7:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L86
  mov    %rbx,%rax
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L41:
  call   <strlen@plt>
  lea    0x1(%rax),%esi
  movslq %esi,%rsi
  jmp    L35
L72:
  mov    %rbx,%rdi
  call   <free@plt>
  mov    $0x0,%ebx
  jmp    L7
L36:
  mov    %rbx,%rdi
  call   <free@plt>
  mov    $0x0,%ebx
  jmp    L7
L86:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_tag: D10
type: string
name: retrieve_data
arguments: data_tag: D13
type: string

tool: D10: LATIN1

tool: D13: UTF-8

assistant: ```c
char *U_Latin1ToUtf8(const char *src, size_t max, size_t *len) {
  char *dst, *dst2;
  char *src2 = (char *)src;
  size_t srclen, dstlen, status;
  if (max) {
    srclen = max;
  } else {
    srclen = strlen(src) + 1;
  }
  dstlen = (1 + 2 * srclen);
  dst2 = dst = calloc(dstlen, 1);
  if (dst) {
    iconv_t conv = iconv_open("UTF-8", "LATIN1");
    if (conv == (iconv_t)-1) {
      free(dst2);
      dst2 = NULL;
    } else {
      status = iconv(conv, (char **)&src2, &srclen, &dst, &dstlen);
      iconv_close(conv);
      if (status == (size_t)-1) {
        free(dst2);
        dst2 = NULL;
      } else if (len) {
        *len = strlen(dst2);
      }
    }
  }
  return ((char *)dst2);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<U_Latin1ToUtf8>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  mov    %rdi,0x10(%rsp)
  test   %rsi,%rsi
  je     L16
L13:
  lea    0x1(%rsi,%rsi,1),%rdi
  mov    %rsi,0x18(%rsp)
  mov    $0x1,%esi
  mov    %rdi,0x20(%rsp)
  call   <calloc@plt>
  mov    %rax,0x8(%rsp)
  mov    %rax,%r12
  test   %rax,%rax
  je     L52
  lea    D11(%rip),%rsi
  lea    D18(%rip),%rdi
  call   <iconv_open@plt>
  mov    %rax,%rbp
  cmp    $0xffffffffffffffff,%rax
  je     L37
  mov    %rax,%rdi
  lea    0x8(%rsp),%rcx
  lea    0x18(%rsp),%rdx
  lea    0x10(%rsp),%rsi
  lea    0x20(%rsp),%r8
  call   <iconv@plt>
  mov    %rbp,%rdi
  mov    %rax,%r13
  call   <iconv_close@plt>
  cmp    $0xffffffffffffffff,%r13
  je     L37
  test   %rbx,%rbx
  je     L52
  mov    %r12,%rdi
  call   <strlen@plt>
  cltq
  mov    %rax,(%rbx)
L52:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L51
  add    $0x38,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  xchg   %ax,%ax
L16:
  call   <strlen@plt>
  lea    0x1(%rax),%esi
  movslq %esi,%rsi
  jmp    L13
L37:
  mov    %r12,%rdi
  xor    %r12d,%r12d
  call   <free@plt>
  jmp    L52
L51:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: label: D11
type: string
name: read_data
arguments: label: D18
type: string

tool: D11: LATIN1

tool: D18: UTF-8

assistant: ```c
char *U_Latin1ToUtf8(const char *src, size_t max, size_t *len) {
  char *dst, *dst2;
  char *src2 = (char *)src;
  size_t srclen, dstlen, status;
  if (max) {
    srclen = max;
  } else {
    srclen = strlen(src) + 1;
  }
  dstlen = (1 + 2 * srclen);
  dst2 = dst = calloc(dstlen, 1);
  if (dst) {
    iconv_t conv = iconv_open("UTF-8", "LATIN1");
    if (conv == (iconv_t)-1) {
      free(dst2);
      dst2 = NULL;
    } else {
      status = iconv(conv, (char **)&src2, &srclen, &dst, &dstlen);
      iconv_close(conv);
      if (status == (size_t)-1) {
        free(dst2);
        dst2 = NULL;
      } else if (len) {
        *len = strlen(dst2);
      }
    }
  }
  return ((char *)dst2);
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<U_Latin1ToUtf8>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  mov    %rdi,0x10(%rsp)
  test   %rsi,%rsi
  je     L34
L60:
  lea    0x1(%rsi,%rsi,1),%rdi
  mov    %rsi,0x18(%rsp)
  mov    $0x1,%esi
  mov    %rdi,0x20(%rsp)
  call   <calloc@plt>
  mov    %rax,0x8(%rsp)
  mov    %rax,%r12
  test   %rax,%rax
  je     L74
  lea    D3(%rip),%rsi
  lea    D13(%rip),%rdi
  call   <iconv_open@plt>
  mov    %rax,%rbp
  cmp    $0xffffffffffffffff,%rax
  je     L73
  mov    %rax,%rdi
  lea    0x8(%rsp),%rcx
  lea    0x18(%rsp),%rdx
  lea    0x10(%rsp),%rsi
  lea    0x20(%rsp),%r8
  call   <iconv@plt>
  mov    %rbp,%rdi
  mov    %rax,%r13
  call   <iconv_close@plt>
  cmp    $0xffffffffffffffff,%r13
  je     L73
  test   %rbx,%rbx
  je     L74
  mov    %r12,%rdi
  call   <strlen@plt>
  cltq
  mov    %rax,(%rbx)
L74:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L45
  add    $0x38,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  xchg   %ax,%ax
L34:
  call   <strlen@plt>
  lea    0x1(%rax),%esi
  movslq %esi,%rsi
  jmp    L60
L73:
  mov    %r12,%rdi
  xor    %r12d,%r12d
  call   <free@plt>
  jmp    L74
L45:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: label: D3
data_type: string
name: read_data
arguments: label: D13
data_type: string

tool: D3: LATIN1

tool: D13: UTF-8

assistant: ```c
char *U_Latin1ToUtf8(const char *src, size_t max, size_t *len) {
  char *dst, *dst2;
  char *src2 = (char *)src;
  size_t srclen, dstlen, status;
  if (max) {
    srclen = max;
  } else {
    srclen = strlen(src) + 1;
  }
  dstlen = (1 + 2 * srclen);
  dst2 = dst = calloc(dstlen, 1);
  if (dst) {
    iconv_t conv = iconv_open("UTF-8", "LATIN1");
    if (conv == (iconv_t)-1) {
      free(dst2);
      dst2 = NULL;
    } else {
      status = iconv(conv, (char **)&src2, &srclen, &dst, &dstlen);
      iconv_close(conv);
      if (status == (size_t)-1) {
        free(dst2);
        dst2 = NULL;
      } else if (len) {
        *len = strlen(dst2);
      }
    }
  }
  return ((char *)dst2);
}
```
user: What is the c source code of the assembly code below:

```asm
<effect_int_ripples>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %edi,-0x34(%rbp)
  mov    %esi,-0x38(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movabs $0x1a1d232b23262b31,%rax
  movabs $0x710192310151d26,%rdx
  mov    %rax,-0x20(%rbp)
  mov    %rdx,-0x18(%rbp)
  mov    -0x34(%rbp),%eax
  imul   $0x3e8,%eax,%eax
  cltd
  idivl  -0x38(%rbp)
  mov    %eax,-0x24(%rbp)
  movl   $0x0,-0x28(%rbp)
  jmp    L55
L30:
  mov    $0x0,%edi
  call   <fill@plt>
  movb   $0x0,-0x2c(%rbp)
  jmp    L28
L13:
  movb   $0x0,-0x2b(%rbp)
  jmp    L34
L14:
  movzbl -0x2c(%rbp),%edx
  movzbl -0x2b(%rbp),%eax
  shl    $0x2,%eax
  add    %edx,%eax
  cltq
  movzbl -0x20(%rbp,%rax,1),%eax
  mov    %al,-0x2a(%rbp)
  mov    -0x28(%rbp),%eax
  mov    %eax,%edx
  movzbl -0x2a(%rbp),%eax
  add    %edx,%eax
  movzbl %al,%eax
  mov    %eax,%edi
  call   <totty_sin@plt>
  add    $0xc4,%eax
  movslq %eax,%rdx
  imul   $0x5397829d,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x4,%edx
  sar    $0x1f,%eax
  mov    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  mov    %al,-0x29(%rbp)
  movzbl -0x29(%rbp),%edx
  movzbl -0x2b(%rbp),%ecx
  movzbl -0x2c(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <setvoxel@plt>
  movzbl -0x29(%rbp),%edx
  movzbl -0x2b(%rbp),%eax
  movzbl -0x2c(%rbp),%esi
  mov    $0x7,%ecx
  sub    %esi,%ecx
  mov    %eax,%esi
  mov    %ecx,%edi
  call   <setvoxel@plt>
  movzbl -0x29(%rbp),%edx
  movzbl -0x2b(%rbp),%eax
  mov    $0x7,%ecx
  sub    %eax,%ecx
  movzbl -0x2c(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <setvoxel@plt>
  movzbl -0x29(%rbp),%eax
  movzbl -0x2b(%rbp),%edx
  mov    $0x7,%ecx
  mov    %ecx,%esi
  sub    %edx,%esi
  movzbl -0x2c(%rbp),%edx
  mov    $0x7,%ecx
  sub    %edx,%ecx
  mov    %eax,%edx
  mov    %ecx,%edi
  call   <setvoxel@plt>
  movzbl -0x2b(%rbp),%eax
  add    $0x1,%eax
  mov    %al,-0x2b(%rbp)
L34:
  cmpb   $0x3,-0x2b(%rbp)
  jbe    L14
  movzbl -0x2c(%rbp),%eax
  add    $0x1,%eax
  mov    %al,-0x2c(%rbp)
L28:
  cmpb   $0x3,-0x2c(%rbp)
  jbe    L13
  mov    -0x38(%rbp),%eax
  mov    %eax,%edi
  call   <delay_ms@plt>
  addl   $0x4,-0x28(%rbp)
L55:
  mov    -0x24(%rbp),%eax
  shl    $0x2,%eax
  cmp    %eax,-0x28(%rbp)
  jl     L30
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L0
  call   <__stack_chk_fail@plt>
L0:
  leave
  ret
```

assistant: ```c
void effect_int_ripples(int seconds, int delay) {
  unsigned char sqrt_LUT[] = {49, 43, 38, 35, 43, 35, 29, 26, 38, 29, 21, 16, 35, 25, 16, 7};
  unsigned char x, y, height, distance;
  int i;
  int iterations = seconds * 1000 / delay;
  for (i = 0; i < iterations * 4; i += 4) {
    fill(0);
    for (x = 0; x < 4; x++) {
      for (y = 0; y < 4; y++) {
        distance = sqrt_LUT[x + y * 4];
        height = (196 + totty_sin(distance + i)) / 49;
        setvoxel(x, y, height);
        setvoxel(7 - x, y, height);
        setvoxel(x, 7 - y, height);
        setvoxel(7 - x, 7 - y, height);
      }
    }
    delay_ms(delay);
  }
}
```
user: Translate the below assembly code into C programming language:

```asm
<effect_int_ripples>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %esi,0xc(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  movabs $0x1a1d232b23262b31,%rax
  movabs $0x710192310151d26,%rdx
  mov    %rax,0x10(%rsp)
  mov    %rdx,0x18(%rsp)
  imul   $0x3e8,%edi,%eax
  cltd
  idiv   %esi
  shl    $0x2,%eax
  mov    %eax,0x8(%rsp)
  test   %eax,%eax
  jle    L24
  movl   $0x0,0x4(%rsp)
  jmp    L53
L13:
  mov    0xc(%rsp),%edi
  call   <delay_ms@plt>
  addl   $0x4,0x4(%rsp)
  mov    0x4(%rsp),%eax
  cmp    0x8(%rsp),%eax
  jge    L24
L53:
  mov    $0x0,%edi
  call   <fill@plt>
  lea    0x10(%rsp),%r15
  mov    $0x7,%r14d
  mov    $0x0,%r13d
L4:
  mov    $0x0,%ebp
L54:
  movzbl 0x4(%rsp),%edi
  add    (%r15,%rbp,4),%dil
  movzbl %dil,%edi
  call   <totty_sin@plt>
  add    $0xc4,%eax
  movslq %eax,%rbx
  imul   $0x5397829d,%rbx,%rbx
  sar    $0x24,%rbx
  sar    $0x1f,%eax
  sub    %eax,%ebx
  movzbl %bl,%ebx
  mov    %ebx,%edx
  mov    %ebp,%esi
  mov    %r13d,%edi
  call   <setvoxel@plt>
  mov    %ebx,%edx
  mov    %ebp,%esi
  mov    %r14d,%edi
  call   <setvoxel@plt>
  mov    $0x7,%r12d
  sub    %ebp,%r12d
  mov    %ebx,%edx
  mov    %r12d,%esi
  mov    %r13d,%edi
  call   <setvoxel@plt>
  mov    %ebx,%edx
  mov    %r12d,%esi
  mov    %r14d,%edi
  call   <setvoxel@plt>
  add    $0x1,%rbp
  cmp    $0x4,%rbp
  jne    L54
  add    $0x1,%r13d
  add    $0x1,%r15
  sub    $0x1,%r14d
  cmp    $0x4,%r13d
  jne    L4
  jmp    L13
L24:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L32
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L32:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void effect_int_ripples(int seconds, int delay) {
  unsigned char sqrt_LUT[] = {49, 43, 38, 35, 43, 35, 29, 26, 38, 29, 21, 16, 35, 25, 16, 7};
  unsigned char x, y, height, distance;
  int i;
  int iterations = seconds * 1000 / delay;
  for (i = 0; i < iterations * 4; i += 4) {
    fill(0);
    for (x = 0; x < 4; x++) {
      for (y = 0; y < 4; y++) {
        distance = sqrt_LUT[x + y * 4];
        height = (196 + totty_sin(distance + i)) / 49;
        setvoxel(x, y, height);
        setvoxel(7 - x, y, height);
        setvoxel(x, 7 - y, height);
        setvoxel(7 - x, 7 - y, height);
      }
    }
    delay_ms(delay);
  }
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<effect_int_ripples>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  movdqa D9(%rip),%xmm0
  mov    %esi,0x14(%rsp)
  lea    0x20(%rsp),%rcx
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  imul   $0x3e8,%edi,%eax
  movl   $0x0,0xc(%rsp)
  mov    %rcx,0x18(%rsp)
  movaps %xmm0,0x20(%rsp)
  cltd
  idiv   %esi
  shl    $0x2,%eax
  mov    %eax,0x10(%rsp)
  test   %eax,%eax
  jle    L34
  nopl   (%rax)
L33:
  xor    %edi,%edi
  call   <fill@plt>
  movzbl 0xc(%rsp),%eax
  mov    0x18(%rsp),%r12
  movq   $0x0,(%rsp)
  mov    $0x31,%edi
  mov    %al,0xb(%rsp)
L66:
  mov    (%rsp),%rax
  mov    $0x7,%ebx
  xor    %r15d,%r15d
  mov    %eax,%ebp
  sub    %eax,%ebx
L0:
  add    0xb(%rsp),%dil
  mov    $0x7,%r14d
  movzbl %dil,%edi
  sub    %r15d,%r14d
  call   <totty_sin@plt>
  mov    %r15d,%esi
  mov    %ebp,%edi
  add    $0xc4,%eax
  movslq %eax,%r13
  sar    $0x1f,%eax
  imul   $0x5397829d,%r13,%r13
  sar    $0x24,%r13
  sub    %eax,%r13d
  movzbl %r13b,%r13d
  mov    %r13d,%edx
  call   <setvoxel@plt>
  mov    %r15d,%esi
  mov    %r13d,%edx
  mov    %ebx,%edi
  call   <setvoxel@plt>
  mov    %r13d,%edx
  mov    %r14d,%esi
  mov    %ebp,%edi
  call   <setvoxel@plt>
  add    $0x1,%r15
  mov    %r13d,%edx
  mov    %r14d,%esi
  mov    %ebx,%edi
  call   <setvoxel@plt>
  cmp    $0x4,%r15
  je     L24
  movzbl (%r12,%r15,4),%edi
  jmp    L0
  nopl   0x0(%rax,%rax,1)
L24:
  addq   $0x1,(%rsp)
  mov    (%rsp),%rax
  add    $0x1,%r12
  cmp    $0x4,%rax
  je     L15
  movzbl (%r12),%edi
  jmp    L66
  nopl   (%rax)
L15:
  mov    0x14(%rsp),%edi
  call   <delay_ms@plt>
  addl   $0x4,0xc(%rsp)
  mov    0xc(%rsp),%eax
  cmp    %eax,0x10(%rsp)
  jg     L33
L34:
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L68
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L68:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D9
data_type: byte[16]

tool: {"D9": [0x31,0x2b,0x26,0x23,0x2b,0x23,0x1d,0x1a,0x26,0x1d,0x15,0x10,0x23,0x19,0x10,0x07]}

assistant: ```c
void effect_int_ripples(int seconds, int delay) {
  unsigned char sqrt_LUT[] = {49, 43, 38, 35, 43, 35, 29, 26, 38, 29, 21, 16, 35, 25, 16, 7};
  unsigned char x, y, height, distance;
  int i;
  int iterations = seconds * 1000 / delay;
  for (i = 0; i < iterations * 4; i += 4) {
    fill(0);
    for (x = 0; x < 4; x++) {
      for (y = 0; y < 4; y++) {
        distance = sqrt_LUT[x + y * 4];
        height = (196 + totty_sin(distance + i)) / 49;
        setvoxel(x, y, height);
        setvoxel(7 - x, y, height);
        setvoxel(x, 7 - y, height);
        setvoxel(7 - x, 7 - y, height);
      }
    }
    delay_ms(delay);
  }
}
```
user: What is the c source code of the assembly code below:

```asm
<effect_int_ripples>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  movdqa D1(%rip),%xmm0
  mov    %esi,0x14(%rsp)
  lea    0x20(%rsp),%rcx
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  imul   $0x3e8,%edi,%eax
  movl   $0x0,0xc(%rsp)
  mov    %rcx,0x18(%rsp)
  movaps %xmm0,0x20(%rsp)
  cltd
  idiv   %esi
  shl    $0x2,%eax
  mov    %eax,0x10(%rsp)
  test   %eax,%eax
  jle    L27
  nopl   (%rax)
L29:
  xor    %edi,%edi
  xor    %ebx,%ebx
  call   <fill@plt>
  movzbl 0xc(%rsp),%eax
  mov    0x18(%rsp),%r12
  mov    %al,0xb(%rsp)
L39:
  mov    $0x7,%ebp
  xor    %r15d,%r15d
  sub    %ebx,%ebp
L22:
  movzbl 0xb(%rsp),%edi
  add    (%r12,%r15,4),%dil
  mov    $0x7,%r13d
  movzbl %dil,%edi
  sub    %r15d,%r13d
  call   <totty_sin@plt>
  mov    %r15d,%esi
  mov    %ebx,%edi
  add    $0xc4,%eax
  movslq %eax,%rdx
  sar    $0x1f,%eax
  imul   $0x5397829d,%rdx,%rdx
  sar    $0x24,%rdx
  sub    %eax,%edx
  movzbl %dl,%r14d
  mov    %r14d,%edx
  call   <setvoxel@plt>
  mov    %r15d,%esi
  mov    %r14d,%edx
  mov    %ebp,%edi
  call   <setvoxel@plt>
  mov    %r14d,%edx
  mov    %r13d,%esi
  mov    %ebx,%edi
  call   <setvoxel@plt>
  add    $0x1,%r15
  mov    %r14d,%edx
  mov    %r13d,%esi
  mov    %ebp,%edi
  call   <setvoxel@plt>
  cmp    $0x4,%r15
  jne    L22
  add    $0x1,%ebx
  add    $0x1,%r12
  cmp    $0x4,%ebx
  jne    L39
  mov    0x14(%rsp),%edi
  call   <delay_ms@plt>
  addl   $0x4,0xc(%rsp)
  mov    0xc(%rsp),%eax
  cmp    %eax,0x10(%rsp)
  jg     L29
L27:
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L4
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L4:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: tag: D1
datatype: byte[16]

tool: {"D1": [0x31,0x2b,0x26,0x23,0x2b,0x23,0x1d,0x1a,0x26,0x1d,0x15,0x10,0x23,0x19,0x10,0x07]}

assistant: ```c
void effect_int_ripples(int seconds, int delay) {
  unsigned char sqrt_LUT[] = {49, 43, 38, 35, 43, 35, 29, 26, 38, 29, 21, 16, 35, 25, 16, 7};
  unsigned char x, y, height, distance;
  int i;
  int iterations = seconds * 1000 / delay;
  for (i = 0; i < iterations * 4; i += 4) {
    fill(0);
    for (x = 0; x < 4; x++) {
      for (y = 0; y < 4; y++) {
        distance = sqrt_LUT[x + y * 4];
        height = (196 + totty_sin(distance + i)) / 49;
        setvoxel(x, y, height);
        setvoxel(7 - x, y, height);
        setvoxel(x, 7 - y, height);
        setvoxel(7 - x, 7 - y, height);
      }
    }
    delay_ms(delay);
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<cpufreq_duration_to_string>:
  endbr64
  sub    $0x8,%rsp
  cmp    $0xf4240,%rdi
  ja     L41
  cmp    $0x186a0,%rdi
  ja     L29
  cmp    $0x3e8,%rdi
  jbe    L18
  mov    %rdi,%rdx
  shr    $0x2,%rdx
  movabs $0x28f5c28f5c28f5c3,%rcx
  mov    %rdx,%rax
  mul    %rcx
  mov    %rdx,%rax
  shr    $0x2,%rax
  and    $0xfffffffffffffffc,%rdx
  add    %rax,%rdx
  lea    (%rdx,%rdx,4),%rax
  shl    $0x2,%rax
  mov    %rdi,%rdx
  sub    %rax,%rdx
  lea    0x64(%rdi),%rax
  cmp    $0x31,%rdx
  cmova  %rax,%rdi
  mov    %rdi,%rdx
  shr    $0x3,%rdx
  movabs $0x20c49ba5e353f7cf,%rcx
  mov    %rdx,%rax
  mul    %rcx
  shr    $0x4,%rdx
  imul   $0x3e8,%rdx,%rdx
  mov    %edi,%eax
  sub    %edx,%eax
  imul   $0x51eb851f,%rax,%rdx
  shr    $0x25,%rdx
  mov    %edi,%esi
  imul   $0x10624dd3,%rsi,%rsi
  shr    $0x26,%rsi
  lea    D1(%rip),%rdi
  mov    $0x0,%eax
  call   <xasprintf@plt>
  jmp    L53
L41:
  movabs $0x346dc5d63886594b,%rdx
  mov    %rdi,%rax
  mul    %rdx
  shr    $0xb,%rdx
  imul   $0x2710,%rdx,%rdx
  mov    %rdi,%rcx
  sub    %rdx,%rcx
  lea    0x2710(%rdi),%rax
  cmp    $0x1387,%rcx
  cmova  %rax,%rdi
  movabs $0x431bde82d7b634db,%rdx
  mov    %rdi,%rax
  mul    %rdx
  shr    $0x12,%rdx
  imul   $0xf4240,%rdx,%rax
  mov    %edi,%edx
  sub    %eax,%edx
  mov    $0xd1b71759,%eax
  imul   %rax,%rdx
  shr    $0x2d,%rdx
  mov    %edi,%esi
  imul   $0x431bde83,%rsi,%rsi
  shr    $0x32,%rsi
  lea    D38(%rip),%rdi
  mov    $0x0,%eax
  call   <xasprintf@plt>
L53:
  add    $0x8,%rsp
  ret
L29:
  mov    %rdi,%rdx
  shr    $0x3,%rdx
  movabs $0x20c49ba5e353f7cf,%rcx
  mov    %rdx,%rax
  mul    %rcx
  shr    $0x4,%rdx
  imul   $0x3e8,%rdx,%rdx
  mov    %rdi,%rcx
  sub    %rdx,%rcx
  lea    0x3e8(%rdi),%rax
  cmp    $0x1f3,%rcx
  cmova  %rax,%rdi
  mov    %edi,%esi
  imul   $0x10624dd3,%rsi,%rsi
  shr    $0x26,%rsi
  lea    D9(%rip),%rdi
  mov    $0x0,%eax
  call   <xasprintf@plt>
  jmp    L53
L18:
  mov    %rdi,%rsi
  lea    D24(%rip),%rdi
  mov    $0x0,%eax
  call   <xasprintf@plt>
  jmp    L53
```

tool_calls: name: parse_data
arguments: tag: D1
datatype: string
name: parse_data
arguments: tag: D38
datatype: string
name: parse_data
arguments: tag: D9
datatype: string
name: parse_data
arguments: tag: D24
datatype: string

tool: D1: %u.%01uus

tool: D38: %u.%02ums

tool: D9: %uus

tool: D24: %luns

assistant: ```c
char *cpufreq_duration_to_string(unsigned long duration) {
  unsigned long tmp;
  if (duration > 1000000) {
    tmp = duration % 10000;
    if (tmp >= 5000)
      duration += 10000;
    return xasprintf("%u.%02ums", ((unsigned int)duration / 1000000), ((unsigned int)(duration % 1000000) / 10000));
  } else if (duration > 100000) {
    tmp = duration % 1000;
    if (tmp >= 500)
      duration += 1000;
    return xasprintf("%uus", ((unsigned int)duration / 1000));
  } else if (duration > 1000) {
    tmp = duration % 100;
    if (tmp >= 50)
      duration += 100;
    return xasprintf("%u.%01uus", ((unsigned int)duration / 1000), ((unsigned int)(duration % 1000) / 100));
  } else
    return xasprintf("%luns", duration);
}
```