ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<RandomFunc>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rax
  sub    $0x99f4bb,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  and    $0x10,%eax
  test   %rax,%rax
  je     L24
  mov    -0x10(%rbp),%rax
  and    $0x10,%eax
  test   %rax,%rax
  jne    L3
  mov    -0x10(%rbp),%rax
  add    %rax,%rax
  mov    %rax,-0x10(%rbp)
  jmp    L3
L24:
  mov    -0x10(%rbp),%rax
  add    %rax,%rax
  mov    %rax,-0x10(%rbp)
L3:
  mov    -0x10(%rbp),%rax
  lea    0x582f408c(%rax),%rdx
  mov    -0x20(%rbp),%rax
  mov    %rdx,(%rax)
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L16
  call   <__stack_chk_fail@plt>
L16:
  leave
  ret
```

assistant: ```c
void RandomFunc(unsigned long input[1], unsigned long output[1]) {
  unsigned long state[1];
  {
    state[0UL] = input[0UL] + 0xffffffffff660b45UL;
    if ((state[0UL] >> 4UL) & 1UL) {
      if (!((state[0UL] >> 4UL) & 1UL)) {
        state[0UL] += state[0UL];
      }
    } else {
      state[0UL] += state[0UL];
    }
    output[0UL] = (state[0UL] + 767205732UL) + 712285992UL;
  }
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<RandomFunc>:
  endbr64
  mov    (%rdi),%rax
  sub    $0x99f4bb,%rax
  lea    (%rax,%rax,1),%rdx
  test   $0x10,%al
  cmove  %rdx,%rax
  add    $0x582f408c,%rax
  mov    %rax,(%rsi)
  ret
```

assistant: ```c
void RandomFunc(unsigned long input[1], unsigned long output[1]) {
  unsigned long state[1];
  {
    state[0UL] = input[0UL] + 0xffffffffff660b45UL;
    if ((state[0UL] >> 4UL) & 1UL) {
      if (!((state[0UL] >> 4UL) & 1UL)) {
        state[0UL] += state[0UL];
      }
    } else {
      state[0UL] += state[0UL];
    }
    output[0UL] = (state[0UL] + 767205732UL) + 712285992UL;
  }
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<RandomFunc>:
  endbr64
  mov    (%rdi),%rax
  sub    $0x99f4bb,%rax
  test   $0x10,%al
  lea    (%rax,%rax,1),%rdx
  cmove  %rdx,%rax
  add    $0x582f408c,%rax
  mov    %rax,(%rsi)
  ret
```

assistant: ```c
void RandomFunc(unsigned long input[1], unsigned long output[1]) {
  unsigned long state[1];
  {
    state[0UL] = input[0UL] + 0xffffffffff660b45UL;
    if ((state[0UL] >> 4UL) & 1UL) {
      if (!((state[0UL] >> 4UL) & 1UL)) {
        state[0UL] += state[0UL];
      }
    } else {
      state[0UL] += state[0UL];
    }
    output[0UL] = (state[0UL] + 767205732UL) + 712285992UL;
  }
}
```
user: What is the c source code of the assembly code below:

```asm
<RandomFunc>:
  endbr64
  mov    (%rdi),%rax
  sub    $0x99f4bb,%rax
  test   $0x10,%al
  lea    (%rax,%rax,1),%rdx
  cmove  %rdx,%rax
  add    $0x582f408c,%rax
  mov    %rax,(%rsi)
  ret
```

assistant: ```c
void RandomFunc(unsigned long input[1], unsigned long output[1]) {
  unsigned long state[1];
  {
    state[0UL] = input[0UL] + 0xffffffffff660b45UL;
    if ((state[0UL] >> 4UL) & 1UL) {
      if (!((state[0UL] >> 4UL) & 1UL)) {
        state[0UL] += state[0UL];
      }
    } else {
      state[0UL] += state[0UL];
    }
    output[0UL] = (state[0UL] + 767205732UL) + 712285992UL;
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<towerOfHanoi>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %edi,-0x4(%rbp)
  mov    %ecx,%eax
  mov    %esi,%ecx
  mov    %cl,-0x8(%rbp)
  mov    %dl,-0xc(%rbp)
  mov    %al,-0x10(%rbp)
  cmpl   $0x1,-0x4(%rbp)
  jne    L11
  movsbl -0xc(%rbp),%edx
  movsbl -0x8(%rbp),%eax
  mov    %eax,%esi
  lea    D14(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x1,%eax
  jmp    L0
L11:
  movsbl -0xc(%rbp),%ecx
  movsbl -0x10(%rbp),%edx
  movsbl -0x8(%rbp),%eax
  mov    -0x4(%rbp),%esi
  lea    -0x1(%rsi),%edi
  mov    %eax,%esi
  call   <towerOfHanoi>
  movsbl -0xc(%rbp),%ecx
  movsbl -0x8(%rbp),%edx
  mov    -0x4(%rbp),%eax
  mov    %eax,%esi
  lea    D6(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movsbl -0x8(%rbp),%ecx
  movsbl -0xc(%rbp),%edx
  movsbl -0x10(%rbp),%eax
  mov    -0x4(%rbp),%esi
  lea    -0x1(%rsi),%edi
  mov    %eax,%esi
  call   <towerOfHanoi>
L0:
  leave
  ret
```

tool_calls: name: read_data
arguments: tag: D14
type: string
name: read_data
arguments: tag: D6
type: string

tool: D14: 
Move disk 1 from %c to %c

tool: D6: 
Move disk %d from %c to %c

assistant: ```c
int towerOfHanoi(int n, char barFrom, char barTo, char barAuxillary) {
  if (n == 1) {
    printf("\nMove disk 1 from %c to %c", barFrom, barTo);
    return 1;
  }
  towerOfHanoi(n - 1, barFrom, barAuxillary, barTo);
  printf("\nMove disk %d from %c to %c", n, barFrom, barTo);
  towerOfHanoi(n - 1, barAuxillary, barTo, barFrom);
}
```
user: Translate the below assembly code into C programming language:

```asm
<towerOfHanoi>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  cmp    $0x1,%edi
  je     L8
  mov    %edi,%r13d
  movsbl %dl,%ebx
  movsbl %cl,%r12d
  movsbl %sil,%ebp
  lea    -0x1(%rdi),%r14d
  mov    %ebx,%ecx
  mov    %r12d,%edx
  mov    %ebp,%esi
  mov    %r14d,%edi
  call   <towerOfHanoi>
  mov    %ebx,%ecx
  mov    %ebp,%edx
  mov    %r13d,%esi
  lea    D9(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    %ebp,%ecx
  mov    %ebx,%edx
  mov    %r12d,%esi
  mov    %r14d,%edi
  call   <towerOfHanoi>
L4:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L8:
  movsbl %dl,%edx
  movsbl %sil,%esi
  lea    D18(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x1,%eax
  jmp    L4
```

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

tool: D9: 
Move disk %d from %c to %c

tool: D18: 
Move disk 1 from %c to %c

assistant: ```c
int towerOfHanoi(int n, char barFrom, char barTo, char barAuxillary) {
  if (n == 1) {
    printf("\nMove disk 1 from %c to %c", barFrom, barTo);
    return 1;
  }
  towerOfHanoi(n - 1, barFrom, barAuxillary, barTo);
  printf("\nMove disk %d from %c to %c", n, barFrom, barTo);
  towerOfHanoi(n - 1, barAuxillary, barTo, barFrom);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<towerOfHanoi>:
  endbr64
  push   %r15
  push   %r14
  movsbl %sil,%r14d
  push   %r13
  movsbl %dl,%r13d
  push   %r12
  push   %rbp
  cmp    $0x1,%edi
  je     L2
  movsbl %cl,%ebp
  lea    -0x1(%rdi),%r15d
  mov    %edi,%r12d
  mov    %r13d,%ecx
  mov    %ebp,%edx
  mov    %r14d,%esi
  mov    %r15d,%edi
  call   <towerOfHanoi>
  mov    %r13d,%ecx
  mov    %r14d,%edx
  mov    %r12d,%esi
  lea    D15(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    %r14d,%ecx
  mov    %r13d,%edx
  mov    %ebp,%esi
  mov    %r15d,%edi
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1120 <towerOfHanoi>
  nopl   0x0(%rax)
L2:
  mov    %r13d,%edx
  mov    %r14d,%esi
  lea    D12(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  pop    %rbp
  mov    $0x1,%eax
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: unpack_data
arguments: data_tag: D15
type: string
name: unpack_data
arguments: data_tag: D12
type: string

tool: D15: 
Move disk %d from %c to %c

tool: D12: 
Move disk 1 from %c to %c

assistant: ```c
int towerOfHanoi(int n, char barFrom, char barTo, char barAuxillary) {
  if (n == 1) {
    printf("\nMove disk 1 from %c to %c", barFrom, barTo);
    return 1;
  }
  towerOfHanoi(n - 1, barFrom, barAuxillary, barTo);
  printf("\nMove disk %d from %c to %c", n, barFrom, barTo);
  towerOfHanoi(n - 1, barAuxillary, barTo, barFrom);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<zig_addw_u32>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    -0x28(%rbp),%rax
  sub    -0x20(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x18(%rbp),%rax
  cmp    -0x8(%rbp),%rax
  jle    L4
  mov    -0x18(%rbp),%rax
  sub    -0x8(%rbp),%rax
  sub    $0x1,%rax
  jmp    L5
L4:
  mov    -0x18(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
L5:
  pop    %rbp
  ret
```

assistant: ```c
uint32_t zig_addw_u32(uint32_t lhs, uint32_t rhs, uint32_t max) {
  uint32_t thresh = max - rhs;
  if (lhs > thresh) {
    return lhs - thresh - 1;
  } else {
    return lhs + rhs;
  }
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<zig_addw_u32>:
  endbr64
  sub    %rsi,%rdx
  mov    %rdi,%rax
  sub    %rdx,%rax
  sub    $0x1,%rax
  add    %rdi,%rsi
  cmp    %rdi,%rdx
  cmovge %rsi,%rax
  ret
```

assistant: ```c
uint32_t zig_addw_u32(uint32_t lhs, uint32_t rhs, uint32_t max) {
  uint32_t thresh = max - rhs;
  if (lhs > thresh) {
    return lhs - thresh - 1;
  } else {
    return lhs + rhs;
  }
}
```
user: What is the c source code of the assembly code below:

```asm
<zig_addw_u32>:
  endbr64
  sub    %rsi,%rdx
  mov    %rdi,%rax
  add    %rdi,%rsi
  sub    %rdx,%rax
  sub    $0x1,%rax
  cmp    %rdi,%rdx
  cmovge %rsi,%rax
  ret
```

assistant: ```c
uint32_t zig_addw_u32(uint32_t lhs, uint32_t rhs, uint32_t max) {
  uint32_t thresh = max - rhs;
  if (lhs > thresh) {
    return lhs - thresh - 1;
  } else {
    return lhs + rhs;
  }
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<zig_addw_u32>:
  endbr64
  sub    %rsi,%rdx
  mov    %rdi,%rax
  add    %rdi,%rsi
  sub    %rdx,%rax
  sub    $0x1,%rax
  cmp    %rdi,%rdx
  cmovge %rsi,%rax
  ret
```

assistant: ```c
uint32_t zig_addw_u32(uint32_t lhs, uint32_t rhs, uint32_t max) {
  uint32_t thresh = max - rhs;
  if (lhs > thresh) {
    return lhs - thresh - 1;
  } else {
    return lhs + rhs;
  }
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<patch_NCAS_3_9_0_46x_extra>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    $0x2,%esi
  mov    $0x0,%edi
  call   <write_ndless3x_loader@plt>
  mov    $0xea,%esi
  mov    $0x1008870b,%edi
  call   <put_byte@plt>
  mov    $0x0,%esi
  mov    $0x10111788,%edi
  call   <put_word@plt>
  mov    $0xe12fff1e,%esi
  mov    $0x1013c764,%edi
  call   <put_word@plt>
  nop
  pop    %rbp
  ret
```

assistant: ```c
__attribute__((always_)) void patch_NCAS_3_9_0_46x_extra(void) {
  write_ndless3x_loader(0, 2);
  put_byte(0x1008870B, 0xEA);
  put_word(0x10111788, 0x00000000);
  put_word(0x1013C764, 0xE12FFF1E);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<patch_NCAS_3_9_0_46x_extra>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x2,%esi
  mov    $0x0,%edi
  call   <write_ndless3x_loader@plt>
  mov    $0xea,%esi
  mov    $0x1008870b,%edi
  call   <put_byte@plt>
  mov    $0x0,%esi
  mov    $0x10111788,%edi
  call   <put_word@plt>
  mov    $0xe12fff1e,%esi
  mov    $0x1013c764,%edi
  call   <put_word@plt>
  add    $0x8,%rsp
  ret
```

assistant: ```c
__attribute__((always_)) void patch_NCAS_3_9_0_46x_extra(void) {
  write_ndless3x_loader(0, 2);
  put_byte(0x1008870B, 0xEA);
  put_word(0x10111788, 0x00000000);
  put_word(0x1013C764, 0xE12FFF1E);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<patch_NCAS_3_9_0_46x_extra>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x2,%esi
  xor    %edi,%edi
  call   <write_ndless3x_loader@plt>
  mov    $0xea,%esi
  mov    $0x1008870b,%edi
  call   <put_byte@plt>
  xor    %esi,%esi
  mov    $0x10111788,%edi
  call   <put_word@plt>
  mov    $0xe12fff1e,%esi
  mov    $0x1013c764,%edi
  add    $0x8,%rsp
  jmp    1090 <put_word@plt>
```

assistant: ```c
__attribute__((always_)) void patch_NCAS_3_9_0_46x_extra(void) {
  write_ndless3x_loader(0, 2);
  put_byte(0x1008870B, 0xEA);
  put_word(0x10111788, 0x00000000);
  put_word(0x1013C764, 0xE12FFF1E);
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<patch_NCAS_3_9_0_46x_extra>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x2,%esi
  xor    %edi,%edi
  call   <write_ndless3x_loader@plt>
  mov    $0xea,%esi
  mov    $0x1008870b,%edi
  call   <put_byte@plt>
  xor    %esi,%esi
  mov    $0x10111788,%edi
  call   <put_word@plt>
  mov    $0xe12fff1e,%esi
  mov    $0x1013c764,%edi
  add    $0x8,%rsp
  jmp    1090 <put_word@plt>
```

assistant: ```c
__attribute__((always_)) void patch_NCAS_3_9_0_46x_extra(void) {
  write_ndless3x_loader(0, 2);
  put_byte(0x1008870B, 0xEA);
  put_word(0x10111788, 0x00000000);
  put_word(0x1013C764, 0xE12FFF1E);
}
```
user: What is the c source code of the assembly code below?

```asm
<FSQLF_is_word>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  cmpq   $0x2,-0x20(%rbp)
  ja     L22
  movq   $0x0,-0x8(%rbp)
  jmp    L40
L18:
  mov    -0x18(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isalnum@plt>
  test   %eax,%eax
  jne    L48
  mov    $0x0,%eax
  jmp    L6
L48:
  addq   $0x1,-0x8(%rbp)
L40:
  mov    -0x8(%rbp),%rax
  cmp    -0x20(%rbp),%rax
  jb     L18
L22:
  mov    $0x1,%eax
L6:
  leave
  ret
```

assistant: ```c
int FSQLF_is_word(char *text, size_t length) {
  if (length <= 2) {
    for (size_t i = 0; i < length; ++i) {
      if (!isalnum(text[i])) {
        return 0;
      }
    }
  }
  return 1;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<FSQLF_is_word>:
  endbr64
  lea    -0x1(%rsi),%rax
  cmp    $0x1,%rax
  ja     L13
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbp
  mov    %rsi,%rbx
  movsbl (%rdi),%edi
  call   <isalnum@plt>
  test   %eax,%eax
  je     L49
  cmp    $0x1,%rbx
  jbe    L15
  movsbl 0x1(%rbp),%edi
  call   <isalnum@plt>
  test   %eax,%eax
  je     L49
L15:
  mov    $0x1,%eax
  jmp    L33
L49:
  mov    $0x0,%eax
L33:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
L13:
  mov    $0x1,%eax
  ret
```

assistant: ```c
int FSQLF_is_word(char *text, size_t length) {
  if (length <= 2) {
    for (size_t i = 0; i < length; ++i) {
      if (!isalnum(text[i])) {
        return 0;
      }
    }
  }
  return 1;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<FSQLF_is_word>:
  endbr64
  lea    -0x1(%rsi),%rax
  cmp    $0x1,%rax
  ja     L29
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x8,%rsp
  movsbl (%rdi),%edi
  call   <isalnum@plt>
  test   %eax,%eax
  je     L35
  cmp    $0x2,%rbx
  jne    L15
  movsbl 0x1(%rbp),%edi
  call   <isalnum@plt>
  test   %eax,%eax
  je     L35
L15:
  add    $0x8,%rsp
  mov    $0x1,%eax
  pop    %rbx
  pop    %rbp
  ret
  nopl   (%rax)
L35:
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  ret
  nopl   0x0(%rax)
L29:
  mov    $0x1,%eax
  ret
```

assistant: ```c
int FSQLF_is_word(char *text, size_t length) {
  if (length <= 2) {
    for (size_t i = 0; i < length; ++i) {
      if (!isalnum(text[i])) {
        return 0;
      }
    }
  }
  return 1;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<FSQLF_is_word>:
  endbr64
  lea    -0x1(%rsi),%rax
  cmp    $0x1,%rax
  ja     L15
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x8,%rsp
  movsbl (%rdi),%edi
  call   <isalnum@plt>
  test   %eax,%eax
  je     L0
  cmp    $0x2,%rbx
  jne    L24
  movsbl 0x1(%rbp),%edi
  call   <isalnum@plt>
  test   %eax,%eax
  je     L0
L24:
  add    $0x8,%rsp
  mov    $0x1,%eax
  pop    %rbx
  pop    %rbp
  ret
  nopl   (%rax)
L0:
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  ret
  nopl   0x0(%rax)
L15:
  mov    $0x1,%eax
  ret
```

assistant: ```c
int FSQLF_is_word(char *text, size_t length) {
  if (length <= 2) {
    for (size_t i = 0; i < length; ++i) {
      if (!isalnum(text[i])) {
        return 0;
      }
    }
  }
  return 1;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<updwtmp>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    D12(%rip),%rax
  mov    (%rax),%edx
  mov    D8(%rip),%rax
  mov    (%rax),%eax
  or     %eax,%edx
  mov    -0x18(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <open@plt>
  mov    %eax,-0x4(%rbp)
  cmpl   $0x0,-0x4(%rbp)
  js     L3
  mov    D29(%rip),%rax
  mov    (%rax),%edx
  mov    D22(%rip),%rax
  mov    (%rax),%ecx
  mov    -0x4(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <fcntl@plt>
  mov    -0x20(%rbp),%rcx
  mov    -0x4(%rbp),%eax
  mov    $0x4,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <write@plt>
  mov    -0x4(%rbp),%eax
  mov    %eax,%edi
  call   <close@plt>
  jmp    L10
L3:
  nop
L10:
  leave
  ret
```

assistant: ```c
void updwtmp(const char *wtmp_file, const struct utmp *ut) {
  int fd = open(wtmp_file, O_WRONLY | O_APPEND);
  if (fd < 0)
    return;
  fcntl(fd, F_SETFD, FD_CLOEXEC);
  write(fd, ut, sizeof(struct utmp));
  close(fd);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<updwtmp>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rsi,%rbp
  mov    D35(%rip),%rax
  mov    (%rax),%esi
  mov    D29(%rip),%rax
  or     (%rax),%esi
  call   <open@plt>
  test   %eax,%eax
  js     L4
  mov    %eax,%ebx
  mov    D7(%rip),%rax
  mov    (%rax),%edx
  mov    D1(%rip),%rax
  mov    (%rax),%esi
  mov    %ebx,%edi
  call   <fcntl@plt>
  mov    $0x4,%edx
  mov    %rbp,%rsi
  mov    %ebx,%edi
  call   <write@plt>
  mov    %ebx,%edi
  call   <close@plt>
L4:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
void updwtmp(const char *wtmp_file, const struct utmp *ut) {
  int fd = open(wtmp_file, O_WRONLY | O_APPEND);
  if (fd < 0)
    return;
  fcntl(fd, F_SETFD, FD_CLOEXEC);
  write(fd, ut, sizeof(struct utmp));
  close(fd);
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<updwtmp>:
  endbr64
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  sub    $0x8,%rsp
  mov    D4(%rip),%rax
  mov    (%rax),%esi
  mov    D0(%rip),%rax
  or     (%rax),%esi
  call   <open@plt>
  test   %eax,%eax
  js     L4
  mov    %eax,%ebp
  mov    D22(%rip),%rax
  mov    %ebp,%edi
  mov    (%rax),%edx
  mov    D19(%rip),%rax
  mov    (%rax),%esi
  call   <fcntl@plt>
  mov    %ebp,%edi
  mov    %r12,%rsi
  mov    $0x4,%edx
  call   <write@plt>
  add    $0x8,%rsp
  mov    %ebp,%edi
  pop    %rbp
  pop    %r12
  jmp    10a0 <close@plt>
  nopl   0x0(%rax)
L4:
  add    $0x8,%rsp
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
void updwtmp(const char *wtmp_file, const struct utmp *ut) {
  int fd = open(wtmp_file, O_WRONLY | O_APPEND);
  if (fd < 0)
    return;
  fcntl(fd, F_SETFD, FD_CLOEXEC);
  write(fd, ut, sizeof(struct utmp));
  close(fd);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<updwtmp>:
  endbr64
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  sub    $0x8,%rsp
  mov    D19(%rip),%rax
  mov    (%rax),%esi
  mov    D38(%rip),%rax
  or     (%rax),%esi
  call   <open@plt>
  test   %eax,%eax
  js     L3
  mov    %eax,%ebp
  mov    D5(%rip),%rax
  mov    %ebp,%edi
  mov    (%rax),%edx
  mov    D22(%rip),%rax
  mov    (%rax),%esi
  call   <fcntl@plt>
  mov    %ebp,%edi
  mov    %r12,%rsi
  mov    $0x4,%edx
  call   <write@plt>
  add    $0x8,%rsp
  mov    %ebp,%edi
  pop    %rbp
  pop    %r12
  jmp    10a0 <close@plt>
  nopl   0x0(%rax)
L3:
  add    $0x8,%rsp
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
void updwtmp(const char *wtmp_file, const struct utmp *ut) {
  int fd = open(wtmp_file, O_WRONLY | O_APPEND);
  if (fd < 0)
    return;
  fcntl(fd, F_SETFD, FD_CLOEXEC);
  write(fd, ut, sizeof(struct utmp));
  close(fd);
}
```
user: Translate the below assembly code into C programming language:

```asm
<dump_trans_matrix>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %esi,-0x18(%rbp)
  mov    %rdx,-0x20(%rbp)
  lea    D34(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    -0x14(%rbp),%eax
  mov    %eax,%esi
  lea    D29(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    -0x18(%rbp),%eax
  mov    %eax,%esi
  lea    D23(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movl   $0x0,-0x8(%rbp)
  jmp    L6
L23:
  movl   $0x0,-0x4(%rbp)
  jmp    L8
L9:
  mov    -0x20(%rbp),%rax
  fldt   (%rax)
  lea    -0x10(%rsp),%rsp
  fstpt  (%rsp)
  lea    D37(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  add    $0x10,%rsp
  addq   $0x10,-0x20(%rbp)
  addl   $0x1,-0x4(%rbp)
L8:
  mov    -0x4(%rbp),%eax
  cmp    -0x18(%rbp),%eax
  jl     L9
  mov    $0xa,%edi
  call   <putchar@plt>
  addl   $0x1,-0x8(%rbp)
L6:
  mov    -0x8(%rbp),%eax
  cmp    -0x14(%rbp),%eax
  jl     L23
  mov    $0xa,%edi
  call   <putchar@plt>
  nop
  leave
  ret
```

tool_calls: name: parse_data
arguments: data_label: D34
type: string
name: parse_data
arguments: data_label: D29
type: string
name: parse_data
arguments: data_label: D23
type: string
name: parse_data
arguments: data_label: D37
type: string

tool: D34: transition matrix dump:

tool: D29: nr rows: %d


tool: D23: nr columns: %d


tool: D37: %Lf  

assistant: ```c
void dump_trans_matrix(int nr_rows, int nr_cols, long double *mtx) {
  int i, j;
  printf("transition matrix dump:\n");
  printf("nr rows: %d\n", nr_rows);
  printf("nr columns: %d\n", nr_cols);
  for (i = 0; i < nr_rows; i++) {
    for (j = 0; j < nr_cols; j++) {
      printf("%Lf  ", *mtx);
      mtx++;
    }
    printf("\n");
  }
  printf("\n");
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<dump_trans_matrix>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %edi,%r14d
  mov    %esi,%r15d
  mov    %rdx,%rbx
  lea    D5(%rip),%rdi
  call   <puts@plt>
  mov    %r14d,%esi
  lea    D15(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    %r15d,%esi
  lea    D33(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  test   %r14d,%r14d
  jle    L19
  lea    -0x1(%r15),%eax
  add    $0x1,%rax
  shl    $0x4,%rax
  mov    %rax,0x8(%rsp)
  mov    $0x0,%r13d
  lea    D36(%rip),%r12
  jmp    L38
L40:
  push   0x8(%rbx)
  push   (%rbx)
  mov    %r12,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  add    $0x10,%rbx
  add    $0x10,%rsp
  cmp    %rbp,%rbx
  jne    L40
  mov    %rbp,%rbx
L6:
  mov    $0xa,%edi
  call   <putchar@plt>
  add    $0x1,%r13d
  cmp    %r13d,%r14d
  je     L19
L38:
  mov    0x8(%rsp),%rax
  lea    (%rbx,%rax,1),%rbp
  test   %r15d,%r15d
  jg     L40
  jmp    L6
L19:
  mov    $0xa,%edi
  call   <putchar@plt>
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D5
type_guessed: string
name: extract_symbolic_data
arguments: data_tag: D15
type_guessed: string
name: extract_symbolic_data
arguments: data_tag: D33
type_guessed: string
name: extract_symbolic_data
arguments: data_tag: D36
type_guessed: string

tool: D5: transition matrix dump:

tool: D15: nr rows: %d


tool: D33: nr columns: %d


tool: D36: %Lf  

assistant: ```c
void dump_trans_matrix(int nr_rows, int nr_cols, long double *mtx) {
  int i, j;
  printf("transition matrix dump:\n");
  printf("nr rows: %d\n", nr_rows);
  printf("nr columns: %d\n", nr_cols);
  for (i = 0; i < nr_rows; i++) {
    for (j = 0; j < nr_cols; j++) {
      printf("%Lf  ", *mtx);
      mtx++;
    }
    printf("\n");
  }
  printf("\n");
}
```