ylfeng/ReF-Decompile-dataset huggingface dataset:
user: What would the C source look like for the assembly code provided here?

```asm
<calcError>:
  endbr64
  push   %rbx
  subsd  %xmm0,%xmm1
  mov    %edi,%ebx
  mov    %ebx,%esi
  sub    $0x10,%rsp
  mulsd  D4(%rip),%xmm1
  cvttsd2si %xmm1,%edi
  call   <pow@plt>
  lea    -0x1(%rbx),%esi
  mov    $0x2,%edi
  movsd  %xmm0,0x8(%rsp)
  call   <pow@plt>
  movsd  0x8(%rsp),%xmm1
  movslq %ebx,%rdi
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x8(%rsp)
  call   <fatorial@plt>
  pxor   %xmm0,%xmm0
  mov    %eax,%r8d
  mov    $0x1,%eax
  cltd
  idiv   %r8d
  cvtsi2sd %eax,%xmm0
  mulsd  0x8(%rsp),%xmm0
  add    $0x10,%rsp
  pop    %rbx
  ret
```

tool_calls: name: disassemble_data
arguments: data_label: D4
type: byte[8]

tool: {"D4": [0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x3f]}

assistant: ```c
double calcError(int n, double a, double b) {
  double p1, p2;
  p1 = pow((b - a) / 2, n) / pow(2, n - 1);
  p2 = 1 / fatorial((unsigned long)n);
  return p1 * p2;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<calcError>:
  endbr64
  push   %rbx
  subsd  %xmm0,%xmm1
  mov    %edi,%ebx
  mov    %ebx,%esi
  sub    $0x10,%rsp
  mulsd  D6(%rip),%xmm1
  cvttsd2si %xmm1,%edi
  call   <pow@plt>
  lea    -0x1(%rbx),%esi
  mov    $0x2,%edi
  movsd  %xmm0,0x8(%rsp)
  call   <pow@plt>
  movsd  0x8(%rsp),%xmm1
  movslq %ebx,%rdi
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x8(%rsp)
  call   <fatorial@plt>
  pxor   %xmm0,%xmm0
  mov    %eax,%r8d
  mov    $0x1,%eax
  cltd
  idiv   %r8d
  cvtsi2sd %eax,%xmm0
  mulsd  0x8(%rsp),%xmm0
  add    $0x10,%rsp
  pop    %rbx
  ret
```

tool_calls: name: unpack_data
arguments: data_tag: D6
type_infered: byte[8]

tool: {"D6": [0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x3f]}

assistant: ```c
double calcError(int n, double a, double b) {
  double p1, p2;
  p1 = pow((b - a) / 2, n) / pow(2, n - 1);
  p2 = 1 / fatorial((unsigned long)n);
  return p1 * p2;
}
```
user: What is the c source code of the assembly code below?

```asm
<sighandle>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %edi,-0x4(%rbp)
  mov    D2(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x4(%rbp)
  je     L9
  mov    D1(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x4(%rbp)
  jne    L10
L9:
  mov    $0x0,%edi
  call   <exit@plt>
L10:
  nop
  leave
  ret
```

assistant: ```c
void sighandle(int signal) {
  if (signal == SIGINT || signal == SIGTERM)
    exit(0);
}
```
user: What is the c source code of the assembly code below:

```asm
<sighandle>:
  endbr64
  mov    D4(%rip),%rax
  cmp    %edi,(%rax)
  je     L17
  mov    D0(%rip),%rax
  cmp    %edi,(%rax)
  je     L17
  ret
L17:
  sub    $0x8,%rsp
  mov    $0x0,%edi
  call   <exit@plt>
  add    $0x8,%rsp
  ret
```

assistant: ```c
void sighandle(int signal) {
  if (signal == SIGINT || signal == SIGTERM)
    exit(0);
}
```
user: What is the c source code of the assembly code below?

```asm
<sighandle>:
  endbr64
  mov    D10(%rip),%rax
  cmp    %edi,(%rax)
  je     L0
  mov    D16(%rip),%rax
  cmp    %edi,(%rax)
  je     L0
  ret
  nopl   0x0(%rax,%rax,1)
L0:
  xor    %edi,%edi
  jmp    1050 <exit@plt>
```

assistant: ```c
void sighandle(int signal) {
  if (signal == SIGINT || signal == SIGTERM)
    exit(0);
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<sighandle>:
  endbr64
  mov    D6(%rip),%rax
  cmp    %edi,(%rax)
  je     L13
  mov    D13(%rip),%rax
  cmp    %edi,(%rax)
  je     L13
  ret
  nopl   0x0(%rax,%rax,1)
L13:
  xor    %edi,%edi
  jmp    1050 <exit@plt>
```

assistant: ```c
void sighandle(int signal) {
  if (signal == SIGINT || signal == SIGTERM)
    exit(0);
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    D33(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    -0xc(%rbp),%rcx
  lea    -0x10(%rbp),%rdx
  lea    -0x14(%rbp),%rax
  mov    %rax,%rsi
  lea    D3(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  mov    -0x14(%rbp),%edx
  mov    -0x10(%rbp),%eax
  cmp    %eax,%edx
  jg     L16
  mov    -0x14(%rbp),%edx
  mov    -0xc(%rbp),%eax
  cmp    %eax,%edx
  jge    L100
L16:
  mov    -0x14(%rbp),%edx
  mov    -0x10(%rbp),%eax
  cmp    %eax,%edx
  jg     L18
  mov    -0x14(%rbp),%edx
  mov    -0xc(%rbp),%eax
  cmp    %eax,%edx
  jl     L18
L100:
  mov    -0x14(%rbp),%eax
  mov    %eax,%esi
  lea    D22(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L61
L18:
  mov    -0x10(%rbp),%edx
  mov    -0x14(%rbp),%eax
  cmp    %eax,%edx
  jg     L75
  mov    -0x10(%rbp),%edx
  mov    -0xc(%rbp),%eax
  cmp    %eax,%edx
  jge    L142
L75:
  mov    -0x10(%rbp),%edx
  mov    -0xc(%rbp),%eax
  cmp    %eax,%edx
  jg     L133
  mov    -0x10(%rbp),%edx
  mov    -0x14(%rbp),%eax
  cmp    %eax,%edx
  jl     L133
L142:
  mov    -0x10(%rbp),%eax
  mov    %eax,%esi
  lea    D22(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L61
L133:
  mov    -0xc(%rbp),%edx
  mov    -0x14(%rbp),%eax
  cmp    %eax,%edx
  jg     L148
  mov    -0xc(%rbp),%edx
  mov    -0x10(%rbp),%eax
  cmp    %eax,%edx
  jge    L88
L148:
  mov    -0xc(%rbp),%edx
  mov    -0x10(%rbp),%eax
  cmp    %eax,%edx
  jg     L61
  mov    -0xc(%rbp),%edx
  mov    -0x14(%rbp),%eax
  cmp    %eax,%edx
  jl     L61
L88:
  mov    -0xc(%rbp),%eax
  mov    %eax,%esi
  lea    D22(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L61:
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L135
  call   <__stack_chk_fail@plt>
L135:
  leave
  ret
```

tool_calls: name: read_data
arguments: data_label: D33
type: string
name: read_data
arguments: data_label: D3
type: string
name: read_data
arguments: data_label: D22
type: string

tool: D33: Please enter 3 numbers separated by spaces > 

tool: D3: %d %d %d

tool: D22: %d is the median


assistant: ```c
int main(void) {
  int int1, int2, int3;
  printf("Please enter 3 numbers separated by spaces > ");
  scanf("%d %d %d", &int1, &int2, &int3);
  if (((int1 <= int2) && (int1 >= int3)) || ((int1 <= int2) && (int1 >= int3)))
    printf("%d is the median\n", int1);
  else if ((((int2 <= int1)) && (int2 >= int3)) || ((int2 <= int3) && (int2 >= int1)))
    printf("%d is the median\n", int2);
  else if (((int3 <= int1) && (int3 >= int2)) || ((int3 <= int2) && (int3 >= int1)))
    printf("%d is the median\n", int3);
  return 0;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<main>:
  endbr64
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    D18(%rip),%rdi
  call   <printf@plt>
  lea    0x14(%rsp),%rcx
  lea    0x10(%rsp),%rdx
  lea    0xc(%rsp),%rsi
  lea    D14(%rip),%rdi
  call   <scanf@plt>
  mov    0xc(%rsp),%eax
  mov    0x10(%rsp),%esi
  cmp    %esi,%eax
  jg     L22
  cmp    0x14(%rsp),%eax
  jge    L73
  cmp    %esi,%eax
  je     L150
  mov    0x14(%rsp),%edx
  jg     L173
  cmp    %edx,%esi
  jle    L161
L173:
  cmp    %edx,%eax
  jg     L157
  cmp    %edx,%esi
  jl     L157
  jmp    L94
L73:
  mov    %eax,%esi
  lea    D24(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L157
L150:
  cmp    0x14(%rsp),%esi
  jge    L161
  mov    0x14(%rsp),%edx
  setle  %cl
  cmp    %esi,%eax
  jg     L5
  test   %cl,%cl
  jne    L161
  jmp    L5
L123:
  mov    0x14(%rsp),%edx
  cmp    %edx,%esi
  setle  %cl
L5:
  cmp    %edx,%eax
  jl     L173
  test   %cl,%cl
  je     L173
L94:
  mov    %edx,%esi
  lea    D24(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L157
L22:
  cmp    0x14(%rsp),%esi
  jl     L123
L161:
  lea    D24(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L157:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L105
  mov    $0x0,%eax
  add    $0x28,%rsp
  ret
L105:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: label: D18
type: string
name: read_data
arguments: label: D14
type: string
name: read_data
arguments: label: D24
type: string

tool: D18: Please enter 3 numbers separated by spaces > 

tool: D14: %d %d %d

tool: D24: %d is the median


assistant: ```c
int main(void) {
  int int1, int2, int3;
  printf("Please enter 3 numbers separated by spaces > ");
  scanf("%d %d %d", &int1, &int2, &int3);
  if (((int1 <= int2) && (int1 >= int3)) || ((int1 <= int2) && (int1 >= int3)))
    printf("%d is the median\n", int1);
  else if ((((int2 <= int1)) && (int2 >= int3)) || ((int2 <= int3) && (int2 >= int1)))
    printf("%d is the median\n", int2);
  else if (((int3 <= int1) && (int3 >= int2)) || ((int3 <= int2) && (int3 >= int1)))
    printf("%d is the median\n", int3);
  return 0;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<main>:
  endbr64
  sub    $0x28,%rsp
  lea    D28(%rip),%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  call   <printf@plt>
  lea    0xc(%rsp),%rsi
  lea    0x14(%rsp),%rcx
  lea    0x10(%rsp),%rdx
  lea    D34(%rip),%rdi
  call   <scanf@plt>
  mov    0xc(%rsp),%r8d
  mov    0x10(%rsp),%esi
  mov    0x14(%rsp),%r9d
  cmp    %esi,%r8d
  jle    L74
  cmp    %r9d,%esi
  jl     L53
L56:
  lea    D7(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
L81:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L43
  xor    %eax,%eax
  add    $0x28,%rsp
  ret
L74:
  cmp    %r9d,%r8d
  jge    L64
  cmp    %esi,%r8d
  je     L56
  cmp    %r9d,%esi
  jle    L56
L63:
  mov    %r9d,%esi
  jmp    L56
L53:
  cmp    %r9d,%r8d
  jge    L63
  jmp    L81
L64:
  mov    %r8d,%esi
  lea    D7(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L81
L43:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_label: D28
type_infered: string
name: retrieve_data
arguments: data_label: D34
type_infered: string
name: retrieve_data
arguments: data_label: D7
type_infered: string

tool: D28: Please enter 3 numbers separated by spaces > 

tool: D34: %d %d %d

tool: D7: %d is the median


assistant: ```c
int main(void) {
  int int1, int2, int3;
  printf("Please enter 3 numbers separated by spaces > ");
  scanf("%d %d %d", &int1, &int2, &int3);
  if (((int1 <= int2) && (int1 >= int3)) || ((int1 <= int2) && (int1 >= int3)))
    printf("%d is the median\n", int1);
  else if ((((int2 <= int1)) && (int2 >= int3)) || ((int2 <= int3) && (int2 >= int1)))
    printf("%d is the median\n", int2);
  else if (((int3 <= int1) && (int3 >= int2)) || ((int3 <= int2) && (int3 >= int1)))
    printf("%d is the median\n", int3);
  return 0;
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<main>:
  endbr64
  sub    $0x28,%rsp
  lea    D16(%rip),%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  call   <printf@plt>
  lea    0xc(%rsp),%rsi
  lea    0x14(%rsp),%rcx
  lea    0x10(%rsp),%rdx
  lea    D26(%rip),%rdi
  call   <scanf@plt>
  mov    0xc(%rsp),%r8d
  mov    0x10(%rsp),%esi
  mov    0x14(%rsp),%r9d
  cmp    %esi,%r8d
  jle    L32
  cmp    %r9d,%esi
  jl     L73
L50:
  lea    D33(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
L46:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L3
  xor    %eax,%eax
  add    $0x28,%rsp
  ret
L32:
  cmp    %r9d,%r8d
  jge    L30
  cmp    %esi,%r8d
  je     L50
  cmp    %r9d,%esi
  jle    L50
L64:
  mov    %r9d,%esi
  jmp    L50
L73:
  cmp    %r9d,%r8d
  jge    L64
  jmp    L46
L30:
  mov    %r8d,%esi
  lea    D33(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L46
L3:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_tag: D16
type: string
name: disassemble_data
arguments: data_tag: D26
type: string
name: disassemble_data
arguments: data_tag: D33
type: string

tool: D16: Please enter 3 numbers separated by spaces > 

tool: D26: %d %d %d

tool: D33: %d is the median


assistant: ```c
int main(void) {
  int int1, int2, int3;
  printf("Please enter 3 numbers separated by spaces > ");
  scanf("%d %d %d", &int1, &int2, &int3);
  if (((int1 <= int2) && (int1 >= int3)) || ((int1 <= int2) && (int1 >= int3)))
    printf("%d is the median\n", int1);
  else if ((((int2 <= int1)) && (int2 >= int3)) || ((int2 <= int3) && (int2 >= int1)))
    printf("%d is the median\n", int2);
  else if (((int3 <= int1) && (int3 >= int2)) || ((int3 <= int2) && (int3 >= int1)))
    printf("%d is the median\n", int3);
  return 0;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<satno>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x4(%rbp)
  mov    %esi,-0x8(%rbp)
  cmpl   $0x0,-0x8(%rbp)
  jg     L244
  mov    $0x0,%eax
  jmp    L231
L244:
  cmpl   $0x20,-0x4(%rbp)
  jg     L143
  cmpl   $0x0,-0x4(%rbp)
  jle    L113
  cmpl   $0x20,-0x4(%rbp)
  ja     L113
  mov    -0x4(%rbp),%eax
  lea    0x0(,%rax,4),%rdx
  lea    D1(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  cltq
  lea    D1(%rip),%rdx
  add    %rdx,%rax
  notrack jmp *%rax
L143:
  cmpl   $0x40,-0x4(%rbp)
  je     L216
  jmp    L113
  cmpl   $0x0,-0x8(%rbp)
  jle    L182
  cmpl   $0x20,-0x8(%rbp)
  jle    L227
L182:
  mov    $0x0,%eax
  jmp    L231
L227:
  mov    -0x8(%rbp),%eax
  jmp    L231
  cmpl   $0x0,-0x8(%rbp)
  js     L310
  cmpl   $0x0,-0x8(%rbp)
  jle    L346
L310:
  mov    $0x0,%eax
  jmp    L231
L346:
  mov    -0x8(%rbp),%eax
  add    $0x21,%eax
  jmp    L231
  cmpl   $0x0,-0x8(%rbp)
  js     L337
  cmpl   $0x0,-0x8(%rbp)
  jle    L329
L337:
  mov    $0x0,%eax
  jmp    L231
L329:
  mov    -0x8(%rbp),%eax
  add    $0x21,%eax
  jmp    L231
  cmpl   $0x0,-0x8(%rbp)
  js     L203
  cmpl   $0x0,-0x8(%rbp)
  jle    L115
L203:
  mov    $0x0,%eax
  jmp    L231
L115:
  mov    -0x8(%rbp),%eax
  add    $0x21,%eax
  jmp    L231
  cmpl   $0x0,-0x8(%rbp)
  js     L232
  cmpl   $0x0,-0x8(%rbp)
  jle    L157
L232:
  mov    $0x0,%eax
  jmp    L231
L157:
  mov    -0x8(%rbp),%eax
  add    $0x21,%eax
  jmp    L231
L216:
  cmpl   $0x0,-0x8(%rbp)
  js     L39
  cmpl   $0x0,-0x8(%rbp)
  jle    L51
L39:
  mov    $0x0,%eax
  jmp    L231
L51:
  mov    -0x8(%rbp),%eax
  add    $0x21,%eax
  jmp    L231
  cmpl   $0x77,-0x8(%rbp)
  jle    L319
  cmpl   $0x8e,-0x8(%rbp)
  jle    L238
L319:
  mov    $0x0,%eax
  jmp    L231
L238:
  mov    -0x8(%rbp),%eax
  sub    $0x57,%eax
  jmp    L231
L113:
  mov    $0x0,%eax
L231:
  pop    %rbp
  ret
```

assistant: ```c
extern int satno(int sys, int prn) {
  if (prn <= 0)
    return 0;
  switch (sys) {
  case 0x01:
    if (prn < 1 || 32 < prn)
      return 0;
    return prn - 1 + 1;
  case 0x04:
    if (prn < 0 || 0 < prn)
      return 0;
    return (32 - 1 + 1) + prn - 0 + 1;
  case 0x08:
    if (prn < 0 || 0 < prn)
      return 0;
    return (32 - 1 + 1) + 0 + prn - 0 + 1;
  case 0x10:
    if (prn < 0 || 0 < prn)
      return 0;
    return (32 - 1 + 1) + 0 + 0 + prn - 0 + 1;
  case 0x20:
    if (prn < 0 || 0 < prn)
      return 0;
    return (32 - 1 + 1) + 0 + 0 + 0 + prn - 0 + 1;
  case 0x40:
    if (prn < 0 || 0 < prn)
      return 0;
    return (32 - 1 + 1) + 0 + 0 + 0 + 0 + prn - 0 + 1;
  case 0x02:
    if (prn < 120 || 142 < prn)
      return 0;
    return (32 - 1 + 1) + 0 + 0 + 0 + 0 + 0 + prn - 120 + 1;
  }
  return 0;
}
```
user: Translate the below assembly code into C programming language:

```asm
<satno>:
  endbr64
  mov    $0x0,%eax
  test   %esi,%esi
  jle    L26
  cmp    $0x1,%edi
  je     L1
  cmp    $0x2,%edi
  je     L6
  ret
L1:
  lea    -0x1(%rsi),%eax
  cmp    $0x20,%eax
  mov    $0x0,%eax
  cmovb  %esi,%eax
  ret
L6:
  lea    -0x78(%rsi),%eax
  sub    $0x57,%esi
  cmp    $0x17,%eax
  mov    $0x0,%eax
  cmovb  %esi,%eax
L26:
  ret
```

assistant: ```c
extern int satno(int sys, int prn) {
  if (prn <= 0)
    return 0;
  switch (sys) {
  case 0x01:
    if (prn < 1 || 32 < prn)
      return 0;
    return prn - 1 + 1;
  case 0x04:
    if (prn < 0 || 0 < prn)
      return 0;
    return (32 - 1 + 1) + prn - 0 + 1;
  case 0x08:
    if (prn < 0 || 0 < prn)
      return 0;
    return (32 - 1 + 1) + 0 + prn - 0 + 1;
  case 0x10:
    if (prn < 0 || 0 < prn)
      return 0;
    return (32 - 1 + 1) + 0 + 0 + prn - 0 + 1;
  case 0x20:
    if (prn < 0 || 0 < prn)
      return 0;
    return (32 - 1 + 1) + 0 + 0 + 0 + prn - 0 + 1;
  case 0x40:
    if (prn < 0 || 0 < prn)
      return 0;
    return (32 - 1 + 1) + 0 + 0 + 0 + 0 + prn - 0 + 1;
  case 0x02:
    if (prn < 120 || 142 < prn)
      return 0;
    return (32 - 1 + 1) + 0 + 0 + 0 + 0 + 0 + prn - 120 + 1;
  }
  return 0;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<satno>:
  endbr64
  xor    %eax,%eax
  test   %esi,%esi
  jle    L3
  cmp    $0x1,%edi
  je     L24
  cmp    $0x2,%edi
  je     L21
L3:
  ret
  nopl   (%rax)
L21:
  lea    -0x78(%rsi),%edx
  sub    $0x57,%esi
  cmp    $0x17,%edx
  cmovb  %esi,%eax
  ret
  nopl   (%rax)
L24:
  lea    -0x1(%rsi),%edx
  cmp    $0x20,%edx
  cmovb  %esi,%eax
  ret
```

assistant: ```c
extern int satno(int sys, int prn) {
  if (prn <= 0)
    return 0;
  switch (sys) {
  case 0x01:
    if (prn < 1 || 32 < prn)
      return 0;
    return prn - 1 + 1;
  case 0x04:
    if (prn < 0 || 0 < prn)
      return 0;
    return (32 - 1 + 1) + prn - 0 + 1;
  case 0x08:
    if (prn < 0 || 0 < prn)
      return 0;
    return (32 - 1 + 1) + 0 + prn - 0 + 1;
  case 0x10:
    if (prn < 0 || 0 < prn)
      return 0;
    return (32 - 1 + 1) + 0 + 0 + prn - 0 + 1;
  case 0x20:
    if (prn < 0 || 0 < prn)
      return 0;
    return (32 - 1 + 1) + 0 + 0 + 0 + prn - 0 + 1;
  case 0x40:
    if (prn < 0 || 0 < prn)
      return 0;
    return (32 - 1 + 1) + 0 + 0 + 0 + 0 + prn - 0 + 1;
  case 0x02:
    if (prn < 120 || 142 < prn)
      return 0;
    return (32 - 1 + 1) + 0 + 0 + 0 + 0 + 0 + prn - 120 + 1;
  }
  return 0;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<satno>:
  endbr64
  xor    %eax,%eax
  test   %esi,%esi
  jle    L16
  cmp    $0x1,%edi
  je     L1
  cmp    $0x2,%edi
  je     L21
L16:
  ret
  nopl   (%rax)
L21:
  lea    -0x78(%rsi),%edx
  sub    $0x57,%esi
  cmp    $0x17,%edx
  cmovb  %esi,%eax
  ret
  nopl   (%rax)
L1:
  lea    -0x1(%rsi),%edx
  cmp    $0x20,%edx
  cmovb  %esi,%eax
  ret
```

assistant: ```c
extern int satno(int sys, int prn) {
  if (prn <= 0)
    return 0;
  switch (sys) {
  case 0x01:
    if (prn < 1 || 32 < prn)
      return 0;
    return prn - 1 + 1;
  case 0x04:
    if (prn < 0 || 0 < prn)
      return 0;
    return (32 - 1 + 1) + prn - 0 + 1;
  case 0x08:
    if (prn < 0 || 0 < prn)
      return 0;
    return (32 - 1 + 1) + 0 + prn - 0 + 1;
  case 0x10:
    if (prn < 0 || 0 < prn)
      return 0;
    return (32 - 1 + 1) + 0 + 0 + prn - 0 + 1;
  case 0x20:
    if (prn < 0 || 0 < prn)
      return 0;
    return (32 - 1 + 1) + 0 + 0 + 0 + prn - 0 + 1;
  case 0x40:
    if (prn < 0 || 0 < prn)
      return 0;
    return (32 - 1 + 1) + 0 + 0 + 0 + 0 + prn - 0 + 1;
  case 0x02:
    if (prn < 120 || 142 < prn)
      return 0;
    return (32 - 1 + 1) + 0 + 0 + 0 + 0 + 0 + prn - 120 + 1;
  }
  return 0;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<cescape_char>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %edi,%ebx
  mov    %rsi,%rbp
  cmp    $0x27,%dil
  jg     L126
  cmp    $0x6,%dil
  jle    L40
  lea    -0x7(%rdi),%eax
  cmp    $0x20,%al
  ja     L40
  movzbl %al,%eax
  lea    D4(%rip),%rdx
  movslq (%rdx,%rax,4),%rax
  add    %rdx,%rax
  notrack jmp *%rax
L126:
  cmp    $0x5c,%dil
  jne    L40
  movb   $0x5c,(%rsi)
  lea    0x2(%rsi),%rax
  movb   $0x5c,0x1(%rsi)
  jmp    L153
  movb   $0x5c,(%rsi)
  lea    0x2(%rsi),%rax
  movb   $0x61,0x1(%rsi)
L153:
  sub    %ebp,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
  movb   $0x5c,(%rsi)
  lea    0x2(%rsi),%rax
  movb   $0x62,0x1(%rsi)
  jmp    L153
  movb   $0x5c,(%rsi)
  lea    0x2(%rsi),%rax
  movb   $0x66,0x1(%rsi)
  jmp    L153
  movb   $0x5c,(%rsi)
  lea    0x2(%rsi),%rax
  movb   $0x6e,0x1(%rsi)
  jmp    L153
  movb   $0x5c,(%rsi)
  lea    0x2(%rsi),%rax
  movb   $0x72,0x1(%rsi)
  jmp    L153
  movb   $0x5c,(%rsi)
  lea    0x2(%rsi),%rax
  movb   $0x74,0x1(%rsi)
  jmp    L153
  movb   $0x5c,(%rsi)
  lea    0x2(%rsi),%rax
  movb   $0x76,0x1(%rsi)
  jmp    L153
  movb   $0x5c,(%rsi)
  lea    0x2(%rsi),%rax
  movb   $0x22,0x1(%rsi)
  jmp    L153
  movb   $0x5c,(%rsi)
  lea    0x2(%rsi),%rax
  movb   $0x27,0x1(%rsi)
  jmp    L153
L40:
  lea    -0x20(%rbx),%eax
  cmp    $0x5e,%al
  ja     L93
  lea    0x1(%rbp),%rax
  mov    %bl,0x0(%rbp)
  jmp    L153
L93:
  movb   $0x5c,0x0(%rbp)
  mov    %ebx,%edi
  shr    $0x6,%dil
  movzbl %dil,%edi
  call   <octchar@plt>
  mov    %al,0x1(%rbp)
  mov    %ebx,%edi
  shr    $0x3,%dil
  movzbl %dil,%edi
  call   <octchar@plt>
  mov    %al,0x2(%rbp)
  movzbl %bl,%edi
  call   <octchar@plt>
  mov    %rax,%rdx
  lea    0x4(%rbp),%rax
  mov    %dl,0x3(%rbp)
  jmp    L153
```

assistant: ```c
int cescape_char(char c, char *buf) {
  char *buf_old = buf;
  switch (c) {
  case '\a':
    *(buf++) = '\\';
    *(buf++) = 'a';
    break;
  case '\b':
    *(buf++) = '\\';
    *(buf++) = 'b';
    break;
  case '\f':
    *(buf++) = '\\';
    *(buf++) = 'f';
    break;
  case '\n':
    *(buf++) = '\\';
    *(buf++) = 'n';
    break;
  case '\r':
    *(buf++) = '\\';
    *(buf++) = 'r';
    break;
  case '\t':
    *(buf++) = '\\';
    *(buf++) = 't';
    break;
  case '\v':
    *(buf++) = '\\';
    *(buf++) = 'v';
    break;
  case '\\':
    *(buf++) = '\\';
    *(buf++) = '\\';
    break;
  case '"':
    *(buf++) = '\\';
    *(buf++) = '"';
    break;
  case '\'':
    *(buf++) = '\\';
    *(buf++) = '\'';
    break;
  default:
    if ((c < ' ') || (c >= 127)) {
      *(buf++) = '\\';
      *(buf++) = octchar((unsigned char)c >> 6);
      *(buf++) = octchar((unsigned char)c >> 3);
      *(buf++) = octchar((unsigned char)c);
    } else
      *(buf++) = c;
    break;
  }
  return buf - buf_old;
}
```