ylfeng/ReF-Decompile-dataset huggingface dataset:
user: What is the c source code of the assembly code below:

```asm
<put32_le>:
  endbr64
  mov    %esi,%edx
  mov    %esi,%eax
  movzbl %sil,%ecx
  sar    $0x10,%edx
  movd   %ecx,%xmm0
  movzbl %ah,%ecx
  shr    $0x18,%eax
  movzbl %dl,%esi
  movd   %ecx,%xmm2
  movd   %eax,%xmm3
  movd   %esi,%xmm1
  punpckldq %xmm2,%xmm0
  punpckldq %xmm3,%xmm1
  punpcklqdq %xmm1,%xmm0
  movups %xmm0,(%rdi)
  ret
```

assistant: ```c
void put32_le(void *p, uint32_t x) {
  *((uint8_t *)p) = x & 0xff;
  *((uint8_t *)p + 1) = x >> 8 & 0xff;
  *((uint8_t *)p + 2) = x >> 16 & 0xff;
  *((uint8_t *)p + 3) = x >> 24 & 0xff;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<setup>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    %esi,-0xc(%rbp)
  mov    %rdx,-0x18(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <config_init@plt>
  mov    -0x18(%rbp),%rdx
  mov    -0xc(%rbp),%ecx
  mov    -0x8(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <parse_args@plt>
  test   %rax,%rax
  je     L32
  mov    $0xffffffff,%eax
  jmp    L34
L32:
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <config_validate@plt>
  test   %rax,%rax
  je     L2
  mov    $0xffffffff,%eax
  jmp    L34
L2:
  mov    $0x0,%eax
L34:
  leave
  ret
```

assistant: ```c
int setup(struct config_t *config, int argc, char **argv) {
  config_init(config);
  if (parse_args(config, argc, argv) != 0)
    return -1;
  if (config_validate(config) != 0)
    return -1;
  return 0;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<setup>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  mov    %esi,%ebp
  mov    %rdx,%r12
  call   <config_init@plt>
  mov    %r12,%rdx
  mov    %ebp,%esi
  mov    %rbx,%rdi
  call   <parse_args@plt>
  test   %rax,%rax
  jne    L5
  mov    %rbx,%rdi
  call   <config_validate@plt>
  neg    %rax
  sbb    %eax,%eax
L12:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L5:
  mov    $0xffffffff,%eax
  jmp    L12
```

assistant: ```c
int setup(struct config_t *config, int argc, char **argv) {
  config_init(config);
  if (parse_args(config, argc, argv) != 0)
    return -1;
  if (config_validate(config) != 0)
    return -1;
  return 0;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<setup>:
  endbr64
  push   %r13
  mov    %rdx,%r13
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  mov    %rdi,%rbp
  call   <config_init@plt>
  mov    %r13,%rdx
  mov    %r12d,%esi
  mov    %rbp,%rdi
  call   <parse_args@plt>
  test   %rax,%rax
  jne    L4
  mov    %rbp,%rdi
  call   <config_validate@plt>
  neg    %rax
  sbb    %eax,%eax
L3:
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   (%rax)
L4:
  mov    $0xffffffff,%eax
  jmp    L3
```

assistant: ```c
int setup(struct config_t *config, int argc, char **argv) {
  config_init(config);
  if (parse_args(config, argc, argv) != 0)
    return -1;
  if (config_validate(config) != 0)
    return -1;
  return 0;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<setup>:
  endbr64
  push   %r13
  mov    %rdx,%r13
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  mov    %rdi,%rbp
  call   <config_init@plt>
  mov    %r13,%rdx
  mov    %r12d,%esi
  mov    %rbp,%rdi
  call   <parse_args@plt>
  test   %rax,%rax
  jne    L11
  mov    %rbp,%rdi
  call   <config_validate@plt>
  neg    %rax
  sbb    %eax,%eax
L16:
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   (%rax)
L11:
  mov    $0xffffffff,%eax
  jmp    L16
```

assistant: ```c
int setup(struct config_t *config, int argc, char **argv) {
  config_init(config);
  if (parse_args(config, argc, argv) != 0)
    return -1;
  if (config_validate(config) != 0)
    return -1;
  return 0;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<readData_4BitIntf>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    $0x0,%eax
  call   <LCDPort_SetRS@plt>
  mov    $0x0,%eax
  call   <LCDPort_SetRW@plt>
  mov    $0x0,%eax
  call   <LCDPort_SetCE@plt>
  mov    $0x0,%eax
  call   <LCDPort_In4@plt>
  shl    $0x4,%eax
  and    $0xf0,%eax
  mov    %eax,-0x4(%rbp)
  mov    $0x0,%eax
  call   <LCDPort_ClearCE@plt>
  mov    $0x0,%eax
  call   <LCDPort_SetCE@plt>
  mov    $0x0,%eax
  call   <LCDPort_In4@plt>
  and    $0xf,%eax
  or     %eax,-0x4(%rbp)
  mov    $0x0,%eax
  call   <LCDPort_ClearCE@plt>
  mov    -0x4(%rbp),%eax
  leave
  ret
```

assistant: ```c
int32_t readData_4BitIntf(void) {
  int32_t rs;
  LCDPort_SetRS();
  LCDPort_SetRW();
  LCDPort_SetCE();
  rs = (LCDPort_In4() & 0x0F) << 4;
  LCDPort_ClearCE();
  LCDPort_SetCE();
  rs |= (LCDPort_In4() & 0x0F);
  LCDPort_ClearCE();
  return rs;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<readData_4BitIntf>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    $0x0,%eax
  call   <LCDPort_SetRS@plt>
  mov    $0x0,%eax
  call   <LCDPort_SetRW@plt>
  mov    $0x0,%eax
  call   <LCDPort_SetCE@plt>
  mov    $0x0,%eax
  call   <LCDPort_In4@plt>
  shl    $0x4,%eax
  movzbl %al,%ebp
  mov    $0x0,%eax
  call   <LCDPort_ClearCE@plt>
  mov    $0x0,%eax
  call   <LCDPort_SetCE@plt>
  mov    $0x0,%eax
  call   <LCDPort_In4@plt>
  and    $0xf,%eax
  mov    %eax,%ebx
  or     %ebp,%ebx
  mov    $0x0,%eax
  call   <LCDPort_ClearCE@plt>
  mov    %ebx,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
int32_t readData_4BitIntf(void) {
  int32_t rs;
  LCDPort_SetRS();
  LCDPort_SetRW();
  LCDPort_SetCE();
  rs = (LCDPort_In4() & 0x0F) << 4;
  LCDPort_ClearCE();
  LCDPort_SetCE();
  rs |= (LCDPort_In4() & 0x0F);
  LCDPort_ClearCE();
  return rs;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<readData_4BitIntf>:
  endbr64
  push   %r12
  xor    %eax,%eax
  push   %rbx
  sub    $0x8,%rsp
  call   <LCDPort_SetRS@plt>
  xor    %eax,%eax
  call   <LCDPort_SetRW@plt>
  xor    %eax,%eax
  call   <LCDPort_SetCE@plt>
  xor    %eax,%eax
  call   <LCDPort_In4@plt>
  shl    $0x4,%eax
  movzbl %al,%ebx
  xor    %eax,%eax
  call   <LCDPort_ClearCE@plt>
  xor    %eax,%eax
  call   <LCDPort_SetCE@plt>
  xor    %eax,%eax
  call   <LCDPort_In4@plt>
  and    $0xf,%eax
  mov    %eax,%r12d
  xor    %eax,%eax
  call   <LCDPort_ClearCE@plt>
  or     %ebx,%r12d
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %r12
  ret
```

assistant: ```c
int32_t readData_4BitIntf(void) {
  int32_t rs;
  LCDPort_SetRS();
  LCDPort_SetRW();
  LCDPort_SetCE();
  rs = (LCDPort_In4() & 0x0F) << 4;
  LCDPort_ClearCE();
  LCDPort_SetCE();
  rs |= (LCDPort_In4() & 0x0F);
  LCDPort_ClearCE();
  return rs;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<readData_4BitIntf>:
  endbr64
  push   %r12
  xor    %eax,%eax
  push   %rbx
  sub    $0x8,%rsp
  call   <LCDPort_SetRS@plt>
  xor    %eax,%eax
  call   <LCDPort_SetRW@plt>
  xor    %eax,%eax
  call   <LCDPort_SetCE@plt>
  xor    %eax,%eax
  call   <LCDPort_In4@plt>
  shl    $0x4,%eax
  movzbl %al,%ebx
  xor    %eax,%eax
  call   <LCDPort_ClearCE@plt>
  xor    %eax,%eax
  call   <LCDPort_SetCE@plt>
  xor    %eax,%eax
  call   <LCDPort_In4@plt>
  and    $0xf,%eax
  mov    %eax,%r12d
  xor    %eax,%eax
  call   <LCDPort_ClearCE@plt>
  or     %ebx,%r12d
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %r12
  ret
```

assistant: ```c
int32_t readData_4BitIntf(void) {
  int32_t rs;
  LCDPort_SetRS();
  LCDPort_SetRW();
  LCDPort_SetCE();
  rs = (LCDPort_In4() & 0x0F) << 4;
  LCDPort_ClearCE();
  LCDPort_SetCE();
  rs |= (LCDPort_In4() & 0x0F);
  LCDPort_ClearCE();
  return rs;
}
```
user: What is the c source code of the assembly code below?

```asm
<random_delete>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <random_destroy@plt>
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  nop
  leave
  ret
```

assistant: ```c
void random_delete(struct random *__restrict rand) {
  random_destroy(rand);
  free(rand);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<random_delete>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  call   <random_destroy@plt>
  mov    %rbx,%rdi
  call   <free@plt>
  pop    %rbx
  ret
```

assistant: ```c
void random_delete(struct random *__restrict rand) {
  random_destroy(rand);
  free(rand);
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<random_delete>:
  endbr64
  push   %rbp
  mov    %rdi,%rbp
  call   <random_destroy@plt>
  mov    %rbp,%rdi
  pop    %rbp
  jmp    1060 <free@plt>
```

assistant: ```c
void random_delete(struct random *__restrict rand) {
  random_destroy(rand);
  free(rand);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<random_delete>:
  endbr64
  push   %rbp
  mov    %rdi,%rbp
  call   <random_destroy@plt>
  mov    %rbp,%rdi
  pop    %rbp
  jmp    1060 <free@plt>
```

assistant: ```c
void random_delete(struct random *__restrict rand) {
  random_destroy(rand);
  free(rand);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<select>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x70,%rsp
  mov    %edi,-0x44(%rbp)
  mov    %rsi,-0x50(%rbp)
  mov    %rdx,-0x58(%rbp)
  mov    %rcx,-0x60(%rbp)
  mov    %r8,-0x68(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x34(%rbp),%rdx
  lea    -0x30(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <gettimeofday@plt>
  mov    -0x30(%rbp),%rdx
  mov    -0x68(%rbp),%rax
  mov    (%rax),%rax
  add    %rdx,%rax
  mov    %rax,-0x30(%rbp)
  mov    -0x28(%rbp),%edx
  mov    -0x68(%rbp),%rax
  mov    0x8(%rax),%eax
  add    %edx,%eax
  mov    %eax,-0x28(%rbp)
  mov    -0x28(%rbp),%eax
  cmp    $0xf423f,%eax
  jle    L4
  mov    -0x30(%rbp),%rcx
  mov    -0x28(%rbp),%eax
  movslq %eax,%rdx
  imul   $0x431bde83,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x12,%edx
  sar    $0x1f,%eax
  mov    %eax,%esi
  mov    %edx,%eax
  sub    %esi,%eax
  cltq
  add    %rcx,%rax
  mov    %rax,-0x30(%rbp)
  mov    -0x28(%rbp),%edx
  movslq %edx,%rax
  imul   $0x431bde83,%rax,%rax
  shr    $0x20,%rax
  sar    $0x12,%eax
  mov    %edx,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%eax
  imul   $0xf4240,%eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  mov    %eax,-0x28(%rbp)
L4:
  lea    -0x34(%rbp),%rdx
  lea    -0x20(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <gettimeofday@plt>
  mov    -0x20(%rbp),%rdx
  mov    -0x30(%rbp),%rax
  cmp    %rax,%rdx
  jl     L4
  mov    -0x18(%rbp),%edx
  mov    -0x28(%rbp),%eax
  cmp    %eax,%edx
  jge    L12
  mov    -0x20(%rbp),%rdx
  mov    -0x30(%rbp),%rax
  cmp    %rax,%rdx
  je     L4
L12:
  nop
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L20
  call   <__stack_chk_fail@plt>
L20:
  leave
  ret
```

assistant: ```c
int select(int n, fd_set *a, fd_set *b, fd_set *c, struct timeval *timeout) {
  struct timeval time1;
  struct timeval time2;
  struct timezone zone1;
  gettimeofday(&time1, &zone1);
  time1.tv_sec += timeout->tv_sec;
  time1.tv_usec += timeout->tv_usec;
  if (time1.tv_usec >= 1000000) {
    time1.tv_sec += time1.tv_usec / 1000000;
    time1.tv_usec %= 1000000;
  }
  do {
    gettimeofday(&time2, &zone1);
  } while ((time2.tv_sec < time1.tv_sec) || ((time2.tv_usec < time1.tv_usec) && (time2.tv_sec == time1.tv_sec)));
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<select>:
  endbr64
  push   %rbx
  sub    $0x40,%rsp
  mov    %r8,%rbx
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  lea    0xc(%rsp),%rsi
  lea    0x10(%rsp),%rdi
  call   <gettimeofday@plt>
  mov    (%rbx),%rcx
  add    0x10(%rsp),%rcx
  mov    %rcx,0x10(%rsp)
  mov    0x8(%rbx),%eax
  add    0x18(%rsp),%eax
  mov    %eax,0x18(%rsp)
  cmp    $0xf423f,%eax
  jle    L18
  movslq %eax,%rdx
  imul   $0x431bde83,%rdx,%rdx
  sar    $0x32,%rdx
  mov    %eax,%esi
  sar    $0x1f,%esi
  sub    %esi,%edx
  movslq %edx,%rsi
  add    %rsi,%rcx
  mov    %rcx,0x10(%rsp)
  imul   $0xf4240,%edx,%edx
  sub    %edx,%eax
  mov    %eax,0x18(%rsp)
L18:
  lea    0xc(%rsp),%rbx
L30:
  lea    0x20(%rsp),%rdi
  mov    %rbx,%rsi
  call   <gettimeofday@plt>
  mov    0x20(%rsp),%rdx
  mov    0x10(%rsp),%rax
  cmp    %rax,%rdx
  jl     L30
  mov    0x18(%rsp),%ecx
  cmp    %ecx,0x28(%rsp)
  jge    L23
  cmp    %rax,%rdx
  je     L30
L23:
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L8
  mov    $0x0,%eax
  add    $0x40,%rsp
  pop    %rbx
  ret
L8:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int select(int n, fd_set *a, fd_set *b, fd_set *c, struct timeval *timeout) {
  struct timeval time1;
  struct timeval time2;
  struct timezone zone1;
  gettimeofday(&time1, &zone1);
  time1.tv_sec += timeout->tv_sec;
  time1.tv_usec += timeout->tv_usec;
  if (time1.tv_usec >= 1000000) {
    time1.tv_sec += time1.tv_usec / 1000000;
    time1.tv_usec %= 1000000;
  }
  do {
    gettimeofday(&time2, &zone1);
  } while ((time2.tv_sec < time1.tv_sec) || ((time2.tv_usec < time1.tv_usec) && (time2.tv_sec == time1.tv_sec)));
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<select>:
  endbr64
  push   %rbp
  mov    %r8,%rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  lea    0xc(%rsp),%rbx
  lea    0x10(%rsp),%rdi
  mov    %rbx,%rsi
  call   <gettimeofday@plt>
  mov    0x0(%rbp),%rcx
  mov    0x8(%rbp),%eax
  add    0x10(%rsp),%rcx
  add    0x18(%rsp),%eax
  mov    %rcx,0x10(%rsp)
  mov    %eax,0x18(%rsp)
  cmp    $0xf423f,%eax
  jle    L17
  movslq %eax,%rdx
  mov    %eax,%esi
  imul   $0x431bde83,%rdx,%rdx
  sar    $0x1f,%esi
  sar    $0x32,%rdx
  sub    %esi,%edx
  movslq %edx,%rsi
  imul   $0xf4240,%edx,%edx
  add    %rsi,%rcx
  mov    %rcx,0x10(%rsp)
  sub    %edx,%eax
  mov    %eax,0x18(%rsp)
L17:
  lea    0x20(%rsp),%rbp
L13:
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  call   <gettimeofday@plt>
  mov    0x20(%rsp),%rdx
  mov    0x10(%rsp),%rax
  cmp    %rax,%rdx
  jl     L13
  mov    0x18(%rsp),%ecx
  cmp    %ecx,0x28(%rsp)
  jge    L18
  cmp    %rax,%rdx
  je     L13
L18:
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L3
  add    $0x48,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  ret
L3:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int select(int n, fd_set *a, fd_set *b, fd_set *c, struct timeval *timeout) {
  struct timeval time1;
  struct timeval time2;
  struct timezone zone1;
  gettimeofday(&time1, &zone1);
  time1.tv_sec += timeout->tv_sec;
  time1.tv_usec += timeout->tv_usec;
  if (time1.tv_usec >= 1000000) {
    time1.tv_sec += time1.tv_usec / 1000000;
    time1.tv_usec %= 1000000;
  }
  do {
    gettimeofday(&time2, &zone1);
  } while ((time2.tv_sec < time1.tv_sec) || ((time2.tv_usec < time1.tv_usec) && (time2.tv_sec == time1.tv_sec)));
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<select>:
  endbr64
  push   %rbp
  mov    %r8,%rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  lea    0xc(%rsp),%rbx
  lea    0x10(%rsp),%rdi
  mov    %rbx,%rsi
  call   <gettimeofday@plt>
  mov    0x0(%rbp),%rcx
  mov    0x8(%rbp),%eax
  add    0x10(%rsp),%rcx
  add    0x18(%rsp),%eax
  mov    %rcx,0x10(%rsp)
  mov    %eax,0x18(%rsp)
  cmp    $0xf423f,%eax
  jle    L48
  movslq %eax,%rdx
  mov    %eax,%esi
  imul   $0x431bde83,%rdx,%rdx
  sar    $0x1f,%esi
  sar    $0x32,%rdx
  sub    %esi,%edx
  movslq %edx,%rsi
  imul   $0xf4240,%edx,%edx
  add    %rsi,%rcx
  mov    %rcx,0x10(%rsp)
  sub    %edx,%eax
  mov    %eax,0x18(%rsp)
L48:
  lea    0x20(%rsp),%rbp
L1:
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  call   <gettimeofday@plt>
  mov    0x20(%rsp),%rdx
  mov    0x10(%rsp),%rax
  cmp    %rax,%rdx
  jl     L1
  mov    0x18(%rsp),%ecx
  cmp    %ecx,0x28(%rsp)
  jge    L4
  cmp    %rax,%rdx
  je     L1
L4:
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L37
  add    $0x48,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  ret
L37:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int select(int n, fd_set *a, fd_set *b, fd_set *c, struct timeval *timeout) {
  struct timeval time1;
  struct timeval time2;
  struct timezone zone1;
  gettimeofday(&time1, &zone1);
  time1.tv_sec += timeout->tv_sec;
  time1.tv_usec += timeout->tv_usec;
  if (time1.tv_usec >= 1000000) {
    time1.tv_sec += time1.tv_usec / 1000000;
    time1.tv_usec %= 1000000;
  }
  do {
    gettimeofday(&time2, &zone1);
  } while ((time2.tv_sec < time1.tv_sec) || ((time2.tv_usec < time1.tv_usec) && (time2.tv_sec == time1.tv_sec)));
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<__UADD8>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x14(%rbp)
  mov    %esi,-0x18(%rbp)
  mov    -0x14(%rbp),%eax
  shl    $0x18,%eax
  sar    $0x18,%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%eax
  shl    $0x18,%eax
  sar    $0x18,%eax
  add    %edx,%eax
  and    $0xff,%eax
  mov    %eax,-0x10(%rbp)
  mov    -0x14(%rbp),%eax
  shl    $0x10,%eax
  sar    $0x18,%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%eax
  shl    $0x10,%eax
  sar    $0x18,%eax
  add    %edx,%eax
  and    $0xff,%eax
  mov    %eax,-0xc(%rbp)
  mov    -0x14(%rbp),%eax
  shl    $0x8,%eax
  sar    $0x18,%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%eax
  shl    $0x8,%eax
  sar    $0x18,%eax
  add    %edx,%eax
  and    $0xff,%eax
  mov    %eax,-0x8(%rbp)
  mov    -0x14(%rbp),%eax
  sar    $0x18,%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%eax
  sar    $0x18,%eax
  add    %edx,%eax
  and    $0xff,%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  shl    $0x18,%eax
  mov    %eax,%edx
  mov    -0x8(%rbp),%eax
  shl    $0x10,%eax
  or     %eax,%edx
  mov    -0xc(%rbp),%eax
  shl    $0x8,%eax
  or     %edx,%eax
  or     -0x10(%rbp),%eax
  pop    %rbp
  ret
```

assistant: ```c
__attribute__((always_)) uint32_t __UADD8(uint32_t x, uint32_t y) {
  int32_t r, s, t, u;
  r = (((x << 24) >> 24) + ((y << 24) >> 24)) & 0x000000FF;
  s = (((x << 16) >> 24) + ((y << 16) >> 24)) & 0x000000FF;
  t = (((x << 8) >> 24) + ((y << 8) >> 24)) & 0x000000FF;
  u = (((x) >> 24) + ((y) >> 24)) & 0x000000FF;
  return ((u << 24) | (t << 16) | (s << 8) | (r));
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<__UADD8>:
  endbr64
  push   %rbx
  mov    %edi,%edx
  mov    %esi,%ebx
  lea    (%rdi,%rsi,1),%eax
  movzbl %al,%eax
  mov    %edi,%ecx
  sar    $0x18,%ecx
  sar    $0x18,%esi
  add    %esi,%ecx
  shl    $0x18,%ecx
  or     %ecx,%eax
  mov    %edi,%ecx
  shl    $0x8,%ecx
  sar    $0x18,%ecx
  mov    %ebx,%esi
  shl    $0x8,%esi
  sar    $0x18,%esi
  add    %esi,%ecx
  shl    $0x10,%ecx
  and    $0xff0000,%ecx
  or     %ecx,%eax
  movsbl %dh,%edx
  movsbl %bh,%ebx
  add    %ebx,%edx
  shl    $0x8,%edx
  movzwl %dx,%edx
  or     %edx,%eax
  pop    %rbx
  ret
```

assistant: ```c
__attribute__((always_)) uint32_t __UADD8(uint32_t x, uint32_t y) {
  int32_t r, s, t, u;
  r = (((x << 24) >> 24) + ((y << 24) >> 24)) & 0x000000FF;
  s = (((x << 16) >> 24) + ((y << 16) >> 24)) & 0x000000FF;
  t = (((x << 8) >> 24) + ((y << 8) >> 24)) & 0x000000FF;
  u = (((x) >> 24) + ((y) >> 24)) & 0x000000FF;
  return ((u << 24) | (t << 16) | (s << 8) | (r));
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<__UADD8>:
  endbr64
  mov    %edi,%ecx
  push   %rbx
  lea    (%rsi,%rdi,1),%eax
  mov    %esi,%ebx
  sar    $0x18,%ecx
  sar    $0x18,%esi
  movzbl %al,%eax
  mov    %edi,%edx
  add    %esi,%ecx
  mov    %ebx,%esi
  movsbl %dh,%edx
  movsbl %bh,%ebx
  shl    $0x18,%ecx
  shl    $0x8,%esi
  add    %ebx,%edx
  pop    %rbx
  sar    $0x18,%esi
  or     %ecx,%eax
  mov    %edi,%ecx
  shl    $0x8,%edx
  shl    $0x8,%ecx
  movzwl %dx,%edx
  sar    $0x18,%ecx
  add    %esi,%ecx
  shl    $0x10,%ecx
  and    $0xff0000,%ecx
  or     %ecx,%eax
  or     %edx,%eax
  ret
```

assistant: ```c
__attribute__((always_)) uint32_t __UADD8(uint32_t x, uint32_t y) {
  int32_t r, s, t, u;
  r = (((x << 24) >> 24) + ((y << 24) >> 24)) & 0x000000FF;
  s = (((x << 16) >> 24) + ((y << 16) >> 24)) & 0x000000FF;
  t = (((x << 8) >> 24) + ((y << 8) >> 24)) & 0x000000FF;
  u = (((x) >> 24) + ((y) >> 24)) & 0x000000FF;
  return ((u << 24) | (t << 16) | (s << 8) | (r));
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<__UADD8>:
  endbr64
  mov    %edi,%ecx
  push   %rbx
  lea    (%rsi,%rdi,1),%eax
  mov    %esi,%ebx
  sar    $0x18,%ecx
  sar    $0x18,%esi
  movzbl %al,%eax
  mov    %edi,%edx
  add    %esi,%ecx
  mov    %ebx,%esi
  movsbl %dh,%edx
  movsbl %bh,%ebx
  shl    $0x18,%ecx
  shl    $0x8,%esi
  add    %ebx,%edx
  pop    %rbx
  sar    $0x18,%esi
  or     %ecx,%eax
  mov    %edi,%ecx
  shl    $0x8,%edx
  shl    $0x8,%ecx
  movzwl %dx,%edx
  sar    $0x18,%ecx
  add    %esi,%ecx
  shl    $0x10,%ecx
  and    $0xff0000,%ecx
  or     %ecx,%eax
  or     %edx,%eax
  ret
```

assistant: ```c
__attribute__((always_)) uint32_t __UADD8(uint32_t x, uint32_t y) {
  int32_t r, s, t, u;
  r = (((x << 24) >> 24) + ((y << 24) >> 24)) & 0x000000FF;
  s = (((x << 16) >> 24) + ((y << 16) >> 24)) & 0x000000FF;
  t = (((x << 8) >> 24) + ((y << 8) >> 24)) & 0x000000FF;
  u = (((x) >> 24) + ((y) >> 24)) & 0x000000FF;
  return ((u << 24) | (t << 16) | (s << 8) | (r));
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<memdumpfd>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %edx,-0x28(%rbp)
  cmpl   $0x0,-0x28(%rbp)
  je     L2
  cmpl   $0x30,-0x28(%rbp)
  setg   %al
  movzbl %al,%eax
  mov    %eax,-0x10(%rbp)
  movl   $0x0,-0x14(%rbp)
  mov    -0x30(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  jmp    L47
L57:
  cmpl   $0x0,-0x10(%rbp)
  je     L12
  mov    -0x14(%rbp),%eax
  movzbl %al,%ecx
  mov    -0x14(%rbp),%eax
  movzbl %al,%edx
  mov    -0x24(%rbp),%eax
  lea    D19(%rip),%rsi
  mov    %eax,%edi
  call   <hprintf@plt>
L12:
  mov    -0x28(%rbp),%eax
  mov    $0x10,%edx
  cmp    %edx,%eax
  cmovg  %edx,%eax
  mov    %eax,-0xc(%rbp)
  movl   $0x0,-0x18(%rbp)
  jmp    L56
L40:
  mov    -0x18(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  mov    %eax,%edi
  call   <isprint@plt>
  test   %rax,%rax
  je     L31
  mov    -0x18(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  jmp    L4
L31:
  mov    $0x2e,%eax
L4:
  mov    -0x18(%rbp),%edx
  movslq %edx,%rcx
  mov    -0x8(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rdx),%edx
  movzbl %dl,%edx
  mov    -0x24(%rbp),%edi
  mov    %eax,%ecx
  lea    D0(%rip),%rax
  mov    %rax,%rsi
  call   <hprintf@plt>
  addl   $0x1,-0x18(%rbp)
L56:
  mov    -0x18(%rbp),%eax
  cmp    -0xc(%rbp),%eax
  jl     L40
  mov    -0x24(%rbp),%eax
  mov    %eax,%esi
  mov    $0xa,%edi
  call   <hputc@plt>
  mov    -0xc(%rbp),%eax
  cltq
  add    %rax,-0x8(%rbp)
  subl   $0x10,-0x28(%rbp)
  addl   $0x10,-0x14(%rbp)
L47:
  cmpl   $0x0,-0x28(%rbp)
  jg     L57
  jmp    L77
L2:
  nop
L77:
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: data_tag: D19
type_infered: string
name: disassemble_data
arguments: data_tag: D0
type_infered: string

tool: D19: %04x(%4d):  

tool: D0: %02x %c 

assistant: ```c
void memdumpfd(int fh, void *p, int len) {
  int i, addr, showaddr;
  unsigned char *s;
  if (len == 0)
    return;
  showaddr = (len > 48);
  addr = 0;
  s = (unsigned char *)p;
  for (; len > 0; len -= 16, addr += 16) {
    if (showaddr)
      hprintf(fh, "%04x(%4d):  ", addr, addr);
    int linelen = len > 16 ? 16 : len;
    for (i = 0; i < linelen; ++i)
      hprintf(fh, "%02x %c ", s[i], isprint(s[i]) ? s[i] : '.');
    hputc('\n', fh);
    s += linelen;
  }
}
```