ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请从给定的汇编指令推导出C源代码:

```asm
<main>:
  endbr64
  push   %r12
  xor    %edi,%edi
  push   %rbp
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  lea    0xc(%rsp),%rbp
  lea    0x10(%rsp),%r12
  call   <time@plt>
  mov    %rbp,%rdi
  mov    %eax,0xc(%rsp)
  call   <ctime@plt>
  mov    %rax,%rdi
  call   <puts@plt>
  mov    %rbp,%rdi
  call   <localtime@plt>
  lea    D3(%rip),%rdx
  mov    $0x15,%esi
  mov    %r12,%rdi
  mov    %rax,%rcx
  call   <strftime@plt>
  mov    %r12,%rdi
  call   <puts@plt>
  mov    %rbp,%rdi
  call   <localtime@plt>
  mov    $0x61,%edx
  mov    (%rax),%r8d
  cmp    $0xb,%r8d
  jle    L17
  sub    $0xc,%r8d
  mov    $0x70,%edx
L17:
  mov    0xc(%rax),%esi
  test   %r8d,%r8d
  mov    $0xc,%ecx
  mov    0x8(%rax),%r10d
  cmove  %ecx,%r8d
  sub    $0x8,%rsp
  mov    0x10(%rax),%r9d
  lea    D12(%rip),%rdi
  lea    0x76c(%rsi),%ecx
  mov    0x4(%rax),%esi
  push   %rdx
  mov    %r10d,%edx
  add    $0x1,%esi
  call   <printf@plt>
  pop    %rax
  pop    %rdx
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L15
  add    $0x38,%rsp
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  ret
L15:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: tag: D3
datatype: string
name: disassemble_data
arguments: tag: D12
datatype: string

tool: D3: %m-%d-%Y  %I:%M%p


tool: D12: %.2d-%.2d-%d  %2d:%.2d%c


assistant: ```c
int main(void) {
  time_t current = time(NULL);
  struct tm *ptr;
  char date_time[21];
  int hour;
  char am_or_pm;
  puts(ctime(&current));
  strftime(date_time, sizeof(date_time), "%m-%d-%Y  %I:%M%p\n", localtime(&current));
  puts(date_time);
  ptr = localtime(&current);
  hour = ptr->tm_hour;
  if (hour <= 11)
    am_or_pm = 'a';
  else {
    hour -= 12;
    am_or_pm = 'p';
  }
  if (hour == 0)
    hour = 12;
  printf("%.2d-%.2d-%d  %2d:%.2d%c\n", ptr->tm_mon + 1, ptr->tm_mday, ptr->tm_year + 1900, hour, ptr->tm_min, am_or_pm);
  return 0;
}
```
user: What is the c source code of the assembly code below?

```asm
<cstring_cmp>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x20(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x10(%rbp),%rax
  mov    (%rax),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  leave
  ret
```

assistant: ```c
int cstring_cmp(const void *a, const void *b) {
  const char **ia = (const char **)a;
  const char **ib = (const char **)b;
  return strcmp(*ia, *ib);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<cstring_cmp>:
  endbr64
  mov    (%rsi),%rsi
  mov    (%rdi),%rdi
  jmp    1050 <strcmp@plt>
```

assistant: ```c
int cstring_cmp(const void *a, const void *b) {
  const char **ia = (const char **)a;
  const char **ib = (const char **)b;
  return strcmp(*ia, *ib);
}
```
user: Translate the below assembly code into C programming language:

```asm
<cstring_cmp>:
  endbr64
  mov    (%rsi),%rsi
  mov    (%rdi),%rdi
  jmp    1050 <strcmp@plt>
```

assistant: ```c
int cstring_cmp(const void *a, const void *b) {
  const char **ia = (const char **)a;
  const char **ib = (const char **)b;
  return strcmp(*ia, *ib);
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<kernel_has_rtsig>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0xc(%rbp),%rax
  mov    %rax,%rdi
  call   <uname@plt>
  test   %rax,%rax
  jne    L1
  mov    -0xc(%rbp),%eax
  lea    D0(%rip),%rdx
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <__strverscmp@plt>
  test   %rax,%rax
  js     L1
  mov    $0x1,%eax
  jmp    L36
L1:
  mov    $0x0,%eax
L36:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L15
  call   <__stack_chk_fail@plt>
L15:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: data_tag: D0
data_type: string

tool: D0: 2.1.70

assistant: ```c
int kernel_has_rtsig(void) {
  struct utsname name;
  return uname(&name) == 0 && __strverscmp(name.release, "2.1.70") >= 0;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<kernel_has_rtsig>:
  endbr64
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    0x4(%rsp),%rdi
  call   <uname@plt>
  mov    %rax,%rdx
  mov    $0x0,%eax
  test   %rdx,%rdx
  je     L18
L8:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L6
  add    $0x18,%rsp
  ret
L18:
  lea    D0(%rip),%rsi
  mov    0x4(%rsp),%edi
  call   <__strverscmp@plt>
  not    %rax
  shr    $0x3f,%rax
  jmp    L8
L6:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: label: D0
datatype: string

tool: D0: 2.1.70

assistant: ```c
int kernel_has_rtsig(void) {
  struct utsname name;
  return uname(&name) == 0 && __strverscmp(name.release, "2.1.70") >= 0;
}
```
user: Translate the below assembly code into C programming language:

```asm
<kernel_has_rtsig>:
  endbr64
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    0x4(%rsp),%rdi
  call   <uname@plt>
  mov    %rax,%r8
  xor    %eax,%eax
  test   %r8,%r8
  je     L11
L22:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L20
  add    $0x18,%rsp
  ret
  nopl   0x0(%rax)
L11:
  mov    0x4(%rsp),%edi
  lea    D3(%rip),%rsi
  call   <__strverscmp@plt>
  not    %rax
  shr    $0x3f,%rax
  jmp    L22
L20:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_label: D3
type_infered: string

tool: D3: 2.1.70

assistant: ```c
int kernel_has_rtsig(void) {
  struct utsname name;
  return uname(&name) == 0 && __strverscmp(name.release, "2.1.70") >= 0;
}
```
user: Translate the below assembly code into C programming language:

```asm
<kernel_has_rtsig>:
  endbr64
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    0x4(%rsp),%rdi
  call   <uname@plt>
  mov    %rax,%r8
  xor    %eax,%eax
  test   %r8,%r8
  je     L0
L12:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L17
  add    $0x18,%rsp
  ret
  nopl   0x0(%rax)
L0:
  mov    0x4(%rsp),%edi
  lea    D8(%rip),%rsi
  call   <__strverscmp@plt>
  not    %rax
  shr    $0x3f,%rax
  jmp    L12
L17:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: tag: D8
datatype: string

tool: D8: 2.1.70

assistant: ```c
int kernel_has_rtsig(void) {
  struct utsname name;
  return uname(&name) == 0 && __strverscmp(name.release, "2.1.70") >= 0;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<matchbracketclass>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  movl   $0x1,-0x4(%rbp)
  mov    -0x20(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x5e,%al
  jne    L20
  movl   $0x0,-0x4(%rbp)
  addq   $0x1,-0x20(%rbp)
  jmp    L20
L126:
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x25,%al
  jne    L113
  addq   $0x1,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%edx
  mov    -0x14(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <match_class@plt>
  test   %rax,%rax
  je     L20
  mov    -0x4(%rbp),%eax
  jmp    L96
L113:
  mov    -0x20(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x2d,%al
  jne    L26
  mov    -0x20(%rbp),%rax
  add    $0x2,%rax
  cmp    %rax,-0x28(%rbp)
  jbe    L26
  addq   $0x2,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
  sub    $0x2,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  cmp    %eax,-0x14(%rbp)
  jl     L20
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  cmp    %eax,-0x14(%rbp)
  jg     L20
  mov    -0x4(%rbp),%eax
  jmp    L96
L26:
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  cmp    %eax,-0x14(%rbp)
  jne    L20
  mov    -0x4(%rbp),%eax
  jmp    L96
L20:
  addq   $0x1,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
  cmp    -0x28(%rbp),%rax
  jb     L126
  cmpl   $0x0,-0x4(%rbp)
  sete   %al
  movzbl %al,%eax
L96:
  leave
  ret
```

assistant: ```c
int matchbracketclass(int c, const char *p, const char *ec) {
  int sig = 1;
  if (*(p + 1) == '^') {
    sig = 0;
    p++;
  }
  while (++p < ec) {
    if (*p == '%') {
      p++;
      if (match_class(c, ((unsigned char)(*p))))
        return sig;
    } else if ((*(p + 1) == '-') && (p + 2 < ec)) {
      p += 2;
      if (((unsigned char)(*(p - 2))) <= c && c <= ((unsigned char)(*p)))
        return sig;
    } else if (((unsigned char)(*p)) == c)
      return sig;
  }
  return !sig;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<matchbracketclass>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %edi,%ebp
  mov    %rdx,%rbx
  mov    $0x1,%r12d
  cmpb   $0x5e,0x1(%rsi)
  je     L23
L120:
  lea    0x1(%rsi),%rdx
  cmp    %rdx,%rbx
  ja     L49
L6:
  xor    $0x1,%r12d
L62:
  mov    %r12d,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L23:
  add    $0x1,%rsi
  mov    $0x0,%r12d
  jmp    L120
L63:
  lea    0x2(%rsi),%r13
  movzbl 0x2(%rsi),%esi
  mov    %ebp,%edi
  call   <match_class@plt>
  test   %rax,%rax
  jne    L62
  mov    %r13,%rsi
  jmp    L131
L31:
  movzbl %al,%eax
  cmp    %ebp,%eax
  je     L62
  mov    %rdx,%rsi
L131:
  lea    0x1(%rsi),%rdx
  cmp    %rbx,%rdx
  jae    L6
L49:
  movzbl 0x1(%rsi),%eax
  cmp    $0x25,%al
  je     L63
  cmpb   $0x2d,0x2(%rsi)
  jne    L31
  lea    0x3(%rsi),%rcx
  cmp    %rbx,%rcx
  jae    L31
  movzbl %al,%eax
  cmp    %ebp,%eax
  jg     L133
  movzbl 0x3(%rsi),%eax
  cmp    %ebp,%eax
  jge    L62
  mov    %rcx,%rsi
  jmp    L131
L133:
  mov    %rcx,%rsi
  jmp    L131
```

assistant: ```c
int matchbracketclass(int c, const char *p, const char *ec) {
  int sig = 1;
  if (*(p + 1) == '^') {
    sig = 0;
    p++;
  }
  while (++p < ec) {
    if (*p == '%') {
      p++;
      if (match_class(c, ((unsigned char)(*p))))
        return sig;
    } else if ((*(p + 1) == '-') && (p + 2 < ec)) {
      p += 2;
      if (((unsigned char)(*(p - 2))) <= c && c <= ((unsigned char)(*p)))
        return sig;
    } else if (((unsigned char)(*p)) == c)
      return sig;
  }
  return !sig;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<matchbracketclass>:
  endbr64
  push   %r13
  mov    %edi,%r13d
  push   %r12
  mov    $0x1,%r12d
  push   %rbp
  mov    %rdx,%rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x8,%rsp
  cmpb   $0x5e,0x1(%rsi)
  jne    L31
  add    $0x1,%rbx
  xor    %r12d,%r12d
L31:
  lea    0x1(%rbx),%rcx
  cmp    %rcx,%rbp
  ja     L27
  jmp    L40
  nopl   (%rax)
L105:
  cmp    %eax,%r13d
  je     L16
  mov    %rcx,%rbx
L23:
  lea    0x1(%rbx),%rcx
  cmp    %rbp,%rcx
  jae    L40
L27:
  movzbl 0x1(%rbx),%eax
  movzbl 0x2(%rbx),%esi
  cmp    $0x25,%al
  je     L99
  cmp    $0x2d,%sil
  jne    L105
  lea    0x3(%rbx),%rdx
  cmp    %rbp,%rdx
  jae    L105
  cmp    %eax,%r13d
  jl     L52
  movzbl 0x3(%rbx),%eax
  cmp    %r13d,%eax
  jge    L16
L52:
  mov    %rdx,%rbx
  lea    0x1(%rbx),%rcx
  cmp    %rbp,%rcx
  jb     L27
  xchg   %ax,%ax
L40:
  xor    $0x1,%r12d
L16:
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopw   0x0(%rax,%rax,1)
L99:
  mov    %r13d,%edi
  add    $0x2,%rbx
  call   <match_class@plt>
  test   %rax,%rax
  je     L23
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
int matchbracketclass(int c, const char *p, const char *ec) {
  int sig = 1;
  if (*(p + 1) == '^') {
    sig = 0;
    p++;
  }
  while (++p < ec) {
    if (*p == '%') {
      p++;
      if (match_class(c, ((unsigned char)(*p))))
        return sig;
    } else if ((*(p + 1) == '-') && (p + 2 < ec)) {
      p += 2;
      if (((unsigned char)(*(p - 2))) <= c && c <= ((unsigned char)(*p)))
        return sig;
    } else if (((unsigned char)(*p)) == c)
      return sig;
  }
  return !sig;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<matchbracketclass>:
  endbr64
  push   %r14
  mov    %edi,%r14d
  push   %r13
  mov    %rdx,%r13
  push   %r12
  mov    $0x1,%r12d
  push   %rbp
  xor    %ebp,%ebp
  push   %rbx
  cmpb   $0x5e,0x1(%rsi)
  mov    %rsi,%rbx
  jne    L52
  add    $0x1,%rbx
  mov    $0x1,%ebp
  xor    %r12d,%r12d
L52:
  lea    0x1(%rbx),%rdx
  cmp    %rdx,%r13
  ja     L13
  jmp    L31
  nopw   0x0(%rax,%rax,1)
L27:
  cmp    %eax,%r14d
  je     L110
  mov    %rdx,%rbx
L49:
  lea    0x1(%rbx),%rdx
  cmp    %r13,%rdx
  jae    L31
L13:
  movzbl 0x1(%rbx),%eax
  movzbl 0x2(%rbx),%esi
  cmp    $0x25,%al
  je     L5
  cmp    $0x2d,%sil
  jne    L27
  lea    0x3(%rbx),%rcx
  cmp    %r13,%rcx
  jae    L27
  cmp    %eax,%r14d
  jl     L106
  movzbl 0x3(%rbx),%eax
  cmp    %r14d,%eax
  jge    L110
L106:
  mov    %rcx,%rbx
  lea    0x1(%rbx),%rdx
  cmp    %r13,%rdx
  jb     L13
  cs nopw 0x0(%rax,%rax,1)
L31:
  mov    %ebp,%r12d
L110:
  pop    %rbx
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nop
L5:
  mov    %r14d,%edi
  add    $0x2,%rbx
  call   <match_class@plt>
  test   %rax,%rax
  je     L49
  pop    %rbx
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

assistant: ```c
int matchbracketclass(int c, const char *p, const char *ec) {
  int sig = 1;
  if (*(p + 1) == '^') {
    sig = 0;
    p++;
  }
  while (++p < ec) {
    if (*p == '%') {
      p++;
      if (match_class(c, ((unsigned char)(*p))))
        return sig;
    } else if ((*(p + 1) == '-') && (p + 2 < ec)) {
      p += 2;
      if (((unsigned char)(*(p - 2))) <= c && c <= ((unsigned char)(*p)))
        return sig;
    } else if (((unsigned char)(*p)) == c)
      return sig;
  }
  return !sig;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<cginocache>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  lea    D11(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    D13(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    D28(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  nop
  pop    %rbp
  ret
```

tool_calls: name: read_data
arguments: tag: D11
type: string
name: read_data
arguments: tag: D13
type: string
name: read_data
arguments: tag: D28
type: string

tool: D11: Cache-Control: no-store, max-age=0, s-maxage=0, proxy-revalidate, must-revalidate


tool: D13: Expires: -1


tool: D28: Pragma: no-cache


assistant: ```c
void cginocache() {
  printf("Cache-Control: no-store, max-age=0, s-maxage=0, proxy-revalidate, must-revalidate\n");
  printf("Expires: -1\n");
  printf("Pragma: no-cache\n");
  return;
  if (cgi_useragent("MSIE"))
    cginocache_msie();
  else
    cginocache_other();
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<cginocache>:
  endbr64
  sub    $0x8,%rsp
  lea    D15(%rip),%rdi
  call   <printf@plt>
  lea    D16(%rip),%rdi
  call   <printf@plt>
  lea    D0(%rip),%rdi
  call   <printf@plt>
  add    $0x8,%rsp
  ret
```

tool_calls: name: disassemble_data
arguments: label: D15
type_guessed: string
name: disassemble_data
arguments: label: D16
type_guessed: string
name: disassemble_data
arguments: label: D0
type_guessed: string

tool: D15: Cache-Control: no-store, max-age=0, s-maxage=0, proxy-revalidate, must-revalidate


tool: D16: Expires: -1


tool: D0: Pragma: no-cache


assistant: ```c
void cginocache() {
  printf("Cache-Control: no-store, max-age=0, s-maxage=0, proxy-revalidate, must-revalidate\n");
  printf("Expires: -1\n");
  printf("Pragma: no-cache\n");
  return;
  if (cgi_useragent("MSIE"))
    cginocache_msie();
  else
    cginocache_other();
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<cginocache>:
  endbr64
  sub    $0x8,%rsp
  lea    D2(%rip),%rdi
  call   <printf@plt>
  lea    D3(%rip),%rdi
  call   <printf@plt>
  lea    D8(%rip),%rdi
  add    $0x8,%rsp
  jmp    1050 <printf@plt>
```

tool_calls: name: retrieve_data
arguments: tag: D2
datatype: string
name: retrieve_data
arguments: tag: D3
datatype: string
name: retrieve_data
arguments: tag: D8
datatype: string

tool: D2: Cache-Control: no-store, max-age=0, s-maxage=0, proxy-revalidate, must-revalidate


tool: D3: Expires: -1


tool: D8: Pragma: no-cache


assistant: ```c
void cginocache() {
  printf("Cache-Control: no-store, max-age=0, s-maxage=0, proxy-revalidate, must-revalidate\n");
  printf("Expires: -1\n");
  printf("Pragma: no-cache\n");
  return;
  if (cgi_useragent("MSIE"))
    cginocache_msie();
  else
    cginocache_other();
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<cginocache>:
  endbr64
  sub    $0x8,%rsp
  lea    D25(%rip),%rdi
  call   <printf@plt>
  lea    D5(%rip),%rdi
  call   <printf@plt>
  lea    D21(%rip),%rdi
  add    $0x8,%rsp
  jmp    1050 <printf@plt>
```

tool_calls: name: unpack_data
arguments: label: D25
type: string
name: unpack_data
arguments: label: D5
type: string
name: unpack_data
arguments: label: D21
type: string

tool: D25: Cache-Control: no-store, max-age=0, s-maxage=0, proxy-revalidate, must-revalidate


tool: D5: Expires: -1


tool: D21: Pragma: no-cache


assistant: ```c
void cginocache() {
  printf("Cache-Control: no-store, max-age=0, s-maxage=0, proxy-revalidate, must-revalidate\n");
  printf("Expires: -1\n");
  printf("Pragma: no-cache\n");
  return;
  if (cgi_useragent("MSIE"))
    cginocache_msie();
  else
    cginocache_other();
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<Writer>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    $0x0,%eax
  call   <__startrek_read_output@plt>
  test   %eax,%eax
  setne  %al
  mov    %al,-0x10(%rbp)
  cmpb   $0x0,-0x10(%rbp)
  je     L70
  movl   $0x1,-0xc(%rbp)
  jmp    L77
L70:
  movl   $0xffffffff,-0xc(%rbp)
L77:
  mov    $0x0,%eax
  call   <__startrek_read_W_state@plt>
  mov    %al,-0xf(%rbp)
  movzbl -0xf(%rbp),%eax
  test   %eax,%eax
  je     L85
  cmp    $0x1,%eax
  jne    L2
  mov    -0xc(%rbp),%eax
  imul   $0xb4,%eax,%eax
  mov    -0xc(%rbp),%edx
  mov    %edx,%ecx
  mov    %eax,%edx
  mov    $0x1e,%esi
  mov    $0x1,%edi
  mov    $0x0,%eax
  call   <move_motor@plt>
  test   %eax,%eax
  setne  %al
  mov    %al,-0xe(%rbp)
  cmpb   $0x0,-0xe(%rbp)
  je     L46
  mov    $0x0,%edi
  mov    $0x0,%eax
  call   <__startrek_write_W_state@plt>
  mov    $0x1,%edi
  mov    $0x0,%eax
  call   <nxt_motor_get_count@plt>
  mov    %eax,-0x4(%rbp)
  mov    -0x4(%rbp),%edx
  movslq %edx,%rax
  imul   $0xffffffffb60b60b7,%rax,%rax
  shr    $0x20,%rax
  add    %edx,%eax
  sar    $0x7,%eax
  mov    %edx,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%eax
  imul   $0xb4,%eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  mov    %eax,%esi
  mov    $0x1,%edi
  mov    $0x0,%eax
  call   <nxt_motor_set_count@plt>
  mov    $0x0,%eax
  call   <__startrek_read_input@plt>
  test   %eax,%eax
  setne  %al
  mov    %al,-0xd(%rbp)
  cmpb   $0x0,-0xd(%rbp)
  je     L50
  movl   $0x0,-0x8(%rbp)
  jmp    L13
L50:
  movl   $0x1,-0x8(%rbp)
L13:
  mov    -0x8(%rbp),%eax
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <__startrek_write_input@plt>
  jmp    L46
L85:
  nop
  jmp    L2
L46:
  nop
L2:
  mov    $0x0,%eax
  call   <TerminateTask@plt>
  nop
  leave
  ret
```

assistant: ```c
void Writer(void) {
  int sign;
  _Bool tmp___0;
  unsigned char tmp___1;
  int tmp___2;
  _Bool tmp___3;
  int tmp___4;
  _Bool tmp___5;
  {
    tmp___0 = __startrek_read_output();
    if (tmp___0 == 1) {
      sign = 1;
    } else {
      sign = -1;
    }
    tmp___1 = __startrek_read_W_state();
    switch (tmp___1) {
    case 0:
      break;
    case 1:
      tmp___5 = move_motor(1, 30, sign * 180, sign);
      if (tmp___5) {
        __startrek_write_W_state(0);
        tmp___2 = nxt_motor_get_count(1);
        nxt_motor_set_count(1, tmp___2 % 180);
        tmp___3 = __startrek_read_input();
        if (tmp___3) {
          tmp___4 = 0;
        } else {
          tmp___4 = 1;
        }
        __startrek_write_input(tmp___4);
      }
      break;
    }
    TerminateTask();
    return;
  }
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<Writer>:
  endbr64
  push   %rbx
  mov    $0x0,%eax
  call   <__startrek_read_output@plt>
  cmp    $0x1,%eax
  sbb    %ebx,%ebx
  or     $0x1,%ebx
  mov    $0x0,%eax
  call   <__startrek_read_W_state@plt>
  cmp    $0x1,%al
  je     L21
L4:
  mov    $0x0,%eax
  call   <TerminateTask@plt>
  pop    %rbx
  ret
L21:
  imul   $0xb4,%ebx,%edx
  mov    %ebx,%ecx
  mov    $0x1e,%esi
  mov    $0x1,%edi
  mov    $0x0,%eax
  call   <move_motor@plt>
  test   %eax,%eax
  je     L4
  mov    $0x0,%edi
  mov    $0x0,%eax
  call   <__startrek_write_W_state@plt>
  mov    $0x1,%edi
  mov    $0x0,%eax
  call   <nxt_motor_get_count@plt>
  movslq %eax,%rdx
  imul   $0xffffffffb60b60b7,%rdx,%rdx
  shr    $0x20,%rdx
  add    %eax,%edx
  sar    $0x7,%edx
  mov    %eax,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%edx
  imul   $0xb4,%edx,%edx
  sub    %edx,%eax
  mov    %eax,%esi
  mov    $0x1,%edi
  mov    $0x0,%eax
  call   <nxt_motor_set_count@plt>
  mov    $0x0,%eax
  call   <__startrek_read_input@plt>
  test   %eax,%eax
  sete   %dil
  movzbl %dil,%edi
  mov    $0x0,%eax
  call   <__startrek_write_input@plt>
  jmp    L4
```

assistant: ```c
void Writer(void) {
  int sign;
  _Bool tmp___0;
  unsigned char tmp___1;
  int tmp___2;
  _Bool tmp___3;
  int tmp___4;
  _Bool tmp___5;
  {
    tmp___0 = __startrek_read_output();
    if (tmp___0 == 1) {
      sign = 1;
    } else {
      sign = -1;
    }
    tmp___1 = __startrek_read_W_state();
    switch (tmp___1) {
    case 0:
      break;
    case 1:
      tmp___5 = move_motor(1, 30, sign * 180, sign);
      if (tmp___5) {
        __startrek_write_W_state(0);
        tmp___2 = nxt_motor_get_count(1);
        nxt_motor_set_count(1, tmp___2 % 180);
        tmp___3 = __startrek_read_input();
        if (tmp___3) {
          tmp___4 = 0;
        } else {
          tmp___4 = 1;
        }
        __startrek_write_input(tmp___4);
      }
      break;
    }
    TerminateTask();
    return;
  }
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<Writer>:
  endbr64
  push   %r12
  xor    %eax,%eax
  call   <__startrek_read_output@plt>
  cmp    $0x1,%eax
  sbb    %r12d,%r12d
  xor    %eax,%eax
  or     $0x1,%r12d
  call   <__startrek_read_W_state@plt>
  cmp    $0x1,%al
  je     L27
L12:
  xor    %eax,%eax
  pop    %r12
  jmp    10d0 <TerminateTask@plt>
  nopl   0x0(%rax,%rax,1)
L27:
  xor    %eax,%eax
  mov    %r12d,%ecx
  mov    $0x1e,%esi
  mov    $0x1,%edi
  imul   $0xb4,%r12d,%edx
  call   <move_motor@plt>
  test   %eax,%eax
  je     L12
  xor    %edi,%edi
  xor    %eax,%eax
  call   <__startrek_write_W_state@plt>
  mov    $0x1,%edi
  xor    %eax,%eax
  call   <nxt_motor_get_count@plt>
  mov    $0x1,%edi
  movslq %eax,%rdx
  mov    %eax,%ecx
  imul   $0xffffffffb60b60b7,%rdx,%rdx
  sar    $0x1f,%ecx
  shr    $0x20,%rdx
  add    %eax,%edx
  sar    $0x7,%edx
  sub    %ecx,%edx
  imul   $0xb4,%edx,%edx
  sub    %edx,%eax
  mov    %eax,%esi
  xor    %eax,%eax
  call   <nxt_motor_set_count@plt>
  xor    %eax,%eax
  call   <__startrek_read_input@plt>
  xor    %edi,%edi
  test   %eax,%eax
  sete   %dil
  xor    %eax,%eax
  call   <__startrek_write_input@plt>
  jmp    L12
```

assistant: ```c
void Writer(void) {
  int sign;
  _Bool tmp___0;
  unsigned char tmp___1;
  int tmp___2;
  _Bool tmp___3;
  int tmp___4;
  _Bool tmp___5;
  {
    tmp___0 = __startrek_read_output();
    if (tmp___0 == 1) {
      sign = 1;
    } else {
      sign = -1;
    }
    tmp___1 = __startrek_read_W_state();
    switch (tmp___1) {
    case 0:
      break;
    case 1:
      tmp___5 = move_motor(1, 30, sign * 180, sign);
      if (tmp___5) {
        __startrek_write_W_state(0);
        tmp___2 = nxt_motor_get_count(1);
        nxt_motor_set_count(1, tmp___2 % 180);
        tmp___3 = __startrek_read_input();
        if (tmp___3) {
          tmp___4 = 0;
        } else {
          tmp___4 = 1;
        }
        __startrek_write_input(tmp___4);
      }
      break;
    }
    TerminateTask();
    return;
  }
}
```