ylfeng/ReF-Decompile-dataset huggingface dataset:
user: Translate the below assembly code into C programming language:

```asm
<subs_num_dump>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x50,%rsp
  mov    %rdi,%rbx
  mov    %ecx,%ebp
  mov    %fs:0x28,%rax
  mov    %rax,0x48(%rsp)
  xor    %eax,%eax
  movzbl (%rdx),%ecx
  shr    $0x7,%cl
  movzbl %cl,%ecx
  lea    -0x1(%rbp),%eax
  lea    0x1(%rdx),%rsi
  mov    %rsp,%r12
  mov    %eax,%edx
  mov    %r12,%rdi
  call   <isup_get_number@plt>
  mov    %r12,%rdx
  lea    D0(%rip),%rsi
  mov    %rbx,%rdi
  call   <ss7_message@plt>
  mov    0x48(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L0
  mov    %ebp,%eax
  add    $0x50,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L0:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: label: D0
type_guessed: string

tool: D0: 			Subsequent signals: %s


assistant: ```c
int((subs_num_dump))(struct ss7 *ss7, int messagetype, unsigned char *parm, int len) {
  int oddeven = (parm[0] >> 7) & 0x1;
  char numbuf[64];
  isup_get_number(numbuf, &parm[1], len - 1, oddeven);
  ss7_message(ss7, "\t\t\tSubsequent signals: %s\n", numbuf);
  return len;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<subs_num_dump>:
  endbr64
  push   %r13
  lea    0x1(%rdx),%rsi
  push   %r12
  mov    %ecx,%r12d
  push   %rbp
  lea    -0x1(%r12),%r8d
  mov    %rdi,%rbp
  sub    $0x50,%rsp
  movzbl (%rdx),%ecx
  mov    %r8d,%edx
  mov    %fs:0x28,%rax
  mov    %rax,0x48(%rsp)
  xor    %eax,%eax
  mov    %rsp,%r13
  shr    $0x7,%cl
  mov    %r13,%rdi
  movzbl %cl,%ecx
  call   <isup_get_number@plt>
  mov    %r13,%rdx
  lea    D8(%rip),%rsi
  mov    %rbp,%rdi
  call   <ss7_message@plt>
  mov    0x48(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L6
  add    $0x50,%rsp
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L6:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_tag: D8
data_type: string

tool: D8: 			Subsequent signals: %s


assistant: ```c
int((subs_num_dump))(struct ss7 *ss7, int messagetype, unsigned char *parm, int len) {
  int oddeven = (parm[0] >> 7) & 0x1;
  char numbuf[64];
  isup_get_number(numbuf, &parm[1], len - 1, oddeven);
  ss7_message(ss7, "\t\t\tSubsequent signals: %s\n", numbuf);
  return len;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<subs_num_dump>:
  endbr64
  push   %r13
  lea    0x1(%rdx),%rsi
  push   %r12
  mov    %ecx,%r12d
  push   %rbp
  lea    -0x1(%r12),%r8d
  mov    %rdi,%rbp
  sub    $0x50,%rsp
  movzbl (%rdx),%ecx
  mov    %r8d,%edx
  mov    %fs:0x28,%rax
  mov    %rax,0x48(%rsp)
  xor    %eax,%eax
  mov    %rsp,%r13
  shr    $0x7,%cl
  mov    %r13,%rdi
  movzbl %cl,%ecx
  call   <isup_get_number@plt>
  mov    %r13,%rdx
  lea    D4(%rip),%rsi
  mov    %rbp,%rdi
  call   <ss7_message@plt>
  mov    0x48(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L0
  add    $0x50,%rsp
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L0:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_label: D4
data_type: string

tool: D4: 			Subsequent signals: %s


assistant: ```c
int((subs_num_dump))(struct ss7 *ss7, int messagetype, unsigned char *parm, int len) {
  int oddeven = (parm[0] >> 7) & 0x1;
  char numbuf[64];
  isup_get_number(numbuf, &parm[1], len - 1, oddeven);
  ss7_message(ss7, "\t\t\tSubsequent signals: %s\n", numbuf);
  return len;
}
```
user: 下面的汇编指令对应的C源代码是什么:

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

assistant: ```c
void uninitvar_gmtime(void) {
  time_t *tp;
  (void)gmtime(tp);
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<uninitvar_gmtime>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x0,%edi
  call   <gmtime@plt>
  add    $0x8,%rsp
  ret
```

assistant: ```c
void uninitvar_gmtime(void) {
  time_t *tp;
  (void)gmtime(tp);
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<uninitvar_gmtime>:
  endbr64
  xor    %edi,%edi
  jmp    1050 <gmtime@plt>
```

assistant: ```c
void uninitvar_gmtime(void) {
  time_t *tp;
  (void)gmtime(tp);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<uninitvar_gmtime>:
  endbr64
  xor    %edi,%edi
  jmp    1050 <gmtime@plt>
```

assistant: ```c
void uninitvar_gmtime(void) {
  time_t *tp;
  (void)gmtime(tp);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<min_int>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x4(%rbp)
  mov    %esi,-0x8(%rbp)
  mov    -0x4(%rbp),%eax
  cmp    -0x8(%rbp),%eax
  jge    L1
  mov    -0x4(%rbp),%eax
  jmp    L2
L1:
  mov    -0x8(%rbp),%eax
L2:
  pop    %rbp
  ret
```

assistant: ```c
int min_int(int a, int b) {
  if (a < b)
    return a;
  else
    return b;
}
```
user: What is the c source code of the assembly code below?

```asm
<min_int>:
  endbr64
  cmp    %esi,%edi
  mov    %esi,%eax
  cmovle %edi,%eax
  ret
```

assistant: ```c
int min_int(int a, int b) {
  if (a < b)
    return a;
  else
    return b;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<min_int>:
  endbr64
  cmp    %esi,%edi
  mov    %esi,%eax
  cmovle %edi,%eax
  ret
```

assistant: ```c
int min_int(int a, int b) {
  if (a < b)
    return a;
  else
    return b;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<min_int>:
  endbr64
  cmp    %esi,%edi
  mov    %esi,%eax
  cmovle %edi,%eax
  ret
```

assistant: ```c
int min_int(int a, int b) {
  if (a < b)
    return a;
  else
    return b;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<__libc_sendmsg>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %edx,-0x28(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x24(%rbp),%eax
  cltq
  mov    %rax,-0x20(%rbp)
  mov    -0x30(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x28(%rbp),%eax
  cltq
  mov    %rax,-0x10(%rbp)
  lea    -0x20(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x10,%edi
  call   <__socketcall@plt>
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L7
  call   <__stack_chk_fail@plt>
L7:
  leave
  ret
```

assistant: ```c
ssize_t __libc_sendmsg(int sockfd, const struct msghdr *msg, int flags) {
  unsigned long args[3];
  args[0] = sockfd;
  args[1] = (unsigned long)msg;
  args[2] = flags;
  return (__socketcall(16, args));
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<__libc_sendmsg>:
  endbr64
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  movslq %edi,%rdi
  mov    %rdi,(%rsp)
  mov    %rsi,0x8(%rsp)
  movslq %edx,%rdx
  mov    %rdx,0x10(%rsp)
  mov    %rsp,%rsi
  mov    $0x10,%edi
  call   <__socketcall@plt>
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L8
  add    $0x28,%rsp
  ret
L8:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
ssize_t __libc_sendmsg(int sockfd, const struct msghdr *msg, int flags) {
  unsigned long args[3];
  args[0] = sockfd;
  args[1] = (unsigned long)msg;
  args[2] = flags;
  return (__socketcall(16, args));
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<__libc_sendmsg>:
  endbr64
  sub    $0x28,%rsp
  movslq %edi,%rdi
  movslq %edx,%rdx
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  mov    %rdi,(%rsp)
  mov    $0x10,%edi
  mov    %rsi,0x8(%rsp)
  mov    %rsp,%rsi
  mov    %rdx,0x10(%rsp)
  call   <__socketcall@plt>
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L3
  add    $0x28,%rsp
  ret
L3:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
ssize_t __libc_sendmsg(int sockfd, const struct msghdr *msg, int flags) {
  unsigned long args[3];
  args[0] = sockfd;
  args[1] = (unsigned long)msg;
  args[2] = flags;
  return (__socketcall(16, args));
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<__libc_sendmsg>:
  endbr64
  sub    $0x28,%rsp
  movq   %rsi,%xmm1
  movslq %edx,%rdx
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  movslq %edi,%rax
  mov    %rsp,%rsi
  mov    $0x10,%edi
  movq   %rax,%xmm0
  mov    %rdx,0x10(%rsp)
  punpcklqdq %xmm1,%xmm0
  movaps %xmm0,(%rsp)
  call   <__socketcall@plt>
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L3
  add    $0x28,%rsp
  ret
L3:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
ssize_t __libc_sendmsg(int sockfd, const struct msghdr *msg, int flags) {
  unsigned long args[3];
  args[0] = sockfd;
  args[1] = (unsigned long)msg;
  args[2] = flags;
  return (__socketcall(16, args));
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<pixel_add>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x8(%rbp)
  mov    %esi,%eax
  mov    %al,-0xc(%rbp)
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%edx
  movzbl -0xc(%rbp),%eax
  add    %edx,%eax
  cmp    $0xff,%eax
  jle    L2
  mov    -0x8(%rbp),%rax
  movb   $0xff,(%rax)
  jmp    L15
L2:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%edx
  movzbl -0xc(%rbp),%eax
  add    %eax,%edx
  mov    -0x8(%rbp),%rax
  mov    %dl,(%rax)
L15:
  nop
  pop    %rbp
  ret
```

assistant: ```c
void pixel_add(unsigned char *pixel, unsigned char value) {
  if (*pixel + value > 255) {
    *pixel = 255;
  } else {
    *pixel += value;
  }
}
```
user: Translate the below assembly code into C programming language:

```asm
<pixel_add>:
  endbr64
  movzbl (%rdi),%eax
  movzbl %al,%edx
  movzbl %sil,%ecx
  add    %ecx,%edx
  add    %esi,%eax
  cmp    $0x100,%edx
  mov    $0xffffffff,%edx
  cmovge %edx,%eax
  mov    %al,(%rdi)
  ret
```

assistant: ```c
void pixel_add(unsigned char *pixel, unsigned char value) {
  if (*pixel + value > 255) {
    *pixel = 255;
  } else {
    *pixel += value;
  }
}
```
user: What is the c source code of the assembly code below?

```asm
<pixel_add>:
  endbr64
  movzbl (%rdi),%edx
  movzbl %sil,%ecx
  mov    %edx,%eax
  add    %ecx,%edx
  add    %esi,%eax
  cmp    $0x100,%edx
  mov    $0xffffffff,%edx
  cmovge %edx,%eax
  mov    %al,(%rdi)
  ret
```

assistant: ```c
void pixel_add(unsigned char *pixel, unsigned char value) {
  if (*pixel + value > 255) {
    *pixel = 255;
  } else {
    *pixel += value;
  }
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<pixel_add>:
  endbr64
  movzbl (%rdi),%edx
  movzbl %sil,%ecx
  mov    %edx,%eax
  add    %ecx,%edx
  add    %esi,%eax
  cmp    $0x100,%edx
  mov    $0xffffffff,%edx
  cmovge %edx,%eax
  mov    %al,(%rdi)
  ret
```

assistant: ```c
void pixel_add(unsigned char *pixel, unsigned char value) {
  if (*pixel + value > 255) {
    *pixel = 255;
  } else {
    *pixel += value;
  }
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<command_show>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x530,%rsp
  mov    %rdi,-0x528(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x510(%rbp),%rcx
  mov    -0x528(%rbp),%rax
  mov    $0x5,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <cut_string@plt>
  lea    -0x510(%rbp),%rax
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <do_open@plt>
  mov    %eax,-0x514(%rbp)
  cmpl   $0xffffffff,-0x514(%rbp)
  je     L20
  lea    -0x410(%rbp),%rcx
  mov    -0x514(%rbp),%eax
  mov    $0x2,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <do_read@plt>
  lea    -0x410(%rbp),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  jmp    L16
L20:
  lea    D3(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  nop
L16:
  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: data_label: D3
data_type: string

tool: D3: file not found.

assistant: ```c
void command_show(char *inputed_command) {
  char fname[256], str[1024];
  int fd;
  cut_string(inputed_command, fname, 5);
  if ((fd = do_open(fname, 0x01)) != -1) {
    do_read(fd, str, 2);
    puts(str);
  } else {
    puts("file not found.");
  }
  return;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<command_show>:
  endbr64
  push   %rbx
  sub    $0x510,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x508(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rbx
  mov    $0x5,%edx
  mov    %rbx,%rsi
  call   <cut_string@plt>
  mov    $0x1,%esi
  mov    %rbx,%rdi
  call   <do_open@plt>
  cmp    $0xffffffff,%eax
  je     L4
  lea    0x100(%rsp),%rbx
  mov    $0x2,%edx
  mov    %rbx,%rsi
  mov    %eax,%edi
  call   <do_read@plt>
  mov    %rbx,%rdi
  call   <puts@plt>
L11:
  mov    0x508(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L10
  add    $0x510,%rsp
  pop    %rbx
  ret
L4:
  lea    D9(%rip),%rdi
  call   <puts@plt>
  jmp    L11
L10:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: label: D9
type: string

tool: D9: file not found.

assistant: ```c
void command_show(char *inputed_command) {
  char fname[256], str[1024];
  int fd;
  cut_string(inputed_command, fname, 5);
  if ((fd = do_open(fname, 0x01)) != -1) {
    do_read(fd, str, 2);
    puts(str);
  } else {
    puts("file not found.");
  }
  return;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<command_show>:
  endbr64
  push   %rbp
  mov    $0x5,%edx
  sub    $0x510,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x508(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rbp
  mov    %rbp,%rsi
  call   <cut_string@plt>
  mov    $0x1,%esi
  mov    %rbp,%rdi
  call   <do_open@plt>
  cmp    $0xffffffff,%eax
  je     L22
  lea    0x100(%rsp),%rbp
  mov    %eax,%edi
  mov    $0x2,%edx
  mov    %rbp,%rsi
  call   <do_read@plt>
  mov    %rbp,%rdi
  call   <puts@plt>
L12:
  mov    0x508(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L8
  add    $0x510,%rsp
  pop    %rbp
  ret
  nopl   0x0(%rax)
L22:
  lea    D4(%rip),%rdi
  call   <puts@plt>
  jmp    L12
L8:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_tag: D4
type_infered: string

tool: D4: file not found.

assistant: ```c
void command_show(char *inputed_command) {
  char fname[256], str[1024];
  int fd;
  cut_string(inputed_command, fname, 5);
  if ((fd = do_open(fname, 0x01)) != -1) {
    do_read(fd, str, 2);
    puts(str);
  } else {
    puts("file not found.");
  }
  return;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<command_show>:
  endbr64
  push   %rbp
  mov    $0x5,%edx
  sub    $0x510,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x508(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rbp
  mov    %rbp,%rsi
  call   <cut_string@plt>
  mov    $0x1,%esi
  mov    %rbp,%rdi
  call   <do_open@plt>
  cmp    $0xffffffff,%eax
  je     L3
  lea    0x100(%rsp),%rbp
  mov    %eax,%edi
  mov    $0x2,%edx
  mov    %rbp,%rsi
  call   <do_read@plt>
  mov    %rbp,%rdi
  call   <puts@plt>
L5:
  mov    0x508(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L24
  add    $0x510,%rsp
  pop    %rbp
  ret
  nopl   0x0(%rax)
L3:
  lea    D9(%rip),%rdi
  call   <puts@plt>
  jmp    L5
L24:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D9
data_type: string

tool: D9: file not found.

assistant: ```c
void command_show(char *inputed_command) {
  char fname[256], str[1024];
  int fd;
  cut_string(inputed_command, fname, 5);
  if ((fd = do_open(fname, 0x01)) != -1) {
    do_read(fd, str, 2);
    puts(str);
  } else {
    puts("file not found.");
  }
  return;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<imax>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x4(%rbp)
  mov    %esi,-0x8(%rbp)
  mov    -0x4(%rbp),%eax
  cmp    -0x8(%rbp),%eax
  jle    L5
  mov    -0x4(%rbp),%eax
  jmp    L6
L5:
  mov    -0x8(%rbp),%eax
L6:
  pop    %rbp
  ret
```

assistant: ```c
int imax(int l, int r) {
  if (l > r)
    return (l);
  return (r);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<imax>:
  endbr64
  cmp    %esi,%edi
  mov    %esi,%eax
  cmovge %edi,%eax
  ret
```

assistant: ```c
int imax(int l, int r) {
  if (l > r)
    return (l);
  return (r);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<imax>:
  endbr64
  cmp    %esi,%edi
  mov    %esi,%eax
  cmovge %edi,%eax
  ret
```

assistant: ```c
int imax(int l, int r) {
  if (l > r)
    return (l);
  return (r);
}
```
user: Translate the below assembly code into C programming language:

```asm
<compare>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,-0x8(%rbp)
  mov    -0x20(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x8(%rbp),%eax
  cmp    -0x4(%rbp),%eax
  setg   %al
  movzbl %al,%edx
  mov    -0x8(%rbp),%eax
  cmp    -0x4(%rbp),%eax
  setl   %al
  movzbl %al,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  pop    %rbp
  ret
```

assistant: ```c
int compare(const void *a, const void *b) {
  int int_a = *((int *)a);
  int int_b = *((int *)b);
  return (int_a > int_b) - (int_a < int_b);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<compare>:
  endbr64
  mov    (%rsi),%eax
  cmp    %eax,(%rdi)
  setg   %al
  movzbl %al,%eax
  setl   %dl
  movzbl %dl,%edx
  sub    %edx,%eax
  ret
```

assistant: ```c
int compare(const void *a, const void *b) {
  int int_a = *((int *)a);
  int int_b = *((int *)b);
  return (int_a > int_b) - (int_a < int_b);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<compare>:
  endbr64
  mov    (%rsi),%eax
  cmp    %eax,(%rdi)
  setg   %al
  setl   %dl
  movzbl %dl,%edx
  movzbl %al,%eax
  sub    %edx,%eax
  ret
```

assistant: ```c
int compare(const void *a, const void *b) {
  int int_a = *((int *)a);
  int int_b = *((int *)b);
  return (int_a > int_b) - (int_a < int_b);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<compare>:
  endbr64
  mov    (%rsi),%eax
  cmp    %eax,(%rdi)
  setg   %al
  setl   %dl
  movzbl %dl,%edx
  movzbl %al,%eax
  sub    %edx,%eax
  ret
```

assistant: ```c
int compare(const void *a, const void *b) {
  int int_a = *((int *)a);
  int int_b = *((int *)b);
  return (int_a > int_b) - (int_a < int_b);
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<ui_cond_timedwait>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %edx,-0x44(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x24(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <gettimeofday@plt>
  mov    $0x0,%edi
  call   <time@plt>
  mov    %rax,%rcx
  mov    -0x44(%rbp),%eax
  movslq %eax,%rdx
  imul   $0x10624dd3,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x6,%edx
  sar    $0x1f,%eax
  mov    %eax,%esi
  mov    %edx,%eax
  sub    %esi,%eax
  cltq
  add    %rcx,%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x24(%rbp),%eax
  imul   $0x3e8,%eax,%ecx
  mov    -0x44(%rbp),%eax
  movslq %eax,%rdx
  imul   $0x10624dd3,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x6,%edx
  mov    %eax,%esi
  sar    $0x1f,%esi
  sub    %esi,%edx
  imul   $0x3e8,%edx,%esi
  sub    %esi,%eax
  mov    %eax,%edx
  imul   $0xf4240,%edx,%eax
  add    %ecx,%eax
  mov    %eax,-0x20(%rbp)
  mov    -0x18(%rbp),%rcx
  mov    -0x20(%rbp),%eax
  movslq %eax,%rdx
  imul   $0x44b82fa1,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x1c,%edx
  sar    $0x1f,%eax
  mov    %eax,%esi
  mov    %edx,%eax
  sub    %esi,%eax
  cltq
  add    %rcx,%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x20(%rbp),%edx
  movslq %edx,%rax
  imul   $0x44b82fa1,%rax,%rax
  shr    $0x20,%rax
  sar    $0x1c,%eax
  mov    %edx,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%eax
  imul   $0x3b9aca00,%eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  mov    %eax,-0x20(%rbp)
  lea    -0x20(%rbp),%rdx
  mov    -0x40(%rbp),%rcx
  mov    -0x38(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <pthread_cond_timedwait@plt>
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L1
  call   <__stack_chk_fail@plt>
L1:
  leave
  ret
```

assistant: ```c
int ui_cond_timedwait(pthread_cond_t *cnd, pthread_mutex_t *mtx, int timeInMs) {
  struct timeval tv;
  struct timespec ts;
  gettimeofday(&tv, NULL);
  ts.tv_sec = time(NULL) + timeInMs / 1000;
  ts.tv_nsec = tv.tv_usec * 1000 + 1000 * 1000 * (timeInMs % 1000);
  ts.tv_sec += ts.tv_nsec / (1000 * 1000 * 1000);
  ts.tv_nsec %= (1000 * 1000 * 1000);
  return pthread_cond_timedwait(cnd, mtx, &ts);
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<ui_cond_timedwait>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x30,%rsp
  mov    %rdi,%rbx
  mov    %rsi,%rbp
  mov    %edx,%r12d
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  lea    0xc(%rsp),%rdi
  mov    $0x0,%esi
  call   <gettimeofday@plt>
  mov    $0x0,%edi
  call   <time@plt>
  mov    %rax,%rdx
  imul   $0x3e8,0xc(%rsp),%ecx
  movslq %r12d,%rax
  imul   $0x10624dd3,%rax,%rax
  sar    $0x26,%rax
  mov    %r12d,%esi
  sar    $0x1f,%esi
  sub    %esi,%eax
  imul   $0x3e8,%eax,%esi
  sub    %esi,%r12d
  imul   $0xf4240,%r12d,%r12d
  add    %r12d,%ecx
  cltq
  add    %rdx,%rax
  movslq %ecx,%rdx
  imul   $0x44b82fa1,%rdx,%rdx
  sar    $0x3c,%rdx
  mov    %ecx,%esi
  sar    $0x1f,%esi
  sub    %esi,%edx
  movslq %edx,%rsi
  add    %rsi,%rax
  mov    %rax,0x18(%rsp)
  imul   $0x3b9aca00,%edx,%edx
  sub    %edx,%ecx
  mov    %ecx,0x10(%rsp)
  lea    0x10(%rsp),%rdx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <pthread_cond_timedwait@plt>
  mov    0x28(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L1
  add    $0x30,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L1:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int ui_cond_timedwait(pthread_cond_t *cnd, pthread_mutex_t *mtx, int timeInMs) {
  struct timeval tv;
  struct timespec ts;
  gettimeofday(&tv, NULL);
  ts.tv_sec = time(NULL) + timeInMs / 1000;
  ts.tv_nsec = tv.tv_usec * 1000 + 1000 * 1000 * (timeInMs % 1000);
  ts.tv_sec += ts.tv_nsec / (1000 * 1000 * 1000);
  ts.tv_nsec %= (1000 * 1000 * 1000);
  return pthread_cond_timedwait(cnd, mtx, &ts);
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<ui_cond_timedwait>:
  endbr64
  push   %r12
  mov    %rsi,%r12
  xor    %esi,%esi
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %edx,%ebx
  sub    $0x30,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  lea    0xc(%rsp),%rdi
  call   <gettimeofday@plt>
  xor    %edi,%edi
  call   <time@plt>
  mov    %ebx,%edx
  imul   $0x3e8,0xc(%rsp),%ecx
  mov    %rbp,%rdi
  mov    %rax,%r8
  movslq %ebx,%rax
  sar    $0x1f,%edx
  imul   $0x10624dd3,%rax,%rax
  sar    $0x26,%rax
  sub    %edx,%eax
  imul   $0x3e8,%eax,%edx
  cltq
  add    %r8,%rax
  sub    %edx,%ebx
  imul   $0xf4240,%ebx,%ebx
  add    %ebx,%ecx
  movslq %ecx,%rdx
  mov    %ecx,%esi
  imul   $0x44b82fa1,%rdx,%rdx
  sar    $0x1f,%esi
  sar    $0x3c,%rdx
  sub    %esi,%edx
  movslq %edx,%rsi
  imul   $0x3b9aca00,%edx,%edx
  add    %rsi,%rax
  mov    %r12,%rsi
  mov    %rax,0x18(%rsp)
  sub    %edx,%ecx
  lea    0x10(%rsp),%rdx
  mov    %ecx,0x10(%rsp)
  call   <pthread_cond_timedwait@plt>
  mov    0x28(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L9
  add    $0x30,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L9:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int ui_cond_timedwait(pthread_cond_t *cnd, pthread_mutex_t *mtx, int timeInMs) {
  struct timeval tv;
  struct timespec ts;
  gettimeofday(&tv, NULL);
  ts.tv_sec = time(NULL) + timeInMs / 1000;
  ts.tv_nsec = tv.tv_usec * 1000 + 1000 * 1000 * (timeInMs % 1000);
  ts.tv_sec += ts.tv_nsec / (1000 * 1000 * 1000);
  ts.tv_nsec %= (1000 * 1000 * 1000);
  return pthread_cond_timedwait(cnd, mtx, &ts);
}
```