ylfeng/ReF-Decompile-dataset huggingface dataset:
user: Converte this assembly snippet into its equivalent C code:

```asm
<_rpc_dtablesize>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    D4(%rip),%eax
  test   %eax,%eax
  jne    L9
  mov    $0x0,%eax
  call   <getdtablesize@plt>
  mov    %eax,D3(%rip)
L9:
  mov    D3(%rip),%eax
  pop    %rbp
  ret
```

assistant: ```c
int _rpc_dtablesize(void) {
  static int size;
  if (size == 0)
    size = getdtablesize();
  return size;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<_rpc_dtablesize>:
  endbr64
  cmpl   $0x0,D2(%rip)
  je     L0
  mov    D2(%rip),%eax
  ret
L0:
  sub    $0x8,%rsp
  mov    $0x0,%eax
  call   <getdtablesize@plt>
  mov    %eax,D7(%rip)
  mov    D7(%rip),%eax
  add    $0x8,%rsp
  ret
```

assistant: ```c
int _rpc_dtablesize(void) {
  static int size;
  if (size == 0)
    size = getdtablesize();
  return size;
}
```
user: What is the c source code of the assembly code below?

```asm
<_rpc_dtablesize>:
  endbr64
  mov    D15(%rip),%eax
  test   %eax,%eax
  je     L4
  ret
  nop
L4:
  sub    $0x8,%rsp
  call   <getdtablesize@plt>
  mov    %eax,D11(%rip)
  add    $0x8,%rsp
  ret
```

assistant: ```c
int _rpc_dtablesize(void) {
  static int size;
  if (size == 0)
    size = getdtablesize();
  return size;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<_rpc_dtablesize>:
  endbr64
  mov    D15(%rip),%eax
  test   %eax,%eax
  je     L2
  ret
  nop
L2:
  sub    $0x8,%rsp
  call   <getdtablesize@plt>
  mov    %eax,D4(%rip)
  add    $0x8,%rsp
  ret
```

assistant: ```c
int _rpc_dtablesize(void) {
  static int size;
  if (size == 0)
    size = getdtablesize();
  return size;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<lmsc_get_page_size>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    D3(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,%edi
  call   <sysconf@plt>
  mov    %eax,-0x4(%rbp)
  cmpl   $0x0,-0x4(%rbp)
  jg     L30
  cmpl   $0x0,-0x4(%rbp)
  je     L24
  mov    -0x4(%rbp),%eax
  jmp    L34
L24:
  mov    $0xffffffff,%eax
  jmp    L34
L30:
  mov    -0x4(%rbp),%eax
L34:
  leave
  ret
```

assistant: ```c
int lmsc_get_page_size(void) {
  int s;
  s = (int)sysconf(_SC_PAGESIZE);
  if (s <= 0) {
    return s ? s : -1;
  }
  return s;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<lmsc_get_page_size>:
  endbr64
  sub    $0x8,%rsp
  mov    D0(%rip),%rax
  mov    (%rax),%edi
  call   <sysconf@plt>
  test   %eax,%eax
  mov    $0xffffffff,%edx
  cmove  %edx,%eax
  add    $0x8,%rsp
  ret
```

assistant: ```c
int lmsc_get_page_size(void) {
  int s;
  s = (int)sysconf(_SC_PAGESIZE);
  if (s <= 0) {
    return s ? s : -1;
  }
  return s;
}
```
user: Translate the below assembly code into C programming language:

```asm
<lmsc_get_page_size>:
  endbr64
  sub    $0x8,%rsp
  mov    D7(%rip),%rax
  mov    (%rax),%edi
  call   <sysconf@plt>
  mov    $0xffffffff,%edx
  test   %eax,%eax
  cmove  %edx,%eax
  add    $0x8,%rsp
  ret
```

assistant: ```c
int lmsc_get_page_size(void) {
  int s;
  s = (int)sysconf(_SC_PAGESIZE);
  if (s <= 0) {
    return s ? s : -1;
  }
  return s;
}
```
user: What is the c source code of the assembly code below:

```asm
<lmsc_get_page_size>:
  endbr64
  sub    $0x8,%rsp
  mov    D6(%rip),%rax
  mov    (%rax),%edi
  call   <sysconf@plt>
  mov    $0xffffffff,%edx
  test   %eax,%eax
  cmove  %edx,%eax
  add    $0x8,%rsp
  ret
```

assistant: ```c
int lmsc_get_page_size(void) {
  int s;
  s = (int)sysconf(_SC_PAGESIZE);
  if (s <= 0) {
    return s ? s : -1;
  }
  return s;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<screen_print_int>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %esi,-0x28(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x28(%rbp),%edx
  lea    -0x16(%rbp),%rcx
  mov    -0x24(%rbp),%eax
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <itoa@plt>
  lea    -0x16(%rbp),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L2
  call   <__stack_chk_fail@plt>
L2:
  leave
  ret
```

assistant: ```c
void screen_print_int(int i, int base) {
  char buf[(14)];
  itoa(i, buf, base);
  puts(buf);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<screen_print_int>:
  endbr64
  push   %rbx
  sub    $0x20,%rsp
  mov    %esi,%edx
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    0xa(%rsp),%rbx
  mov    %rbx,%rsi
  call   <itoa@plt>
  mov    %rbx,%rdi
  call   <puts@plt>
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L9
  add    $0x20,%rsp
  pop    %rbx
  ret
L9:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void screen_print_int(int i, int base) {
  char buf[(14)];
  itoa(i, buf, base);
  puts(buf);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<screen_print_int>:
  endbr64
  push   %rbp
  mov    %esi,%edx
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    0xa(%rsp),%rbp
  mov    %rbp,%rsi
  call   <itoa@plt>
  mov    %rbp,%rdi
  call   <puts@plt>
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L0
  add    $0x20,%rsp
  pop    %rbp
  ret
L0:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void screen_print_int(int i, int base) {
  char buf[(14)];
  itoa(i, buf, base);
  puts(buf);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<screen_print_int>:
  endbr64
  push   %rbp
  mov    %esi,%edx
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    0xa(%rsp),%rbp
  mov    %rbp,%rsi
  call   <itoa@plt>
  mov    %rbp,%rdi
  call   <puts@plt>
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L4
  add    $0x20,%rsp
  pop    %rbp
  ret
L4:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void screen_print_int(int i, int base) {
  char buf[(14)];
  itoa(i, buf, base);
  puts(buf);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<cfg_discover_paths>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    $0xe1,%edx
  lea    D21(%rip),%rax
  mov    %rax,%rsi
  lea    D22(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <log_prefix@plt>
  lea    D29(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <log_msg@plt>
  mov    $0x0,%eax
  call   <find_home_dir@plt>
  mov    $0x0,%eax
  call   <find_config_dir@plt>
  mov    $0x0,%eax
  call   <find_data_dir@plt>
  mov    $0x0,%eax
  call   <find_config_file@plt>
  mov    $0x0,%eax
  call   <store_config_paths@plt>
  mov    $0x0,%eax
  call   <setup_dirs@plt>
  nop
  pop    %rbp
  ret
```

tool_calls: name: unpack_data
arguments: data_tag: D21
datatype: string
name: unpack_data
arguments: data_tag: D22
datatype: string
name: unpack_data
arguments: data_tag: D29
datatype: string

tool: D21: cfg_discover_paths

tool: D22: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/cosminadrianpopescu/vifm/refs/heads/master/src/cfg/config.c

tool: D29: Entered into this function

assistant: ```c
void cfg_discover_paths(void) {
  {
    log_prefix("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/cosminadrianpopescu/vifm/refs/heads/master/src/cfg/config.c", __FUNCTION__, 225);
    log_msg("Entered into this function");
  };
  find_home_dir();
  find_config_dir();
  find_data_dir();
  find_config_file();
  store_config_paths();
  setup_dirs();
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<cfg_discover_paths>:
  endbr64
  sub    $0x8,%rsp
  mov    $0xe1,%edx
  lea    D17(%rip),%rsi
  lea    D21(%rip),%rdi
  mov    $0x0,%eax
  call   <log_prefix@plt>
  lea    D20(%rip),%rdi
  mov    $0x0,%eax
  call   <log_msg@plt>
  mov    $0x0,%eax
  call   <find_home_dir@plt>
  mov    $0x0,%eax
  call   <find_config_dir@plt>
  mov    $0x0,%eax
  call   <find_data_dir@plt>
  mov    $0x0,%eax
  call   <find_config_file@plt>
  mov    $0x0,%eax
  call   <store_config_paths@plt>
  mov    $0x0,%eax
  call   <setup_dirs@plt>
  add    $0x8,%rsp
  ret
```

tool_calls: name: read_data
arguments: data_tag: D17
type_infered: string
name: read_data
arguments: data_tag: D21
type_infered: string
name: read_data
arguments: data_tag: D20
type_infered: string

tool: D17: cfg_discover_paths

tool: D21: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/cosminadrianpopescu/vifm/refs/heads/master/src/cfg/config.c

tool: D20: Entered into this function

assistant: ```c
void cfg_discover_paths(void) {
  {
    log_prefix("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/cosminadrianpopescu/vifm/refs/heads/master/src/cfg/config.c", __FUNCTION__, 225);
    log_msg("Entered into this function");
  };
  find_home_dir();
  find_config_dir();
  find_data_dir();
  find_config_file();
  store_config_paths();
  setup_dirs();
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<cfg_discover_paths>:
  endbr64
  sub    $0x8,%rsp
  mov    $0xe1,%edx
  lea    D23(%rip),%rsi
  xor    %eax,%eax
  lea    D27(%rip),%rdi
  call   <log_prefix@plt>
  lea    D5(%rip),%rdi
  xor    %eax,%eax
  call   <log_msg@plt>
  xor    %eax,%eax
  call   <find_home_dir@plt>
  xor    %eax,%eax
  call   <find_config_dir@plt>
  xor    %eax,%eax
  call   <find_data_dir@plt>
  xor    %eax,%eax
  call   <find_config_file@plt>
  xor    %eax,%eax
  call   <store_config_paths@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  jmp    10e0 <setup_dirs@plt>
```

tool_calls: name: extract_symbolic_data
arguments: label: D23
type_guessed: string
name: extract_symbolic_data
arguments: label: D27
type_guessed: string
name: extract_symbolic_data
arguments: label: D5
type_guessed: string

tool: D23: cfg_discover_paths

tool: D27: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/cosminadrianpopescu/vifm/refs/heads/master/src/cfg/config.c

tool: D5: Entered into this function

assistant: ```c
void cfg_discover_paths(void) {
  {
    log_prefix("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/cosminadrianpopescu/vifm/refs/heads/master/src/cfg/config.c", __FUNCTION__, 225);
    log_msg("Entered into this function");
  };
  find_home_dir();
  find_config_dir();
  find_data_dir();
  find_config_file();
  store_config_paths();
  setup_dirs();
}
```
user: Translate the below assembly code into C programming language:

```asm
<cfg_discover_paths>:
  endbr64
  sub    $0x8,%rsp
  mov    $0xe1,%edx
  lea    D11(%rip),%rsi
  xor    %eax,%eax
  lea    D18(%rip),%rdi
  call   <log_prefix@plt>
  lea    D25(%rip),%rdi
  xor    %eax,%eax
  call   <log_msg@plt>
  xor    %eax,%eax
  call   <find_home_dir@plt>
  xor    %eax,%eax
  call   <find_config_dir@plt>
  xor    %eax,%eax
  call   <find_data_dir@plt>
  xor    %eax,%eax
  call   <find_config_file@plt>
  xor    %eax,%eax
  call   <store_config_paths@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  jmp    10e0 <setup_dirs@plt>
```

tool_calls: name: unpack_data
arguments: label: D11
type: string
name: unpack_data
arguments: label: D18
type: string
name: unpack_data
arguments: label: D25
type: string

tool: D11: cfg_discover_paths

tool: D18: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/cosminadrianpopescu/vifm/refs/heads/master/src/cfg/config.c

tool: D25: Entered into this function

assistant: ```c
void cfg_discover_paths(void) {
  {
    log_prefix("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/cosminadrianpopescu/vifm/refs/heads/master/src/cfg/config.c", __FUNCTION__, 225);
    log_msg("Entered into this function");
  };
  find_home_dir();
  find_config_dir();
  find_data_dir();
  find_config_file();
  store_config_paths();
  setup_dirs();
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<str_to_long>:
  endbr64
  mov    %rdi,%r8
  mov    %rsi,%rdi
  mov    %rdx,%r10
  mov    %rcx,%r9
  mov    $0x0,%edx
  jmp    L5
L134:
  cmp    %rsi,%rdi
  jle    L26
  movsbq (%r8,%rsi,1),%rcx
  lea    0x2(%rdx),%rsi
  lea    -0x30(%rcx),%rax
  cmp    $0x9,%rax
  jbe    L96
L116:
  mov    %rsi,%rdx
L5:
  cmp    %rdi,%rdx
  jge    L8
  movzbl (%r8,%rdx,1),%eax
  movsbq %al,%rcx
  lea    0x1(%rdx),%rsi
  test   %rcx,%rcx
  je     L75
  cmp    $0x2d,%rcx
  je     L134
  movsbq %al,%rax
  sub    $0x30,%rax
  cmp    $0x9,%rax
  ja     L116
  mov    $0x0,%r11d
L15:
  mov    $0x0,%eax
L114:
  lea    (%rax,%rax,4),%rax
  lea    -0x30(%rcx,%rax,2),%rax
  cmp    %rdi,%rsi
  jge    L21
  movzbl (%r8,%rsi,1),%edx
  movsbq %dl,%rcx
  add    $0x1,%rsi
  sub    $0x30,%edx
  cmp    $0x9,%dl
  jbe    L114
  mov    %r11,%rcx
  mov    $0x0,%edi
  jmp    L24
L96:
  mov    $0x1,%r11d
  jmp    L15
L8:
  mov    %rdx,%rsi
  mov    $0xffffffffffffffff,%rdi
  mov    $0x0,%eax
  mov    $0x0,%ecx
L24:
  mov    %rax,%rdx
  neg    %rdx
  cmp    $0x1,%rcx
  cmove  %rdx,%rax
  mov    %rsi,(%r10)
  mov    %rax,(%r9)
  mov    %rdi,%rax
  ret
L75:
  mov    %rcx,%rax
  mov    $0xffffffffffffffff,%rdi
  jmp    L24
L26:
  mov    $0xffffffffffffffff,%rdi
  mov    $0x0,%eax
  mov    $0x0,%ecx
  jmp    L24
L21:
  mov    %r11,%rcx
  mov    $0x0,%edi
  jmp    L24
```

assistant: ```c
long str_to_long(char *str, long maxlen, long *pnext, long *result) {
  long c;
  long is_neg;
  long is_checking;
  long n;
  long ret;
  long next;
  n = 0;
  is_neg = 0;
  is_checking = 1;
  ret = -1;
  next = 0;
  do {
    if (next < maxlen) {
      c = (long)str[next];
      next = next + 1;
    } else {
      goto str_to_long_exit;
    }
    if (c == (0))
      goto str_to_long_exit;
    if (c == (long)'-') {
      if (next < maxlen) {
        c = (long)str[next];
        next = next + 1;
      } else {
        goto str_to_long_exit;
      }
      if (c <= (long)'9') {
        if (c >= (long)'0') {
          is_neg = 1;
          is_checking = 0;
          ret = 0;
        }
      }
    } else if (c <= (long)'9') {
      if (c >= (long)'0') {
        is_checking = 0;
        ret = 0;
      }
    }
  } while (is_checking == 1);
  is_checking = 1;
  do {
    n = n * 10 + (long)c - (long)'0';
    if (next < maxlen) {
      c = (long)str[next];
      next = next + 1;
    } else {
      goto str_to_long_exit;
    }
    if (c == (0))
      goto str_to_long_exit;
    if (c > (long)'9') {
      is_checking = 0;
    }
    if (c < (long)'0') {
      is_checking = 0;
    }
  } while (is_checking == 1);
str_to_long_exit:
  if (is_neg == 1) {
    n = 0 - n;
  }
  *pnext = next;
  *result = n;
  return ret;
}
```
user: Translate the below assembly code into C programming language:

```asm
<str_to_long>:
  endbr64
  mov    %rcx,%r9
  mov    %rdx,%r10
  xor    %ecx,%ecx
  mov    $0xffffffffffffffff,%r8
  xor    %eax,%eax
  test   %rsi,%rsi
  jle    L9
  xor    %edx,%edx
  jmp    L7
  nopw   0x0(%rax,%rax,1)
L104:
  lea    -0x30(%rax),%rdx
  cmp    $0x9,%rdx
  jbe    L106
  mov    %rcx,%rdx
L91:
  cmp    %rdx,%rsi
  jle    L42
L7:
  movsbq (%rdi,%rdx,1),%rax
  lea    0x1(%rdx),%rcx
  test   %rax,%rax
  je     L52
  cmp    $0x2d,%rax
  jne    L104
  cmp    %rcx,%rsi
  jle    L47
  movsbq (%rdi,%rcx,1),%rax
  add    $0x2,%rdx
  lea    -0x30(%rax),%rcx
  cmp    $0x9,%rcx
  ja     L91
  mov    %rdx,%rcx
  mov    $0x1,%r8d
L36:
  push   %rbx
  xor    %r11d,%r11d
L121:
  lea    (%r11,%r11,4),%rdx
  lea    (%rax,%rdx,2),%rbx
  lea    -0x30(%rbx),%r11
  cmp    %rsi,%rcx
  jge    L148
  movsbq (%rdi,%rcx,1),%rax
  add    $0x1,%rcx
  mov    %rax,%rdx
  sub    $0x30,%edx
  cmp    $0x9,%dl
  jbe    L121
L148:
  cmp    $0x1,%r8
  jne    L133
  mov    $0x30,%eax
  xor    %r8d,%r8d
  sub    %rbx,%rax
L10:
  mov    %rcx,(%r10)
  pop    %rbx
  mov    %rax,(%r9)
  mov    %r8,%rax
  ret
L106:
  xor    %r8d,%r8d
  jmp    L36
  nopl   (%rax)
L52:
  mov    $0xffffffffffffffff,%r8
L9:
  mov    %rcx,(%r10)
  mov    %rax,(%r9)
  mov    %r8,%rax
  ret
  nopl   0x0(%rax)
L42:
  mov    %rdx,%rcx
  mov    $0xffffffffffffffff,%r8
  xor    %eax,%eax
  jmp    L9
L47:
  mov    $0xffffffffffffffff,%r8
  xor    %eax,%eax
  jmp    L9
L133:
  mov    %r11,%rax
  jmp    L10
```

assistant: ```c
long str_to_long(char *str, long maxlen, long *pnext, long *result) {
  long c;
  long is_neg;
  long is_checking;
  long n;
  long ret;
  long next;
  n = 0;
  is_neg = 0;
  is_checking = 1;
  ret = -1;
  next = 0;
  do {
    if (next < maxlen) {
      c = (long)str[next];
      next = next + 1;
    } else {
      goto str_to_long_exit;
    }
    if (c == (0))
      goto str_to_long_exit;
    if (c == (long)'-') {
      if (next < maxlen) {
        c = (long)str[next];
        next = next + 1;
      } else {
        goto str_to_long_exit;
      }
      if (c <= (long)'9') {
        if (c >= (long)'0') {
          is_neg = 1;
          is_checking = 0;
          ret = 0;
        }
      }
    } else if (c <= (long)'9') {
      if (c >= (long)'0') {
        is_checking = 0;
        ret = 0;
      }
    }
  } while (is_checking == 1);
  is_checking = 1;
  do {
    n = n * 10 + (long)c - (long)'0';
    if (next < maxlen) {
      c = (long)str[next];
      next = next + 1;
    } else {
      goto str_to_long_exit;
    }
    if (c == (0))
      goto str_to_long_exit;
    if (c > (long)'9') {
      is_checking = 0;
    }
    if (c < (long)'0') {
      is_checking = 0;
    }
  } while (is_checking == 1);
str_to_long_exit:
  if (is_neg == 1) {
    n = 0 - n;
  }
  *pnext = next;
  *result = n;
  return ret;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<str_to_long>:
  endbr64
  mov    %rcx,%r9
  mov    %rdx,%r10
  xor    %ecx,%ecx
  mov    $0xffffffffffffffff,%r8
  xor    %eax,%eax
  test   %rsi,%rsi
  jle    L92
  xor    %edx,%edx
  jmp    L126
  nopw   0x0(%rax,%rax,1)
L83:
  lea    -0x30(%rax),%rdx
  cmp    $0x9,%rdx
  jbe    L46
  mov    %rcx,%rdx
L62:
  cmp    %rdx,%rsi
  jle    L69
L126:
  movsbq (%rdi,%rdx,1),%rax
  lea    0x1(%rdx),%rcx
  test   %rax,%rax
  je     L57
  cmp    $0x2d,%rax
  jne    L83
  cmp    %rcx,%rsi
  jle    L117
  movsbq (%rdi,%rcx,1),%rax
  add    $0x2,%rdx
  lea    -0x30(%rax),%rcx
  cmp    $0x9,%rcx
  ja     L62
  mov    %rdx,%rcx
  mov    $0x1,%r8d
L9:
  push   %rbx
  xor    %r11d,%r11d
L16:
  lea    (%r11,%r11,4),%rdx
  lea    (%rax,%rdx,2),%rbx
  lea    -0x30(%rbx),%r11
  cmp    %rsi,%rcx
  jge    L141
  movsbq (%rdi,%rcx,1),%rax
  add    $0x1,%rcx
  mov    %rax,%rdx
  sub    $0x30,%edx
  cmp    $0x9,%dl
  jbe    L16
L141:
  cmp    $0x1,%r8
  jne    L121
  mov    $0x30,%eax
  xor    %r8d,%r8d
  sub    %rbx,%rax
L82:
  mov    %rcx,(%r10)
  pop    %rbx
  mov    %rax,(%r9)
  mov    %r8,%rax
  ret
L46:
  xor    %r8d,%r8d
  jmp    L9
  nopl   (%rax)
L57:
  mov    $0xffffffffffffffff,%r8
L92:
  mov    %rcx,(%r10)
  mov    %rax,(%r9)
  mov    %r8,%rax
  ret
  nopl   0x0(%rax)
L69:
  mov    %rdx,%rcx
  mov    $0xffffffffffffffff,%r8
  xor    %eax,%eax
  jmp    L92
L117:
  mov    $0xffffffffffffffff,%r8
  xor    %eax,%eax
  jmp    L92
L121:
  mov    %r11,%rax
  jmp    L82
```

assistant: ```c
long str_to_long(char *str, long maxlen, long *pnext, long *result) {
  long c;
  long is_neg;
  long is_checking;
  long n;
  long ret;
  long next;
  n = 0;
  is_neg = 0;
  is_checking = 1;
  ret = -1;
  next = 0;
  do {
    if (next < maxlen) {
      c = (long)str[next];
      next = next + 1;
    } else {
      goto str_to_long_exit;
    }
    if (c == (0))
      goto str_to_long_exit;
    if (c == (long)'-') {
      if (next < maxlen) {
        c = (long)str[next];
        next = next + 1;
      } else {
        goto str_to_long_exit;
      }
      if (c <= (long)'9') {
        if (c >= (long)'0') {
          is_neg = 1;
          is_checking = 0;
          ret = 0;
        }
      }
    } else if (c <= (long)'9') {
      if (c >= (long)'0') {
        is_checking = 0;
        ret = 0;
      }
    }
  } while (is_checking == 1);
  is_checking = 1;
  do {
    n = n * 10 + (long)c - (long)'0';
    if (next < maxlen) {
      c = (long)str[next];
      next = next + 1;
    } else {
      goto str_to_long_exit;
    }
    if (c == (0))
      goto str_to_long_exit;
    if (c > (long)'9') {
      is_checking = 0;
    }
    if (c < (long)'0') {
      is_checking = 0;
    }
  } while (is_checking == 1);
str_to_long_exit:
  if (is_neg == 1) {
    n = 0 - n;
  }
  *pnext = next;
  *result = n;
  return ret;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<fineCost>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x4(%rbp)
  mov    %esi,-0x8(%rbp)
  mov    %edx,-0xc(%rbp)
  mov    %ecx,-0x10(%rbp)
  mov    %r8d,-0x14(%rbp)
  mov    %r9d,-0x18(%rbp)
  mov    -0xc(%rbp),%eax
  cmp    -0x18(%rbp),%eax
  setl   %dl
  mov    -0xc(%rbp),%eax
  cmp    -0x18(%rbp),%eax
  jg     L30
  mov    -0x8(%rbp),%eax
  cmp    -0x14(%rbp),%eax
  jg     L30
  mov    -0x4(%rbp),%eax
  cmp    -0x10(%rbp),%eax
  jg     L30
  mov    $0x1,%eax
  jmp    L69
L30:
  mov    $0x0,%eax
L69:
  and    $0x1,%eax
  or     %edx,%eax
  test   %al,%al
  je     L84
  mov    $0x0,%eax
  jmp    L66
L84:
  mov    -0xc(%rbp),%eax
  cmp    -0x18(%rbp),%eax
  jne    L73
  mov    -0x8(%rbp),%eax
  cmp    -0x14(%rbp),%eax
  jne    L73
  mov    -0x4(%rbp),%eax
  sub    -0x10(%rbp),%eax
  mov    %eax,%edx
  mov    %edx,%eax
  shl    $0x4,%eax
  sub    %edx,%eax
  jmp    L66
L73:
  mov    -0xc(%rbp),%eax
  cmp    -0x18(%rbp),%eax
  jne    L93
  mov    -0x8(%rbp),%eax
  sub    -0x14(%rbp),%eax
  imul   $0x1f4,%eax,%eax
  jmp    L66
L93:
  mov    $0x2710,%eax
L66:
  pop    %rbp
  ret
```

assistant: ```c
int fineCost(int returnDay, int returnMonth, int returnYear, int dueDay, int dueMonth, int dueYear) {
  if ((returnYear < dueYear) | (returnYear <= dueYear && returnMonth <= dueMonth && returnDay <= dueDay)) {
    return 0;
  } else if (returnYear == dueYear && returnMonth == dueMonth) {
    return 15 * (returnDay - dueDay);
  } else if (returnYear == dueYear) {
    return 500 * (returnMonth - dueMonth);
  } else {
    return 10000;
  }
}
```
user: What is the c source code of the assembly code below?

```asm
<fineCost>:
  endbr64
  mov    %edi,%eax
  cmp    %r8d,%esi
  setle  %dil
  cmp    %ecx,%eax
  setle  %r10b
  and    %r10d,%edi
  cmp    %r9d,%edx
  setle  %r10b
  test   %r10b,%dil
  jne    L1
  cmp    %r9d,%edx
  jl     L1
  jne    L49
  cmp    %r8d,%esi
  jne    L49
  sub    %ecx,%eax
  mov    %eax,%ecx
  shl    $0x4,%ecx
  sub    %eax,%ecx
  jmp    L65
L49:
  mov    $0x2710,%ecx
  cmp    %r9d,%edx
  jne    L65
  sub    %r8d,%esi
  imul   $0x1f4,%esi,%ecx
  jmp    L65
L1:
  mov    $0x0,%ecx
L65:
  mov    %ecx,%eax
  ret
```

assistant: ```c
int fineCost(int returnDay, int returnMonth, int returnYear, int dueDay, int dueMonth, int dueYear) {
  if ((returnYear < dueYear) | (returnYear <= dueYear && returnMonth <= dueMonth && returnDay <= dueDay)) {
    return 0;
  } else if (returnYear == dueYear && returnMonth == dueMonth) {
    return 15 * (returnDay - dueDay);
  } else if (returnYear == dueYear) {
    return 500 * (returnMonth - dueMonth);
  } else {
    return 10000;
  }
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<fineCost>:
  endbr64
  cmp    %r8d,%esi
  mov    %edi,%eax
  setle  %r10b
  cmp    %ecx,%edi
  setle  %dil
  test   %dil,%r10b
  je     L29
  xor    %eax,%eax
  cmp    %r9d,%edx
  jle    L40
L31:
  mov    $0x2710,%eax
  cmp    %r9d,%edx
  jne    L43
  sub    %r8d,%esi
  imul   $0x1f4,%esi,%eax
  ret
  nopl   0x0(%rax,%rax,1)
L40:
  ret
  nopl   0x0(%rax)
L18:
  xor    %eax,%eax
L43:
  ret
  nopl   0x0(%rax,%rax,1)
L29:
  cmp    %r9d,%edx
  jl     L18
  jne    L31
  cmp    %r8d,%esi
  jne    L31
  sub    %ecx,%eax
  mov    %eax,%edx
  shl    $0x4,%eax
  sub    %edx,%eax
  ret
```

assistant: ```c
int fineCost(int returnDay, int returnMonth, int returnYear, int dueDay, int dueMonth, int dueYear) {
  if ((returnYear < dueYear) | (returnYear <= dueYear && returnMonth <= dueMonth && returnDay <= dueDay)) {
    return 0;
  } else if (returnYear == dueYear && returnMonth == dueMonth) {
    return 15 * (returnDay - dueDay);
  } else if (returnYear == dueYear) {
    return 500 * (returnMonth - dueMonth);
  } else {
    return 10000;
  }
}
```