ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<printEgyptian>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %esi,-0x18(%rbp)
  cmpl   $0x0,-0x18(%rbp)
  je     L37
  cmpl   $0x0,-0x14(%rbp)
  je     L37
  mov    -0x18(%rbp),%eax
  cltd
  idivl  -0x14(%rbp)
  mov    %edx,%eax
  test   %eax,%eax
  jne    L64
  mov    -0x18(%rbp),%eax
  cltd
  idivl  -0x14(%rbp)
  mov    %eax,%esi
  lea    D12(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  jmp    L11
L64:
  mov    -0x14(%rbp),%eax
  cltd
  idivl  -0x18(%rbp)
  mov    %edx,%eax
  test   %eax,%eax
  jne    L74
  mov    -0x14(%rbp),%eax
  cltd
  idivl  -0x18(%rbp)
  mov    %eax,%esi
  lea    D28(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  jmp    L11
L74:
  mov    -0x14(%rbp),%eax
  cmp    -0x18(%rbp),%eax
  jle    L63
  mov    -0x14(%rbp),%eax
  cltd
  idivl  -0x18(%rbp)
  mov    %eax,%esi
  lea    D36(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    -0x14(%rbp),%eax
  cltd
  idivl  -0x18(%rbp)
  mov    -0x18(%rbp),%eax
  mov    %eax,%esi
  mov    %edx,%edi
  call   <printEgyptian>
  jmp    L11
L63:
  mov    -0x18(%rbp),%eax
  cltd
  idivl  -0x14(%rbp)
  add    $0x1,%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  mov    %eax,%esi
  lea    D21(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    -0x18(%rbp),%eax
  imul   -0x4(%rbp),%eax
  mov    %eax,%edx
  mov    -0x14(%rbp),%eax
  imul   -0x4(%rbp),%eax
  sub    -0x18(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <printEgyptian>
  jmp    L11
L37:
  nop
L11:
  leave
  ret
```

tool_calls: name: read_data
arguments: data_tag: D12
data_type: string
name: read_data
arguments: data_tag: D28
data_type: string
name: read_data
arguments: data_tag: D36
data_type: string
name: read_data
arguments: data_tag: D21
data_type: string

tool: D12: 1/%d

tool: D28: %d

tool: D36: %d + 

tool: D21: 1/%d + 

assistant: ```c
void printEgyptian(int numerator, int denominator) {
  if (denominator == 0 || numerator == 0)
    return;
  if (denominator % numerator == 0) {
    printf("1/%d", denominator / numerator);
    return;
  }
  if (numerator % denominator == 0) {
    printf("%d", numerator / denominator);
    return;
  }
  if (numerator > denominator) {
    printf("%d + ", numerator / denominator);
    printEgyptian(numerator % denominator, denominator);
    return;
  }
  int n = (denominator / numerator) + 1;
  printf("1/%d + ", n);
  printEgyptian((numerator * n) - denominator, denominator * n);
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<printEgyptian>:
  endbr64
  test   %esi,%esi
  je     L60
  push   %r12
  push   %rbp
  push   %rbx
  mov    %edi,%ebx
  mov    %esi,%ebp
  test   %edi,%edi
  je     L14
  mov    %esi,%eax
  cltd
  idiv   %edi
  test   %edx,%edx
  je     L76
  mov    %edi,%eax
  cltd
  idiv   %esi
  mov    %edx,%r12d
  test   %edx,%edx
  je     L37
  cmp    %edi,%esi
  jl     L3
  mov    %esi,%eax
  cltd
  idiv   %edi
  lea    0x1(%rax),%r12d
  mov    %r12d,%esi
  lea    D36(%rip),%rdi
  call   <printf@plt>
  mov    %ebp,%esi
  imul   %r12d,%esi
  imul   %r12d,%ebx
  mov    %ebx,%edi
  sub    %ebp,%edi
  call   <printEgyptian>
L14:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L76:
  mov    %esi,%eax
  cltd
  idiv   %edi
  mov    %eax,%esi
  lea    D18(%rip),%rdi
  call   <printf@plt>
  jmp    L14
L37:
  mov    %edi,%eax
  cltd
  idiv   %esi
  mov    %eax,%esi
  lea    D25(%rip),%rdi
  call   <printf@plt>
  jmp    L14
L3:
  mov    %edi,%eax
  cltd
  idiv   %esi
  mov    %eax,%esi
  lea    D33(%rip),%rdi
  call   <printf@plt>
  mov    %ebp,%esi
  mov    %r12d,%edi
  call   <printEgyptian>
  jmp    L14
L60:
  ret
```

tool_calls: name: disassemble_data
arguments: data_label: D36
datatype: string
name: disassemble_data
arguments: data_label: D18
datatype: string
name: disassemble_data
arguments: data_label: D25
datatype: string
name: disassemble_data
arguments: data_label: D33
datatype: string

tool: D36: 1/%d + 

tool: D18: 1/%d

tool: D25: %d

tool: D33: %d + 

assistant: ```c
void printEgyptian(int numerator, int denominator) {
  if (denominator == 0 || numerator == 0)
    return;
  if (denominator % numerator == 0) {
    printf("1/%d", denominator / numerator);
    return;
  }
  if (numerator % denominator == 0) {
    printf("%d", numerator / denominator);
    return;
  }
  if (numerator > denominator) {
    printf("%d + ", numerator / denominator);
    printEgyptian(numerator % denominator, denominator);
    return;
  }
  int n = (denominator / numerator) + 1;
  printf("1/%d + ", n);
  printEgyptian((numerator * n) - denominator, denominator * n);
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<printEgyptian>:
  endbr64
  test   %esi,%esi
  je     L5
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %edi,%ebx
  test   %edi,%edi
  je     L23
  mov    %esi,%eax
  mov    %esi,%r14d
  cltd
  idiv   %edi
  test   %edx,%edx
  je     L104
  mov    %edi,%eax
  cltd
  idiv   %esi
  mov    %edx,%ebp
  test   %edx,%edx
  je     L56
  lea    D23(%rip),%r13
  lea    D0(%rip),%r12
  jmp    L46
  nopl   (%rax)
L22:
  mov    %ebx,%eax
  mov    %r12,%rdi
  mov    %ebp,%ebx
  cltd
  idiv   %r14d
  mov    %eax,%esi
  call   <printf@plt>
  mov    %r14d,%eax
  cltd
  idiv   %ebx
  test   %edx,%edx
  je     L104
L92:
  mov    %ebx,%eax
  cltd
  idiv   %r14d
  mov    %edx,%ebp
  test   %edx,%edx
  je     L56
L46:
  cmp    %ebx,%r14d
  jl     L22
  mov    %r14d,%eax
  mov    %r13,%rdi
  cltd
  idiv   %ebx
  lea    0x1(%rax),%ebp
  mov    %ebp,%esi
  call   <printf@plt>
  mov    %ebp,%edx
  imul   %ebx,%ebp
  imul   %r14d,%edx
  mov    %ebp,%ebx
  sub    %r14d,%ebx
  test   %edx,%edx
  je     L23
  test   %ebx,%ebx
  je     L23
  mov    %edx,%r14d
  mov    %r14d,%eax
  cltd
  idiv   %ebx
  test   %edx,%edx
  jne    L92
L104:
  mov    %r14d,%eax
  lea    D11(%rip),%rdi
  cltd
  idiv   %ebx
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  mov    %eax,%esi
  jmp    1050 <printf@plt>
  nop
L23:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax)
L56:
  mov    %ebx,%eax
  lea    D18(%rip),%rdi
  pop    %rbx
  pop    %rbp
  cltd
  pop    %r12
  pop    %r13
  idiv   %r14d
  pop    %r14
  mov    %eax,%esi
  jmp    1050 <printf@plt>
L5:
  ret
```

tool_calls: name: parse_data
arguments: tag: D23
type_guessed: string
name: parse_data
arguments: tag: D0
type_guessed: string
name: parse_data
arguments: tag: D11
type_guessed: string
name: parse_data
arguments: tag: D18
type_guessed: string

tool: D23: 1/%d + 

tool: D0: %d + 

tool: D11: 1/%d

tool: D18: %d

assistant: ```c
void printEgyptian(int numerator, int denominator) {
  if (denominator == 0 || numerator == 0)
    return;
  if (denominator % numerator == 0) {
    printf("1/%d", denominator / numerator);
    return;
  }
  if (numerator % denominator == 0) {
    printf("%d", numerator / denominator);
    return;
  }
  if (numerator > denominator) {
    printf("%d + ", numerator / denominator);
    printEgyptian(numerator % denominator, denominator);
    return;
  }
  int n = (denominator / numerator) + 1;
  printf("1/%d + ", n);
  printEgyptian((numerator * n) - denominator, denominator * n);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<printEgyptian>:
  endbr64
  test   %esi,%esi
  je     L33
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %edi,%ebx
  test   %edi,%edi
  je     L9
  mov    %esi,%eax
  mov    %esi,%r14d
  cltd
  idiv   %edi
  test   %edx,%edx
  je     L4
  mov    %edi,%eax
  cltd
  idiv   %esi
  mov    %edx,%ebp
  test   %edx,%edx
  je     L106
  lea    D6(%rip),%r13
  lea    D9(%rip),%r12
  jmp    L7
  nopl   (%rax)
L5:
  mov    %ebx,%eax
  mov    %r12,%rdi
  mov    %ebp,%ebx
  cltd
  idiv   %r14d
  mov    %eax,%esi
  call   <printf@plt>
  mov    %r14d,%eax
  cltd
  idiv   %ebx
  test   %edx,%edx
  je     L4
L108:
  mov    %ebx,%eax
  cltd
  idiv   %r14d
  mov    %edx,%ebp
  test   %edx,%edx
  je     L106
L7:
  cmp    %ebx,%r14d
  jl     L5
  mov    %r14d,%eax
  mov    %r13,%rdi
  cltd
  idiv   %ebx
  lea    0x1(%rax),%ebp
  mov    %ebp,%esi
  call   <printf@plt>
  mov    %ebp,%edx
  imul   %ebx,%ebp
  imul   %r14d,%edx
  mov    %ebp,%ebx
  sub    %r14d,%ebx
  test   %edx,%edx
  je     L9
  test   %ebx,%ebx
  je     L9
  mov    %edx,%r14d
  mov    %r14d,%eax
  cltd
  idiv   %ebx
  test   %edx,%edx
  jne    L108
L4:
  mov    %r14d,%eax
  lea    D8(%rip),%rdi
  cltd
  idiv   %ebx
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  mov    %eax,%esi
  jmp    1050 <printf@plt>
  nop
L9:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax)
L106:
  mov    %ebx,%eax
  lea    D13(%rip),%rdi
  pop    %rbx
  pop    %rbp
  cltd
  pop    %r12
  pop    %r13
  idiv   %r14d
  pop    %r14
  mov    %eax,%esi
  jmp    1050 <printf@plt>
L33:
  ret
```

tool_calls: name: parse_data
arguments: tag: D6
data_type: string
name: parse_data
arguments: tag: D9
data_type: string
name: parse_data
arguments: tag: D8
data_type: string
name: parse_data
arguments: tag: D13
data_type: string

tool: D6: 1/%d + 

tool: D9: %d + 

tool: D8: 1/%d

tool: D13: %d

assistant: ```c
void printEgyptian(int numerator, int denominator) {
  if (denominator == 0 || numerator == 0)
    return;
  if (denominator % numerator == 0) {
    printf("1/%d", denominator / numerator);
    return;
  }
  if (numerator % denominator == 0) {
    printf("%d", numerator / denominator);
    return;
  }
  if (numerator > denominator) {
    printf("%d + ", numerator / denominator);
    printEgyptian(numerator % denominator, denominator);
    return;
  }
  int n = (denominator / numerator) + 1;
  printf("1/%d + ", n);
  printEgyptian((numerator * n) - denominator, denominator * n);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<val2elapstr>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  cmpl   $0x1517f,-0x14(%rbp)
  jle    L17
  mov    -0x14(%rbp),%eax
  movslq %eax,%rdx
  imul   $0xffffffffc22e4507,%rdx,%rdx
  shr    $0x20,%rdx
  add    %eax,%edx
  sar    $0x10,%edx
  sar    $0x1f,%eax
  sub    %eax,%edx
  mov    -0x8(%rbp),%rax
  lea    D34(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <sprintf@plt>
  cltq
  add    %rax,-0x8(%rbp)
L17:
  cmpl   $0xe0f,-0x14(%rbp)
  jle    L27
  mov    -0x14(%rbp),%edx
  movslq %edx,%rax
  imul   $0xffffffffc22e4507,%rax,%rax
  shr    $0x20,%rax
  add    %edx,%eax
  sar    $0x10,%eax
  mov    %edx,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%eax
  imul   $0x15180,%eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  movslq %eax,%rdx
  imul   $0xffffffff91a2b3c5,%rdx,%rdx
  shr    $0x20,%rdx
  add    %eax,%edx
  sar    $0xb,%edx
  sar    $0x1f,%eax
  sub    %eax,%edx
  mov    -0x8(%rbp),%rax
  lea    D8(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <sprintf@plt>
  cltq
  add    %rax,-0x8(%rbp)
L27:
  cmpl   $0x3b,-0x14(%rbp)
  jle    L18
  mov    -0x14(%rbp),%edx
  movslq %edx,%rax
  imul   $0xffffffff91a2b3c5,%rax,%rax
  shr    $0x20,%rax
  add    %edx,%eax
  sar    $0xb,%eax
  mov    %edx,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%eax
  imul   $0xe10,%eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  movslq %eax,%rdx
  imul   $0xffffffff88888889,%rdx,%rdx
  shr    $0x20,%rdx
  add    %eax,%edx
  sar    $0x5,%edx
  sar    $0x1f,%eax
  sub    %eax,%edx
  mov    -0x8(%rbp),%rax
  lea    D9(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <sprintf@plt>
  cltq
  add    %rax,-0x8(%rbp)
L18:
  mov    -0x14(%rbp),%edx
  movslq %edx,%rax
  imul   $0xffffffff88888889,%rax,%rax
  shr    $0x20,%rax
  add    %edx,%eax
  sar    $0x5,%eax
  mov    %edx,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%eax
  imul   $0x3c,%eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  mov    -0x8(%rbp),%rcx
  mov    %eax,%edx
  lea    D33(%rip),%rax
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   <sprintf@plt>
  cltq
  add    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  sub    -0x20(%rbp),%rax
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: label: D34
type: string
name: disassemble_data
arguments: label: D8
type: string
name: disassemble_data
arguments: label: D9
type: string
name: disassemble_data
arguments: label: D33
type: string

tool: D34: %dd

tool: D8: %dh

tool: D9: %dm

tool: D33: %ds

assistant: ```c
int val2elapstr(int value, char *strvalue) {
  char *p = strvalue;
  if (value >= (24 * 60 * 60)) {
    p += sprintf(p, "%dd", value / (24 * 60 * 60));
  }
  if (value >= (60 * 60)) {
    p += sprintf(p, "%dh", (value % (24 * 60 * 60)) / (60 * 60));
  }
  if (value >= (60)) {
    p += sprintf(p, "%dm", (value % (60 * 60)) / (60));
  }
  p += sprintf(p, "%ds", (value % (60)));
  return p - strvalue;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<val2elapstr>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %edi,%ebx
  mov    %rsi,%r12
  cmp    $0x1517f,%edi
  jg     L35
  cmp    $0xe0f,%edi
  jg     L48
  cmp    $0x3b,%edi
  jg     L17
  mov    %rsi,%rbp
L10:
  movslq %ebx,%rax
  imul   $0xffffffff88888889,%rax,%rax
  shr    $0x20,%rax
  add    %ebx,%eax
  sar    $0x5,%eax
  mov    %ebx,%edx
  sar    $0x1f,%edx
  sub    %edx,%eax
  imul   $0x3c,%eax,%eax
  sub    %eax,%ebx
  mov    %ebx,%edx
  lea    D31(%rip),%rsi
  mov    %rbp,%rdi
  call   <sprintf@plt>
  lea    (%rax,%rbp,1),%eax
  sub    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L35:
  movslq %edi,%rdx
  imul   $0xffffffffc22e4507,%rdx,%rdx
  shr    $0x20,%rdx
  add    %edi,%edx
  sar    $0x10,%edx
  mov    %edi,%eax
  sar    $0x1f,%eax
  sub    %eax,%edx
  lea    D12(%rip),%rsi
  mov    %r12,%rdi
  call   <sprintf@plt>
  movslq %eax,%rbp
  add    %r12,%rbp
L16:
  movslq %ebx,%rax
  imul   $0xffffffffc22e4507,%rax,%rax
  shr    $0x20,%rax
  add    %ebx,%eax
  sar    $0x10,%eax
  mov    %ebx,%edx
  sar    $0x1f,%edx
  sub    %edx,%eax
  imul   $0x15180,%eax,%eax
  mov    %ebx,%ecx
  sub    %eax,%ecx
  movslq %ecx,%rdx
  imul   $0xffffffff91a2b3c5,%rdx,%rdx
  shr    $0x20,%rdx
  add    %ecx,%edx
  sar    $0xb,%edx
  sar    $0x1f,%ecx
  sub    %ecx,%edx
  lea    D26(%rip),%rsi
  mov    %rbp,%rdi
  call   <sprintf@plt>
  cltq
  add    %rax,%rbp
L33:
  movslq %ebx,%rax
  imul   $0xffffffff91a2b3c5,%rax,%rax
  shr    $0x20,%rax
  add    %ebx,%eax
  sar    $0xb,%eax
  mov    %ebx,%edx
  sar    $0x1f,%edx
  sub    %edx,%eax
  imul   $0xe10,%eax,%eax
  mov    %ebx,%ecx
  sub    %eax,%ecx
  movslq %ecx,%rdx
  imul   $0xffffffff88888889,%rdx,%rdx
  shr    $0x20,%rdx
  add    %ecx,%edx
  sar    $0x5,%edx
  sar    $0x1f,%ecx
  sub    %ecx,%edx
  lea    D25(%rip),%rsi
  mov    %rbp,%rdi
  call   <sprintf@plt>
  cltq
  add    %rax,%rbp
  jmp    L10
L48:
  mov    %rsi,%rbp
  jmp    L16
L17:
  mov    %rsi,%rbp
  jmp    L33
```

tool_calls: name: read_data
arguments: data_tag: D31
data_type: string
name: read_data
arguments: data_tag: D12
data_type: string
name: read_data
arguments: data_tag: D26
data_type: string
name: read_data
arguments: data_tag: D25
data_type: string

tool: D31: %ds

tool: D12: %dd

tool: D26: %dh

tool: D25: %dm

assistant: ```c
int val2elapstr(int value, char *strvalue) {
  char *p = strvalue;
  if (value >= (24 * 60 * 60)) {
    p += sprintf(p, "%dd", value / (24 * 60 * 60));
  }
  if (value >= (60 * 60)) {
    p += sprintf(p, "%dh", (value % (24 * 60 * 60)) / (60 * 60));
  }
  if (value >= (60)) {
    p += sprintf(p, "%dm", (value % (60 * 60)) / (60));
  }
  p += sprintf(p, "%ds", (value % (60)));
  return p - strvalue;
}
```
user: What is the c source code of the assembly code below?

```asm
<val2elapstr>:
  endbr64
  push   %r13
  push   %r12
  mov    %edi,%r12d
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  sub    $0x8,%rsp
  cmp    $0x1517f,%edi
  jg     L15
  mov    %rsi,%r13
  movslq %edi,%rbx
  cmp    $0xe0f,%edi
  jg     L20
  cmp    $0x3b,%edi
  jg     L0
L31:
  imul   $0xffffffff88888889,%rbx,%rax
  mov    %r12d,%edx
  mov    %r13,%rdi
  sar    $0x1f,%edx
  lea    D28(%rip),%rsi
  shr    $0x20,%rax
  add    %r12d,%eax
  sar    $0x5,%eax
  sub    %edx,%eax
  mov    %r12d,%edx
  imul   $0x3c,%eax,%eax
  sub    %eax,%edx
  call   <sprintf@plt>
  add    $0x8,%rsp
  add    %r13d,%eax
  pop    %rbx
  sub    %ebp,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax,%rax,1)
L15:
  movslq %edi,%rbx
  mov    %edi,%eax
  lea    D3(%rip),%rsi
  imul   $0xffffffffc22e4507,%rbx,%rdx
  sar    $0x1f,%eax
  shr    $0x20,%rdx
  add    %edi,%edx
  mov    %rbp,%rdi
  sar    $0x10,%edx
  sub    %eax,%edx
  call   <sprintf@plt>
  movslq %eax,%r13
  add    %rbp,%r13
L20:
  imul   $0xffffffffc22e4507,%rbx,%rax
  mov    %r12d,%edx
  mov    %r13,%rdi
  sar    $0x1f,%edx
  lea    D33(%rip),%rsi
  shr    $0x20,%rax
  add    %r12d,%eax
  sar    $0x10,%eax
  sub    %edx,%eax
  mov    %r12d,%edx
  imul   $0x15180,%eax,%eax
  sub    %eax,%edx
  mov    $0x91a2b3c5,%eax
  imul   %rax,%rdx
  shr    $0x2b,%rdx
  call   <sprintf@plt>
  cltq
  add    %rax,%r13
L0:
  imul   $0xffffffff91a2b3c5,%rbx,%rax
  mov    %r12d,%edx
  mov    %r13,%rdi
  sar    $0x1f,%edx
  lea    D12(%rip),%rsi
  shr    $0x20,%rax
  add    %r12d,%eax
  sar    $0xb,%eax
  sub    %edx,%eax
  mov    %r12d,%edx
  imul   $0xe10,%eax,%eax
  sub    %eax,%edx
  mov    $0x88888889,%eax
  imul   %rax,%rdx
  shr    $0x25,%rdx
  call   <sprintf@plt>
  cltq
  add    %rax,%r13
  jmp    L31
```

tool_calls: name: extract_symbolic_data
arguments: tag: D28
data_type: string
name: extract_symbolic_data
arguments: tag: D3
data_type: string
name: extract_symbolic_data
arguments: tag: D33
data_type: string
name: extract_symbolic_data
arguments: tag: D12
data_type: string

tool: D28: %ds

tool: D3: %dd

tool: D33: %dh

tool: D12: %dm

assistant: ```c
int val2elapstr(int value, char *strvalue) {
  char *p = strvalue;
  if (value >= (24 * 60 * 60)) {
    p += sprintf(p, "%dd", value / (24 * 60 * 60));
  }
  if (value >= (60 * 60)) {
    p += sprintf(p, "%dh", (value % (24 * 60 * 60)) / (60 * 60));
  }
  if (value >= (60)) {
    p += sprintf(p, "%dm", (value % (60 * 60)) / (60));
  }
  p += sprintf(p, "%ds", (value % (60)));
  return p - strvalue;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<val2elapstr>:
  endbr64
  push   %r13
  push   %r12
  mov    %edi,%r12d
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  sub    $0x8,%rsp
  cmp    $0x1517f,%edi
  jg     L13
  mov    %rsi,%r13
  movslq %edi,%rbx
  cmp    $0xe0f,%edi
  jg     L38
  cmp    $0x3b,%edi
  jg     L6
L37:
  imul   $0xffffffff88888889,%rbx,%rax
  mov    %r12d,%edx
  mov    %r13,%rdi
  sar    $0x1f,%edx
  lea    D30(%rip),%rsi
  shr    $0x20,%rax
  add    %r12d,%eax
  sar    $0x5,%eax
  sub    %edx,%eax
  mov    %r12d,%edx
  imul   $0x3c,%eax,%eax
  sub    %eax,%edx
  call   <sprintf@plt>
  add    $0x8,%rsp
  add    %r13d,%eax
  pop    %rbx
  sub    %ebp,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax,%rax,1)
L13:
  movslq %edi,%rbx
  mov    %edi,%eax
  lea    D38(%rip),%rsi
  imul   $0xffffffffc22e4507,%rbx,%rdx
  sar    $0x1f,%eax
  shr    $0x20,%rdx
  add    %edi,%edx
  mov    %rbp,%rdi
  sar    $0x10,%edx
  sub    %eax,%edx
  call   <sprintf@plt>
  movslq %eax,%r13
  add    %rbp,%r13
L38:
  imul   $0xffffffffc22e4507,%rbx,%rax
  mov    %r12d,%edx
  mov    %r13,%rdi
  sar    $0x1f,%edx
  lea    D26(%rip),%rsi
  shr    $0x20,%rax
  add    %r12d,%eax
  sar    $0x10,%eax
  sub    %edx,%eax
  mov    %r12d,%edx
  imul   $0x15180,%eax,%eax
  sub    %eax,%edx
  mov    $0x91a2b3c5,%eax
  imul   %rax,%rdx
  shr    $0x2b,%rdx
  call   <sprintf@plt>
  cltq
  add    %rax,%r13
L6:
  imul   $0xffffffff91a2b3c5,%rbx,%rax
  mov    %r12d,%edx
  mov    %r13,%rdi
  sar    $0x1f,%edx
  lea    D23(%rip),%rsi
  shr    $0x20,%rax
  add    %r12d,%eax
  sar    $0xb,%eax
  sub    %edx,%eax
  mov    %r12d,%edx
  imul   $0xe10,%eax,%eax
  sub    %eax,%edx
  mov    $0x88888889,%eax
  imul   %rax,%rdx
  shr    $0x25,%rdx
  call   <sprintf@plt>
  cltq
  add    %rax,%r13
  jmp    L37
```

tool_calls: name: read_data
arguments: tag: D30
type_guessed: string
name: read_data
arguments: tag: D38
type_guessed: string
name: read_data
arguments: tag: D26
type_guessed: string
name: read_data
arguments: tag: D23
type_guessed: string

tool: D30: %ds

tool: D38: %dd

tool: D26: %dh

tool: D23: %dm

assistant: ```c
int val2elapstr(int value, char *strvalue) {
  char *p = strvalue;
  if (value >= (24 * 60 * 60)) {
    p += sprintf(p, "%dd", value / (24 * 60 * 60));
  }
  if (value >= (60 * 60)) {
    p += sprintf(p, "%dh", (value % (24 * 60 * 60)) / (60 * 60));
  }
  if (value >= (60)) {
    p += sprintf(p, "%dm", (value % (60 * 60)) / (60));
  }
  p += sprintf(p, "%ds", (value % (60)));
  return p - strvalue;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<any_directional_flips>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    %edx,-0x20(%rbp)
  mov    %ecx,-0x24(%rbp)
  mov    -0x1c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x24(%rbp)
  jne    L11
  mov    -0x1c(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x24(%rbp)
  jne    L16
  mov    -0x1c(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x24(%rbp)
  jne    L16
  mov    -0x1c(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x24(%rbp)
  jne    L16
  mov    -0x1c(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x24(%rbp)
  jne    L16
  mov    -0x1c(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x24(%rbp)
  jne    L16
  mov    -0x1c(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rax,-0x8(%rbp)
L16:
  mov    -0x8(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x20(%rbp)
  jne    L11
  mov    $0x1,%eax
  jmp    L74
L11:
  mov    $0x0,%eax
L74:
  pop    %rbp
  ret
```

assistant: ```c
int any_directional_flips(uint8_t *sq, int inc, int color, int oppcol) {
  uint8_t *pt = sq + inc;
  if (*pt == oppcol) {
    pt += inc;
    if (*pt == oppcol) {
      pt += inc;
      if (*pt == oppcol) {
        pt += inc;
        if (*pt == oppcol) {
          pt += inc;
          if (*pt == oppcol) {
            pt += inc;
            if (*pt == oppcol) {
              pt += inc;
            }
          }
        }
      }
    }
    if (*pt == color)
      return 1;
  }
  return 0;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<any_directional_flips>:
  endbr64
  movslq %esi,%rsi
  shl    $0x2,%rsi
  add    %rsi,%rdi
  mov    $0x0,%eax
  cmp    %ecx,(%rdi)
  je     L57
L20:
  ret
L57:
  add    %rsi,%rdi
  cmp    %ecx,(%rdi)
  je     L38
L63:
  cmp    %edx,(%rdi)
  sete   %al
  movzbl %al,%eax
  jmp    L20
L38:
  add    %rsi,%rdi
  cmp    %ecx,(%rdi)
  jne    L63
  add    %rsi,%rdi
  cmp    %ecx,(%rdi)
  jne    L63
  add    %rsi,%rdi
  cmp    %ecx,(%rdi)
  jne    L63
  add    %rsi,%rdi
  add    %rdi,%rsi
  cmp    %ecx,(%rdi)
  cmove  %rsi,%rdi
  jmp    L63
```

assistant: ```c
int any_directional_flips(uint8_t *sq, int inc, int color, int oppcol) {
  uint8_t *pt = sq + inc;
  if (*pt == oppcol) {
    pt += inc;
    if (*pt == oppcol) {
      pt += inc;
      if (*pt == oppcol) {
        pt += inc;
        if (*pt == oppcol) {
          pt += inc;
          if (*pt == oppcol) {
            pt += inc;
            if (*pt == oppcol) {
              pt += inc;
            }
          }
        }
      }
    }
    if (*pt == color)
      return 1;
  }
  return 0;
}
```