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

```asm
<literal_string_Good>:
  endbr64
  ret
```

assistant: ```c
void literal_string_Good() {
  int a[1];
  char *s = "hello";
  for (int i = 0; i < 5; i++) {
    if (s[i] > 'o') {
      a[s[i]] = 0;
    }
  }
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    D12(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    -0xc(%rbp),%rax
  mov    %rax,%rsi
  lea    D11(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  cmp    $0x1,%eax
  je     L15
  lea    D28(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x1,%eax
  jmp    L13
L15:
  mov    -0xc(%rbp),%eax
  mov    %eax,%edi
  call   <sieve@plt>
  mov    $0x0,%eax
L13:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L28
  call   <__stack_chk_fail@plt>
L28:
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: data_label: D12
type: string
name: disassemble_data
arguments: data_label: D11
type: string
name: disassemble_data
arguments: data_label: D28
type: string

tool: D12: n = 

tool: D11:  %d

tool: D28: Bad input!


assistant: ```c
int main(void) {
  printf("n = ");
  int n;
  if (scanf(" %d", &n) != 1) {
    printf("Bad input!\n");
    return 1;
  }
  sieve(n);
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<main>:
  endbr64
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    D8(%rip),%rdi
  call   <printf@plt>
  lea    0x4(%rsp),%rsi
  lea    D20(%rip),%rdi
  call   <scanf@plt>
  cmp    $0x1,%eax
  je     L20
  lea    D17(%rip),%rdi
  call   <printf@plt>
  mov    $0x1,%eax
L18:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L11
  add    $0x18,%rsp
  ret
L20:
  mov    0x4(%rsp),%edi
  call   <sieve@plt>
  mov    $0x0,%eax
  jmp    L18
L11:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: label: D8
datatype: string
name: extract_symbolic_data
arguments: label: D20
datatype: string
name: extract_symbolic_data
arguments: label: D17
datatype: string

tool: D8: n = 

tool: D20:  %d

tool: D17: Bad input!


assistant: ```c
int main(void) {
  printf("n = ");
  int n;
  if (scanf(" %d", &n) != 1) {
    printf("Bad input!\n");
    return 1;
  }
  sieve(n);
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<main>:
  endbr64
  sub    $0x18,%rsp
  lea    D24(%rip),%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  call   <printf@plt>
  lea    0x4(%rsp),%rsi
  lea    D4(%rip),%rdi
  call   <scanf@plt>
  cmp    $0x1,%eax
  je     L23
  lea    D8(%rip),%rdi
  call   <printf@plt>
  mov    $0x1,%eax
L2:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L26
  add    $0x18,%rsp
  ret
L23:
  mov    0x4(%rsp),%edi
  call   <sieve@plt>
  xor    %eax,%eax
  jmp    L2
L26:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_label: D24
data_type: string
name: read_data
arguments: data_label: D4
data_type: string
name: read_data
arguments: data_label: D8
data_type: string

tool: D24: n = 

tool: D4:  %d

tool: D8: Bad input!


assistant: ```c
int main(void) {
  printf("n = ");
  int n;
  if (scanf(" %d", &n) != 1) {
    printf("Bad input!\n");
    return 1;
  }
  sieve(n);
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<main>:
  endbr64
  sub    $0x18,%rsp
  lea    D25(%rip),%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  call   <printf@plt>
  lea    0x4(%rsp),%rsi
  lea    D21(%rip),%rdi
  call   <scanf@plt>
  cmp    $0x1,%eax
  je     L7
  lea    D10(%rip),%rdi
  call   <printf@plt>
  mov    $0x1,%eax
L27:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L3
  add    $0x18,%rsp
  ret
L7:
  mov    0x4(%rsp),%edi
  call   <sieve@plt>
  xor    %eax,%eax
  jmp    L27
L3:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: tag: D25
type: string
name: disassemble_data
arguments: tag: D21
type: string
name: disassemble_data
arguments: tag: D10
type: string

tool: D25: n = 

tool: D21:  %d

tool: D10: Bad input!


assistant: ```c
int main(void) {
  printf("n = ");
  int n;
  if (scanf(" %d", &n) != 1) {
    printf("Bad input!\n");
    return 1;
  }
  sieve(n);
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<GenMes>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,%eax
  mov    %esi,%edx
  mov    %ax,-0x14(%rbp)
  mov    %edx,%eax
  mov    %al,-0x18(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movzwl -0x14(%rbp),%eax
  movzbl %al,%eax
  mov    %eax,%esi
  mov    $0x194,%edi
  call   <RegWriteA@plt>
  movzwl -0x14(%rbp),%eax
  shr    $0x8,%ax
  movzbl %al,%eax
  and    $0x1,%eax
  mov    %eax,%esi
  mov    $0x195,%edi
  call   <RegWriteA@plt>
  mov    $0x0,%esi
  mov    $0x1041,%edi
  call   <RamWrite32A@plt>
  cmpb   $0x0,-0x18(%rbp)
  jne    L28
  mov    $0x4,%esi
  mov    $0x193,%edi
  call   <RegWriteA@plt>
  mov    $0x0,%esi
  mov    $0x192,%edi
  call   <RegWriteA@plt>
  mov    $0x3a7ffff7,%esi
  mov    $0x1230,%edi
  call   <RamWrite32A@plt>
  jmp    L21
L28:
  mov    $0x1,%esi
  mov    $0x193,%edi
  call   <RegWriteA@plt>
  mov    $0x0,%esi
  mov    $0x192,%edi
  call   <RegWriteA@plt>
  mov    $0x3f800000,%esi
  mov    $0x1230,%edi
  call   <RamWrite32A@plt>
L21:
  mov    $0x0,%esi
  mov    $0x198,%edi
  call   <RegWriteA@plt>
  mov    $0x1,%esi
  mov    $0x190,%edi
  call   <BsyWit@plt>
  mov    $0x1,%edi
  call   <RamAccFixMod@plt>
  lea    -0xa(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x1041,%edi
  call   <RamReadA@plt>
  mov    $0x0,%edi
  call   <RamAccFixMod@plt>
  movzwl -0xa(%rbp),%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L22
  call   <__stack_chk_fail@plt>
L22:
  leave
  ret
```

assistant: ```c
short GenMes(unsigned short UsRamAdd, unsigned char UcMesMod) {
  short SsMesRlt;
  RegWriteA(0x0194, (unsigned char)UsRamAdd);
  RegWriteA(0x0195, (unsigned char)((UsRamAdd >> 8) & 0x0001));
  RamWrite32A(0x1041, 0x00000000);
  if (!UcMesMod) {
    RegWriteA(0x0193, 0x04);
    RegWriteA(0x0192, 0x00);
    RamWrite32A(0x1230, 0x3A7FFFF7);
  } else {
    RegWriteA(0x0193, 0x01);
    RegWriteA(0x0192, 0x00);
    RamWrite32A(0x1230, 0x3F800000);
  }
  RegWriteA(0x0198, 0x00);
  BsyWit(0x0190, 0x01);
  RamAccFixMod(0x01);
  RamReadA(0x1041, (unsigned short *)&SsMesRlt);
  RamAccFixMod(0x00);
  return (SsMesRlt);
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<GenMes>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %edi,%ebx
  mov    %esi,%ebp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  movzbl %dil,%esi
  mov    $0x194,%edi
  call   <RegWriteA@plt>
  mov    %ebx,%esi
  shr    $0x8,%si
  and    $0x1,%esi
  mov    $0x195,%edi
  call   <RegWriteA@plt>
  mov    $0x0,%esi
  mov    $0x1041,%edi
  call   <RamWrite32A@plt>
  test   %bpl,%bpl
  jne    L17
  mov    $0x4,%esi
  mov    $0x193,%edi
  call   <RegWriteA@plt>
  mov    $0x0,%esi
  mov    $0x192,%edi
  call   <RegWriteA@plt>
  mov    $0x3a7ffff7,%esi
  mov    $0x1230,%edi
  call   <RamWrite32A@plt>
L3:
  mov    $0x0,%esi
  mov    $0x198,%edi
  call   <RegWriteA@plt>
  mov    $0x1,%esi
  mov    $0x190,%edi
  call   <BsyWit@plt>
  mov    $0x1,%edi
  call   <RamAccFixMod@plt>
  lea    0x6(%rsp),%rsi
  mov    $0x1041,%edi
  call   <RamReadA@plt>
  mov    $0x0,%edi
  call   <RamAccFixMod@plt>
  movzwl 0x6(%rsp),%eax
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L0
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  ret
L17:
  mov    $0x1,%esi
  mov    $0x193,%edi
  call   <RegWriteA@plt>
  mov    $0x0,%esi
  mov    $0x192,%edi
  call   <RegWriteA@plt>
  mov    $0x3f800000,%esi
  mov    $0x1230,%edi
  call   <RamWrite32A@plt>
  jmp    L3
L0:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
short GenMes(unsigned short UsRamAdd, unsigned char UcMesMod) {
  short SsMesRlt;
  RegWriteA(0x0194, (unsigned char)UsRamAdd);
  RegWriteA(0x0195, (unsigned char)((UsRamAdd >> 8) & 0x0001));
  RamWrite32A(0x1041, 0x00000000);
  if (!UcMesMod) {
    RegWriteA(0x0193, 0x04);
    RegWriteA(0x0192, 0x00);
    RamWrite32A(0x1230, 0x3A7FFFF7);
  } else {
    RegWriteA(0x0193, 0x01);
    RegWriteA(0x0192, 0x00);
    RamWrite32A(0x1230, 0x3F800000);
  }
  RegWriteA(0x0198, 0x00);
  BsyWit(0x0190, 0x01);
  RamAccFixMod(0x01);
  RamReadA(0x1041, (unsigned short *)&SsMesRlt);
  RamAccFixMod(0x00);
  return (SsMesRlt);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<GenMes>:
  endbr64
  push   %rbp
  mov    %esi,%ebp
  movzbl %dil,%esi
  push   %rbx
  mov    %edi,%ebx
  mov    $0x194,%edi
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  call   <RegWriteA@plt>
  mov    %ebx,%esi
  mov    $0x195,%edi
  shr    $0x8,%si
  and    $0x1,%esi
  call   <RegWriteA@plt>
  xor    %esi,%esi
  mov    $0x1041,%edi
  call   <RamWrite32A@plt>
  test   %bpl,%bpl
  jne    L5
  mov    $0x4,%esi
  mov    $0x193,%edi
  call   <RegWriteA@plt>
  xor    %esi,%esi
  mov    $0x192,%edi
  call   <RegWriteA@plt>
  mov    $0x3a7ffff7,%esi
  mov    $0x1230,%edi
  call   <RamWrite32A@plt>
L12:
  xor    %esi,%esi
  mov    $0x198,%edi
  call   <RegWriteA@plt>
  mov    $0x1,%esi
  mov    $0x190,%edi
  call   <BsyWit@plt>
  mov    $0x1,%edi
  call   <RamAccFixMod@plt>
  lea    0x6(%rsp),%rsi
  mov    $0x1041,%edi
  call   <RamReadA@plt>
  xor    %edi,%edi
  call   <RamAccFixMod@plt>
  movzwl 0x6(%rsp),%eax
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L29
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  ret
  nopl   (%rax)
L5:
  mov    $0x1,%esi
  mov    $0x193,%edi
  call   <RegWriteA@plt>
  xor    %esi,%esi
  mov    $0x192,%edi
  call   <RegWriteA@plt>
  mov    $0x3f800000,%esi
  mov    $0x1230,%edi
  call   <RamWrite32A@plt>
  jmp    L12
L29:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
short GenMes(unsigned short UsRamAdd, unsigned char UcMesMod) {
  short SsMesRlt;
  RegWriteA(0x0194, (unsigned char)UsRamAdd);
  RegWriteA(0x0195, (unsigned char)((UsRamAdd >> 8) & 0x0001));
  RamWrite32A(0x1041, 0x00000000);
  if (!UcMesMod) {
    RegWriteA(0x0193, 0x04);
    RegWriteA(0x0192, 0x00);
    RamWrite32A(0x1230, 0x3A7FFFF7);
  } else {
    RegWriteA(0x0193, 0x01);
    RegWriteA(0x0192, 0x00);
    RamWrite32A(0x1230, 0x3F800000);
  }
  RegWriteA(0x0198, 0x00);
  BsyWit(0x0190, 0x01);
  RamAccFixMod(0x01);
  RamReadA(0x1041, (unsigned short *)&SsMesRlt);
  RamAccFixMod(0x00);
  return (SsMesRlt);
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<GenMes>:
  endbr64
  push   %rbp
  mov    %esi,%ebp
  movzbl %dil,%esi
  push   %rbx
  mov    %edi,%ebx
  mov    $0x194,%edi
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  call   <RegWriteA@plt>
  mov    %ebx,%esi
  mov    $0x195,%edi
  shr    $0x8,%si
  and    $0x1,%esi
  call   <RegWriteA@plt>
  xor    %esi,%esi
  mov    $0x1041,%edi
  call   <RamWrite32A@plt>
  test   %bpl,%bpl
  jne    L24
  mov    $0x4,%esi
  mov    $0x193,%edi
  call   <RegWriteA@plt>
  xor    %esi,%esi
  mov    $0x192,%edi
  call   <RegWriteA@plt>
  mov    $0x3a7ffff7,%esi
  mov    $0x1230,%edi
  call   <RamWrite32A@plt>
L27:
  xor    %esi,%esi
  mov    $0x198,%edi
  call   <RegWriteA@plt>
  mov    $0x1,%esi
  mov    $0x190,%edi
  call   <BsyWit@plt>
  mov    $0x1,%edi
  call   <RamAccFixMod@plt>
  lea    0x6(%rsp),%rsi
  mov    $0x1041,%edi
  call   <RamReadA@plt>
  xor    %edi,%edi
  call   <RamAccFixMod@plt>
  movzwl 0x6(%rsp),%eax
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L18
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  ret
  nopl   (%rax)
L24:
  mov    $0x1,%esi
  mov    $0x193,%edi
  call   <RegWriteA@plt>
  xor    %esi,%esi
  mov    $0x192,%edi
  call   <RegWriteA@plt>
  mov    $0x3f800000,%esi
  mov    $0x1230,%edi
  call   <RamWrite32A@plt>
  jmp    L27
L18:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
short GenMes(unsigned short UsRamAdd, unsigned char UcMesMod) {
  short SsMesRlt;
  RegWriteA(0x0194, (unsigned char)UsRamAdd);
  RegWriteA(0x0195, (unsigned char)((UsRamAdd >> 8) & 0x0001));
  RamWrite32A(0x1041, 0x00000000);
  if (!UcMesMod) {
    RegWriteA(0x0193, 0x04);
    RegWriteA(0x0192, 0x00);
    RamWrite32A(0x1230, 0x3A7FFFF7);
  } else {
    RegWriteA(0x0193, 0x01);
    RegWriteA(0x0192, 0x00);
    RamWrite32A(0x1230, 0x3F800000);
  }
  RegWriteA(0x0198, 0x00);
  BsyWit(0x0190, 0x01);
  RamAccFixMod(0x01);
  RamReadA(0x1041, (unsigned short *)&SsMesRlt);
  RamAccFixMod(0x00);
  return (SsMesRlt);
}
```
user: Translate the below assembly code into C programming language:

```asm
<ps_test_open>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0xd0,%rsp
  mov    %rdi,-0xc8(%rbp)
  mov    %esi,-0xcc(%rbp)
  mov    %rdx,-0xa0(%rbp)
  mov    %rcx,-0x98(%rbp)
  mov    %r8,-0x90(%rbp)
  mov    %r9,-0x88(%rbp)
  test   %al,%al
  je     L1
  movaps %xmm0,-0x80(%rbp)
  movaps %xmm1,-0x70(%rbp)
  movaps %xmm2,-0x60(%rbp)
  movaps %xmm3,-0x50(%rbp)
  movaps %xmm4,-0x40(%rbp)
  movaps %xmm5,-0x30(%rbp)
  movaps %xmm6,-0x20(%rbp)
  movaps %xmm7,-0x10(%rbp)
L1:
  mov    -0xcc(%rbp),%edx
  mov    -0xc8(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <open@plt>
  mov    %eax,-0xb4(%rbp)
  cmpl   $0xffffffff,-0xb4(%rbp)
  jne    L0
  mov    -0xc8(%rbp),%rax
  mov    %rax,%rdi
  call   <perror@plt>
  mov    $0x1,%edi
  call   <exit@plt>
L0:
  mov    -0xb4(%rbp),%eax
  mov    %eax,%esi
  lea    D5(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    -0xb4(%rbp),%eax
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: data_tag: D5
datatype: string

tool: D5: dskr = %d


assistant: ```c
int ps_test_open(const char *name, int oflag, ...) {
  int dskr;
  dskr = open(name, oflag);
  if (dskr == -1) {
    perror(name);
    exit(1);
  }
  if (0 == 0)
    printf("dskr = %d\n", dskr);
  return dskr;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<ps_test_open>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbp
  call   <open@plt>
  mov    %eax,%ebx
  cmp    $0xffffffff,%eax
  je     L16
L13:
  mov    %ebx,%esi
  lea    D8(%rip),%rdi
  call   <printf@plt>
  mov    %ebx,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
L16:
  mov    %rbp,%rdi
  call   <perror@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L13
```

tool_calls: name: retrieve_data
arguments: label: D8
type: string

tool: D8: dskr = %d


assistant: ```c
int ps_test_open(const char *name, int oflag, ...) {
  int dskr;
  dskr = open(name, oflag);
  if (dskr == -1) {
    perror(name);
    exit(1);
  }
  if (0 == 0)
    printf("dskr = %d\n", dskr);
  return dskr;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<ps_test_open>:
  endbr64
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  sub    $0x8,%rsp
  call   <open@plt>
  mov    %eax,%r12d
  cmp    $0xffffffff,%eax
  je     L8
L12:
  mov    %r12d,%esi
  lea    D0(%rip),%rdi
  call   <printf@plt>
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  ret
  nopl   (%rax)
L8:
  mov    %rbp,%rdi
  call   <perror@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L12
```

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

tool: D0: dskr = %d


assistant: ```c
int ps_test_open(const char *name, int oflag, ...) {
  int dskr;
  dskr = open(name, oflag);
  if (dskr == -1) {
    perror(name);
    exit(1);
  }
  if (0 == 0)
    printf("dskr = %d\n", dskr);
  return dskr;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<ps_test_open>:
  endbr64
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  sub    $0x8,%rsp
  call   <open@plt>
  mov    %eax,%r12d
  cmp    $0xffffffff,%eax
  je     L14
L5:
  mov    %r12d,%esi
  lea    D5(%rip),%rdi
  call   <printf@plt>
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  ret
  nopl   (%rax)
L14:
  mov    %rbp,%rdi
  call   <perror@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L5
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D5
datatype: string

tool: D5: dskr = %d


assistant: ```c
int ps_test_open(const char *name, int oflag, ...) {
  int dskr;
  dskr = open(name, oflag);
  if (dskr == -1) {
    perror(name);
    exit(1);
  }
  if (0 == 0)
    printf("dskr = %d\n", dskr);
  return dskr;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<trap_minimum>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x58,%rsp
  mov    %rdi,%r12
  mov    %rsi,%rbp
  mov    %rdx,0x10(%rsp)
  mov    %rcx,%r13
  mov    %r8,%r14
  mov    %r9,%r15
  movsd  %xmm0,0x18(%rsp)
  mov    0x90(%rsp),%rbx
  mov    %fs:0x28,%rax
  mov    %rax,0x48(%rsp)
  xor    %eax,%eax
  movapd %xmm0,%xmm1
  movsd  (%rdi),%xmm0
  call   <numcmp@plt>
  movl   $0x1,0x24(%rsp)
  test   %rax,%rax
  jg     L42
L71:
  lea    0x40(%rsp),%rax
  mov    %rax,0x28(%rsp)
  jmp    L30
L42:
  movsd  0x18(%rsp),%xmm1
  mov    0x10(%rsp),%rax
  movsd  (%rax),%xmm0
  call   <numcmp@plt>
  test   %rax,%rax
  setle  %al
  movzbl %al,%eax
  mov    %eax,0x24(%rsp)
  jmp    L71
L55:
  mov    0x24(%rsp),%eax
  cmp    0x98(%rsp),%eax
  jge    L10
  lea    0x3c(%rsp),%rdi
  movsd  (%r15),%xmm2
  movsd  (%r14),%xmm1
  movsd  0x0(%r13),%xmm0
  mov    0x28(%rsp),%rsi
  call   <golden_section_probe@plt>
  cmpl   $0x0,0x3c(%rsp)
  je     L10
  movsd  0x40(%rsp),%xmm0
  call   *%rbx
  movsd  %xmm0,0x8(%rsp)
  movapd %xmm0,%xmm1
  movsd  0x40(%rsp),%xmm0
  mov    %r15,%r9
  mov    %r14,%r8
  mov    %r13,%rcx
  mov    0x10(%rsp),%rdx
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <insert_new_trap_point@plt>
  movsd  0x18(%rsp),%xmm1
  movsd  0x0(%rbp),%xmm0
  call   <numcmp@plt>
  test   %rax,%rax
  jle    L57
L30:
  movsd  0x0(%rbp),%xmm1
  movsd  (%r12),%xmm0
  call   <numcmp@plt>
  test   %rax,%rax
  jg     L55
  movsd  0x0(%rbp),%xmm1
  mov    0x10(%rsp),%rax
  movsd  (%rax),%xmm0
  call   <numcmp@plt>
  test   %rax,%rax
  jg     L55
L10:
  mov    0x48(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L76
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L57:
  movsd  0x18(%rsp),%xmm1
  movsd  0x8(%rsp),%xmm0
  call   <numcmp@plt>
  test   %rax,%rax
  setle  %al
  movzbl %al,%eax
  add    %eax,0x24(%rsp)
  jmp    L30
L76:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void trap_minimum(double *pf0, double *pf1, double *pf2, double *px0, double *px1, double *px2, double f_goal, double (*pfunction)(double x), int max_iterations) {
  double xnew, fnew;
  int success;
  int improvement_count;
  improvement_count = 0;
  if ((numcmp(*pf0, f_goal) <= 0) || (numcmp(*pf2, f_goal) <= 0))
    ++improvement_count;
  while ((numcmp(*pf0, *pf1) > 0) || (numcmp(*pf2, *pf1) > 0)) {
    if (improvement_count >= max_iterations)
      break;
    golden_section_probe(&success, &xnew, *px0, *px1, *px2);
    if (!success)
      break;
    fnew = (*pfunction)(xnew);
    insert_new_trap_point(pf0, pf1, pf2, px0, px1, px2, xnew, fnew);
    if ((numcmp(*pf1, f_goal) <= 0) && (numcmp(fnew, f_goal) <= 0))
      ++improvement_count;
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<trap_minimum>:
  endbr64
  push   %r15
  movapd %xmm0,%xmm1
  mov    %rdx,%r15
  push   %r14
  mov    %r9,%r14
  push   %r13
  mov    %r8,%r13
  push   %r12
  mov    %rcx,%r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x58,%rsp
  mov    0x90(%rsp),%rax
  movsd  %xmm0,0x10(%rsp)
  movsd  (%rdi),%xmm0
  mov    %rax,0x28(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x48(%rsp)
  xor    %eax,%eax
  call   <numcmp@plt>
  movl   $0x1,0x1c(%rsp)
  test   %rax,%rax
  jle    L69
  movsd  0x10(%rsp),%xmm1
  movsd  (%r15),%xmm0
  call   <numcmp@plt>
  test   %rax,%rax
  setle  %al
  movzbl %al,%eax
  mov    %eax,0x1c(%rsp)
L69:
  lea    0x40(%rsp),%rax
  mov    %rax,0x20(%rsp)
  jmp    L2
  nopl   (%rax)
L23:
  mov    0x1c(%rsp),%eax
  cmp    0x98(%rsp),%eax
  jge    L33
  movsd  (%r14),%xmm2
  movsd  0x0(%r13),%xmm1
  lea    0x3c(%rsp),%rdi
  movsd  (%r12),%xmm0
  mov    0x20(%rsp),%rsi
  call   <golden_section_probe@plt>
  mov    0x3c(%rsp),%eax
  test   %eax,%eax
  je     L33
  mov    0x28(%rsp),%rax
  movsd  0x40(%rsp),%xmm0
  call   *%rax
  mov    %r14,%r9
  mov    %r13,%r8
  mov    %r12,%rcx
  movapd %xmm0,%xmm1
  movsd  %xmm0,0x8(%rsp)
  mov    %r15,%rdx
  mov    %rbx,%rsi
  movsd  0x40(%rsp),%xmm0
  mov    %rbp,%rdi
  call   <insert_new_trap_point@plt>
  movsd  0x10(%rsp),%xmm1
  movsd  (%rbx),%xmm0
  call   <numcmp@plt>
  movsd  0x8(%rsp),%xmm2
  test   %rax,%rax
  jle    L27
L2:
  movsd  (%rbx),%xmm1
  movsd  0x0(%rbp),%xmm0
  call   <numcmp@plt>
  test   %rax,%rax
  jg     L23
  movsd  (%rbx),%xmm1
  movsd  (%r15),%xmm0
  call   <numcmp@plt>
  test   %rax,%rax
  jg     L23
  nopl   (%rax)
L33:
  mov    0x48(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L71
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L27:
  movsd  0x10(%rsp),%xmm1
  movapd %xmm2,%xmm0
  call   <numcmp@plt>
  test   %rax,%rax
  setle  %al
  movzbl %al,%eax
  add    %eax,0x1c(%rsp)
  jmp    L2
L71:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void trap_minimum(double *pf0, double *pf1, double *pf2, double *px0, double *px1, double *px2, double f_goal, double (*pfunction)(double x), int max_iterations) {
  double xnew, fnew;
  int success;
  int improvement_count;
  improvement_count = 0;
  if ((numcmp(*pf0, f_goal) <= 0) || (numcmp(*pf2, f_goal) <= 0))
    ++improvement_count;
  while ((numcmp(*pf0, *pf1) > 0) || (numcmp(*pf2, *pf1) > 0)) {
    if (improvement_count >= max_iterations)
      break;
    golden_section_probe(&success, &xnew, *px0, *px1, *px2);
    if (!success)
      break;
    fnew = (*pfunction)(xnew);
    insert_new_trap_point(pf0, pf1, pf2, px0, px1, px2, xnew, fnew);
    if ((numcmp(*pf1, f_goal) <= 0) && (numcmp(fnew, f_goal) <= 0))
      ++improvement_count;
  }
}
```