user: Please show me the C implementation that matches the assembly code listed below:

```asm
<rpn_eval>:
  endbr64
  push   %r15
  lea    D100(%rip),%rsi
  movq   %xmm0,%r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x18,%rsp
  call   <fopen@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L91
L165:
  lea    D62(%rip),%r12
  lea    D81(%rip),%r13
  lea    D67(%rip),%r14
  nopw   0x0(%rax,%rax,1)
L115:
  mov    %rbx,%rdi
  call   <nextword@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L174
L166:
  mov    %rbp,%rdi
  call   <atof@plt>
  pxor   %xmm2,%xmm2
  ucomisd %xmm2,%xmm0
  jp     L1
  jne    L1
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L159
  movq   %r15,%xmm0
  call   <stack_push@plt>
  mov    %rbx,%rdi
  call   <nextword@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  jne    L166
L174:
  xor    %eax,%eax
  call   <stack_top@plt>
  cmp    $0x1,%eax
  je     L93
  lea    D123(%rip),%rdi
  call   <puts@plt>
  mov    $0x1,%edi
  call   <exit@plt>
L93:
  add    $0x18,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1210 <stack_pop@plt>
L69:
  lea    D38(%rip),%rsi
  mov    %rbp,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L115
  call   <stack_pop@plt>
  call   <exp@plt>
  nopl   0x0(%rax,%rax,1)
L1:
  call   <stack_push@plt>
  jmp    L115
  nopw   0x0(%rax,%rax,1)
L159:
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L254
  call   <stack_pop@plt>
  xor    %eax,%eax
  movsd  %xmm0,0x8(%rsp)
  call   <stack_pop@plt>
  addsd  0x8(%rsp),%xmm0
  call   <stack_push@plt>
  jmp    L115
  nopw   0x0(%rax,%rax,1)
L254:
  mov    %r14,%rsi
  mov    %rbp,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L102
  call   <stack_pop@plt>
  xor    %eax,%eax
  movsd  %xmm0,0x8(%rsp)
  call   <stack_pop@plt>
  subsd  0x8(%rsp),%xmm0
  call   <stack_push@plt>
  jmp    L115
  nopw   0x0(%rax,%rax,1)
L102:
  lea    D76(%rip),%rsi
  mov    %rbp,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L240
  call   <stack_pop@plt>
  xor    %eax,%eax
  movsd  %xmm0,0x8(%rsp)
  call   <stack_pop@plt>
  mulsd  0x8(%rsp),%xmm0
  call   <stack_push@plt>
  jmp    L115
  xchg   %ax,%ax
L240:
  lea    D7(%rip),%rsi
  mov    %rbp,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L195
  lea    D71(%rip),%rsi
  mov    %rbp,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L147
  call   <stack_pop@plt>
  call   <sin@plt>
  call   <stack_push@plt>
  jmp    L115
  nopl   0x0(%rax)
L195:
  call   <stack_pop@plt>
  xor    %eax,%eax
  movsd  %xmm0,0x8(%rsp)
  call   <stack_pop@plt>
  divsd  0x8(%rsp),%xmm0
  call   <stack_push@plt>
  jmp    L115
  nopw   0x0(%rax,%rax,1)
L91:
  mov    %rbp,%rsi
  lea    D46(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L165
L147:
  lea    D15(%rip),%rsi
  mov    %rbp,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L73
  lea    D69(%rip),%rsi
  mov    %rbp,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L47
  call   <stack_pop@plt>
  xor    %eax,%eax
  movsd  %xmm0,0x8(%rsp)
  call   <stack_pop@plt>
  movsd  0x8(%rsp),%xmm1
  call   <pow@plt>
  call   <stack_push@plt>
  jmp    L115
L73:
  call   <stack_pop@plt>
  call   <cos@plt>
  call   <stack_push@plt>
  jmp    L115
L47:
  lea    D124(%rip),%rsi
  mov    %rbp,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L69
  call   <stack_pop@plt>
  call   <log@plt>
  call   <stack_push@plt>
  jmp    L115
```

tool_calls: name: parse_data
arguments: data_label: D100
type_infered: string
name: parse_data
arguments: data_label: D62
type_infered: string
name: parse_data
arguments: data_label: D81
type_infered: string
name: parse_data
arguments: data_label: D67
type_infered: string
name: parse_data
arguments: data_label: D123
type_infered: string
name: parse_data
arguments: data_label: D38
type_infered: string
name: parse_data
arguments: data_label: D76
type_infered: string
name: parse_data
arguments: data_label: D7
type_infered: string
name: parse_data
arguments: data_label: D71
type_infered: string
name: parse_data
arguments: data_label: D46
type_infered: string
name: parse_data
arguments: data_label: D15
type_infered: string
name: parse_data
arguments: data_label: D69
type_infered: string
name: parse_data
arguments: data_label: D124
type_infered: string

tool: D100: r

tool: D62: x

tool: D81: +

tool: D67: -

tool: D123: Elements remain in the stack

tool: D38: exp

tool: D76: *

tool: D7: /

tool: D71: sin

tool: D46: Could not open file %s


tool: D15: cos

tool: D69: pow

tool: D124: log

assistant: ```c
double rpn_eval(char *fileName, double x) {
  double a, b, c;
  FILE *fd;
  fd = fopen(fileName, "r");
  if (fd == NULL) {
    printf("Could not open file %s\n", fileName);
    exit(1);
  }
  char *word;
  while (word = nextword(fd)) {
    if (c = atof(word)) {
      stack_push(c);
    } else if (strcmp(word, "x") == 0) {
      stack_push(x);
    } else if (strcmp(word, "+") == 0) {
      a = stack_pop();
      b = stack_pop();
      stack_push(a + b);
    } else if (strcmp(word, "-") == 0) {
      a = stack_pop();
      b = stack_pop();
      stack_push(b - a);
    } else if (strcmp(word, "*") == 0) {
      a = stack_pop();
      b = stack_pop();
      stack_push(a * b);
    } else if (strcmp(word, "/") == 0) {
      a = stack_pop();
      b = stack_pop();
      stack_push(b / a);
    } else if (strcmp(word, "sin") == 0) {
      a = stack_pop();
      stack_push(sin(a));
    } else if (strcmp(word, "cos") == 0) {
      a = stack_pop();
      stack_push(cos(a));
    } else if (strcmp(word, "pow") == 0) {
      a = stack_pop();
      b = stack_pop();
      stack_push(pow(b, a));
    } else if (strcmp(word, "log") == 0) {
      a = stack_pop();
      stack_push(log(a));
    } else if (strcmp(word, "exp") == 0) {
      a = stack_pop();
      stack_push(exp(a));
    }
  }
  if (stack_top() != 1) {
    printf("Elements remain in the stack\n");
    exit(1);
  }
  double result = stack_pop();
  return result;
}
```