ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  lea    D36(%rip),%r14
  push   %r13
  push   %r12
  lea    D18(%rip),%r12
  push   %rbp
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x78,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x68(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%rax
  mov    %rax,(%rsp)
  jmp    L12
  nopl   (%rax)
L31:
  mov    0x10(%rsp,%r13,4),%eax
  cmp    %ebp,%eax
  jge    L24
  mov    %ebx,0xc(%rsp)
  mov    %eax,%ebp
L24:
  cmp    $0x14,%r15d
  je     L45
L44:
  mov    %r15d,%ebx
L12:
  lea    0x1(%rbx),%r15d
  mov    %r14,%rdi
  movslq %ebx,%r13
  mov    %r15d,%esi
  call   <printf@plt>
  mov    (%rsp),%rax
  mov    %r12,%rdi
  lea    (%rax,%r13,4),%rsi
  call   <scanf@plt>
  test   %ebx,%ebx
  jne    L31
  movl   $0x0,0xc(%rsp)
  mov    0x10(%rsp),%ebp
  mov    $0x1,%r15d
  jmp    L44
  nopw   0x0(%rax,%rax,1)
L45:
  mov    %ebp,%esi
  lea    D35(%rip),%rdi
  call   <printf@plt>
  mov    0xc(%rsp),%esi
  lea    D8(%rip),%rdi
  add    $0x1,%esi
  call   <printf@plt>
  mov    0x68(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L7
  add    $0x78,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L7:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_label: D36
type_guessed: string
name: retrieve_data
arguments: data_label: D18
type_guessed: string
name: retrieve_data
arguments: data_label: D35
type_guessed: string
name: retrieve_data
arguments: data_label: D8
type_guessed: string

tool: D36: Informe a posicao %d: 

tool: D18: %d

tool: D35: O menor elemento de N eh: %d


tool: D8: E sua posicao dentro do vetor eh: %d


assistant: ```c
void main() {
  int n[20], menor, pos;
  for (int i = 0; i < 20; i++) {
    printf("Informe a posicao %d: ", i + 1);
    scanf("%d", &n[i]);
    if (i == 0) {
      menor = n[i];
      pos = i;
    } else {
      if (menor > n[i]) {
        menor = n[i];
        pos = i;
      }
    }
  }
  printf("O menor elemento de N eh: %d\n", menor);
  printf("E sua posicao dentro do vetor eh: %d\n", pos + 1);
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  lea    D31(%rip),%r14
  push   %r13
  push   %r12
  lea    D3(%rip),%r12
  push   %rbp
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x78,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x68(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%rax
  mov    %rax,(%rsp)
  jmp    L14
  nopl   (%rax)
L30:
  mov    0x10(%rsp,%r13,4),%eax
  cmp    %ebp,%eax
  jge    L20
  mov    %ebx,0xc(%rsp)
  mov    %eax,%ebp
L20:
  cmp    $0x14,%r15d
  je     L38
L21:
  mov    %r15d,%ebx
L14:
  lea    0x1(%rbx),%r15d
  mov    %r14,%rdi
  movslq %ebx,%r13
  mov    %r15d,%esi
  call   <printf@plt>
  mov    (%rsp),%rax
  mov    %r12,%rdi
  lea    (%rax,%r13,4),%rsi
  call   <scanf@plt>
  test   %ebx,%ebx
  jne    L30
  movl   $0x0,0xc(%rsp)
  mov    0x10(%rsp),%ebp
  mov    $0x1,%r15d
  jmp    L21
  nopw   0x0(%rax,%rax,1)
L38:
  mov    %ebp,%esi
  lea    D4(%rip),%rdi
  call   <printf@plt>
  mov    0xc(%rsp),%esi
  lea    D19(%rip),%rdi
  add    $0x1,%esi
  call   <printf@plt>
  mov    0x68(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L10
  add    $0x78,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L10:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_label: D31
data_type: string
name: disassemble_data
arguments: data_label: D3
data_type: string
name: disassemble_data
arguments: data_label: D4
data_type: string
name: disassemble_data
arguments: data_label: D19
data_type: string

tool: D31: Informe a posicao %d: 

tool: D3: %d

tool: D4: O menor elemento de N eh: %d


tool: D19: E sua posicao dentro do vetor eh: %d


assistant: ```c
void main() {
  int n[20], menor, pos;
  for (int i = 0; i < 20; i++) {
    printf("Informe a posicao %d: ", i + 1);
    scanf("%d", &n[i]);
    if (i == 0) {
      menor = n[i];
      pos = i;
    } else {
      if (menor > n[i]) {
        menor = n[i];
        pos = i;
      }
    }
  }
  printf("O menor elemento de N eh: %d\n", menor);
  printf("E sua posicao dentro do vetor eh: %d\n", pos + 1);
}
```
user: What is the c source code of the assembly code below?

```asm
<test_double>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  movsd  %xmm0,-0x8(%rbp)
  movsd  %xmm1,-0x10(%rbp)
  movsd  %xmm2,-0x18(%rbp)
  mov    %rdi,-0x20(%rbp)
  movsd  -0x10(%rbp),%xmm0
  subsd  -0x8(%rbp),%xmm0
  movq   D8(%rip),%xmm1
  andpd  %xmm1,%xmm0
  comisd -0x18(%rbp),%xmm0
  jbe    L17
  mov    -0x20(%rbp),%rax
  mov    %rax,%rsi
  lea    D9(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movsd  -0x10(%rbp),%xmm1
  movsd  -0x18(%rbp),%xmm0
  mov    -0x8(%rbp),%rax
  movapd %xmm1,%xmm2
  movapd %xmm0,%xmm1
  movq   %rax,%xmm0
  lea    D18(%rip),%rax
  mov    %rax,%rdi
  mov    $0x3,%eax
  call   <printf@plt>
  jmp    L14
L17:
  mov    -0x20(%rbp),%rax
  mov    %rax,%rsi
  lea    D24(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L14:
  nop
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: label: D8
data_type: qword
name: extract_symbolic_data
arguments: label: D9
data_type: string
name: extract_symbolic_data
arguments: label: D18
data_type: string
name: extract_symbolic_data
arguments: label: D24
data_type: string

tool: D8: 9223372036854775807

tool: D9: Test %s FAILED:


tool: D18: Expected result %g with tolerance %g, but got %g instead


tool: D24: Test %s SUCCEEDED


assistant: ```c
void test_double(double expected, double actual, double tolerance, const char *testname) {
  if (fabs(actual - expected) > tolerance) {
    printf("Test %s FAILED:\n", testname);
    printf("Expected result %g with tolerance %g, but got %g instead\n", expected, tolerance, actual);
  } else {
    printf("Test %s SUCCEEDED\n", testname);
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<test_double>:
  endbr64
  push   %rbx
  sub    $0x10,%rsp
  movsd  %xmm0,(%rsp)
  movsd  %xmm2,0x8(%rsp)
  mov    %rdi,%rsi
  movapd %xmm1,%xmm0
  subsd  (%rsp),%xmm0
  andpd  D35(%rip),%xmm0
  comisd %xmm2,%xmm0
  jbe    L7
  movq   %xmm1,%rbx
  lea    D7(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movq   %rbx,%xmm2
  movsd  0x8(%rsp),%xmm1
  movsd  (%rsp),%xmm0
  lea    D9(%rip),%rdi
  mov    $0x3,%eax
  call   <printf@plt>
L12:
  add    $0x10,%rsp
  pop    %rbx
  ret
L7:
  lea    D12(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L12
```

tool_calls: name: extract_symbolic_data
arguments: label: D35
type_infered: qword[2]
name: extract_symbolic_data
arguments: label: D7
type_infered: string
name: extract_symbolic_data
arguments: label: D9
type_infered: string
name: extract_symbolic_data
arguments: label: D12
type_infered: string

tool: {"D35": [0x7fffffffffffffff,0x0000000000000000]}

tool: D7: Test %s FAILED:


tool: D9: Expected result %g with tolerance %g, but got %g instead


tool: D12: Test %s SUCCEEDED


assistant: ```c
void test_double(double expected, double actual, double tolerance, const char *testname) {
  if (fabs(actual - expected) > tolerance) {
    printf("Test %s FAILED:\n", testname);
    printf("Expected result %g with tolerance %g, but got %g instead\n", expected, tolerance, actual);
  } else {
    printf("Test %s SUCCEEDED\n", testname);
  }
}
```
user: Translate the below assembly code into C programming language:

```asm
<test_double>:
  endbr64
  movapd %xmm2,%xmm3
  movapd %xmm1,%xmm2
  sub    $0x28,%rsp
  mov    %rdi,%rsi
  subsd  %xmm0,%xmm2
  andpd  D28(%rip),%xmm2
  movsd  %xmm1,0x18(%rsp)
  movsd  %xmm0,0x10(%rsp)
  comisd %xmm3,%xmm2
  movsd  %xmm3,0x8(%rsp)
  jbe    L4
  lea    D11(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  movsd  0x18(%rsp),%xmm1
  movsd  0x8(%rsp),%xmm3
  lea    D8(%rip),%rdi
  movsd  0x10(%rsp),%xmm0
  mov    $0x3,%eax
  add    $0x28,%rsp
  movapd %xmm1,%xmm2
  movapd %xmm3,%xmm1
  jmp    1050 <printf@plt>
  nopl   0x0(%rax)
L4:
  lea    D5(%rip),%rdi
  xor    %eax,%eax
  add    $0x28,%rsp
  jmp    1050 <printf@plt>
```

tool_calls: name: unpack_data
arguments: data_tag: D28
type: qword[2]
name: unpack_data
arguments: data_tag: D11
type: string
name: unpack_data
arguments: data_tag: D8
type: string
name: unpack_data
arguments: data_tag: D5
type: string

tool: {"D28": [0x7fffffffffffffff,0x0000000000000000]}

tool: D11: Test %s FAILED:


tool: D8: Expected result %g with tolerance %g, but got %g instead


tool: D5: Test %s SUCCEEDED


assistant: ```c
void test_double(double expected, double actual, double tolerance, const char *testname) {
  if (fabs(actual - expected) > tolerance) {
    printf("Test %s FAILED:\n", testname);
    printf("Expected result %g with tolerance %g, but got %g instead\n", expected, tolerance, actual);
  } else {
    printf("Test %s SUCCEEDED\n", testname);
  }
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<test_double>:
  endbr64
  movapd %xmm2,%xmm3
  movapd %xmm1,%xmm2
  sub    $0x28,%rsp
  mov    %rdi,%rsi
  subsd  %xmm0,%xmm2
  andpd  D1(%rip),%xmm2
  movsd  %xmm1,0x18(%rsp)
  movsd  %xmm0,0x10(%rsp)
  comisd %xmm3,%xmm2
  movsd  %xmm3,0x8(%rsp)
  jbe    L3
  lea    D14(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  movsd  0x18(%rsp),%xmm1
  movsd  0x8(%rsp),%xmm3
  lea    D33(%rip),%rdi
  movsd  0x10(%rsp),%xmm0
  mov    $0x3,%eax
  add    $0x28,%rsp
  movapd %xmm1,%xmm2
  movapd %xmm3,%xmm1
  jmp    1050 <printf@plt>
  nopl   0x0(%rax)
L3:
  lea    D37(%rip),%rdi
  xor    %eax,%eax
  add    $0x28,%rsp
  jmp    1050 <printf@plt>
```

tool_calls: name: retrieve_data
arguments: data_label: D1
data_type: qword[2]
name: retrieve_data
arguments: data_label: D14
data_type: string
name: retrieve_data
arguments: data_label: D33
data_type: string
name: retrieve_data
arguments: data_label: D37
data_type: string

tool: {"D1": [0x7fffffffffffffff,0x0000000000000000]}

tool: D14: Test %s FAILED:


tool: D33: Expected result %g with tolerance %g, but got %g instead


tool: D37: Test %s SUCCEEDED


assistant: ```c
void test_double(double expected, double actual, double tolerance, const char *testname) {
  if (fabs(actual - expected) > tolerance) {
    printf("Test %s FAILED:\n", testname);
    printf("Expected result %g with tolerance %g, but got %g instead\n", expected, tolerance, actual);
  } else {
    printf("Test %s SUCCEEDED\n", testname);
  }
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<find_grade>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  movss  %xmm0,-0x14(%rbp)
  movss  %xmm1,-0x18(%rbp)
  movss  %xmm2,-0x1c(%rbp)
  movss  %xmm3,-0x20(%rbp)
  movss  %xmm4,-0x24(%rbp)
  movss  -0x14(%rbp),%xmm0
  comiss -0x18(%rbp),%xmm0
  jb     L45
  movb   $0x41,-0x1(%rbp)
  jmp    L23
L45:
  movss  -0x14(%rbp),%xmm0
  comiss -0x1c(%rbp),%xmm0
  jb     L24
  movb   $0x42,-0x1(%rbp)
  jmp    L23
L24:
  movss  -0x14(%rbp),%xmm0
  comiss -0x20(%rbp),%xmm0
  jb     L21
  movb   $0x43,-0x1(%rbp)
  jmp    L23
L21:
  movb   $0x44,-0x1(%rbp)
L23:
  movzbl -0x1(%rbp),%eax
  pop    %rbp
  ret
```

assistant: ```c
char find_grade(float student_score, float a, float b, float c, float d) {
  char grade;
  if (student_score >= a)
    grade = 'A';
  else if (student_score >= b)
    grade = 'B';
  else if (student_score >= c)
    grade = 'C';
  else
    grade = 'D';
  return (grade);
}
```
user: Translate the below assembly code into C programming language:

```asm
<find_grade>:
  endbr64
  mov    $0x41,%eax
  comiss %xmm1,%xmm0
  jae    L11
  mov    $0x42,%eax
  comiss %xmm2,%xmm0
  jae    L11
  ucomiss %xmm3,%xmm0
  setb   %al
  add    $0x43,%eax
L11:
  ret
```

assistant: ```c
char find_grade(float student_score, float a, float b, float c, float d) {
  char grade;
  if (student_score >= a)
    grade = 'A';
  else if (student_score >= b)
    grade = 'B';
  else if (student_score >= c)
    grade = 'C';
  else
    grade = 'D';
  return (grade);
}
```
user: What is the c source code of the assembly code below?

```asm
<find_grade>:
  endbr64
  comiss %xmm1,%xmm0
  mov    $0x41,%eax
  jae    L11
  comiss %xmm2,%xmm0
  mov    $0x42,%eax
  jb     L13
L11:
  ret
  nopl   0x0(%rax)
L13:
  ucomiss %xmm3,%xmm0
  setb   %al
  add    $0x43,%eax
  ret
```

assistant: ```c
char find_grade(float student_score, float a, float b, float c, float d) {
  char grade;
  if (student_score >= a)
    grade = 'A';
  else if (student_score >= b)
    grade = 'B';
  else if (student_score >= c)
    grade = 'C';
  else
    grade = 'D';
  return (grade);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<find_grade>:
  endbr64
  comiss %xmm1,%xmm0
  mov    $0x41,%eax
  jae    L16
  comiss %xmm2,%xmm0
  mov    $0x42,%eax
  jb     L14
L16:
  ret
  nopl   0x0(%rax)
L14:
  ucomiss %xmm3,%xmm0
  setb   %al
  add    $0x43,%eax
  ret
```

assistant: ```c
char find_grade(float student_score, float a, float b, float c, float d) {
  char grade;
  if (student_score >= a)
    grade = 'A';
  else if (student_score >= b)
    grade = 'B';
  else if (student_score >= c)
    grade = 'C';
  else
    grade = 'D';
  return (grade);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<lstat>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    %rsi,-0x10(%rbp)
  mov    -0x10(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <stat@plt>
  leave
  ret
```

assistant: ```c
int lstat(path, buf)
char *path;
struct stat *buf;
{
  extern int stat();
  return (stat(path, buf));
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<lstat>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x0,%eax
  call   <stat@plt>
  add    $0x8,%rsp
  ret
```

assistant: ```c
int lstat(path, buf)
char *path;
struct stat *buf;
{
  extern int stat();
  return (stat(path, buf));
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<lstat>:
  endbr64
  xor    %eax,%eax
  jmp    1050 <stat@plt>
```

assistant: ```c
int lstat(path, buf)
char *path;
struct stat *buf;
{
  extern int stat();
  return (stat(path, buf));
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<lstat>:
  endbr64
  xor    %eax,%eax
  jmp    1050 <stat@plt>
```

assistant: ```c
int lstat(path, buf)
char *path;
struct stat *buf;
{
  extern int stat();
  return (stat(path, buf));
}
```
user: Translate the below assembly code into C programming language:

```asm
<rotate_left>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x14(%rbp)
  mov    %esi,-0x18(%rbp)
  movl   $0x20,-0xc(%rbp)
  mov    -0xc(%rbp),%eax
  sub    -0x18(%rbp),%eax
  sub    $0x1,%eax
  mov    -0x14(%rbp),%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  add    %eax,%eax
  mov    %eax,-0x8(%rbp)
  mov    -0x18(%rbp),%eax
  mov    -0x14(%rbp),%edx
  mov    %eax,%ecx
  shr    %cl,%edx
  mov    %edx,%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x8(%rbp),%edx
  mov    -0x4(%rbp),%eax
  add    %edx,%eax
  pop    %rbp
  ret
```

assistant: ```c
int rotate_left(unsigned x, int n) {
  int w = sizeof(x) << 3;
  int left = (x << (w - n - 1)) << 1;
  int right = x >> n;
  return left + right;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<rotate_left>:
  endbr64
  mov    $0x1f,%ecx
  sub    %esi,%ecx
  mov    %edi,%eax
  shl    %cl,%eax
  mov    %esi,%ecx
  shr    %cl,%edi
  lea    (%rdi,%rax,2),%eax
  ret
```

assistant: ```c
int rotate_left(unsigned x, int n) {
  int w = sizeof(x) << 3;
  int left = (x << (w - n - 1)) << 1;
  int right = x >> n;
  return left + right;
}
```
user: Translate the below assembly code into C programming language:

```asm
<rotate_left>:
  endbr64
  mov    $0x1f,%ecx
  mov    %edi,%eax
  sub    %esi,%ecx
  shl    %cl,%eax
  mov    %esi,%ecx
  shr    %cl,%edi
  lea    (%rdi,%rax,2),%eax
  ret
```

assistant: ```c
int rotate_left(unsigned x, int n) {
  int w = sizeof(x) << 3;
  int left = (x << (w - n - 1)) << 1;
  int right = x >> n;
  return left + right;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<rotate_left>:
  endbr64
  mov    $0x1f,%ecx
  mov    %edi,%eax
  sub    %esi,%ecx
  shl    %cl,%eax
  mov    %esi,%ecx
  shr    %cl,%edi
  lea    (%rdi,%rax,2),%eax
  ret
```

assistant: ```c
int rotate_left(unsigned x, int n) {
  int w = sizeof(x) << 3;
  int left = (x << (w - n - 1)) << 1;
  int right = x >> n;
  return left + right;
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<calc_jobnum>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    -0x28(%rbp),%rax
  add    $0x3,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L78
  addq   $0x1,-0x10(%rbp)
L78:
  movl   $0x0,-0x1c(%rbp)
  mov    -0x10(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  jmp    L89
L60:
  mov    -0x1c(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  add    %eax,%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x30,%eax
  add    %edx,%eax
  mov    %eax,-0x1c(%rbp)
  addq   $0x1,-0x18(%rbp)
L89:
  mov    -0x10(%rbp),%rax
  add    $0x5,%rax
  cmp    %rax,-0x18(%rbp)
  jae    L33
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L60
L33:
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  jmp    L97
L102:
  addq   $0x1,-0x18(%rbp)
L97:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L102
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  jne    L86
  movl   $0x0,-0x1c(%rbp)
  mov    -0x10(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  jmp    L48
L95:
  mov    -0x1c(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  add    %eax,%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x30,%eax
  add    %edx,%eax
  mov    %eax,-0x1c(%rbp)
  addq   $0x1,-0x18(%rbp)
L48:
  mov    -0x10(%rbp),%rax
  add    $0x3,%rax
  cmp    %rax,-0x18(%rbp)
  jae    L99
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L95
L99:
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x8(%rbp)
L86:
  cmpq   $0x0,-0x30(%rbp)
  je     L4
  mov    -0x30(%rbp),%rax
  mov    -0x8(%rbp),%rdx
  mov    %rdx,(%rax)
L4:
  mov    -0x1c(%rbp),%eax
  leave
  ret
```

assistant: ```c
int calc_jobnum(const char *cfname, const char **hostpp) {
  int jnum;
  const char *cp, *numstr, *hoststr;
  numstr = cfname + 3;
  if (!isdigit((u_char)(*numstr)))
    numstr++;
  jnum = 0;
  for (cp = numstr; (cp < numstr + 5) && isdigit((u_char)(*cp)); cp++)
    jnum = jnum * 10 + (*cp - '0');
  hoststr = cp;
  while (isdigit((u_char)(*cp)))
    cp++;
  if (*cp == '.') {
    jnum = 0;
    for (cp = numstr; (cp < numstr + 3) && isdigit((u_char)(*cp)); cp++)
      jnum = jnum * 10 + (*cp - '0');
    hoststr = cp;
  }
  if (hostpp != NULL)
    *hostpp = hoststr;
  return (jnum);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<calc_jobnum>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%r12
  mov    %rsi,%r14
  movsbl 0x3(%rdi),%edi
  call   <isdigit@plt>
  cmp    $0x1,%rax
  adc    $0x3,%r12
  lea    0x5(%r12),%r13
  mov    %r12,%rbx
  mov    $0x0,%ebp
L61:
  movsbl (%rbx),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L103
  lea    0x0(%rbp,%rbp,4),%edx
  movsbl (%rbx),%eax
  lea    -0x30(%rax,%rdx,2),%ebp
  add    $0x1,%rbx
  cmp    %r13,%rbx
  jne    L61
L51:
  mov    %r13,%rbx
  jmp    L52
L103:
  mov    %rbx,%r13
  jmp    L51
L99:
  add    $0x1,%rbx
L52:
  movsbl (%rbx),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L99
  cmpb   $0x2e,(%rbx)
  je     L73
L22:
  test   %r14,%r14
  je     L106
  mov    %r13,(%r14)
L106:
  mov    %ebp,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L73:
  lea    0x3(%r12),%r13
  mov    $0x0,%ebp
L49:
  movsbl (%r12),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L86
  lea    0x0(%rbp,%rbp,4),%edx
  movsbl (%r12),%eax
  lea    -0x30(%rax,%rdx,2),%ebp
  add    $0x1,%r12
  cmp    %r13,%r12
  jne    L49
  jmp    L22
L86:
  mov    %r12,%r13
  jmp    L22
```

assistant: ```c
int calc_jobnum(const char *cfname, const char **hostpp) {
  int jnum;
  const char *cp, *numstr, *hoststr;
  numstr = cfname + 3;
  if (!isdigit((u_char)(*numstr)))
    numstr++;
  jnum = 0;
  for (cp = numstr; (cp < numstr + 5) && isdigit((u_char)(*cp)); cp++)
    jnum = jnum * 10 + (*cp - '0');
  hoststr = cp;
  while (isdigit((u_char)(*cp)))
    cp++;
  if (*cp == '.') {
    jnum = 0;
    for (cp = numstr; (cp < numstr + 3) && isdigit((u_char)(*cp)); cp++)
      jnum = jnum * 10 + (*cp - '0');
    hoststr = cp;
  }
  if (hostpp != NULL)
    *hostpp = hoststr;
  return (jnum);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<calc_jobnum>:
  endbr64
  push   %r14
  mov    %rsi,%r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  movsbl 0x3(%rdi),%edi
  call   <isdigit@plt>
  cmp    $0x1,%rax
  adc    $0x3,%rbp
  xor    %r12d,%r12d
  lea    0x5(%rbp),%r13
  mov    %rbp,%rbx
L52:
  movsbl (%rbx),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L72
  movsbl (%rbx),%eax
  lea    (%r12,%r12,4),%edx
  add    $0x1,%rbx
  lea    -0x30(%rax,%rdx,2),%r12d
  cmp    %r13,%rbx
  jne    L52
L74:
  mov    %r13,%rbx
  jmp    L80
  nopl   0x0(%rax)
L86:
  add    $0x1,%rbx
L80:
  movsbl (%rbx),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L86
  cmpb   $0x2e,(%rbx)
  je     L101
L12:
  test   %r14,%r14
  je     L51
  mov    %r13,(%r14)
L51:
  pop    %rbx
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopw   0x0(%rax,%rax,1)
L101:
  lea    0x3(%rbp),%r13
  xor    %r12d,%r12d
L89:
  movsbl 0x0(%rbp),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L102
  movsbl 0x0(%rbp),%eax
  lea    (%r12,%r12,4),%edx
  add    $0x1,%rbp
  lea    -0x30(%rax,%rdx,2),%r12d
  cmp    %r13,%rbp
  jne    L89
  jmp    L12
  nopl   (%rax)
L72:
  mov    %rbx,%r13
  jmp    L74
L102:
  mov    %rbp,%r13
  jmp    L12
```

assistant: ```c
int calc_jobnum(const char *cfname, const char **hostpp) {
  int jnum;
  const char *cp, *numstr, *hoststr;
  numstr = cfname + 3;
  if (!isdigit((u_char)(*numstr)))
    numstr++;
  jnum = 0;
  for (cp = numstr; (cp < numstr + 5) && isdigit((u_char)(*cp)); cp++)
    jnum = jnum * 10 + (*cp - '0');
  hoststr = cp;
  while (isdigit((u_char)(*cp)))
    cp++;
  if (*cp == '.') {
    jnum = 0;
    for (cp = numstr; (cp < numstr + 3) && isdigit((u_char)(*cp)); cp++)
      jnum = jnum * 10 + (*cp - '0');
    hoststr = cp;
  }
  if (hostpp != NULL)
    *hostpp = hoststr;
  return (jnum);
}
```