ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<mat4_fromQuat>:
  endbr64
  movss  0x4(%rsi),%xmm3
  movss  0x8(%rsi),%xmm2
  movss  (%rsi),%xmm4
  movss  0xc(%rsi),%xmm1
  movl   $0x0,0xc(%rdi)
  movaps %xmm3,%xmm0
  movaps %xmm2,%xmm5
  movaps %xmm2,%xmm6
  movl   $0x0,0x1c(%rdi)
  addss  %xmm3,%xmm0
  movaps %xmm2,%xmm9
  movaps %xmm3,%xmm8
  movq   $0x0,0x2c(%rdi)
  addss  %xmm2,%xmm9
  movaps %xmm4,%xmm7
  movaps %xmm1,%xmm10
  movq   $0x0,0x34(%rdi)
  addss  %xmm4,%xmm7
  mulss  %xmm0,%xmm3
  mulss  %xmm0,%xmm5
  mulss  %xmm9,%xmm2
  mulss  %xmm1,%xmm0
  mulss  %xmm9,%xmm1
  movss  D6(%rip),%xmm9
  mulss  %xmm7,%xmm8
  mulss  %xmm7,%xmm4
  movaps %xmm9,%xmm11
  movss  %xmm9,0x3c(%rdi)
  subss  %xmm3,%xmm11
  mulss  %xmm7,%xmm6
  mulss  %xmm7,%xmm10
  subss  %xmm2,%xmm11
  movss  %xmm11,(%rdi)
  movaps %xmm8,%xmm11
  subss  %xmm1,%xmm8
  addss  %xmm1,%xmm11
  movaps %xmm4,%xmm1
  movaps %xmm9,%xmm4
  subss  %xmm1,%xmm4
  movss  %xmm8,0x10(%rdi)
  movss  %xmm11,0x4(%rdi)
  movaps %xmm6,%xmm11
  addss  %xmm0,%xmm6
  movaps %xmm4,%xmm1
  subss  %xmm0,%xmm11
  subss  %xmm3,%xmm4
  subss  %xmm2,%xmm1
  movss  %xmm6,0x20(%rdi)
  movss  %xmm11,0x8(%rdi)
  movss  %xmm1,0x14(%rdi)
  movaps %xmm5,%xmm1
  subss  %xmm10,%xmm5
  addss  %xmm10,%xmm1
  movss  %xmm4,0x28(%rdi)
  movss  %xmm5,0x24(%rdi)
  movss  %xmm1,0x18(%rdi)
  ret
```

tool_calls: name: retrieve_data
arguments: tag: D6
type_infered: f32

tool: D6: 1

assistant: ```c
void mat4_fromQuat(float *dst, float *q) {
  float x = q[0], y = q[1], z = q[2], w = q[3];
  float x2 = x + x;
  float y2 = y + y;
  float z2 = z + z;
  float xx = x * x2;
  float yx = y * x2;
  float yy = y * y2;
  float zx = z * x2;
  float zy = z * y2;
  float zz = z * z2;
  float wx = w * x2;
  float wy = w * y2;
  float wz = w * z2;
  dst[0] = 1 - yy - zz;
  dst[1] = yx + wz;
  dst[2] = zx - wy;
  dst[3] = 0;
  dst[4] = yx - wz;
  dst[5] = 1 - xx - zz;
  dst[6] = zy + wx;
  dst[7] = 0;
  dst[8] = zx + wy;
  dst[9] = zy - wx;
  dst[10] = 1 - xx - yy;
  dst[11] = 0;
  dst[12] = 0;
  dst[13] = 0;
  dst[14] = 0;
  dst[15] = 1;
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<mat4_fromQuat>:
  endbr64
  movss  0x4(%rsi),%xmm3
  movss  0x8(%rsi),%xmm2
  movss  (%rsi),%xmm4
  movss  0xc(%rsi),%xmm1
  movl   $0x0,0xc(%rdi)
  movaps %xmm3,%xmm0
  movaps %xmm2,%xmm5
  movaps %xmm2,%xmm6
  movl   $0x0,0x1c(%rdi)
  addss  %xmm3,%xmm0
  movaps %xmm2,%xmm9
  movaps %xmm3,%xmm8
  movq   $0x0,0x2c(%rdi)
  addss  %xmm2,%xmm9
  movaps %xmm4,%xmm7
  movaps %xmm1,%xmm10
  movq   $0x0,0x34(%rdi)
  addss  %xmm4,%xmm7
  mulss  %xmm0,%xmm3
  mulss  %xmm0,%xmm5
  mulss  %xmm9,%xmm2
  mulss  %xmm1,%xmm0
  mulss  %xmm9,%xmm1
  movss  D8(%rip),%xmm9
  mulss  %xmm7,%xmm8
  mulss  %xmm7,%xmm4
  movaps %xmm9,%xmm11
  movss  %xmm9,0x3c(%rdi)
  subss  %xmm3,%xmm11
  mulss  %xmm7,%xmm6
  mulss  %xmm7,%xmm10
  subss  %xmm2,%xmm11
  movss  %xmm11,(%rdi)
  movaps %xmm8,%xmm11
  subss  %xmm1,%xmm8
  addss  %xmm1,%xmm11
  movaps %xmm4,%xmm1
  movaps %xmm9,%xmm4
  subss  %xmm1,%xmm4
  movss  %xmm8,0x10(%rdi)
  movss  %xmm11,0x4(%rdi)
  movaps %xmm6,%xmm11
  addss  %xmm0,%xmm6
  movaps %xmm4,%xmm1
  subss  %xmm0,%xmm11
  subss  %xmm3,%xmm4
  subss  %xmm2,%xmm1
  movss  %xmm6,0x20(%rdi)
  movss  %xmm11,0x8(%rdi)
  movss  %xmm1,0x14(%rdi)
  movaps %xmm5,%xmm1
  subss  %xmm10,%xmm5
  addss  %xmm10,%xmm1
  movss  %xmm4,0x28(%rdi)
  movss  %xmm5,0x24(%rdi)
  movss  %xmm1,0x18(%rdi)
  ret
```

tool_calls: name: disassemble_data
arguments: label: D8
data_type: f32

tool: D8: 1

assistant: ```c
void mat4_fromQuat(float *dst, float *q) {
  float x = q[0], y = q[1], z = q[2], w = q[3];
  float x2 = x + x;
  float y2 = y + y;
  float z2 = z + z;
  float xx = x * x2;
  float yx = y * x2;
  float yy = y * y2;
  float zx = z * x2;
  float zy = z * y2;
  float zz = z * z2;
  float wx = w * x2;
  float wy = w * y2;
  float wz = w * z2;
  dst[0] = 1 - yy - zz;
  dst[1] = yx + wz;
  dst[2] = zx - wy;
  dst[3] = 0;
  dst[4] = yx - wz;
  dst[5] = 1 - xx - zz;
  dst[6] = zy + wx;
  dst[7] = 0;
  dst[8] = zx + wy;
  dst[9] = zy - wx;
  dst[10] = 1 - xx - yy;
  dst[11] = 0;
  dst[12] = 0;
  dst[13] = 0;
  dst[14] = 0;
  dst[15] = 1;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<audio_out_resample_stereotomono>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %edx,-0x24(%rbp)
  jmp    L4
L6:
  mov    -0x18(%rbp),%rax
  lea    0x4(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  mov    (%rax),%eax
  sar    %eax
  mov    %eax,-0x4(%rbp)
  mov    -0x18(%rbp),%rax
  lea    0x4(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  mov    (%rax),%eax
  sar    %eax
  add    %eax,-0x4(%rbp)
  mov    -0x20(%rbp),%rax
  lea    0x4(%rax),%rdx
  mov    %rdx,-0x20(%rbp)
  mov    -0x4(%rbp),%edx
  mov    %edx,(%rax)
L4:
  mov    -0x24(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,-0x24(%rbp)
  test   %eax,%eax
  jne    L6
  nop
  nop
  pop    %rbp
  ret
```

assistant: ```c
void audio_out_resample_stereotomono(int16_t *input_samples, int16_t *output_samples, uint32_t frames) {
  while (frames--) {
    int16_t os;
    os = (*input_samples++) >> 1;
    os += (*input_samples++) >> 1;
    *output_samples++ = os;
  }
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<audio_out_resample_stereotomono>:
  endbr64
  test   %edx,%edx
  je     L10
  mov    %edx,%edx
  mov    $0x0,%eax
L13:
  mov    (%rdi,%rax,8),%r8d
  sar    %r8d
  mov    0x4(%rdi,%rax,8),%ecx
  sar    %ecx
  add    %r8d,%ecx
  mov    %ecx,(%rsi,%rax,4)
  add    $0x1,%rax
  cmp    %rdx,%rax
  jne    L13
L10:
  ret
```

assistant: ```c
void audio_out_resample_stereotomono(int16_t *input_samples, int16_t *output_samples, uint32_t frames) {
  while (frames--) {
    int16_t os;
    os = (*input_samples++) >> 1;
    os += (*input_samples++) >> 1;
    *output_samples++ = os;
  }
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<audio_out_resample_stereotomono>:
  endbr64
  test   %edx,%edx
  je     L6
  mov    %edx,%edx
  xor    %eax,%eax
  nopl   0x0(%rax)
L1:
  mov    (%rdi,%rax,8),%r8d
  mov    0x4(%rdi,%rax,8),%ecx
  sar    %r8d
  sar    %ecx
  add    %r8d,%ecx
  mov    %ecx,(%rsi,%rax,4)
  add    $0x1,%rax
  cmp    %rax,%rdx
  jne    L1
L6:
  ret
```

assistant: ```c
void audio_out_resample_stereotomono(int16_t *input_samples, int16_t *output_samples, uint32_t frames) {
  while (frames--) {
    int16_t os;
    os = (*input_samples++) >> 1;
    os += (*input_samples++) >> 1;
    *output_samples++ = os;
  }
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<audio_out_resample_stereotomono>:
  endbr64
  mov    %rdi,%rcx
  lea    -0x1(%rdx),%r10d
  test   %edx,%edx
  je     L53
  mov    %edx,%r8d
  mov    %edx,%r9d
  lea    (%rdi,%r8,8),%rax
  lea    (%rsi,%r8,4),%rdi
  cmp    %rax,%rsi
  setae  %al
  cmp    %rdi,%rcx
  setae  %dil
  or     %dil,%al
  je     L74
  cmp    $0x1,%edx
  je     L74
  cmp    $0x2,%r10d
  jbe    L80
  mov    %edx,%edi
  xor    %eax,%eax
  shr    $0x2,%edi
  shl    $0x4,%rdi
  nopl   (%rax)
L96:
  movdqu (%rcx,%rax,2),%xmm0
  movdqu 0x10(%rcx,%rax,2),%xmm3
  movdqa %xmm0,%xmm1
  shufps $0xdd,%xmm3,%xmm0
  psrad  $0x1,%xmm0
  shufps $0x88,%xmm3,%xmm1
  psrad  $0x1,%xmm1
  paddd  %xmm1,%xmm0
  movups %xmm0,(%rsi,%rax,1)
  add    $0x10,%rax
  cmp    %rdi,%rax
  jne    L96
  mov    %edx,%r10d
  and    $0xfffffffc,%r10d
  mov    %r10d,%r8d
  lea    (%rcx,%r8,8),%rax
  lea    (%rsi,%r8,4),%rdi
  cmp    %r10d,%edx
  je     L53
  sub    %r10d,%edx
  mov    %edx,%r9d
  cmp    $0x1,%edx
  je     L82
L58:
  lea    (%rcx,%r8,8),%rdx
  movq   (%rdx),%xmm0
  movq   0x8(%rdx),%xmm2
  mov    %r9d,%edx
  and    $0xfffffffe,%edx
  movdqa %xmm0,%xmm1
  punpckldq %xmm2,%xmm0
  mov    %edx,%ecx
  punpckldq %xmm2,%xmm1
  pshufd $0xe,%xmm0,%xmm0
  lea    (%rax,%rcx,8),%rax
  psrad  $0x1,%xmm1
  psrad  $0x1,%xmm0
  lea    (%rdi,%rcx,4),%rdi
  paddd  %xmm1,%xmm0
  movq   %xmm0,(%rsi,%r8,4)
  cmp    %edx,%r9d
  je     L53
L82:
  mov    (%rax),%edx
  mov    0x4(%rax),%eax
  sar    %edx
  sar    %eax
  add    %edx,%eax
  mov    %eax,(%rdi)
  ret
  nopl   (%rax)
L74:
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L99:
  mov    (%rcx,%rax,8),%edi
  mov    0x4(%rcx,%rax,8),%edx
  sar    %edi
  sar    %edx
  add    %edi,%edx
  mov    %edx,(%rsi,%rax,4)
  add    $0x1,%rax
  cmp    %r8,%rax
  jne    L99
L53:
  ret
L80:
  mov    %rsi,%rdi
  mov    %rcx,%rax
  xor    %r8d,%r8d
  jmp    L58
```

assistant: ```c
void audio_out_resample_stereotomono(int16_t *input_samples, int16_t *output_samples, uint32_t frames) {
  while (frames--) {
    int16_t os;
    os = (*input_samples++) >> 1;
    os += (*input_samples++) >> 1;
    *output_samples++ = os;
  }
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<usl_fd_read>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    -0x30(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  movq   $0x0,-0x18(%rbp)
  jmp    L17
L27:
  mov    -0x38(%rbp),%rax
  sub    -0x18(%rbp),%rax
  mov    %rax,%rdx
  mov    -0x10(%rbp),%rcx
  mov    -0x24(%rbp),%eax
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <read@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  je     L38
  mov    -0x8(%rbp),%rax
  add    %rax,-0x18(%rbp)
  mov    -0x8(%rbp),%rax
  add    %rax,-0x10(%rbp)
L17:
  mov    -0x18(%rbp),%rax
  cmp    -0x38(%rbp),%rax
  jb     L27
  jmp    L12
L38:
  nop
L12:
  mov    -0x18(%rbp),%rax
  leave
  ret
```

assistant: ```c
size_t usl_fd_read(int fd, void *buf, size_t count) {
  size_t chars_read;
  char *ptr = buf;
  for (chars_read = 0; chars_read < count;) {
    size_t nb = read(fd, ptr, count - chars_read);
    if (nb < 0) {
      if (errno == EINTR)
        continue;
      return -1;
    }
    if (nb == 0)
      break;
    chars_read += nb;
    ptr += nb;
  }
  return chars_read;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<usl_fd_read>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdx,%r12
  test   %rdx,%rdx
  je     L30
  mov    %edi,%r13d
  mov    %rsi,%rbp
  mov    $0x0,%ebx
L8:
  mov    %r12,%rdx
  sub    %rbx,%rdx
  mov    %rbp,%rsi
  mov    %r13d,%edi
  call   <read@plt>
  test   %rax,%rax
  je     L21
  add    %rax,%rbx
  add    %rax,%rbp
  cmp    %rbx,%r12
  ja     L8
L21:
  mov    %rbx,%rax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L30:
  mov    %rdx,%rbx
  jmp    L21
```

assistant: ```c
size_t usl_fd_read(int fd, void *buf, size_t count) {
  size_t chars_read;
  char *ptr = buf;
  for (chars_read = 0; chars_read < count;) {
    size_t nb = read(fd, ptr, count - chars_read);
    if (nb < 0) {
      if (errno == EINTR)
        continue;
      return -1;
    }
    if (nb == 0)
      break;
    chars_read += nb;
    ptr += nb;
  }
  return chars_read;
}
```
user: Translate the below assembly code into C programming language:

```asm
<usl_fd_read>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  test   %rdx,%rdx
  je     L2
  mov    %edi,%ebp
  mov    %rsi,%rbx
  mov    %rdx,%r13
  xor    %r12d,%r12d
  jmp    L9
L38:
  add    %rax,%r12
  add    %rax,%rbx
  cmp    %r12,%r13
  jbe    L25
L9:
  mov    %r13,%rdx
  mov    %rbx,%rsi
  mov    %ebp,%edi
  sub    %r12,%rdx
  call   <read@plt>
  test   %rax,%rax
  jne    L38
L25:
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L2:
  xor    %r12d,%r12d
  jmp    L25
```

assistant: ```c
size_t usl_fd_read(int fd, void *buf, size_t count) {
  size_t chars_read;
  char *ptr = buf;
  for (chars_read = 0; chars_read < count;) {
    size_t nb = read(fd, ptr, count - chars_read);
    if (nb < 0) {
      if (errno == EINTR)
        continue;
      return -1;
    }
    if (nb == 0)
      break;
    chars_read += nb;
    ptr += nb;
  }
  return chars_read;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<usl_fd_read>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  test   %rdx,%rdx
  je     L48
  mov    %edi,%ebp
  mov    %rsi,%rbx
  mov    %rdx,%r13
  xor    %r12d,%r12d
  jmp    L25
L32:
  add    %rax,%r12
  add    %rax,%rbx
  cmp    %r12,%r13
  jbe    L37
L25:
  mov    %r13,%rdx
  mov    %rbx,%rsi
  mov    %ebp,%edi
  sub    %r12,%rdx
  call   <read@plt>
  test   %rax,%rax
  jne    L32
L37:
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L48:
  xor    %r12d,%r12d
  jmp    L37
```

assistant: ```c
size_t usl_fd_read(int fd, void *buf, size_t count) {
  size_t chars_read;
  char *ptr = buf;
  for (chars_read = 0; chars_read < count;) {
    size_t nb = read(fd, ptr, count - chars_read);
    if (nb < 0) {
      if (errno == EINTR)
        continue;
      return -1;
    }
    if (nb == 0)
      break;
    chars_read += nb;
    ptr += nb;
  }
  return chars_read;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<seedit>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x73,%al
  jne    L41
  lea    D38(%rip),%rax
  mov    %rax,%rsi
  lea    D5(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fopen@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  jne    L1
  movl   $0xe76b,-0x14(%rbp)
  jmp    L49
L1:
  lea    -0x14(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  lea    D17(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <fscanf@plt>
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
L49:
  mov    -0x14(%rbp),%eax
  mov    %eax,%edi
  call   <srand@plt>
  mov    -0x14(%rbp),%eax
  mov    %eax,%esi
  lea    D68(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  jmp    L9
L41:
  lea    D45(%rip),%rax
  mov    %rax,%rsi
  lea    D5(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fopen@plt>
  mov    %rax,-0x10(%rbp)
  mov    $0x0,%eax
  call   <rand@plt>
  mov    %eax,%edx
  mov    -0x10(%rbp),%rax
  lea    D55(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <fprintf@plt>
L9:
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L18
  call   <__stack_chk_fail@plt>
L18:
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: label: D38
type_guessed: string
name: extract_symbolic_data
arguments: label: D5
type_guessed: string
name: extract_symbolic_data
arguments: label: D17
type_guessed: string
name: extract_symbolic_data
arguments: label: D68
type_guessed: string
name: extract_symbolic_data
arguments: label: D45
type_guessed: string
name: extract_symbolic_data
arguments: label: D55
type_guessed: string

tool: D38: r

tool: D5: seedms

tool: D17:  %d

tool: D68: 
%d


tool: D45: w

tool: D55: %d 


assistant: ```c
void seedit(const char *flag) {
  FILE *fopen(), *pfseed;
  unsigned int seed2;
  if (flag[0] == 's') {
    pfseed = fopen("seedms", "r");
    if (pfseed == NULL) {
      seed2 = 59243;
    } else {
      fscanf(pfseed, " %d", &seed2);
      fclose(pfseed);
    }
    srand(seed2);
    printf("\n%d\n", seed2);
  } else {
    pfseed = fopen("seedms", "w");
    fprintf(pfseed, "%d \n", rand());
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<seedit>:
  endbr64
  push   %rbx
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  cmpb   $0x73,(%rdi)
  je     L13
  lea    D14(%rip),%rsi
  lea    D13(%rip),%rdi
  mov    $0x0,%eax
  call   <fopen@plt>
  mov    %rax,%rbx
  mov    $0x0,%eax
  call   <rand@plt>
  mov    %eax,%edx
  lea    D39(%rip),%rsi
  mov    %rbx,%rdi
  call   <fprintf@plt>
L36:
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L35
  add    $0x10,%rsp
  pop    %rbx
  ret
L13:
  lea    D2(%rip),%rsi
  lea    D13(%rip),%rdi
  call   <fopen@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L8
  lea    0x4(%rsp),%rdx
  lea    D43(%rip),%rsi
  mov    %rax,%rdi
  call   <fscanf@plt>
  mov    %rbx,%rdi
  call   <fclose@plt>
L18:
  mov    0x4(%rsp),%edi
  call   <srand@plt>
  mov    0x4(%rsp),%esi
  lea    D51(%rip),%rdi
  call   <printf@plt>
  jmp    L36
L8:
  movl   $0xe76b,0x4(%rsp)
  jmp    L18
L35:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_tag: D14
type: string
name: disassemble_data
arguments: data_tag: D13
type: string
name: disassemble_data
arguments: data_tag: D39
type: string
name: disassemble_data
arguments: data_tag: D2
type: string
name: disassemble_data
arguments: data_tag: D43
type: string
name: disassemble_data
arguments: data_tag: D51
type: string

tool: D14: w

tool: D13: seedms

tool: D39: %d 


tool: D2: r

tool: D43:  %d

tool: D51: 
%d


assistant: ```c
void seedit(const char *flag) {
  FILE *fopen(), *pfseed;
  unsigned int seed2;
  if (flag[0] == 's') {
    pfseed = fopen("seedms", "r");
    if (pfseed == NULL) {
      seed2 = 59243;
    } else {
      fscanf(pfseed, " %d", &seed2);
      fclose(pfseed);
    }
    srand(seed2);
    printf("\n%d\n", seed2);
  } else {
    pfseed = fopen("seedms", "w");
    fprintf(pfseed, "%d \n", rand());
  }
}
```
user: What is the c source code of the assembly code below:

```asm
<seedit>:
  endbr64
  push   %rbp
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  cmpb   $0x73,(%rdi)
  je     L33
  lea    D63(%rip),%rsi
  lea    D13(%rip),%rdi
  xor    %eax,%eax
  call   <fopen@plt>
  mov    %rax,%rbp
  xor    %eax,%eax
  call   <rand@plt>
  mov    %eax,%edx
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L43
  add    $0x10,%rsp
  mov    %rbp,%rdi
  lea    D57(%rip),%rsi
  pop    %rbp
  jmp    1110 <fprintf@plt>
  nopw   0x0(%rax,%rax,1)
L33:
  lea    D46(%rip),%rsi
  lea    D13(%rip),%rdi
  call   <fopen@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L34
  lea    0x4(%rsp),%rdx
  lea    D53(%rip),%rsi
  mov    %rax,%rdi
  call   <fscanf@plt>
  mov    %rbp,%rdi
  call   <fclose@plt>
  mov    0x4(%rsp),%edi
L4:
  call   <srand@plt>
  mov    0x4(%rsp),%esi
  lea    D21(%rip),%rdi
  call   <printf@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L43
  add    $0x10,%rsp
  pop    %rbp
  ret
  cs nopw 0x0(%rax,%rax,1)
L34:
  movl   $0xe76b,0x4(%rsp)
  mov    $0xe76b,%edi
  jmp    L4
L43:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D63
type_guessed: string
name: extract_symbolic_data
arguments: data_label: D13
type_guessed: string
name: extract_symbolic_data
arguments: data_label: D57
type_guessed: string
name: extract_symbolic_data
arguments: data_label: D46
type_guessed: string
name: extract_symbolic_data
arguments: data_label: D53
type_guessed: string
name: extract_symbolic_data
arguments: data_label: D21
type_guessed: string

tool: D63: w

tool: D13: seedms

tool: D57: %d 


tool: D46: r

tool: D53:  %d

tool: D21: 
%d


assistant: ```c
void seedit(const char *flag) {
  FILE *fopen(), *pfseed;
  unsigned int seed2;
  if (flag[0] == 's') {
    pfseed = fopen("seedms", "r");
    if (pfseed == NULL) {
      seed2 = 59243;
    } else {
      fscanf(pfseed, " %d", &seed2);
      fclose(pfseed);
    }
    srand(seed2);
    printf("\n%d\n", seed2);
  } else {
    pfseed = fopen("seedms", "w");
    fprintf(pfseed, "%d \n", rand());
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<seedit>:
  endbr64
  push   %rbp
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  cmpb   $0x73,(%rdi)
  je     L46
  lea    D13(%rip),%rsi
  lea    D36(%rip),%rdi
  xor    %eax,%eax
  call   <fopen@plt>
  mov    %rax,%rbp
  xor    %eax,%eax
  call   <rand@plt>
  mov    %eax,%edx
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L1
  add    $0x10,%rsp
  mov    %rbp,%rdi
  lea    D45(%rip),%rsi
  pop    %rbp
  jmp    1110 <fprintf@plt>
  nopw   0x0(%rax,%rax,1)
L46:
  lea    D32(%rip),%rsi
  lea    D36(%rip),%rdi
  call   <fopen@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L37
  lea    0x4(%rsp),%rdx
  lea    D51(%rip),%rsi
  mov    %rax,%rdi
  call   <fscanf@plt>
  mov    %rbp,%rdi
  call   <fclose@plt>
  mov    0x4(%rsp),%edi
L44:
  call   <srand@plt>
  mov    0x4(%rsp),%esi
  lea    D44(%rip),%rdi
  call   <printf@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L1
  add    $0x10,%rsp
  pop    %rbp
  ret
  cs nopw 0x0(%rax,%rax,1)
L37:
  movl   $0xe76b,0x4(%rsp)
  mov    $0xe76b,%edi
  jmp    L44
L1:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: label: D13
type: string
name: unpack_data
arguments: label: D36
type: string
name: unpack_data
arguments: label: D45
type: string
name: unpack_data
arguments: label: D32
type: string
name: unpack_data
arguments: label: D51
type: string
name: unpack_data
arguments: label: D44
type: string

tool: D13: w

tool: D36: seedms

tool: D45: %d 


tool: D32: r

tool: D51:  %d

tool: D44: 
%d


assistant: ```c
void seedit(const char *flag) {
  FILE *fopen(), *pfseed;
  unsigned int seed2;
  if (flag[0] == 's') {
    pfseed = fopen("seedms", "r");
    if (pfseed == NULL) {
      seed2 = 59243;
    } else {
      fscanf(pfseed, " %d", &seed2);
      fclose(pfseed);
    }
    srand(seed2);
    printf("\n%d\n", seed2);
  } else {
    pfseed = fopen("seedms", "w");
    fprintf(pfseed, "%d \n", rand());
  }
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<IniPtMovMod_lc898122>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %edi,%eax
  mov    %al,-0x4(%rbp)
  movzbl -0x4(%rbp),%eax
  test   %eax,%eax
  je     L23
  cmp    $0x1,%eax
  je     L15
  jmp    L16
L23:
  mov    $0x0,%esi
  mov    $0x154,%edi
  call   <RegWriteA_lc898122@plt>
  mov    $0x54,%esi
  mov    $0x155,%edi
  call   <RegWriteA_lc898122@plt>
  mov    $0x14,%esi
  mov    $0x156,%edi
  call   <RegWriteA_lc898122@plt>
  mov    $0x94,%esi
  mov    $0x157,%edi
  call   <RegWriteA_lc898122@plt>
  mov    $0x0,%esi
  mov    $0x158,%edi
  call   <RegWriteA_lc898122@plt>
  jmp    L16
L15:
  mov    $0x0,%esi
  mov    $0x154,%edi
  call   <RegWriteA_lc898122@plt>
  mov    $0x0,%esi
  mov    $0x155,%edi
  call   <RegWriteA_lc898122@plt>
  mov    $0x14,%esi
  mov    $0x156,%edi
  call   <RegWriteA_lc898122@plt>
  mov    $0x94,%esi
  mov    $0x157,%edi
  call   <RegWriteA_lc898122@plt>
  mov    $0x0,%esi
  mov    $0x158,%edi
  call   <RegWriteA_lc898122@plt>
  nop
L16:
  nop
  leave
  ret
```

assistant: ```c
void IniPtMovMod_lc898122(unsigned char UcPtMod) {
  switch (UcPtMod) {
  case 0x00:
    RegWriteA_lc898122(0x0154, 0x00);
    RegWriteA_lc898122(0x0155, 0x54);
    RegWriteA_lc898122(0x0156, 0x14);
    RegWriteA_lc898122(0x0157, 0x94);
    RegWriteA_lc898122(0x0158, 0x00);
    break;
  case 0x01:
    RegWriteA_lc898122(0x0154, 0x00);
    RegWriteA_lc898122(0x0155, 0x00);
    RegWriteA_lc898122(0x0156, 0x14);
    RegWriteA_lc898122(0x0157, 0x94);
    RegWriteA_lc898122(0x0158, 0x00);
    break;
  }
}
```