ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<partition>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %rdi,%r13
  push   %r12
  mov    %esi,%r12d
  mov    %edx,%esi
  push   %rbp
  mov    %r12d,%edi
  mov    %edx,%ebp
  push   %rbx
  sub    $0x8,%rsp
  call   <choosePivot@plt>
  cltq
  lea    0x0(%r13,%rax,4),%r14
  movslq %ebp,%rax
  lea    0x0(%r13,%rax,4),%rdi
  mov    %r14,%rsi
  mov    (%r14),%r15d
  call   <swap@plt>
  cmp    %ebp,%r12d
  jge    L19
  sub    $0x1,%ebp
  movslq %r12d,%rax
  sub    %r12d,%ebp
  lea    0x0(%r13,%rax,4),%rbx
  add    %rax,%rbp
  lea    0x4(%r13,%rbp,4),%rbp
  jmp    L44
  nopl   0x0(%rax,%rax,1)
L1:
  add    $0x4,%rbx
  cmp    %rbp,%rbx
  je     L19
L44:
  cmp    %r15d,(%rbx)
  jge    L1
  movslq %r12d,%rax
  mov    %rbx,%rdi
  add    $0x4,%rbx
  add    $0x1,%r12d
  lea    0x0(%r13,%rax,4),%rsi
  call   <swap@plt>
  cmp    %rbp,%rbx
  jne    L44
L19:
  movslq %r12d,%rax
  mov    %r14,%rsi
  lea    0x0(%r13,%rax,4),%rdi
  call   <swap@plt>
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
int partition(int *A, int lo, int hi) {
  int i;
  int pivotIndex = choosePivot(lo, hi);
  int pivotValue = A[pivotIndex];
  int position = lo;
  swap(&A[hi], &A[pivotIndex]);
  for (i = lo; i < hi; i++) {
    if (A[i] < pivotValue) {
      swap(&A[i], &A[position]);
      position++;
    }
  }
  swap(&A[position], &A[pivotIndex]);
  return position;
}
```
user: What is the c source code of the assembly code below:

```asm
<partition>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %rdi,%r13
  push   %r12
  mov    %esi,%r12d
  mov    %edx,%esi
  push   %rbp
  mov    %r12d,%edi
  mov    %edx,%ebp
  push   %rbx
  sub    $0x8,%rsp
  call   <choosePivot@plt>
  cltq
  lea    0x0(%r13,%rax,4),%r14
  movslq %ebp,%rax
  lea    0x0(%r13,%rax,4),%rdi
  mov    %r14,%rsi
  mov    (%r14),%r15d
  call   <swap@plt>
  cmp    %ebp,%r12d
  jge    L32
  sub    $0x1,%ebp
  movslq %r12d,%rax
  sub    %r12d,%ebp
  lea    0x0(%r13,%rax,4),%rbx
  add    %rax,%rbp
  lea    0x4(%r13,%rbp,4),%rbp
  jmp    L13
  nopl   0x0(%rax,%rax,1)
L5:
  add    $0x4,%rbx
  cmp    %rbp,%rbx
  je     L32
L13:
  cmp    %r15d,(%rbx)
  jge    L5
  movslq %r12d,%rax
  mov    %rbx,%rdi
  add    $0x4,%rbx
  add    $0x1,%r12d
  lea    0x0(%r13,%rax,4),%rsi
  call   <swap@plt>
  cmp    %rbp,%rbx
  jne    L13
L32:
  movslq %r12d,%rax
  mov    %r14,%rsi
  lea    0x0(%r13,%rax,4),%rdi
  call   <swap@plt>
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
int partition(int *A, int lo, int hi) {
  int i;
  int pivotIndex = choosePivot(lo, hi);
  int pivotValue = A[pivotIndex];
  int position = lo;
  swap(&A[hi], &A[pivotIndex]);
  for (i = lo; i < hi; i++) {
    if (A[i] < pivotValue) {
      swap(&A[i], &A[position]);
      position++;
    }
  }
  swap(&A[position], &A[pivotIndex]);
  return position;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<ms2tcode>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %edi,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  imul   $0x10624dd3,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x6,%edx
  mov    %eax,%ecx
  sar    $0x1f,%ecx
  mov    %edx,%esi
  sub    %ecx,%esi
  imul   $0x3e8,%esi,%edx
  sub    %edx,%eax
  mov    %eax,%esi
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  imul   $0x10624dd3,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x6,%edx
  sar    $0x1f,%eax
  mov    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  movslq %eax,%rdx
  imul   $0xffffffff88888889,%rdx,%rdx
  shr    $0x20,%rdx
  add    %eax,%edx
  sar    $0x5,%edx
  mov    %eax,%edi
  sar    $0x1f,%edi
  mov    %edx,%ecx
  sub    %edi,%ecx
  imul   $0x3c,%ecx,%edx
  sub    %edx,%eax
  mov    %eax,%ecx
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  imul   $0x45e7b273,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0xe,%edx
  sar    $0x1f,%eax
  sub    %eax,%edx
  movslq %edx,%rax
  imul   $0xffffffff88888889,%rax,%rax
  shr    $0x20,%rax
  add    %edx,%eax
  sar    $0x5,%eax
  mov    %edx,%edi
  sar    $0x1f,%edi
  sub    %edi,%eax
  imul   $0x3c,%eax,%edi
  mov    %edx,%eax
  sub    %edi,%eax
  mov    -0x4(%rbp),%edx
  movslq %edx,%rdi
  imul   $0x4a90be59,%rdi,%rdi
  shr    $0x20,%rdi
  sar    $0x14,%edi
  sar    $0x1f,%edx
  mov    %edx,%r8d
  sub    %r8d,%edi
  mov    %edi,%edx
  mov    %esi,%r9d
  mov    %ecx,%r8d
  mov    %eax,%ecx
  lea    D8(%rip),%rax
  mov    %rax,%rsi
  lea    D6(%rip),%rax
  mov    %rax,%rdi
  call   <sprintf@plt>
  lea    D6(%rip),%rax
  leave
  ret
```

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

tool: D8: %02d:%02d:%02d.%03d

assistant: ```c
const char *ms2tcode(int ms) {
  static char buf[32];
  sprintf(buf, "%02d:%02d:%02d.%03d", ms / 1000 / 60 / 60, (ms / 1000 / 60) % 60, (ms / 1000) % 60, ms % 1000);
  return buf;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<ms2tcode>:
  endbr64
  push   %rbx
  mov    %edi,%r9d
  movslq %edi,%rdx
  imul   $0x10624dd3,%rdx,%r8
  sar    $0x26,%r8
  sar    $0x1f,%edi
  sub    %edi,%r8d
  imul   $0x3e8,%r8d,%r10d
  movslq %r8d,%rax
  imul   $0xffffffff88888889,%rax,%rax
  shr    $0x20,%rax
  add    %r8d,%eax
  sar    $0x5,%eax
  mov    %r8d,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%eax
  imul   $0x3c,%eax,%eax
  imul   $0x45e7b273,%rdx,%rcx
  sar    $0x2e,%rcx
  sub    %edi,%ecx
  movslq %ecx,%rsi
  imul   $0xffffffff88888889,%rsi,%rsi
  shr    $0x20,%rsi
  add    %ecx,%esi
  sar    $0x5,%esi
  mov    %ecx,%r11d
  sar    $0x1f,%r11d
  sub    %r11d,%esi
  imul   $0x3c,%esi,%esi
  sub    %esi,%ecx
  imul   $0x4a90be59,%rdx,%rdx
  sar    $0x34,%rdx
  sub    %edi,%edx
  sub    %r10d,%r9d
  sub    %eax,%r8d
  lea    D5(%rip),%rsi
  lea    D17(%rip),%rbx
  mov    %rbx,%rdi
  call   <sprintf@plt>
  mov    %rbx,%rax
  pop    %rbx
  ret
```

tool_calls: name: unpack_data
arguments: tag: D5
type: string

tool: D5: %02d:%02d:%02d.%03d

assistant: ```c
const char *ms2tcode(int ms) {
  static char buf[32];
  sprintf(buf, "%02d:%02d:%02d.%03d", ms / 1000 / 60 / 60, (ms / 1000 / 60) % 60, (ms / 1000) % 60, ms % 1000);
  return buf;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<ms2tcode>:
  endbr64
  movslq %edi,%rdx
  push   %r12
  lea    D16(%rip),%r12
  imul   $0x10624dd3,%rdx,%r8
  mov    %edx,%edi
  mov    %rdx,%r9
  sar    $0x1f,%edi
  sar    $0x26,%r8
  sub    %edi,%r8d
  movslq %r8d,%rax
  imul   $0x3e8,%r8d,%r10d
  mov    %r8d,%ecx
  imul   $0xffffffff88888889,%rax,%rax
  sar    $0x1f,%ecx
  sub    %r10d,%r9d
  shr    $0x20,%rax
  add    %r8d,%eax
  sar    $0x5,%eax
  sub    %ecx,%eax
  imul   $0x45e7b273,%rdx,%rcx
  imul   $0x4a90be59,%rdx,%rdx
  imul   $0x3c,%eax,%eax
  sar    $0x2e,%rcx
  sub    %edi,%ecx
  sar    $0x34,%rdx
  movslq %ecx,%rsi
  mov    %ecx,%r11d
  sub    %edi,%edx
  sub    %eax,%r8d
  imul   $0xffffffff88888889,%rsi,%rsi
  sar    $0x1f,%r11d
  mov    %r12,%rdi
  shr    $0x20,%rsi
  add    %ecx,%esi
  sar    $0x5,%esi
  sub    %r11d,%esi
  imul   $0x3c,%esi,%esi
  sub    %esi,%ecx
  lea    D19(%rip),%rsi
  call   <sprintf@plt>
  mov    %r12,%rax
  pop    %r12
  ret
```

tool_calls: name: read_data
arguments: data_tag: D19
type: string

tool: D19: %02d:%02d:%02d.%03d

assistant: ```c
const char *ms2tcode(int ms) {
  static char buf[32];
  sprintf(buf, "%02d:%02d:%02d.%03d", ms / 1000 / 60 / 60, (ms / 1000 / 60) % 60, (ms / 1000) % 60, ms % 1000);
  return buf;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<ms2tcode>:
  endbr64
  movslq %edi,%rdx
  push   %r12
  lea    D16(%rip),%r12
  imul   $0x10624dd3,%rdx,%r8
  mov    %edx,%edi
  mov    %rdx,%r9
  sar    $0x1f,%edi
  sar    $0x26,%r8
  sub    %edi,%r8d
  movslq %r8d,%rax
  imul   $0x3e8,%r8d,%r10d
  mov    %r8d,%ecx
  imul   $0xffffffff88888889,%rax,%rax
  sar    $0x1f,%ecx
  sub    %r10d,%r9d
  shr    $0x20,%rax
  add    %r8d,%eax
  sar    $0x5,%eax
  sub    %ecx,%eax
  imul   $0x45e7b273,%rdx,%rcx
  imul   $0x4a90be59,%rdx,%rdx
  imul   $0x3c,%eax,%eax
  sar    $0x2e,%rcx
  sub    %edi,%ecx
  sar    $0x34,%rdx
  movslq %ecx,%rsi
  mov    %ecx,%r11d
  sub    %edi,%edx
  sub    %eax,%r8d
  imul   $0xffffffff88888889,%rsi,%rsi
  sar    $0x1f,%r11d
  mov    %r12,%rdi
  shr    $0x20,%rsi
  add    %ecx,%esi
  sar    $0x5,%esi
  sub    %r11d,%esi
  imul   $0x3c,%esi,%esi
  sub    %esi,%ecx
  lea    D2(%rip),%rsi
  call   <sprintf@plt>
  mov    %r12,%rax
  pop    %r12
  ret
```

tool_calls: name: unpack_data
arguments: data_tag: D2
datatype: string

tool: D2: %02d:%02d:%02d.%03d

assistant: ```c
const char *ms2tcode(int ms) {
  static char buf[32];
  sprintf(buf, "%02d:%02d:%02d.%03d", ms / 1000 / 60 / 60, (ms / 1000 / 60) % 60, (ms / 1000) % 60, ms % 1000);
  return buf;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<d_s>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  movl   $0x1,-0x10(%rbp)
  movq   $0x0,-0x8(%rbp)
  mov    $0x64,%edi
  call   <malloc@plt>
  mov    %rax,-0x18(%rbp)
  jmp    L39
L25:
  addq   $0x1,-0x8(%rbp)
  mov    -0x10(%rbp),%eax
  imul   $0x64,%eax,%eax
  cltq
  cmp    %rax,-0x8(%rbp)
  jle    L10
  addl   $0x1,-0x10(%rbp)
  mov    -0x10(%rbp),%eax
  cltq
  imul   $0x64,%eax,%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <realloc@plt>
  mov    %rax,-0x18(%rbp)
L10:
  mov    -0x8(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    -0xc(%rbp),%edx
  mov    %dl,(%rax)
L39:
  mov    D11(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,%edi
  call   <fgetc@plt>
  mov    %eax,-0xc(%rbp)
  cmpl   $0xa,-0xc(%rbp)
  je     L0
  mov    D4(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0xc(%rbp)
  jne    L25
L0:
  mov    -0x8(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x18(%rbp),%rax
  leave
  ret
```

assistant: ```c
char *d_s(char *s) {
  int c;
  int mult = 1;
  long int sz = 0;
  s = malloc(sizeof(char) * 100);
  while ((c = fgetc(stdin)) != '\n' && c != EOF) {
    if (++sz > (mult * 100)) {
      s = realloc(s, sizeof(char) * 100 * ++mult);
    }
    *(s + (sz - 1)) = c;
  }
  *(s + sz) = '\0';
  return s;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<d_s>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    $0x64,%edi
  call   <malloc@plt>
  mov    %rax,%r13
  mov    $0x0,%ebp
  mov    $0x1,%r14d
  mov    D11(%rip),%r15
  jmp    L26
L9:
  mov    %bl,0x0(%r13,%rbp,1)
  mov    %r12,%rbp
L26:
  mov    (%r15),%edi
  call   <fgetc@plt>
  mov    %eax,%ebx
  cmp    $0xa,%eax
  je     L28
  mov    D8(%rip),%rax
  cmp    %ebx,(%rax)
  je     L28
  lea    0x1(%rbp),%r12
  imul   $0x64,%r14d,%eax
  cltq
  cmp    %r12,%rax
  jge    L9
  add    $0x1,%r14d
  imul   $0x64,%r14d,%esi
  mov    %r13,%rdi
  call   <realloc@plt>
  mov    %rax,%r13
  jmp    L9
L28:
  movb   $0x0,0x0(%r13,%rbp,1)
  mov    %r13,%rax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
char *d_s(char *s) {
  int c;
  int mult = 1;
  long int sz = 0;
  s = malloc(sizeof(char) * 100);
  while ((c = fgetc(stdin)) != '\n' && c != EOF) {
    if (++sz > (mult * 100)) {
      s = realloc(s, sizeof(char) * 100 * ++mult);
    }
    *(s + (sz - 1)) = c;
  }
  *(s + sz) = '\0';
  return s;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<d_s>:
  endbr64
  push   %r15
  mov    $0x64,%edi
  push   %r14
  push   %r13
  xor    %r13d,%r13d
  push   %r12
  push   %rbp
  mov    $0x1,%ebp
  push   %rbx
  sub    $0x8,%rsp
  call   <malloc@plt>
  mov    D10(%rip),%r12
  mov    %rax,%r15
  jmp    L28
L14:
  mov    %bl,(%r15,%r13,1)
  mov    %r14,%r13
L28:
  mov    (%r12),%edi
  call   <fgetc@plt>
  mov    %eax,%ebx
  cmp    $0xa,%eax
  je     L24
  mov    D0(%rip),%rax
  cmp    %ebx,(%rax)
  je     L24
  imul   $0x64,%ebp,%eax
  lea    0x1(%r13),%r14
  cltq
  cmp    %r14,%rax
  jge    L14
  add    $0x1,%ebp
  mov    %r15,%rdi
  imul   $0x64,%ebp,%esi
  call   <realloc@plt>
  mov    %rax,%r15
  jmp    L14
  nopl   0x0(%rax,%rax,1)
L24:
  movb   $0x0,(%r15,%r13,1)
  add    $0x8,%rsp
  mov    %r15,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
char *d_s(char *s) {
  int c;
  int mult = 1;
  long int sz = 0;
  s = malloc(sizeof(char) * 100);
  while ((c = fgetc(stdin)) != '\n' && c != EOF) {
    if (++sz > (mult * 100)) {
      s = realloc(s, sizeof(char) * 100 * ++mult);
    }
    *(s + (sz - 1)) = c;
  }
  *(s + sz) = '\0';
  return s;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<d_s>:
  endbr64
  push   %r15
  mov    $0x64,%edi
  push   %r14
  push   %r13
  xor    %r13d,%r13d
  push   %r12
  push   %rbp
  mov    $0x1,%ebp
  push   %rbx
  sub    $0x8,%rsp
  call   <malloc@plt>
  mov    D6(%rip),%r12
  mov    %rax,%r15
  jmp    L25
L0:
  mov    %bl,(%r15,%r13,1)
  mov    %r14,%r13
L25:
  mov    (%r12),%edi
  call   <fgetc@plt>
  mov    %eax,%ebx
  cmp    $0xa,%eax
  je     L16
  mov    D2(%rip),%rax
  cmp    %ebx,(%rax)
  je     L16
  imul   $0x64,%ebp,%eax
  lea    0x1(%r13),%r14
  cltq
  cmp    %r14,%rax
  jge    L0
  add    $0x1,%ebp
  mov    %r15,%rdi
  imul   $0x64,%ebp,%esi
  call   <realloc@plt>
  mov    %rax,%r15
  jmp    L0
  nopl   0x0(%rax,%rax,1)
L16:
  movb   $0x0,(%r15,%r13,1)
  add    $0x8,%rsp
  mov    %r15,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
char *d_s(char *s) {
  int c;
  int mult = 1;
  long int sz = 0;
  s = malloc(sizeof(char) * 100);
  while ((c = fgetc(stdin)) != '\n' && c != EOF) {
    if (++sz > (mult * 100)) {
      s = realloc(s, sizeof(char) * 100 * ++mult);
    }
    *(s + (sz - 1)) = c;
  }
  *(s + sz) = '\0';
  return s;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<roadmap_math_adjust_zoom>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %edi,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  mov    %eax,%edi
  call   <roadmap_square_at_current_scale@plt>
  test   %eax,%eax
  jne    L15
  mov    -0x4(%rbp),%eax
  mov    %eax,%edi
  call   <roadmap_square_scale@plt>
  test   %rax,%rax
  jne    L23
  mov    $0x5a,%edi
  call   <roadmap_math_zoom_set@plt>
  jmp    L15
L23:
  mov    $0x82,%edi
  call   <roadmap_math_zoom_set@plt>
L15:
  nop
  leave
  ret
```

assistant: ```c
void roadmap_math_adjust_zoom(int square) {
  if (!roadmap_square_at_current_scale(square)) {
    if (roadmap_square_scale(square) == 0) {
      roadmap_math_zoom_set(90);
    } else {
      roadmap_math_zoom_set(130);
    }
  }
}
```
user: Translate the below assembly code into C programming language:

```asm
<roadmap_math_adjust_zoom>:
  endbr64
  push   %rbx
  mov    %edi,%ebx
  call   <roadmap_square_at_current_scale@plt>
  test   %eax,%eax
  je     L28
L38:
  pop    %rbx
  ret
L28:
  mov    %ebx,%edi
  call   <roadmap_square_scale@plt>
  test   %rax,%rax
  jne    L30
  mov    $0x5a,%edi
  call   <roadmap_math_zoom_set@plt>
  jmp    L38
L30:
  mov    $0x82,%edi
  call   <roadmap_math_zoom_set@plt>
  jmp    L38
```

assistant: ```c
void roadmap_math_adjust_zoom(int square) {
  if (!roadmap_square_at_current_scale(square)) {
    if (roadmap_square_scale(square) == 0) {
      roadmap_math_zoom_set(90);
    } else {
      roadmap_math_zoom_set(130);
    }
  }
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<roadmap_math_adjust_zoom>:
  endbr64
  push   %rbp
  mov    %edi,%ebp
  call   <roadmap_square_at_current_scale@plt>
  test   %eax,%eax
  je     L19
  pop    %rbp
  ret
  nopw   0x0(%rax,%rax,1)
L19:
  mov    %ebp,%edi
  call   <roadmap_square_scale@plt>
  test   %rax,%rax
  jne    L12
  mov    $0x5a,%edi
  pop    %rbp
  jmp    1080 <roadmap_math_zoom_set@plt>
  nop
L12:
  mov    $0x82,%edi
  pop    %rbp
  jmp    1080 <roadmap_math_zoom_set@plt>
```

assistant: ```c
void roadmap_math_adjust_zoom(int square) {
  if (!roadmap_square_at_current_scale(square)) {
    if (roadmap_square_scale(square) == 0) {
      roadmap_math_zoom_set(90);
    } else {
      roadmap_math_zoom_set(130);
    }
  }
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<roadmap_math_adjust_zoom>:
  endbr64
  push   %rbp
  mov    %edi,%ebp
  call   <roadmap_square_at_current_scale@plt>
  test   %eax,%eax
  je     L9
  pop    %rbp
  ret
  nopw   0x0(%rax,%rax,1)
L9:
  mov    %ebp,%edi
  call   <roadmap_square_scale@plt>
  test   %rax,%rax
  jne    L16
  mov    $0x5a,%edi
  pop    %rbp
  jmp    1080 <roadmap_math_zoom_set@plt>
  nop
L16:
  mov    $0x82,%edi
  pop    %rbp
  jmp    1080 <roadmap_math_zoom_set@plt>
```

assistant: ```c
void roadmap_math_adjust_zoom(int square) {
  if (!roadmap_square_at_current_scale(square)) {
    if (roadmap_square_scale(square) == 0) {
      roadmap_math_zoom_set(90);
    } else {
      roadmap_math_zoom_set(130);
    }
  }
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<ft_strtrim>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  cmpq   $0x0,-0x28(%rbp)
  jne    L78
  mov    $0x0,%eax
  jmp    L65
L78:
  movq   $0x0,-0x10(%rbp)
  movq   $0x0,-0x18(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <ft_strlen@plt>
  mov    %rax,-0x20(%rbp)
  jmp    L76
L53:
  addq   $0x1,-0x18(%rbp)
L76:
  mov    -0x18(%rbp),%rax
  cmp    -0x20(%rbp),%rax
  je     L23
  mov    -0x28(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x20,%al
  je     L53
  mov    -0x28(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0xa,%al
  je     L53
  mov    -0x28(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x9,%al
  je     L53
  jmp    L23
L109:
  subq   $0x1,-0x20(%rbp)
L23:
  mov    -0x20(%rbp),%rax
  cmp    -0x18(%rbp),%rax
  je     L144
  mov    -0x20(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x20,%al
  je     L109
  mov    -0x20(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0xa,%al
  je     L109
  mov    -0x20(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x9,%al
  je     L109
L144:
  mov    -0x20(%rbp),%rax
  sub    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <ft_strnew@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x20(%rbp),%rax
  cmp    -0x18(%rbp),%rax
  jbe    L55
  jmp    L103
L93:
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  mov    -0x28(%rbp),%rdx
  lea    (%rax,%rdx,1),%rcx
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  mov    -0x8(%rbp),%rdx
  add    %rax,%rdx
  movzbl (%rcx),%eax
  mov    %al,(%rdx)
L103:
  mov    -0x18(%rbp),%rax
  cmp    -0x20(%rbp),%rax
  jne    L93
L55:
  mov    -0x8(%rbp),%rax
L65:
  leave
  ret
```

assistant: ```c
char *ft_strtrim(char const *s) {
  char *dest;
  size_t l;
  size_t j;
  size_t i;
  if (s == NULL)
    return (NULL);
  i = 0;
  j = 0;
  l = ft_strlen(s);
  while ((j != l) && (s[j] == ' ' || s[j] == '\n' || s[j] == '\t'))
    j++;
  while ((l != j) && (s[l - 1] == ' ' || s[l - 1] == '\n' || s[l - 1] == '\t'))
    l--;
  dest = ft_strnew(l - j);
  if (l > j) {
    while (j != l)
      dest[i++] = s[j++];
  }
  return (dest);
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<ft_strtrim>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%r12
  test   %rdi,%rdi
  je     L121
  call   <ft_strlen@plt>
  mov    %rax,%rbx
  mov    $0x0,%ebp
  test   %rax,%rax
  jne    L76
L44:
  mov    %rbx,%rbp
L122:
  mov    %rbx,%rdi
  sub    %rbp,%rdi
  call   <ft_strnew@plt>
L131:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L116:
  add    $0x1,%rbp
  cmp    %rbp,%rbx
  je     L44
L76:
  movzbl (%r12,%rbp,1),%eax
  lea    -0x9(%rax),%edx
  cmp    $0x1,%dl
  jbe    L116
  cmp    $0x20,%al
  je     L116
  jmp    L117
L38:
  mov    %rcx,%rbx
L117:
  cmp    %rbp,%rbx
  je     L97
  lea    -0x1(%rbx),%rcx
  movzbl -0x1(%r12,%rbx,1),%eax
  lea    -0x9(%rax),%edx
  cmp    $0x1,%dl
  jbe    L38
  cmp    $0x20,%al
  je     L38
  mov    %rbx,%rdi
  sub    %rbp,%rdi
  call   <ft_strnew@plt>
  cmp    %rbp,%rbx
  jbe    L131
  mov    %rbp,%rdx
  mov    %rax,%rsi
  sub    %rbp,%rsi
L71:
  add    $0x1,%rdx
  movzbl -0x1(%r12,%rdx,1),%ecx
  mov    %cl,-0x1(%rsi,%rdx,1)
  cmp    %rdx,%rbx
  jne    L71
  jmp    L131
L121:
  mov    %rdi,%rax
  jmp    L131
L97:
  mov    %rbp,%rbx
  jmp    L122
```

assistant: ```c
char *ft_strtrim(char const *s) {
  char *dest;
  size_t l;
  size_t j;
  size_t i;
  if (s == NULL)
    return (NULL);
  i = 0;
  j = 0;
  l = ft_strlen(s);
  while ((j != l) && (s[j] == ' ' || s[j] == '\n' || s[j] == '\t'))
    j++;
  while ((l != j) && (s[l - 1] == ' ' || s[l - 1] == '\n' || s[l - 1] == '\t'))
    l--;
  dest = ft_strnew(l - j);
  if (l > j) {
    while (j != l)
      dest[i++] = s[j++];
  }
  return (dest);
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<ft_strtrim>:
  endbr64
  test   %rdi,%rdi
  je     L97
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  xor    %ebx,%ebx
  call   <ft_strlen@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L98
  nopl   0x0(%rax,%rax,1)
L36:
  movzbl (%r12,%rbx,1),%eax
  lea    -0x9(%rax),%edx
  cmp    $0x1,%dl
  jbe    L9
  cmp    $0x20,%al
  jne    L56
L9:
  add    $0x1,%rbx
  cmp    %rbx,%rbp
  jne    L36
L98:
  pop    %rbx
  xor    %edi,%edi
  pop    %rbp
  pop    %r12
  jmp    1060 <ft_strnew@plt>
  nopl   (%rax)
L92:
  mov    %rcx,%rbp
L56:
  cmp    %rbx,%rbp
  je     L98
  movzbl -0x1(%r12,%rbp,1),%eax
  lea    -0x1(%rbp),%rcx
  lea    -0x9(%rax),%edx
  cmp    $0x1,%dl
  jbe    L92
  cmp    $0x20,%al
  je     L92
  mov    %rbp,%rdi
  sub    %rbx,%rdi
  call   <ft_strnew@plt>
  cmp    %rbx,%rbp
  jbe    L95
  mov    %rax,%rcx
  sub    %rbx,%rcx
  nopl   0x0(%rax)
L89:
  add    $0x1,%rbx
  movzbl -0x1(%r12,%rbx,1),%edx
  mov    %dl,-0x1(%rcx,%rbx,1)
  cmp    %rbx,%rbp
  jne    L89
L95:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L97:
  xor    %eax,%eax
  ret
```

assistant: ```c
char *ft_strtrim(char const *s) {
  char *dest;
  size_t l;
  size_t j;
  size_t i;
  if (s == NULL)
    return (NULL);
  i = 0;
  j = 0;
  l = ft_strlen(s);
  while ((j != l) && (s[j] == ' ' || s[j] == '\n' || s[j] == '\t'))
    j++;
  while ((l != j) && (s[l - 1] == ' ' || s[l - 1] == '\n' || s[l - 1] == '\t'))
    l--;
  dest = ft_strnew(l - j);
  if (l > j) {
    while (j != l)
      dest[i++] = s[j++];
  }
  return (dest);
}
```