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

```asm
<write_zcc_defined>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    %esi,-0xc(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rsi
  lea    D25(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <add_zccopt@plt>
  mov    -0x8(%rbp),%rax
  mov    %rax,%rsi
  lea    D20(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <add_zccopt@plt>
  mov    -0xc(%rbp),%edx
  mov    -0x8(%rbp),%rax
  mov    %rax,%rsi
  lea    D38(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <add_zccopt@plt>
  lea    D23(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <add_zccopt@plt>
  nop
  leave
  ret
```

tool_calls: name: read_data
arguments: data_tag: D25
data_type: string
name: read_data
arguments: data_tag: D20
data_type: string
name: read_data
arguments: data_tag: D38
data_type: string
name: read_data
arguments: data_tag: D23
data_type: string

tool: D25: 
IF !DEFINED_%s


tool: D20: 	defc	DEFINED_%s = 1


tool: D38: 	defc %s = %d


tool: D23: ENDIF



assistant: ```c
void write_zcc_defined(char *name, int value) {
  add_zccopt("\nIF !DEFINED_%s\n", name);
  add_zccopt("\tdefc\tDEFINED_%s = 1\n", name);
  add_zccopt("\tdefc %s = %d\n", name, value);
  add_zccopt("ENDIF\n\n");
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<write_zcc_defined>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbx
  mov    %esi,%ebp
  mov    %rdi,%rsi
  lea    D34(%rip),%rdi
  mov    $0x0,%eax
  call   <add_zccopt@plt>
  mov    %rbx,%rsi
  lea    D5(%rip),%rdi
  mov    $0x0,%eax
  call   <add_zccopt@plt>
  mov    %ebp,%edx
  mov    %rbx,%rsi
  lea    D0(%rip),%rdi
  mov    $0x0,%eax
  call   <add_zccopt@plt>
  lea    D36(%rip),%rdi
  mov    $0x0,%eax
  call   <add_zccopt@plt>
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

tool_calls: name: retrieve_data
arguments: data_tag: D34
type_guessed: string
name: retrieve_data
arguments: data_tag: D5
type_guessed: string
name: retrieve_data
arguments: data_tag: D0
type_guessed: string
name: retrieve_data
arguments: data_tag: D36
type_guessed: string

tool: D34: 
IF !DEFINED_%s


tool: D5: 	defc	DEFINED_%s = 1


tool: D0: 	defc %s = %d


tool: D36: ENDIF



assistant: ```c
void write_zcc_defined(char *name, int value) {
  add_zccopt("\nIF !DEFINED_%s\n", name);
  add_zccopt("\tdefc\tDEFINED_%s = 1\n", name);
  add_zccopt("\tdefc %s = %d\n", name, value);
  add_zccopt("ENDIF\n\n");
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<write_zcc_defined>:
  endbr64
  push   %r12
  xor    %eax,%eax
  mov    %esi,%r12d
  mov    %rdi,%rsi
  push   %rbp
  mov    %rdi,%rbp
  lea    D20(%rip),%rdi
  sub    $0x8,%rsp
  call   <add_zccopt@plt>
  mov    %rbp,%rsi
  lea    D13(%rip),%rdi
  xor    %eax,%eax
  call   <add_zccopt@plt>
  mov    %r12d,%edx
  mov    %rbp,%rsi
  xor    %eax,%eax
  lea    D26(%rip),%rdi
  call   <add_zccopt@plt>
  add    $0x8,%rsp
  lea    D38(%rip),%rdi
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  jmp    1050 <add_zccopt@plt>
```

tool_calls: name: unpack_data
arguments: data_label: D20
datatype: string
name: unpack_data
arguments: data_label: D13
datatype: string
name: unpack_data
arguments: data_label: D26
datatype: string
name: unpack_data
arguments: data_label: D38
datatype: string

tool: D20: 
IF !DEFINED_%s


tool: D13: 	defc	DEFINED_%s = 1


tool: D26: 	defc %s = %d


tool: D38: ENDIF



assistant: ```c
void write_zcc_defined(char *name, int value) {
  add_zccopt("\nIF !DEFINED_%s\n", name);
  add_zccopt("\tdefc\tDEFINED_%s = 1\n", name);
  add_zccopt("\tdefc %s = %d\n", name, value);
  add_zccopt("ENDIF\n\n");
}
```
user: What is the c source code of the assembly code below?

```asm
<write_zcc_defined>:
  endbr64
  push   %r12
  xor    %eax,%eax
  mov    %esi,%r12d
  mov    %rdi,%rsi
  push   %rbp
  mov    %rdi,%rbp
  lea    D38(%rip),%rdi
  sub    $0x8,%rsp
  call   <add_zccopt@plt>
  mov    %rbp,%rsi
  lea    D20(%rip),%rdi
  xor    %eax,%eax
  call   <add_zccopt@plt>
  mov    %r12d,%edx
  mov    %rbp,%rsi
  xor    %eax,%eax
  lea    D39(%rip),%rdi
  call   <add_zccopt@plt>
  add    $0x8,%rsp
  lea    D18(%rip),%rdi
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  jmp    1050 <add_zccopt@plt>
```

tool_calls: name: unpack_data
arguments: label: D38
type_guessed: string
name: unpack_data
arguments: label: D20
type_guessed: string
name: unpack_data
arguments: label: D39
type_guessed: string
name: unpack_data
arguments: label: D18
type_guessed: string

tool: D38: 
IF !DEFINED_%s


tool: D20: 	defc	DEFINED_%s = 1


tool: D39: 	defc %s = %d


tool: D18: ENDIF



assistant: ```c
void write_zcc_defined(char *name, int value) {
  add_zccopt("\nIF !DEFINED_%s\n", name);
  add_zccopt("\tdefc\tDEFINED_%s = 1\n", name);
  add_zccopt("\tdefc %s = %d\n", name, value);
  add_zccopt("ENDIF\n\n");
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<asn1_print_integer_ctx>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  movl   $0x1,-0xc(%rbp)
  mov    -0x20(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x0,%edi
  call   <i2s_ASN1_INTEGER@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <BIO_puts@plt>
  test   %rax,%rax
  jg     L7
  movl   $0x0,-0xc(%rbp)
L7:
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <OPENSSL_free@plt>
  mov    -0xc(%rbp),%eax
  leave
  ret
```

assistant: ```c
int asn1_print_integer_ctx(BIO *out, ASN1_INTEGER *str, const ASN1_PCTX *pctx) {
  char *s;
  int ret = 1;
  s = i2s_ASN1_INTEGER(NULL, str);
  if (BIO_puts(out, s) <= 0)
    ret = 0;
  OPENSSL_free(s);
  return ret;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<asn1_print_integer_ctx>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbp
  mov    $0x0,%edi
  call   <i2s_ASN1_INTEGER@plt>
  mov    %rax,%rbx
  mov    %rax,%rsi
  mov    %rbp,%rdi
  call   <BIO_puts@plt>
  mov    %rax,%rbp
  mov    %rbx,%rdi
  call   <OPENSSL_free@plt>
  test   %rbp,%rbp
  setg   %al
  movzbl %al,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
int asn1_print_integer_ctx(BIO *out, ASN1_INTEGER *str, const ASN1_PCTX *pctx) {
  char *s;
  int ret = 1;
  s = i2s_ASN1_INTEGER(NULL, str);
  if (BIO_puts(out, s) <= 0)
    ret = 0;
  OPENSSL_free(s);
  return ret;
}
```
user: What is the c source code of the assembly code below?

```asm
<asn1_print_integer_ctx>:
  endbr64
  push   %r12
  mov    %rdi,%r12
  xor    %edi,%edi
  push   %rbp
  push   %rbx
  call   <i2s_ASN1_INTEGER@plt>
  mov    %r12,%rdi
  mov    %rax,%rsi
  mov    %rax,%rbp
  call   <BIO_puts@plt>
  mov    %rbp,%rdi
  mov    %rax,%rbx
  call   <OPENSSL_free@plt>
  xor    %eax,%eax
  test   %rbx,%rbx
  pop    %rbx
  setg   %al
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
int asn1_print_integer_ctx(BIO *out, ASN1_INTEGER *str, const ASN1_PCTX *pctx) {
  char *s;
  int ret = 1;
  s = i2s_ASN1_INTEGER(NULL, str);
  if (BIO_puts(out, s) <= 0)
    ret = 0;
  OPENSSL_free(s);
  return ret;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<asn1_print_integer_ctx>:
  endbr64
  push   %r12
  mov    %rdi,%r12
  xor    %edi,%edi
  push   %rbp
  push   %rbx
  call   <i2s_ASN1_INTEGER@plt>
  mov    %r12,%rdi
  mov    %rax,%rsi
  mov    %rax,%rbp
  call   <BIO_puts@plt>
  mov    %rbp,%rdi
  mov    %rax,%rbx
  call   <OPENSSL_free@plt>
  xor    %eax,%eax
  test   %rbx,%rbx
  pop    %rbx
  setg   %al
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
int asn1_print_integer_ctx(BIO *out, ASN1_INTEGER *str, const ASN1_PCTX *pctx) {
  char *s;
  int ret = 1;
  s = i2s_ASN1_INTEGER(NULL, str);
  if (BIO_puts(out, s) <= 0)
    ret = 0;
  OPENSSL_free(s);
  return ret;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<thread_func_2>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    (%rax),%eax
  cmp    $0x2,%eax
  je     L8
  lea    D38(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    $0x2d,%edx
  lea    D11(%rip),%rax
  mov    %rax,%rsi
  lea    D30(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    -0x8(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,%edx
  mov    $0x2,%esi
  lea    D49(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x0,%eax
  call   <abort@plt>
  jmp    L10
L8:
  lea    D43(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
L10:
  mov    $0x0,%eax
  leave
  ret
```

tool_calls: name: unpack_data
arguments: tag: D38
data_type: string
name: unpack_data
arguments: tag: D11
data_type: string
name: unpack_data
arguments: tag: D30
data_type: string
name: unpack_data
arguments: tag: D49
data_type: string
name: unpack_data
arguments: tag: D43
data_type: string

tool: D38: 
---- TEST FAILED ----

tool: D11: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ZaoLahma/C_FTPServer/refs/heads/master/test/test.c

tool: D30: File: %s, line: %d


tool: D49: 2 (0x%x) != *testInt (0x%x)


tool: D43: 2 == *testInt validated OK

assistant: ```c
void *thread_func_2(void *arg) {
  unsigned int *testInt = (unsigned int *)arg;
  if (2 != *testInt) {
    printf("\n---- TEST FAILED ----\n");
    printf("File: %s, line: %d\n", "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ZaoLahma/C_FTPServer/refs/heads/master/test/test.c", 45);
    printf("2"
           " (0x%x) != "
           "*testInt"
           " (0x%x)\n",
           (unsigned int)2, (unsigned int)*testInt);
    abort();
  } else {
    printf("2"
           " == "
           "*testInt"
           " validated OK\n");
  };
  return 0;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<thread_func_2>:
  endbr64
  push   %rbx
  cmpl   $0x2,(%rdi)
  je     L12
  mov    %rdi,%rbx
  lea    D20(%rip),%rdi
  call   <puts@plt>
  mov    $0x2d,%edx
  lea    D26(%rip),%rsi
  lea    D19(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    (%rbx),%edx
  mov    $0x2,%esi
  lea    D7(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x0,%eax
  call   <abort@plt>
L3:
  mov    $0x0,%eax
  pop    %rbx
  ret
L12:
  lea    D10(%rip),%rdi
  call   <puts@plt>
  jmp    L3
```

tool_calls: name: retrieve_data
arguments: label: D20
type_guessed: string
name: retrieve_data
arguments: label: D26
type_guessed: string
name: retrieve_data
arguments: label: D19
type_guessed: string
name: retrieve_data
arguments: label: D7
type_guessed: string
name: retrieve_data
arguments: label: D10
type_guessed: string

tool: D20: 
---- TEST FAILED ----

tool: D26: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ZaoLahma/C_FTPServer/refs/heads/master/test/test.c

tool: D19: File: %s, line: %d


tool: D7: 2 (0x%x) != *testInt (0x%x)


tool: D10: 2 == *testInt validated OK

assistant: ```c
void *thread_func_2(void *arg) {
  unsigned int *testInt = (unsigned int *)arg;
  if (2 != *testInt) {
    printf("\n---- TEST FAILED ----\n");
    printf("File: %s, line: %d\n", "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ZaoLahma/C_FTPServer/refs/heads/master/test/test.c", 45);
    printf("2"
           " (0x%x) != "
           "*testInt"
           " (0x%x)\n",
           (unsigned int)2, (unsigned int)*testInt);
    abort();
  } else {
    printf("2"
           " == "
           "*testInt"
           " validated OK\n");
  };
  return 0;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<thread_func_2>:
  endbr64
  push   %rbx
  cmpl   $0x2,(%rdi)
  je     L1
  mov    %rdi,%rbx
  lea    D4(%rip),%rdi
  call   <puts@plt>
  mov    $0x2d,%edx
  lea    D47(%rip),%rsi
  xor    %eax,%eax
  lea    D33(%rip),%rdi
  call   <printf@plt>
  mov    (%rbx),%edx
  mov    $0x2,%esi
  xor    %eax,%eax
  lea    D19(%rip),%rdi
  call   <printf@plt>
  xor    %eax,%eax
  call   <abort@plt>
  xor    %eax,%eax
  pop    %rbx
  ret
  nopl   0x0(%rax,%rax,1)
L1:
  lea    D6(%rip),%rdi
  call   <puts@plt>
  xor    %eax,%eax
  pop    %rbx
  ret
```

tool_calls: name: unpack_data
arguments: tag: D4
type_infered: string
name: unpack_data
arguments: tag: D47
type_infered: string
name: unpack_data
arguments: tag: D33
type_infered: string
name: unpack_data
arguments: tag: D19
type_infered: string
name: unpack_data
arguments: tag: D6
type_infered: string

tool: D4: 
---- TEST FAILED ----

tool: D47: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ZaoLahma/C_FTPServer/refs/heads/master/test/test.c

tool: D33: File: %s, line: %d


tool: D19: 2 (0x%x) != *testInt (0x%x)


tool: D6: 2 == *testInt validated OK

assistant: ```c
void *thread_func_2(void *arg) {
  unsigned int *testInt = (unsigned int *)arg;
  if (2 != *testInt) {
    printf("\n---- TEST FAILED ----\n");
    printf("File: %s, line: %d\n", "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ZaoLahma/C_FTPServer/refs/heads/master/test/test.c", 45);
    printf("2"
           " (0x%x) != "
           "*testInt"
           " (0x%x)\n",
           (unsigned int)2, (unsigned int)*testInt);
    abort();
  } else {
    printf("2"
           " == "
           "*testInt"
           " validated OK\n");
  };
  return 0;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<thread_func_2>:
  endbr64
  push   %rbx
  cmpl   $0x2,(%rdi)
  je     L8
  mov    %rdi,%rbx
  lea    D25(%rip),%rdi
  call   <puts@plt>
  mov    $0x2d,%edx
  lea    D18(%rip),%rsi
  xor    %eax,%eax
  lea    D16(%rip),%rdi
  call   <printf@plt>
  mov    (%rbx),%edx
  mov    $0x2,%esi
  xor    %eax,%eax
  lea    D0(%rip),%rdi
  call   <printf@plt>
  xor    %eax,%eax
  call   <abort@plt>
  xor    %eax,%eax
  pop    %rbx
  ret
  nopl   0x0(%rax,%rax,1)
L8:
  lea    D30(%rip),%rdi
  call   <puts@plt>
  xor    %eax,%eax
  pop    %rbx
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D25
datatype: string
name: extract_symbolic_data
arguments: data_label: D18
datatype: string
name: extract_symbolic_data
arguments: data_label: D16
datatype: string
name: extract_symbolic_data
arguments: data_label: D0
datatype: string
name: extract_symbolic_data
arguments: data_label: D30
datatype: string

tool: D25: 
---- TEST FAILED ----

tool: D18: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ZaoLahma/C_FTPServer/refs/heads/master/test/test.c

tool: D16: File: %s, line: %d


tool: D0: 2 (0x%x) != *testInt (0x%x)


tool: D30: 2 == *testInt validated OK

assistant: ```c
void *thread_func_2(void *arg) {
  unsigned int *testInt = (unsigned int *)arg;
  if (2 != *testInt) {
    printf("\n---- TEST FAILED ----\n");
    printf("File: %s, line: %d\n", "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ZaoLahma/C_FTPServer/refs/heads/master/test/test.c", 45);
    printf("2"
           " (0x%x) != "
           "*testInt"
           " (0x%x)\n",
           (unsigned int)2, (unsigned int)*testInt);
    abort();
  } else {
    printf("2"
           " == "
           "*testInt"
           " validated OK\n");
  };
  return 0;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<ln_range_degrees>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  movsd  %xmm0,-0x18(%rbp)
  movsd  -0x18(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  comisd %xmm1,%xmm0
  jb     L2
  movsd  D23(%rip),%xmm0
  comisd -0x18(%rbp),%xmm0
  jbe    L2
  movsd  -0x18(%rbp),%xmm0
  jmp    L0
L2:
  movsd  -0x18(%rbp),%xmm0
  movsd  D23(%rip),%xmm1
  divsd  %xmm1,%xmm0
  cvttsd2si %xmm0,%eax
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  movsd  %xmm0,-0x8(%rbp)
  pxor   %xmm0,%xmm0
  comisd -0x18(%rbp),%xmm0
  jbe    L17
  movsd  -0x8(%rbp),%xmm0
  movsd  D9(%rip),%xmm1
  subsd  %xmm1,%xmm0
  movsd  %xmm0,-0x8(%rbp)
L17:
  movsd  -0x8(%rbp),%xmm1
  movsd  D23(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,-0x8(%rbp)
  movsd  -0x18(%rbp),%xmm0
  subsd  -0x8(%rbp),%xmm0
L0:
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  pop    %rbp
  ret
```

tool_calls: name: read_data
arguments: data_label: D23
data_type: f64
name: read_data
arguments: data_label: D9
data_type: f32[2]

tool: D23: 360

tool: {"D9": [0.0,1.875]}

assistant: ```c
double ln_range_degrees(double angle) {
  double temp;
  if (angle >= 0.0 && angle < 360.0)
    return angle;
  temp = (int)(angle / 360);
  if (angle < 0.0)
    temp--;
  temp *= 360.0;
  return angle - temp;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<ln_range_degrees>:
  endbr64
  comisd D16(%rip),%xmm0
  jb     L19
  movapd %xmm0,%xmm2
  movsd  D10(%rip),%xmm1
  comisd %xmm0,%xmm1
  ja     L31
L19:
  movapd %xmm0,%xmm1
  divsd  D10(%rip),%xmm1
  cvttsd2si %xmm1,%eax
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  pxor   %xmm2,%xmm2
  comisd %xmm0,%xmm2
  ja     L3
L28:
  mulsd  D10(%rip),%xmm1
  movapd %xmm0,%xmm2
  subsd  %xmm1,%xmm2
L31:
  movapd %xmm2,%xmm0
  ret
L3:
  subsd  D23(%rip),%xmm1
  jmp    L28
```

tool_calls: name: extract_symbolic_data
arguments: tag: D16
datatype: f64[2]
name: extract_symbolic_data
arguments: tag: D10
datatype: f64
name: extract_symbolic_data
arguments: tag: D23
datatype: byte[8]

tool: {"D16": [0.0,360.0]}

tool: D10: 360

tool: {"D23": [0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x3f]}

assistant: ```c
double ln_range_degrees(double angle) {
  double temp;
  if (angle >= 0.0 && angle < 360.0)
    return angle;
  temp = (int)(angle / 360);
  if (angle < 0.0)
    temp--;
  temp *= 360.0;
  return angle - temp;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<ln_range_degrees>:
  endbr64
  pxor   %xmm3,%xmm3
  movsd  D3(%rip),%xmm2
  comisd %xmm3,%xmm0
  jb     L6
  comisd %xmm0,%xmm2
  movapd %xmm0,%xmm4
  ja     L19
L6:
  movapd %xmm0,%xmm1
  comisd %xmm0,%xmm3
  divsd  %xmm2,%xmm1
  cvttsd2si %xmm1,%eax
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  ja     L4
L11:
  mulsd  %xmm2,%xmm1
  movapd %xmm0,%xmm4
  subsd  %xmm1,%xmm4
L19:
  movapd %xmm4,%xmm0
  ret
  nopl   0x0(%rax,%rax,1)
L4:
  subsd  D1(%rip),%xmm1
  jmp    L11
```

tool_calls: name: retrieve_data
arguments: tag: D3
type_guessed: f64
name: retrieve_data
arguments: tag: D1
type_guessed: f32[2]

tool: D3: 360

tool: {"D1": [0.0,1.875]}

assistant: ```c
double ln_range_degrees(double angle) {
  double temp;
  if (angle >= 0.0 && angle < 360.0)
    return angle;
  temp = (int)(angle / 360);
  if (angle < 0.0)
    temp--;
  temp *= 360.0;
  return angle - temp;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<ln_range_degrees>:
  endbr64
  pxor   %xmm3,%xmm3
  movsd  D17(%rip),%xmm2
  comisd %xmm3,%xmm0
  jb     L9
  comisd %xmm0,%xmm2
  movapd %xmm0,%xmm4
  ja     L39
L9:
  movapd %xmm0,%xmm1
  comisd %xmm0,%xmm3
  divsd  %xmm2,%xmm1
  cvttsd2si %xmm1,%eax
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  ja     L32
L0:
  mulsd  %xmm2,%xmm1
  movapd %xmm0,%xmm4
  subsd  %xmm1,%xmm4
L39:
  movapd %xmm4,%xmm0
  ret
  nopl   0x0(%rax,%rax,1)
L32:
  subsd  D7(%rip),%xmm1
  jmp    L0
```

tool_calls: name: retrieve_data
arguments: data_label: D17
type_infered: f64
name: retrieve_data
arguments: data_label: D7
type_infered: f32[2]

tool: D17: 360

tool: {"D7": [0.0,1.875]}

assistant: ```c
double ln_range_degrees(double angle) {
  double temp;
  if (angle >= 0.0 && angle < 360.0)
    return angle;
  temp = (int)(angle / 360);
  if (angle < 0.0)
    temp--;
  temp *= 360.0;
  return angle - temp;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<load_ranking>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x148,%rsp
  mov    %rdi,-0x138(%rbp)
  mov    %rsi,-0x140(%rbp)
  mov    %rdx,-0x148(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x18(%rbp)
  xor    %eax,%eax
  movl   $0xa,-0x12c(%rbp)
  mov    -0x148(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  jne    L11
  mov    -0x12c(%rbp),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    -0x148(%rbp),%rdx
  mov    %rax,(%rdx)
L11:
  mov    -0x138(%rbp),%rax
  lea    D10(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x128(%rbp)
  cmpq   $0x0,-0x128(%rbp)
  jne    L42
  lea    D5(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x1,%edi
  call   <exit@plt>
L42:
  mov    -0x140(%rbp),%rax
  movl   $0x0,(%rax)
  jmp    L19
L51:
  mov    -0x140(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x12c(%rbp)
  jne    L36
  addl   $0xa,-0x12c(%rbp)
  mov    -0x12c(%rbp),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%edx
  mov    -0x148(%rbp),%rax
  mov    (%rax),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <realloc@plt>
  mov    -0x148(%rbp),%rdx
  mov    %rax,(%rdx)
L36:
  mov    -0x148(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x140(%rbp),%rax
  mov    (%rax),%eax
  cltq
  shl    $0x3,%rax
  lea    (%rdx,%rax,1),%rbx
  lea    -0x120(%rbp),%rax
  mov    %rax,%rdi
  call   <atof@plt>
  movq   %xmm0,%rax
  mov    %rax,(%rbx)
  mov    -0x140(%rbp),%rax
  mov    (%rax),%eax
  lea    0x1(%rax),%edx
  mov    -0x140(%rbp),%rax
  mov    %edx,(%rax)
L19:
  mov    -0x128(%rbp),%rdx
  lea    -0x120(%rbp),%rax
  mov    $0xff,%esi
  mov    %rax,%rdi
  call   <fgets@plt>
  test   %rax,%rax
  jne    L51
  nop
  mov    -0x18(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L45
  call   <__stack_chk_fail@plt>
L45:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D10
type_infered: string
name: extract_symbolic_data
arguments: data_label: D5
type_infered: string

tool: D10: r

tool: D5: Unable to open file: %s!!! Exiting


assistant: ```c
void load_ranking(char *fname, int *N, double **R) {
  char buff[256];
  int size = 10;
  FILE *f;
  if (*R == NULL) {
    *R = malloc(size * sizeof(double));
  }
  f = fopen(fname, "r");
  if (!f) {
    printf("Unable to open file: %s!!! Exiting\n");
    exit(1);
  }
  *N = 0;
  while (fgets(buff, 255, f)) {
    if (*N == size) {
      size += 10;
      *R = realloc(*R, size * sizeof(double));
    }
    (*R)[*N] = atof(buff);
    *N += 1;
  }
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<load_ranking>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x118,%rsp
  mov    %rdi,%rbp
  mov    %rsi,%rbx
  mov    %rdx,%r12
  mov    %fs:0x28,%rax
  mov    %rax,0x108(%rsp)
  xor    %eax,%eax
  cmpq   $0x0,(%rdx)
  je     L18
L26:
  lea    D18(%rip),%rsi
  mov    %rbp,%rdi
  call   <fopen@plt>
  mov    %rax,%r14
  test   %rax,%rax
  je     L75
L48:
  mov    $0x0,%eax
  mov    $0xa,%r13d
  mov    %rsp,%rbp
  jmp    L12
L18:
  mov    $0x50,%edi
  call   <malloc@plt>
  mov    %rax,(%r12)
  jmp    L26
L75:
  lea    D2(%rip),%rdi
  call   <printf@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L48
L27:
  movslq (%rbx),%rdx
  mov    (%r12),%rax
  lea    (%rax,%rdx,8),%r15
  mov    %rbp,%rdi
  call   <atof@plt>
  movsd  %xmm0,(%r15)
  mov    (%rbx),%eax
  add    $0x1,%eax
L12:
  mov    %eax,(%rbx)
  mov    %r14,%rdx
  mov    $0xff,%esi
  mov    %rbp,%rdi
  call   <fgets@plt>
  test   %rax,%rax
  je     L25
  cmp    %r13d,(%rbx)
  jne    L27
  add    $0xa,%r13d
  lea    0x0(,%r13,8),%esi
  mov    (%r12),%rdi
  call   <realloc@plt>
  mov    %rax,(%r12)
  jmp    L27
L25:
  mov    0x108(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L33
  add    $0x118,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L33:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_label: D18
type_guessed: string
name: unpack_data
arguments: data_label: D2
type_guessed: string

tool: D18: r

tool: D2: Unable to open file: %s!!! Exiting


assistant: ```c
void load_ranking(char *fname, int *N, double **R) {
  char buff[256];
  int size = 10;
  FILE *f;
  if (*R == NULL) {
    *R = malloc(size * sizeof(double));
  }
  f = fopen(fname, "r");
  if (!f) {
    printf("Unable to open file: %s!!! Exiting\n");
    exit(1);
  }
  *N = 0;
  while (fgets(buff, 255, f)) {
    if (*N == size) {
      size += 10;
      *R = realloc(*R, size * sizeof(double));
    }
    (*R)[*N] = atof(buff);
    *N += 1;
  }
}
```