ylfeng/ReF-Decompile-dataset huggingface dataset:
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<main>:
  endbr64
  push   %r14
  lea    D11(%rip),%rdi
  push   %r13
  push   %r12
  push   %rbp
  lea    D50(%rip),%rbp
  push   %rbx
  mov    $0x19,%ebx
  sub    $0x120,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x118(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%r14
  call   <printf@plt>
  lea    0x4(%rsp),%rsi
  mov    %rbp,%rdi
  call   <scanf@plt>
  lea    D16(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  lea    0x8(%rsp),%rsi
  mov    %rbp,%rdi
  call   <scanf@plt>
  lea    D38(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    %rbp,%rdi
  lea    0xc(%rsp),%rsi
  mov    %r14,%rbp
  call   <scanf@plt>
  mov    0x4(%rsp),%edx
  mov    0x8(%rsp),%esi
  mov    0xc(%rsp),%edi
  call   <DMY2Jul@plt>
  lea    D61(%rip),%rdi
  mov    %eax,%esi
  mov    %eax,0xc(%rsp)
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x4(%rsp),%eax
  lea    D59(%rip),%rdi
  lea    -0x76c(%rax),%r12d
  movslq 0xc(%rsp),%rax
  mov    %r12d,0x4(%rsp)
  movslq %r12d,%r12
  imul   $0x3e8,%r12,%r12
  add    %rax,%r12
  xor    %eax,%eax
  mov    %r12,%r13
  mov    %r12,%rsi
  call   <printf@plt>
  not    %r13
  nopw   0x0(%rax,%rax,1)
L12:
  mov    %ebx,%ecx
  mov    %r12,%rdi
  add    $0x1,%rbp
  shr    %cl,%rdi
  call   <Int2Mime@plt>
  mov    %ebx,%ecx
  mov    %r13,%rdi
  sub    $0x5,%ebx
  mov    %al,-0x1(%rbp)
  shr    %cl,%rdi
  call   <Int2Mime@plt>
  mov    %al,0x5(%rbp)
  cmp    $0xfffffffb,%ebx
  jne    L12
  xor    %eax,%eax
  mov    %r14,%rsi
  movb   $0x0,0x1c(%rsp)
  lea    D39(%rip),%rdi
  call   <printf@plt>
  mov    0x118(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L5
  add    $0x120,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L5:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: tag: D11
type: string
name: disassemble_data
arguments: tag: D50
type: string
name: disassemble_data
arguments: tag: D16
type: string
name: disassemble_data
arguments: tag: D38
type: string
name: disassemble_data
arguments: tag: D61
type: string
name: disassemble_data
arguments: tag: D59
type: string
name: disassemble_data
arguments: tag: D39
type: string

tool: D11: Year:

tool: D50: %i

tool: D16: Month:

tool: D38: Date of month:

tool: D61: Julian day: %i


tool: D59: 
%li


tool: D39: 
%s


assistant: ```c
main() {
  int Year, Month, Day, Count;
  unsigned long Jul, InvJul;
  char Buffer[255];
  printf("Year:");
  scanf("%i", &Year);
  printf("Month:");
  scanf("%i", &Month);
  printf("Date of month:");
  scanf("%i", &Day);
  Day = DMY2Jul(Day, Month, Year);
  printf("Julian day: %i\n", Day);
  Year -= 1900;
  Jul = 1000 * (long)Year + (long)Day;
  InvJul = ~Jul;
  printf("\n%li\n", Jul);
  for (Count = 0; Count <= 5; Count++) {
    Buffer[Count] = Int2Mime(Jul >> ((5 - Count) * 5));
    Buffer[Count + 6] = Int2Mime(InvJul >> ((5 - Count) * 5));
  }
  Buffer[Count << 1] = 0;
  printf("\n%s\n", Buffer);
}
```
user: What is the c source code of the assembly code below:

```asm
<l4_widened_no_overrun_Good_FP>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x34(%rbp)
  jmp    L15
L17:
  mov    -0x34(%rbp),%eax
  cltq
  movl   $0x0,-0x30(%rbp,%rax,4)
  addl   $0x1,-0x34(%rbp)
L15:
  mov    -0x34(%rbp),%eax
  mov    $0xa,%esi
  mov    %eax,%edi
  call   <less_than@plt>
  test   %rax,%rax
  jne    L17
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L23
  call   <__stack_chk_fail@plt>
L23:
  leave
  ret
```

assistant: ```c
void l4_widened_no_overrun_Good_FP() {
  int a[10];
  for (int i = 0; less_than(i, 10); i++) {
    a[i] = 0;
  }
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<l4_widened_no_overrun_Good_FP>:
  endbr64
  push   %rbx
  mov    $0x0,%ebx
  jmp    L6
L0:
  add    $0x1,%ebx
L6:
  mov    $0xa,%esi
  mov    %ebx,%edi
  call   <less_than@plt>
  test   %rax,%rax
  jne    L0
  pop    %rbx
  ret
```

assistant: ```c
void l4_widened_no_overrun_Good_FP() {
  int a[10];
  for (int i = 0; less_than(i, 10); i++) {
    a[i] = 0;
  }
}
```
user: What is the c source code of the assembly code below?

```asm
<l4_widened_no_overrun_Good_FP>:
  endbr64
  push   %rbx
  xor    %ebx,%ebx
  jmp    L2
  nopl   0x0(%rax)
L8:
  add    $0x1,%ebx
L2:
  mov    $0xa,%esi
  mov    %ebx,%edi
  call   <less_than@plt>
  test   %rax,%rax
  jne    L8
  pop    %rbx
  ret
```

assistant: ```c
void l4_widened_no_overrun_Good_FP() {
  int a[10];
  for (int i = 0; less_than(i, 10); i++) {
    a[i] = 0;
  }
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<l4_widened_no_overrun_Good_FP>:
  endbr64
  push   %rbx
  xor    %ebx,%ebx
  jmp    L9
  nopl   0x0(%rax)
L4:
  add    $0x1,%ebx
L9:
  mov    $0xa,%esi
  mov    %ebx,%edi
  call   <less_than@plt>
  test   %rax,%rax
  jne    L4
  pop    %rbx
  ret
```

assistant: ```c
void l4_widened_no_overrun_Good_FP() {
  int a[10];
  for (int i = 0; less_than(i, 10); i++) {
    a[i] = 0;
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<expect_msk>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %edi,-0x4(%rbp)
  mov    %esi,-0x8(%rbp)
  cmpl   $0x0,-0x4(%rbp)
  jne    L11
  lea    D36(%rip),%rax
  jmp    L6
L11:
  lea    D7(%rip),%rax
L6:
  mov    -0x8(%rbp),%ecx
  mov    -0x8(%rbp),%edx
  mov    %rax,%rsi
  lea    D27(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x0,%edi
  call   <fflush@plt>
  cmpl   $0xffffffff,-0x4(%rbp)
  jne    L5
  lea    D32(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    $0x0,%edi
  call   <fflush@plt>
L5:
  mov    $0x0,%eax
  leave
  ret
```

tool_calls: name: parse_data
arguments: data_tag: D36
datatype: string
name: parse_data
arguments: data_tag: D7
datatype: string
name: parse_data
arguments: data_tag: D27
datatype: string
name: parse_data
arguments: data_tag: D32
datatype: string

tool: D36: SUCCESS

tool: D7: FAILURE

tool: D27: 	MSK Expected %s, Got 0x%x(0%o) (Will always return expected))


tool: D32: 	Failed Phase 2: You may not expect failure on a mode_t.

assistant: ```c
int expect_msk(int expected, mode_t ret) {
  printf("\tMSK Expected %s, Got 0x%x(0%o) "
         "(Will always return expected))\n",
         expected == 0 ? "SUCCESS" : "FAILURE", ret, ret);
  fflush(NULL);
  if (expected == -1) {
    printf("\tFailed Phase 2: You may not expect failure on a mode_t.\n");
    fflush(NULL);
  }
  return 0;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<expect_msk>:
  endbr64
  push   %rbx
  mov    %esi,%edx
  test   %edi,%edi
  je     L5
  mov    %edi,%ebx
  mov    %esi,%ecx
  lea    D41(%rip),%rsi
  lea    D32(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x0,%edi
  call   <fflush@plt>
  cmp    $0xffffffff,%ebx
  jne    L3
  lea    D27(%rip),%rdi
  call   <puts@plt>
  mov    $0x0,%edi
  call   <fflush@plt>
  jmp    L3
L5:
  mov    %esi,%ecx
  lea    D15(%rip),%rsi
  lea    D32(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x0,%edi
  call   <fflush@plt>
L3:
  mov    $0x0,%eax
  pop    %rbx
  ret
```

tool_calls: name: read_data
arguments: tag: D41
type_infered: string
name: read_data
arguments: tag: D32
type_infered: string
name: read_data
arguments: tag: D27
type_infered: string
name: read_data
arguments: tag: D15
type_infered: string

tool: D41: FAILURE

tool: D32: 	MSK Expected %s, Got 0x%x(0%o) (Will always return expected))


tool: D27: 	Failed Phase 2: You may not expect failure on a mode_t.

tool: D15: SUCCESS

assistant: ```c
int expect_msk(int expected, mode_t ret) {
  printf("\tMSK Expected %s, Got 0x%x(0%o) "
         "(Will always return expected))\n",
         expected == 0 ? "SUCCESS" : "FAILURE", ret, ret);
  fflush(NULL);
  if (expected == -1) {
    printf("\tFailed Phase 2: You may not expect failure on a mode_t.\n");
    fflush(NULL);
  }
  return 0;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<expect_msk>:
  endbr64
  push   %rbx
  mov    %esi,%edx
  test   %edi,%edi
  je     L6
  mov    %edi,%ebx
  mov    %esi,%ecx
  lea    D9(%rip),%rdi
  xor    %eax,%eax
  lea    D34(%rip),%rsi
  call   <printf@plt>
  xor    %edi,%edi
  call   <fflush@plt>
  cmp    $0xffffffff,%ebx
  je     L10
  xor    %eax,%eax
  pop    %rbx
  ret
  nopl   0x0(%rax)
L6:
  mov    %esi,%ecx
  lea    D9(%rip),%rdi
  lea    D25(%rip),%rsi
  xor    %eax,%eax
  call   <printf@plt>
  xor    %edi,%edi
  call   <fflush@plt>
  xor    %eax,%eax
  pop    %rbx
  ret
  nopw   0x0(%rax,%rax,1)
L10:
  lea    D47(%rip),%rdi
  call   <puts@plt>
  xor    %edi,%edi
  call   <fflush@plt>
  xor    %eax,%eax
  pop    %rbx
  ret
```

tool_calls: name: extract_symbolic_data
arguments: label: D9
type: string
name: extract_symbolic_data
arguments: label: D34
type: string
name: extract_symbolic_data
arguments: label: D25
type: string
name: extract_symbolic_data
arguments: label: D47
type: string

tool: D9: 	MSK Expected %s, Got 0x%x(0%o) (Will always return expected))


tool: D34: FAILURE

tool: D25: SUCCESS

tool: D47: 	Failed Phase 2: You may not expect failure on a mode_t.

assistant: ```c
int expect_msk(int expected, mode_t ret) {
  printf("\tMSK Expected %s, Got 0x%x(0%o) "
         "(Will always return expected))\n",
         expected == 0 ? "SUCCESS" : "FAILURE", ret, ret);
  fflush(NULL);
  if (expected == -1) {
    printf("\tFailed Phase 2: You may not expect failure on a mode_t.\n");
    fflush(NULL);
  }
  return 0;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<expect_msk>:
  endbr64
  push   %rbx
  mov    %esi,%edx
  test   %edi,%edi
  je     L12
  mov    %edi,%ebx
  mov    %esi,%ecx
  lea    D49(%rip),%rdi
  xor    %eax,%eax
  lea    D5(%rip),%rsi
  call   <printf@plt>
  xor    %edi,%edi
  call   <fflush@plt>
  cmp    $0xffffffff,%ebx
  je     L15
  xor    %eax,%eax
  pop    %rbx
  ret
  nopl   0x0(%rax)
L12:
  mov    %esi,%ecx
  lea    D49(%rip),%rdi
  lea    D43(%rip),%rsi
  xor    %eax,%eax
  call   <printf@plt>
  xor    %edi,%edi
  call   <fflush@plt>
  xor    %eax,%eax
  pop    %rbx
  ret
  nopw   0x0(%rax,%rax,1)
L15:
  lea    D38(%rip),%rdi
  call   <puts@plt>
  xor    %edi,%edi
  call   <fflush@plt>
  xor    %eax,%eax
  pop    %rbx
  ret
```

tool_calls: name: retrieve_data
arguments: label: D49
type_infered: string
name: retrieve_data
arguments: label: D5
type_infered: string
name: retrieve_data
arguments: label: D43
type_infered: string
name: retrieve_data
arguments: label: D38
type_infered: string

tool: D49: 	MSK Expected %s, Got 0x%x(0%o) (Will always return expected))


tool: D5: FAILURE

tool: D43: SUCCESS

tool: D38: 	Failed Phase 2: You may not expect failure on a mode_t.

assistant: ```c
int expect_msk(int expected, mode_t ret) {
  printf("\tMSK Expected %s, Got 0x%x(0%o) "
         "(Will always return expected))\n",
         expected == 0 ? "SUCCESS" : "FAILURE", ret, ret);
  fflush(NULL);
  if (expected == -1) {
    printf("\tFailed Phase 2: You may not expect failure on a mode_t.\n");
    fflush(NULL);
  }
  return 0;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<pathjoin>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    $0x201,%edi
  call   <xmalloc@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jne    L1
  mov    -0x20(%rbp),%rcx
  mov    -0x8(%rbp),%rax
  mov    $0x100,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  jmp    L16
L1:
  mov    -0x18(%rbp),%rcx
  mov    -0x8(%rbp),%rax
  mov    $0x100,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  mov    -0x8(%rbp),%rax
  lea    D8(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  mov    -0x20(%rbp),%rcx
  mov    -0x8(%rbp),%rax
  mov    $0x100,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncat@plt>
L16:
  mov    -0x8(%rbp),%rax
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D8
data_type: string

tool: D8: /

assistant: ```c
char *pathjoin(const char *a, const char *b) {
  char *result;
  result = xmalloc(256 * 2 + 1);
  if (b[0] == '/') {
    strncpy(result, b, 256);
  } else {
    strncpy(result, a, 256);
    strcat(result, "/");
    strncat(result, b, 256);
  }
  return result;
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<pathjoin>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%r12
  mov    %rsi,%rbp
  mov    $0x201,%edi
  call   <xmalloc@plt>
  mov    %rax,%rbx
  cmpb   $0x2f,0x0(%rbp)
  je     L3
  mov    $0x100,%edx
  mov    %r12,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  lea    D6(%rip),%rsi
  mov    %rbx,%rdi
  call   <strcat@plt>
  mov    $0x100,%edx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <strncat@plt>
L19:
  mov    %rbx,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L3:
  mov    $0x100,%edx
  mov    %rbp,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  jmp    L19
```

tool_calls: name: unpack_data
arguments: data_label: D6
type_guessed: string

tool: D6: /

assistant: ```c
char *pathjoin(const char *a, const char *b) {
  char *result;
  result = xmalloc(256 * 2 + 1);
  if (b[0] == '/') {
    strncpy(result, b, 256);
  } else {
    strncpy(result, a, 256);
    strcat(result, "/");
    strncat(result, b, 256);
  }
  return result;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<pathjoin>:
  endbr64
  push   %r13
  mov    %rdi,%r13
  mov    $0x201,%edi
  push   %r12
  push   %rbp
  mov    %rsi,%rbp
  call   <xmalloc@plt>
  cmpb   $0x2f,0x0(%rbp)
  mov    $0x100,%edx
  mov    %rax,%r12
  je     L4
  mov    %r13,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  mov    %r12,%rdi
  lea    D7(%rip),%rsi
  call   <strcat@plt>
  mov    %rbp,%rsi
  mov    %r12,%rdi
  mov    $0x100,%edx
  call   <strncat@plt>
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopw   0x0(%rax,%rax,1)
L4:
  mov    %rbp,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D7
type: string

tool: D7: /

assistant: ```c
char *pathjoin(const char *a, const char *b) {
  char *result;
  result = xmalloc(256 * 2 + 1);
  if (b[0] == '/') {
    strncpy(result, b, 256);
  } else {
    strncpy(result, a, 256);
    strcat(result, "/");
    strncat(result, b, 256);
  }
  return result;
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<pathjoin>:
  endbr64
  push   %r13
  mov    %rdi,%r13
  mov    $0x201,%edi
  push   %r12
  push   %rbp
  mov    %rsi,%rbp
  call   <xmalloc@plt>
  cmpb   $0x2f,0x0(%rbp)
  mov    $0x100,%edx
  mov    %rax,%r12
  je     L6
  mov    %r13,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  mov    %r12,%rdi
  lea    D5(%rip),%rsi
  call   <strcat@plt>
  mov    %rbp,%rsi
  mov    %r12,%rdi
  mov    $0x100,%edx
  call   <strncat@plt>
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopw   0x0(%rax,%rax,1)
L6:
  mov    %rbp,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

tool_calls: name: unpack_data
arguments: data_tag: D5
type_guessed: string

tool: D5: /

assistant: ```c
char *pathjoin(const char *a, const char *b) {
  char *result;
  result = xmalloc(256 * 2 + 1);
  if (b[0] == '/') {
    strncpy(result, b, 256);
  } else {
    strncpy(result, a, 256);
    strcat(result, "/");
    strncat(result, b, 256);
  }
  return result;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<cel_sdms_hash>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  mov    %rdi,-0x10(%rbp)
  mov    $0x0,%ebx
  jmp    L8
L1:
  imul   $0x1003f,%ebx,%ecx
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  movzbl (%rax),%eax
  movsbl %al,%eax
  lea    (%rcx,%rax,1),%ebx
L8:
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L1
  mov    %ebx,%eax
  and    $0x7fffffff,%eax
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
extern uint32_t cel_sdms_hash(const char *str) {
  register uint32_t h = 0;
  while (*str != '\0') {
    h = 65599 * h + (*str++);
  }
  return (h & 0x7FFFFFFF);
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<cel_sdms_hash>:
  endbr64
  movzbl (%rdi),%edx
  test   %dl,%dl
  je     L9
  mov    $0x0,%eax
L10:
  imul   $0x1003f,%eax,%eax
  add    $0x1,%rdi
  movsbl %dl,%edx
  add    %edx,%eax
  movzbl (%rdi),%edx
  test   %dl,%dl
  jne    L10
L18:
  and    $0x7fffffff,%eax
  ret
L9:
  mov    $0x0,%eax
  jmp    L18
```

assistant: ```c
extern uint32_t cel_sdms_hash(const char *str) {
  register uint32_t h = 0;
  while (*str != '\0') {
    h = 65599 * h + (*str++);
  }
  return (h & 0x7FFFFFFF);
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<cel_sdms_hash>:
  endbr64
  movsbl (%rdi),%edx
  xor    %eax,%eax
  test   %dl,%dl
  je     L15
  nopl   (%rax)
L2:
  imul   $0x1003f,%eax,%eax
  add    $0x1,%rdi
  add    %edx,%eax
  movsbl (%rdi),%edx
  test   %dl,%dl
  jne    L2
  and    $0x7fffffff,%eax
  ret
  nopl   0x0(%rax)
L15:
  ret
```

assistant: ```c
extern uint32_t cel_sdms_hash(const char *str) {
  register uint32_t h = 0;
  while (*str != '\0') {
    h = 65599 * h + (*str++);
  }
  return (h & 0x7FFFFFFF);
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<cel_sdms_hash>:
  endbr64
  movsbl (%rdi),%edx
  xor    %eax,%eax
  test   %dl,%dl
  je     L2
  nopl   (%rax)
L1:
  imul   $0x1003f,%eax,%eax
  add    $0x1,%rdi
  add    %edx,%eax
  movsbl (%rdi),%edx
  test   %dl,%dl
  jne    L1
  and    $0x7fffffff,%eax
  ret
  nopl   0x0(%rax)
L2:
  ret
```

assistant: ```c
extern uint32_t cel_sdms_hash(const char *str) {
  register uint32_t h = 0;
  while (*str != '\0') {
    h = 65599 * h + (*str++);
  }
  return (h & 0x7FFFFFFF);
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<Resolve>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %edx,-0x34(%rbp)
  mov    -0x30(%rbp),%rax
  mov    $0x18,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  mov    D1(%rip),%rax
  mov    (%rax),%edx
  mov    -0x30(%rbp),%rax
  mov    %edx,0x10(%rax)
  mov    -0x34(%rbp),%eax
  movzwl %ax,%eax
  mov    %eax,%edi
  call   <htons@plt>
  mov    -0x30(%rbp),%rdx
  mov    %rax,0x8(%rdx)
  mov    -0x28(%rbp),%rax
  mov    $0x3a,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  je     L86
  mov    -0x10(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,%rdi
  call   <atoi@plt>
  movzwl %ax,%eax
  mov    %eax,%edi
  call   <htons@plt>
  mov    -0x30(%rbp),%rdx
  mov    %rax,0x8(%rdx)
  mov    -0x10(%rbp),%rax
  movb   $0x0,(%rax)
L86:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L49
  mov    $0x0,%eax
  jmp    L48
L49:
  movl   $0x0,-0x14(%rbp)
  jmp    L31
L138:
  mov    -0x14(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %eax,%eax
  jne    L101
  mov    -0x14(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  jne    L106
L101:
  addl   $0x1,-0x14(%rbp)
L31:
  mov    -0x14(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L138
  jmp    L1
L106:
  nop
L1:
  mov    -0x14(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L71
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <gethostbyname@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L46
  mov    $0x0,%eax
  jmp    L48
L46:
  mov    -0x8(%rbp),%rax
  mov    (%rax),%rax
  mov    (%rax),%rdx
  mov    -0x30(%rbp),%rax
  mov    %rdx,(%rax)
  mov    $0x1,%eax
  jmp    L48
L71:
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <inet_addr@plt>
  mov    -0x30(%rbp),%rdx
  mov    %rax,(%rdx)
  mov    -0x30(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  je     L83
  mov    $0x1,%eax
  jmp    L48
L83:
  mov    $0x0,%eax
L48:
  leave
  ret
```

assistant: ```c
int Resolve(const char *address, struct sockaddr_in *addr, int defaultport) {
  char *p;
  int i;
  memset(addr, 0, sizeof(struct sockaddr_in));
  addr->sin_family = AF_INET;
  addr->sin_port = htons((unsigned short)defaultport);
  if ((p = strchr(address, ':'))) {
    addr->sin_port = htons((unsigned short)atoi(p + 1));
    *p = 0;
  }
  if (!*address)
    return 0;
  for (i = 0; address[i]; i++)
    if (!isdigit((unsigned char)address[i]) && address[i] != '.')
      break;
  if (address[i]) {
    struct hostent *h;
    h = gethostbyname(address);
    if (!h)
      return 0;
    addr->sin_addr.s_addr = *((unsigned long *)h->h_addr);
    return 1;
  } else {
    addr->sin_addr.s_addr = inet_addr(address);
    if (addr->sin_addr.s_addr)
      return 1;
    else
      return 0;
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<Resolve>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%r13
  mov    %rsi,%r12
  mov    %edx,%ebx
  mov    $0x18,%edx
  mov    $0x0,%esi
  mov    %r12,%rdi
  call   <memset@plt>
  mov    D5(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,0x10(%r12)
  movzwl %bx,%edi
  call   <htons@plt>
  mov    %rax,0x8(%r12)
  mov    $0x3a,%esi
  mov    %r13,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L2
  mov    %rax,%rbx
  lea    0x1(%rax),%rdi
  call   <atoi@plt>
  movzwl %ax,%edi
  call   <htons@plt>
  mov    %rax,0x8(%r12)
  movb   $0x0,(%rbx)
L2:
  movzbl 0x0(%r13),%edi
  mov    $0x0,%ebx
  test   %dil,%dil
  je     L72
  mov    %r13,%rbp
  jmp    L23
L80:
  add    $0x1,%rbp
  movzbl 0x0(%rbp),%edi
  test   %dil,%dil
  je     L65
L23:
  movzbl %dil,%edi
  call   <isdigit@plt>
  mov    %eax,%ebx
  test   %eax,%eax
  jne    L80
  cmpb   $0x2e,0x0(%rbp)
  je     L80
  cmpb   $0x0,0x0(%rbp)
  je     L65
  mov    %r13,%rdi
  call   <gethostbyname@plt>
  test   %rax,%rax
  je     L72
  mov    (%rax),%rax
  mov    (%rax),%rax
  mov    %rax,(%r12)
  mov    $0x1,%ebx
  jmp    L72
L65:
  mov    %r13,%rdi
  call   <inet_addr@plt>
  mov    %rax,(%r12)
  test   %rax,%rax
  setne  %bl
  movzbl %bl,%ebx
L72:
  mov    %ebx,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
int Resolve(const char *address, struct sockaddr_in *addr, int defaultport) {
  char *p;
  int i;
  memset(addr, 0, sizeof(struct sockaddr_in));
  addr->sin_family = AF_INET;
  addr->sin_port = htons((unsigned short)defaultport);
  if ((p = strchr(address, ':'))) {
    addr->sin_port = htons((unsigned short)atoi(p + 1));
    *p = 0;
  }
  if (!*address)
    return 0;
  for (i = 0; address[i]; i++)
    if (!isdigit((unsigned char)address[i]) && address[i] != '.')
      break;
  if (address[i]) {
    struct hostent *h;
    h = gethostbyname(address);
    if (!h)
      return 0;
    addr->sin_addr.s_addr = *((unsigned long *)h->h_addr);
    return 1;
  } else {
    addr->sin_addr.s_addr = inet_addr(address);
    if (addr->sin_addr.s_addr)
      return 1;
    else
      return 0;
  }
}
```