ylfeng/ReF-Decompile-dataset huggingface dataset:
user: Demonstrate the C code that generates the assembly output below:

```asm
<vasprintf>:
  endbr64
  push   %r13
  mov    %edx,%ecx
  mov    %edx,%r13d
  mov    %rsi,%rdx
  push   %r12
  mov    %rsi,%r12
  xor    %esi,%esi
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  xor    %edi,%edi
  sub    $0x8,%rsp
  call   <vsnprintf@plt>
  lea    0x1(%rax),%ebp
  movslq %ebp,%rbp
  mov    %rbp,%rdi
  call   <malloc@plt>
  test   %rax,%rax
  je     L8
  mov    %rax,(%rbx)
  add    $0x8,%rsp
  mov    %r13d,%ecx
  mov    %r12,%rdx
  pop    %rbx
  mov    %rbp,%rsi
  mov    %rax,%rdi
  pop    %rbp
  pop    %r12
  pop    %r13
  jmp    1060 <vsnprintf@plt>
L8:
  pop    %rdx
  or     $0xffffffff,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
int vasprintf(char **strp, const char *fmt, va_list ap) {
  ssize_t len = vsnprintf(NULL, 0, fmt, ap) + 1;
  char *res = malloc(len);
  if (res == NULL)
    return -1;
  *strp = res;
  return vsnprintf(res, len, fmt, ap);
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<vasprintf>:
  endbr64
  push   %r13
  mov    %edx,%ecx
  mov    %edx,%r13d
  mov    %rsi,%rdx
  push   %r12
  mov    %rsi,%r12
  xor    %esi,%esi
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  xor    %edi,%edi
  sub    $0x8,%rsp
  call   <vsnprintf@plt>
  lea    0x1(%rax),%ebp
  movslq %ebp,%rbp
  mov    %rbp,%rdi
  call   <malloc@plt>
  test   %rax,%rax
  je     L7
  mov    %rax,(%rbx)
  add    $0x8,%rsp
  mov    %r13d,%ecx
  mov    %r12,%rdx
  pop    %rbx
  mov    %rbp,%rsi
  mov    %rax,%rdi
  pop    %rbp
  pop    %r12
  pop    %r13
  jmp    1060 <vsnprintf@plt>
L7:
  pop    %rdx
  or     $0xffffffff,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
int vasprintf(char **strp, const char *fmt, va_list ap) {
  ssize_t len = vsnprintf(NULL, 0, fmt, ap) + 1;
  char *res = malloc(len);
  if (res == NULL)
    return -1;
  *strp = res;
  return vsnprintf(res, len, fmt, ap);
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<is_plist_event>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x14(%rbp)
  movb   $0x0,-0x1(%rbp)
  mov    -0x14(%rbp),%eax
  sub    $0x50,%eax
  cmp    $0x3,%eax
  ja     L0
  movb   $0x1,-0x1(%rbp)
L0:
  movzbl -0x1(%rbp),%eax
  pop    %rbp
  ret
```

assistant: ```c
_Bool is_plist_event(const int event) {
  _Bool result = 0;
  switch (event) {
  case 0x50:
  case 0x51:
  case 0x52:
  case 0x53:
    result = 1;
  }
  return result;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<is_plist_event>:
  endbr64
  sub    $0x50,%edi
  cmp    $0x3,%edi
  setbe  %al
  ret
```

assistant: ```c
_Bool is_plist_event(const int event) {
  _Bool result = 0;
  switch (event) {
  case 0x50:
  case 0x51:
  case 0x52:
  case 0x53:
    result = 1;
  }
  return result;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<is_plist_event>:
  endbr64
  sub    $0x50,%edi
  cmp    $0x3,%edi
  setbe  %al
  ret
```

assistant: ```c
_Bool is_plist_event(const int event) {
  _Bool result = 0;
  switch (event) {
  case 0x50:
  case 0x51:
  case 0x52:
  case 0x53:
    result = 1;
  }
  return result;
}
```
user: Translate the below assembly code into C programming language:

```asm
<is_plist_event>:
  endbr64
  sub    $0x50,%edi
  cmp    $0x3,%edi
  setbe  %al
  ret
```

assistant: ```c
_Bool is_plist_event(const int event) {
  _Bool result = 0;
  switch (event) {
  case 0x50:
  case 0x51:
  case 0x52:
  case 0x53:
    result = 1;
  }
  return result;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<uppercase>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,-0x28(%rbp)
  movl   $0x0,-0x14(%rbp)
  movl   $0x0,-0x18(%rbp)
  jmp    L58
L45:
  mov    -0x18(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x40,%al
  jle    L17
  mov    -0x18(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x5a,%al
  jle    L43
L17:
  mov    -0x18(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x5f,%al
  jle    L51
  mov    -0x18(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x7b,%al
  jle    L43
L51:
  mov    -0x18(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x20,%al
  jne    L28
L43:
  mov    -0x18(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    -0x14(%rbp),%edx
  movslq %edx,%rcx
  mov    -0x28(%rbp),%rdx
  lea    (%rcx,%rdx,1),%rbx
  mov    %eax,%edi
  call   <toupper@plt>
  mov    %al,(%rbx)
  addl   $0x1,-0x14(%rbp)
L28:
  addl   $0x1,-0x18(%rbp)
L58:
  mov    -0x18(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L45
  mov    -0x14(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  nop
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
void uppercase(char *string) {
  int i;
  int pos = 0;
  for (i = 0; string[i] != 0; i++) {
    if ((string[i] > 64 && string[i] < 91) || (string[i] >= 96 && string[i] <= 123) || string[i] == 32) {
      string[pos] = toupper(string[i]);
      pos++;
    }
  }
  string[pos] = 0;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<uppercase>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%r12
  movzbl (%rdi),%edi
  test   %dil,%dil
  je     L34
  lea    0x1(%r12),%rbx
  mov    $0x0,%ebp
  jmp    L57
L51:
  movslq %ebp,%r13
  add    %r12,%r13
  movsbl %dil,%edi
  call   <toupper@plt>
  mov    %al,0x0(%r13)
  add    $0x1,%ebp
L38:
  add    $0x1,%rbx
  movzbl -0x1(%rbx),%edi
  test   %dil,%dil
  je     L33
L57:
  lea    -0x41(%rdi),%eax
  cmp    $0x19,%al
  setbe  %al
  lea    -0x60(%rdi),%edx
  cmp    $0x1b,%dl
  setbe  %dl
  or     %dl,%al
  jne    L51
  cmp    $0x20,%dil
  jne    L38
  jmp    L51
L34:
  mov    $0x0,%ebp
L33:
  movslq %ebp,%rbp
  movb   $0x0,(%r12,%rbp,1)
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
void uppercase(char *string) {
  int i;
  int pos = 0;
  for (i = 0; string[i] != 0; i++) {
    if ((string[i] > 64 && string[i] < 91) || (string[i] >= 96 && string[i] <= 123) || string[i] == 32) {
      string[pos] = toupper(string[i]);
      pos++;
    }
  }
  string[pos] = 0;
}
```
user: Translate the below assembly code into C programming language:

```asm
<uppercase>:
  endbr64
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  movsbl (%rdi),%edi
  test   %dil,%dil
  je     L18
  lea    0x1(%r12),%rbx
  xor    %ebp,%ebp
  jmp    L8
  nopl   0x0(%rax)
L38:
  cmp    $0x20,%dil
  je     L25
  movsbl (%rbx),%edi
  add    $0x1,%rbx
  test   %dil,%dil
  je     L11
L8:
  lea    -0x41(%rdi),%eax
  lea    -0x60(%rdi),%edx
  cmp    $0x19,%al
  setbe  %al
  cmp    $0x1b,%dl
  setbe  %dl
  or     %dl,%al
  je     L38
L25:
  call   <toupper@plt>
  add    $0x1,%rbx
  mov    %eax,%r8d
  movslq %ebp,%rax
  add    $0x1,%ebp
  mov    %r8b,(%r12,%rax,1)
  movsbl -0x1(%rbx),%edi
  test   %dil,%dil
  jne    L8
L11:
  movslq %ebp,%rbp
  add    %rbp,%r12
L18:
  pop    %rbx
  pop    %rbp
  movb   $0x0,(%r12)
  pop    %r12
  ret
```

assistant: ```c
void uppercase(char *string) {
  int i;
  int pos = 0;
  for (i = 0; string[i] != 0; i++) {
    if ((string[i] > 64 && string[i] < 91) || (string[i] >= 96 && string[i] <= 123) || string[i] == 32) {
      string[pos] = toupper(string[i]);
      pos++;
    }
  }
  string[pos] = 0;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<uppercase>:
  endbr64
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  movsbl (%rdi),%edi
  test   %dil,%dil
  je     L59
  lea    0x1(%r12),%rbx
  xor    %ebp,%ebp
  nopw   0x0(%rax,%rax,1)
L49:
  lea    -0x41(%rdi),%eax
  lea    -0x60(%rdi),%edx
  cmp    $0x19,%al
  setbe  %al
  cmp    $0x1b,%dl
  setbe  %dl
  or     %dl,%al
  jne    L51
  cmp    $0x20,%dil
  je     L51
  movsbl (%rbx),%edi
  add    $0x1,%rbx
  test   %dil,%dil
  jne    L49
L7:
  movslq %ebp,%rbp
  add    %rbp,%r12
L59:
  pop    %rbx
  pop    %rbp
  movb   $0x0,(%r12)
  pop    %r12
  ret
  nopw   0x0(%rax,%rax,1)
L51:
  call   <toupper@plt>
  add    $0x1,%rbx
  mov    %eax,%r8d
  movslq %ebp,%rax
  add    $0x1,%ebp
  mov    %r8b,(%r12,%rax,1)
  movsbl -0x1(%rbx),%edi
  test   %dil,%dil
  jne    L49
  jmp    L7
```

assistant: ```c
void uppercase(char *string) {
  int i;
  int pos = 0;
  for (i = 0; string[i] != 0; i++) {
    if ((string[i] > 64 && string[i] < 91) || (string[i] >= 96 && string[i] <= 123) || string[i] == 32) {
      string[pos] = toupper(string[i]);
      pos++;
    }
  }
  string[pos] = 0;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<brainfuck>:
  endbr64
  movzbl (%rcx),%eax
  test   %al,%al
  je     L83
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbp
  mov    %rsi,%r13
  mov    %rdx,%r14
  mov    %rcx,%rbx
  mov    $0x0,%edx
  lea    D8(%rip),%r12
  jmp    L169
  mov    $0xc0,%eax
  jmp    L202
  mov    $0x4,%eax
  jmp    L202
  mov    $0x10,%eax
  jmp    L202
  mov    $0x30,%eax
  jmp    L202
  test   %edx,%edx
  jne    L129
  mov    $0x40,%eax
  jmp    L46
L26:
  mov    $0x0,%ecx
  test   $0x10,%al
  je     L180
  mov    %eax,%ecx
  sar    $0x4,%ecx
  movslq %ecx,%rcx
  sub    $0x2,%rcx
L180:
  add    %rcx,%rbp
  movzbl 0x0(%rbp),%ecx
  mov    $0x0,%esi
  test   $0x40,%al
  je     L152
  sar    $0x6,%eax
  mov    $0x2,%esi
  sub    %eax,%esi
L152:
  lea    (%rcx,%rsi,1),%eax
  mov    %al,0x0(%rbp)
  jmp    L129
  mov    $0x1,%eax
  jmp    L91
  mov    $0x3,%eax
L91:
  test   %edx,%edx
  je     L46
L54:
  sub    %eax,%edx
  add    $0x2,%edx
  je     L36
L129:
  mov    %edx,%eax
  not    %eax
  shr    $0x1f,%eax
  mov    %edx,%ecx
  shr    $0x1f,%ecx
  sub    %ecx,%eax
  cltq
  add    %rax,%rbx
  movzbl (%rbx),%eax
  test   %al,%al
  je     L196
L169:
  sub    $0x2b,%eax
  cmp    $0x32,%al
  ja     L176
  movzbl %al,%eax
  movslq (%r12,%rax,4),%rax
  add    %r12,%rax
  notrack jmp *%rax
L176:
  mov    $0x0,%eax
L202:
  test   %edx,%edx
  jne    L129
L46:
  cmpb   $0x0,0x0(%rbp)
  sete   %sil
  mov    %eax,%ecx
  shr    %ecx
  and    $0x1,%ecx
  cmp    %cl,%sil
  je     L36
  test   $0x1,%al
  jne    L54
L36:
  mov    %eax,%edx
  and    $0xc,%edx
  je     L26
  test   $0x4,%al
  mov    %r13,%rax
  cmovne %r14,%rax
  mov    %rbp,%rdi
  call   *%rax
  mov    $0x0,%edx
  jmp    L129
  mov    $0x8,%eax
  jmp    L202
L196:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L83:
  ret
```

assistant: ```c
void brainfuck(char *m, void (*i)(char *), void (*o)(char *), const char *c) {
  int l = 0;
  while (*c) {
    int x = 0;
    switch (*c) {
    case 43:
      x = 64;
      break;
    case 44:
      x = 8;
      break;
    case 45:
      x = 192;
      break;
    case 46:
      x = 4;
      break;
    case 60:
      x = 16;
      break;
    case 62:
      x = 48;
      break;
    case 91:
      x = 1;
      break;
    case 93:
      x = 3;
      break;
    }
    (l += l || !*m != !!(x & 2) ? (x & 1 ? 2 - x : 0) : 0) ? 0 : (x & 12 ? (x & 4 ? o : i)(m), 0 : (*(m += (x & 16 ? x >> 4 : 2) - 2) += 2 - (x & 64 ? x >> 6 : 2))), *(c += (l >= 0) - (l < 0));
  }
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<print>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x4e0,%rsp
  mov    %rdi,-0x4d8(%rbp)
  mov    %rsi,-0xa8(%rbp)
  mov    %rdx,-0xa0(%rbp)
  mov    %rcx,-0x98(%rbp)
  mov    %r8,-0x90(%rbp)
  mov    %r9,-0x88(%rbp)
  test   %al,%al
  je     L3
  movaps %xmm0,-0x80(%rbp)
  movaps %xmm1,-0x70(%rbp)
  movaps %xmm2,-0x60(%rbp)
  movaps %xmm3,-0x50(%rbp)
  movaps %xmm4,-0x40(%rbp)
  movaps %xmm5,-0x30(%rbp)
  movaps %xmm6,-0x20(%rbp)
  movaps %xmm7,-0x10(%rbp)
L3:
  mov    %fs:0x28,%rax
  mov    %rax,-0xb8(%rbp)
  xor    %eax,%eax
  mov    -0x4d8(%rbp),%rdx
  mov    -0x4c4(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <va_start@plt>
  mov    -0x4c4(%rbp),%ecx
  mov    -0x4d8(%rbp),%rdx
  lea    -0x4c0(%rbp),%rax
  mov    $0x100,%esi
  mov    %rax,%rdi
  call   <vswprintf@plt>
  mov    -0x4c4(%rbp),%eax
  mov    %eax,%edi
  call   <va_end@plt>
  lea    -0x4c0(%rbp),%rax
  mov    %rax,%rdi
  call   <ConsoleAddText@plt>
  nop
  mov    -0xb8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L18
  call   <__stack_chk_fail@plt>
L18:
  leave
  ret
```

assistant: ```c
void print(const wchar_t *format, ...) {
  wchar_t str[256];
  va_list va;
  va_start(va, format);
  vswprintf(str, sizeof(str) / sizeof(str[0]), format, va);
  va_end(va);
  ConsoleAddText(str);
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<print>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x410,%rsp
  mov    %rdi,%rbx
  mov    %fs:0x28,%rax
  mov    %rax,0x408(%rsp)
  xor    %eax,%eax
  mov    %rdi,%rsi
  mov    $0x0,%ebp
  mov    %ebp,%edi
  call   <va_start@plt>
  mov    %rsp,%r12
  mov    %ebp,%ecx
  mov    %rbx,%rdx
  mov    $0x100,%esi
  mov    %r12,%rdi
  call   <vswprintf@plt>
  mov    %ebp,%edi
  call   <va_end@plt>
  mov    %r12,%rdi
  call   <ConsoleAddText@plt>
  mov    0x408(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L1
  add    $0x410,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L1:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void print(const wchar_t *format, ...) {
  wchar_t str[256];
  va_list va;
  va_start(va, format);
  vswprintf(str, sizeof(str) / sizeof(str[0]), format, va);
  va_end(va);
  ConsoleAddText(str);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<print>:
  endbr64
  push   %r13
  mov    %rdi,%rsi
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  xor    %ebp,%ebp
  mov    %ebp,%edi
  sub    $0x410,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x408(%rsp)
  xor    %eax,%eax
  mov    %rsp,%r13
  call   <va_start@plt>
  mov    %ebp,%ecx
  mov    %r12,%rdx
  mov    $0x100,%esi
  mov    %r13,%rdi
  call   <vswprintf@plt>
  mov    %ebp,%edi
  call   <va_end@plt>
  mov    %r13,%rdi
  call   <ConsoleAddText@plt>
  mov    0x408(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L1
  add    $0x410,%rsp
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L1:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void print(const wchar_t *format, ...) {
  wchar_t str[256];
  va_list va;
  va_start(va, format);
  vswprintf(str, sizeof(str) / sizeof(str[0]), format, va);
  va_end(va);
  ConsoleAddText(str);
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<print>:
  endbr64
  push   %r13
  mov    %rdi,%rsi
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  xor    %ebp,%ebp
  mov    %ebp,%edi
  sub    $0x410,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x408(%rsp)
  xor    %eax,%eax
  mov    %rsp,%r13
  call   <va_start@plt>
  mov    %ebp,%ecx
  mov    %r12,%rdx
  mov    $0x100,%esi
  mov    %r13,%rdi
  call   <vswprintf@plt>
  mov    %ebp,%edi
  call   <va_end@plt>
  mov    %r13,%rdi
  call   <ConsoleAddText@plt>
  mov    0x408(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L1
  add    $0x410,%rsp
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L1:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void print(const wchar_t *format, ...) {
  wchar_t str[256];
  va_list va;
  va_start(va, format);
  vswprintf(str, sizeof(str) / sizeof(str[0]), format, va);
  va_end(va);
  ConsoleAddText(str);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<psdimension>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  movl   $0x0,-0x1c(%rbp)
  cmpq   $0x0,-0x28(%rbp)
  je     L87
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L48
L87:
  mov    $0xffffffff,%eax
  jmp    L72
L48:
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2d,%al
  jne    L121
  addq   $0x1,-0x18(%rbp)
  jmp    L121
L35:
  addq   $0x1,-0x18(%rbp)
L121:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L35
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  jne    L101
  mov    -0x1c(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x1c(%rbp)
  test   %eax,%eax
  je     L35
L101:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L52
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isalpha@plt>
  test   %eax,%eax
  jne    L52
  mov    $0xffffffff,%eax
  jmp    L72
L52:
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <atof@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <unitfactor@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x8(%rbp)
  pxor   %xmm0,%xmm0
  ucomisd -0x8(%rbp),%xmm0
  jp     L16
  pxor   %xmm0,%xmm0
  ucomisd -0x8(%rbp),%xmm0
  je     L67
L16:
  movsd  -0x10(%rbp),%xmm0
  movapd %xmm0,%xmm1
  mulsd  -0x8(%rbp),%xmm1
  movsd  D6(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  cvttsd2si %xmm0,%edx
  mov    -0x30(%rbp),%rax
  mov    %edx,(%rax)
  mov    $0x0,%eax
  jmp    L72
L67:
  mov    $0x1,%eax
L72:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: data_label: D6
data_type: byte[8]

tool: {"D6": [0x00,0x00,0x00,0x00,0x00,0x00,0x52,0x40]}

assistant: ```c
int psdimension(const char *what, int *dim) {
  const char *unit;
  int dot = 0;
  if (!what || !*what)
    return -1;
  if (*(unit = what) == '-')
    ++unit;
  for (; isdigit(*unit) || (*unit == '.' && !dot++); ++unit)
    ;
  if (*unit && !isalpha(*unit)) {
    return -1;
  } else {
    double base = atof(what);
    double factor = unitfactor(unit);
    if (factor) {
      *dim = base * factor * 72;
      return 0;
    }
    return 1;
  }
}
```
user: Translate the below assembly code into C programming language:

```asm
<psdimension>:
  endbr64
  test   %rdi,%rdi
  je     L49
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%r12
  mov    %rsi,%r13
  movzbl (%rdi),%edx
  mov    $0xffffffff,%eax
  test   %dl,%dl
  je     L39
  cmp    $0x2d,%dl
  sete   %bl
  movzbl %bl,%ebx
  add    %rdi,%rbx
  mov    $0x0,%ebp
  jmp    L56
L67:
  mov    %eax,%ebp
L17:
  add    $0x1,%rbx
L56:
  movsbl (%rbx),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L17
  movzbl (%rbx),%edi
  cmp    $0x2e,%dil
  jne    L106
  lea    0x1(%rbp),%eax
  test   %ebp,%ebp
  je     L67
L19:
  movsbl %dil,%edi
  call   <isalpha@plt>
  mov    %eax,%edx
  mov    $0xffffffff,%eax
  test   %edx,%edx
  jne    L0
  jmp    L39
L106:
  test   %dil,%dil
  jne    L19
L0:
  mov    %r12,%rdi
  call   <atof@plt>
  movq   %xmm0,%rbp
  mov    %rbx,%rdi
  call   <unitfactor@plt>
  ucomisd D18(%rip),%xmm0
  jp     L81
  mov    $0x1,%eax
  jne    L81
L39:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L81:
  movq   %rbp,%xmm1
  mulsd  %xmm0,%xmm1
  movapd %xmm1,%xmm0
  mulsd  D2(%rip),%xmm0
  cvttsd2si %xmm0,%eax
  mov    %eax,0x0(%r13)
  mov    $0x0,%eax
  jmp    L39
L49:
  mov    $0xffffffff,%eax
  ret
```

tool_calls: name: read_data
arguments: data_label: D18
type_infered: byte[8]
name: read_data
arguments: data_label: D2
type_infered: byte[8]

tool: {"D18": [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]}

tool: {"D2": [0x00,0x00,0x00,0x00,0x00,0x00,0x52,0x40]}

assistant: ```c
int psdimension(const char *what, int *dim) {
  const char *unit;
  int dot = 0;
  if (!what || !*what)
    return -1;
  if (*(unit = what) == '-')
    ++unit;
  for (; isdigit(*unit) || (*unit == '.' && !dot++); ++unit)
    ;
  if (*unit && !isalpha(*unit)) {
    return -1;
  } else {
    double base = atof(what);
    double factor = unitfactor(unit);
    if (factor) {
      *dim = base * factor * 72;
      return 0;
    }
    return 1;
  }
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<psdimension>:
  endbr64
  test   %rdi,%rdi
  je     L24
  push   %r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  movsbl (%rdi),%edi
  test   %dil,%dil
  je     L66
  mov    %rsi,%r13
  mov    %r12,%rbp
  cmp    $0x2d,%dil
  je     L13
L1:
  xor    %ebx,%ebx
  jmp    L80
  nopw   0x0(%rax,%rax,1)
L75:
  test   %ebx,%ebx
  jne    L126
  mov    $0x1,%ebx
L11:
  movsbl 0x1(%rbp),%edi
  add    $0x1,%rbp
L80:
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L11
  movzbl 0x0(%rbp),%eax
  cmp    $0x2e,%al
  je     L75
  test   %al,%al
  jne    L99
L74:
  mov    %r12,%rdi
  call   <atof@plt>
  mov    %rbp,%rdi
  movsd  %xmm0,0x8(%rsp)
  call   <unitfactor@plt>
  ucomisd D4(%rip),%xmm0
  jp     L10
  mov    $0x1,%eax
  je     L83
L10:
  mulsd  0x8(%rsp),%xmm0
  mulsd  D15(%rip),%xmm0
  cvttsd2si %xmm0,%eax
  mov    %eax,0x0(%r13)
  xor    %eax,%eax
L83:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   (%rax)
L126:
  mov    $0x2e,%edi
L2:
  call   <isalpha@plt>
  test   %eax,%eax
  jne    L74
L66:
  add    $0x18,%rsp
  mov    $0xffffffff,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  cs nopw 0x0(%rax,%rax,1)
L13:
  movsbl 0x1(%r12),%edi
  lea    0x1(%r12),%rbp
  jmp    L1
L24:
  mov    $0xffffffff,%eax
  ret
L99:
  movsbl %al,%edi
  jmp    L2
```

tool_calls: name: unpack_data
arguments: data_tag: D4
data_type: byte[8]
name: unpack_data
arguments: data_tag: D15
data_type: byte[8]

tool: {"D4": [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]}

tool: {"D15": [0x00,0x00,0x00,0x00,0x00,0x00,0x52,0x40]}

assistant: ```c
int psdimension(const char *what, int *dim) {
  const char *unit;
  int dot = 0;
  if (!what || !*what)
    return -1;
  if (*(unit = what) == '-')
    ++unit;
  for (; isdigit(*unit) || (*unit == '.' && !dot++); ++unit)
    ;
  if (*unit && !isalpha(*unit)) {
    return -1;
  } else {
    double base = atof(what);
    double factor = unitfactor(unit);
    if (factor) {
      *dim = base * factor * 72;
      return 0;
    }
    return 1;
  }
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<psdimension>:
  endbr64
  test   %rdi,%rdi
  je     L25
  push   %r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  movzbl (%rdi),%eax
  test   %al,%al
  je     L36
  xor    %ebp,%ebp
  cmp    $0x2d,%al
  mov    %rsi,%rbx
  sete   %bpl
  xor    %r13d,%r13d
  add    %rdi,%rbp
  jmp    L32
  nopl   0x0(%rax,%rax,1)
L103:
  test   %r13d,%r13d
  jne    L27
  mov    $0x1,%r13d
L26:
  add    $0x1,%rbp
L32:
  movsbl 0x0(%rbp),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L26
  movzbl 0x0(%rbp),%eax
  cmp    $0x2e,%al
  je     L103
  test   %al,%al
  jne    L0
L4:
  mov    %r12,%rdi
  call   <atof@plt>
  mov    %rbp,%rdi
  movsd  %xmm0,0x8(%rsp)
  call   <unitfactor@plt>
  ucomisd D0(%rip),%xmm0
  jp     L82
  mov    $0x1,%eax
  je     L40
L82:
  mulsd  0x8(%rsp),%xmm0
  mulsd  D18(%rip),%xmm0
  cvttsd2si %xmm0,%eax
  mov    %eax,(%rbx)
  xor    %eax,%eax
L40:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L27:
  mov    $0x2e,%edi
L97:
  call   <isalpha@plt>
  test   %eax,%eax
  jne    L4
L36:
  add    $0x18,%rsp
  mov    $0xffffffff,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  cs nopw 0x0(%rax,%rax,1)
L25:
  mov    $0xffffffff,%eax
  ret
L0:
  movsbl %al,%edi
  jmp    L97
```

tool_calls: name: unpack_data
arguments: tag: D0
type_guessed: byte[8]
name: unpack_data
arguments: tag: D18
type_guessed: byte[8]

tool: {"D0": [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]}

tool: {"D18": [0x00,0x00,0x00,0x00,0x00,0x00,0x52,0x40]}

assistant: ```c
int psdimension(const char *what, int *dim) {
  const char *unit;
  int dot = 0;
  if (!what || !*what)
    return -1;
  if (*(unit = what) == '-')
    ++unit;
  for (; isdigit(*unit) || (*unit == '.' && !dot++); ++unit)
    ;
  if (*unit && !isalpha(*unit)) {
    return -1;
  } else {
    double base = atof(what);
    double factor = unitfactor(unit);
    if (factor) {
      *dim = base * factor * 72;
      return 0;
    }
    return 1;
  }
}
```