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

```asm
<rodaContador>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  movl   $0x0,-0x10(%rbp)
  movl   $0x0,-0xc(%rbp)
  movl   $0x0,-0x8(%rbp)
  movl   $0x0,-0x4(%rbp)
  mov    $0x64,%edi
  call   <delay_ms@plt>
L46:
  mov    -0x4(%rbp),%eax
  mov    $0x4,%esi
  mov    %eax,%edi
  call   <mostraNumero@plt>
  mov    -0x8(%rbp),%eax
  mov    $0x3,%esi
  mov    %eax,%edi
  call   <mostraNumero@plt>
  mov    -0xc(%rbp),%eax
  mov    $0x2,%esi
  mov    %eax,%edi
  call   <mostraNumero@plt>
  mov    -0x10(%rbp),%eax
  mov    $0x1,%esi
  mov    %eax,%edi
  call   <mostraNumero@plt>
  mov    $0xa,%edi
  call   <delay_ms@plt>
  addl   $0x1,-0x4(%rbp)
  cmpl   $0x9,-0x4(%rbp)
  jle    L22
  movl   $0x0,-0x4(%rbp)
  addl   $0x1,-0x8(%rbp)
L22:
  cmpl   $0x9,-0x8(%rbp)
  jle    L49
  movl   $0x0,-0x8(%rbp)
  addl   $0x1,-0xc(%rbp)
L49:
  cmpl   $0x9,-0xc(%rbp)
  jle    L33
  movl   $0x0,-0xc(%rbp)
  addl   $0x1,-0x10(%rbp)
L33:
  cmpl   $0x9,-0x10(%rbp)
  jle    L46
  movl   $0x0,-0x4(%rbp)
  movl   $0x0,-0x8(%rbp)
  movl   $0x0,-0xc(%rbp)
  movl   $0x0,-0x10(%rbp)
  jmp    L46
```

assistant: ```c
void rodaContador() {
  int contador_4 = 0;
  int contador_3 = 0;
  int contador_2 = 0;
  int contador_1 = 0;
  delay_ms(100);
  while (1) {
    mostraNumero(contador_1, 4);
    mostraNumero(contador_2, 3);
    mostraNumero(contador_3, 2);
    mostraNumero(contador_4, 1);
    delay_ms(10);
    contador_1++;
    if (contador_1 > 9) {
      contador_1 = 0;
      contador_2++;
    }
    if (contador_2 > 9) {
      contador_2 = 0;
      contador_3++;
    }
    if (contador_3 > 9) {
      contador_3 = 0;
      contador_4++;
    }
    if (contador_4 > 9) {
      contador_1 = 0;
      contador_2 = 0;
      contador_3 = 0;
      contador_4 = 0;
    }
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<rodaContador>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    $0x64,%edi
  call   <delay_ms@plt>
  mov    $0x4,%esi
  mov    $0x0,%edi
  call   <mostraNumero@plt>
  mov    $0x3,%esi
  mov    $0x0,%edi
  call   <mostraNumero@plt>
  mov    $0x2,%esi
  mov    $0x0,%edi
  call   <mostraNumero@plt>
  mov    $0x1,%esi
  mov    $0x0,%edi
  call   <mostraNumero@plt>
  mov    $0xa,%edi
  call   <delay_ms@plt>
  mov    $0x0,%r13d
  mov    $0x1,%r12d
  mov    $0x0,%ebp
  mov    $0x0,%ebx
  jmp    L4
L43:
  mov    $0x4,%esi
  mov    %r12d,%edi
  call   <mostraNumero@plt>
  mov    $0x3,%esi
  mov    %ebp,%edi
  call   <mostraNumero@plt>
  mov    $0x2,%esi
  mov    %ebx,%edi
  call   <mostraNumero@plt>
  mov    $0x1,%esi
  mov    %r13d,%edi
  call   <mostraNumero@plt>
  mov    $0xa,%edi
  call   <delay_ms@plt>
  add    $0x1,%r12d
  cmp    $0x9,%r12d
  jle    L35
  add    $0x1,%ebp
  mov    $0x0,%r12d
L35:
  cmp    $0x9,%ebp
  jle    L4
  add    $0x1,%ebx
  mov    $0x0,%ebp
L4:
  cmp    $0x9,%ebx
  jle    L9
  add    $0x1,%r13d
  mov    $0x0,%ebx
L9:
  cmp    $0x9,%r13d
  jle    L43
  mov    $0x4,%esi
  mov    $0x0,%edi
  call   <mostraNumero@plt>
  mov    $0x3,%esi
  mov    $0x0,%edi
  call   <mostraNumero@plt>
  mov    $0x2,%esi
  mov    $0x0,%edi
  call   <mostraNumero@plt>
  mov    $0x1,%esi
  mov    $0x0,%edi
  call   <mostraNumero@plt>
  mov    $0xa,%edi
  call   <delay_ms@plt>
  mov    $0x0,%ebx
  mov    $0x0,%r13d
  mov    $0x1,%r12d
  mov    $0x0,%ebp
  jmp    L35
```

assistant: ```c
void rodaContador() {
  int contador_4 = 0;
  int contador_3 = 0;
  int contador_2 = 0;
  int contador_1 = 0;
  delay_ms(100);
  while (1) {
    mostraNumero(contador_1, 4);
    mostraNumero(contador_2, 3);
    mostraNumero(contador_3, 2);
    mostraNumero(contador_4, 1);
    delay_ms(10);
    contador_1++;
    if (contador_1 > 9) {
      contador_1 = 0;
      contador_2++;
    }
    if (contador_2 > 9) {
      contador_2 = 0;
      contador_3++;
    }
    if (contador_3 > 9) {
      contador_3 = 0;
      contador_4++;
    }
    if (contador_4 > 9) {
      contador_1 = 0;
      contador_2 = 0;
      contador_3 = 0;
      contador_4 = 0;
    }
  }
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<rodaContador>:
  endbr64
  push   %r13
  mov    $0x64,%edi
  push   %r12
  xor    %r12d,%r12d
  push   %rbp
  xor    %ebp,%ebp
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x8,%rsp
  call   <delay_ms@plt>
  mov    $0x4,%esi
  xor    %edi,%edi
  call   <mostraNumero@plt>
  mov    $0x3,%esi
  xor    %edi,%edi
  call   <mostraNumero@plt>
  mov    $0x2,%esi
  xor    %edi,%edi
  call   <mostraNumero@plt>
  mov    $0x1,%esi
  xor    %edi,%edi
  call   <mostraNumero@plt>
  mov    $0xa,%edi
  call   <delay_ms@plt>
  mov    $0x1,%edi
  xchg   %ax,%ax
L12:
  cmp    $0xa,%ebx
  jne    L7
L47:
  add    $0x1,%ebp
  xor    %ebx,%ebx
L7:
  cmp    $0xa,%ebp
  jne    L54
  mov    $0x4,%esi
  xor    %edi,%edi
  xor    %ebp,%ebp
  xor    %r12d,%r12d
  call   <mostraNumero@plt>
  mov    $0x3,%esi
  xor    %edi,%edi
  xor    %ebx,%ebx
  call   <mostraNumero@plt>
  mov    $0x2,%esi
  xor    %edi,%edi
  call   <mostraNumero@plt>
  mov    $0x1,%esi
  xor    %edi,%edi
  call   <mostraNumero@plt>
  mov    $0xa,%edi
  call   <delay_ms@plt>
  mov    $0x1,%edi
L54:
  mov    $0x4,%esi
  lea    0x1(%rdi),%r13d
  call   <mostraNumero@plt>
  mov    $0x3,%esi
  mov    %r12d,%edi
  call   <mostraNumero@plt>
  mov    $0x2,%esi
  mov    %ebx,%edi
  call   <mostraNumero@plt>
  mov    $0x1,%esi
  mov    %ebp,%edi
  call   <mostraNumero@plt>
  mov    $0xa,%edi
  call   <delay_ms@plt>
  mov    %r13d,%edi
  cmp    $0xa,%r13d
  jne    L29
  add    $0x1,%r12d
  xor    %edi,%edi
L29:
  cmp    $0xa,%r12d
  jne    L12
  add    $0x1,%ebx
  xor    %r12d,%r12d
  cmp    $0xa,%ebx
  jne    L7
  jmp    L47
```

assistant: ```c
void rodaContador() {
  int contador_4 = 0;
  int contador_3 = 0;
  int contador_2 = 0;
  int contador_1 = 0;
  delay_ms(100);
  while (1) {
    mostraNumero(contador_1, 4);
    mostraNumero(contador_2, 3);
    mostraNumero(contador_3, 2);
    mostraNumero(contador_4, 1);
    delay_ms(10);
    contador_1++;
    if (contador_1 > 9) {
      contador_1 = 0;
      contador_2++;
    }
    if (contador_2 > 9) {
      contador_2 = 0;
      contador_3++;
    }
    if (contador_3 > 9) {
      contador_3 = 0;
      contador_4++;
    }
    if (contador_4 > 9) {
      contador_1 = 0;
      contador_2 = 0;
      contador_3 = 0;
      contador_4 = 0;
    }
  }
}
```
user: What is the c source code of the assembly code below:

```asm
<rodaContador>:
  endbr64
  push   %r13
  mov    $0x64,%edi
  push   %r12
  xor    %r12d,%r12d
  push   %rbp
  xor    %ebp,%ebp
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x8,%rsp
  call   <delay_ms@plt>
  mov    $0x4,%esi
  xor    %edi,%edi
  call   <mostraNumero@plt>
  mov    $0x3,%esi
  xor    %edi,%edi
  call   <mostraNumero@plt>
  mov    $0x2,%esi
  xor    %edi,%edi
  call   <mostraNumero@plt>
  mov    $0x1,%esi
  xor    %edi,%edi
  call   <mostraNumero@plt>
  mov    $0xa,%edi
  call   <delay_ms@plt>
  mov    $0x1,%edi
  xchg   %ax,%ax
L16:
  cmp    $0xa,%ebx
  jne    L25
L41:
  add    $0x1,%ebp
  xor    %ebx,%ebx
L25:
  cmp    $0xa,%ebp
  jne    L33
  mov    $0x4,%esi
  xor    %edi,%edi
  xor    %ebp,%ebp
  xor    %r12d,%r12d
  call   <mostraNumero@plt>
  mov    $0x3,%esi
  xor    %edi,%edi
  xor    %ebx,%ebx
  call   <mostraNumero@plt>
  mov    $0x2,%esi
  xor    %edi,%edi
  call   <mostraNumero@plt>
  mov    $0x1,%esi
  xor    %edi,%edi
  call   <mostraNumero@plt>
  mov    $0xa,%edi
  call   <delay_ms@plt>
  mov    $0x1,%edi
L33:
  mov    $0x4,%esi
  lea    0x1(%rdi),%r13d
  call   <mostraNumero@plt>
  mov    $0x3,%esi
  mov    %r12d,%edi
  call   <mostraNumero@plt>
  mov    $0x2,%esi
  mov    %ebx,%edi
  call   <mostraNumero@plt>
  mov    $0x1,%esi
  mov    %ebp,%edi
  call   <mostraNumero@plt>
  mov    $0xa,%edi
  call   <delay_ms@plt>
  mov    %r13d,%edi
  cmp    $0xa,%r13d
  jne    L40
  add    $0x1,%r12d
  xor    %edi,%edi
L40:
  cmp    $0xa,%r12d
  jne    L16
  add    $0x1,%ebx
  xor    %r12d,%r12d
  cmp    $0xa,%ebx
  jne    L25
  jmp    L41
```

assistant: ```c
void rodaContador() {
  int contador_4 = 0;
  int contador_3 = 0;
  int contador_2 = 0;
  int contador_1 = 0;
  delay_ms(100);
  while (1) {
    mostraNumero(contador_1, 4);
    mostraNumero(contador_2, 3);
    mostraNumero(contador_3, 2);
    mostraNumero(contador_4, 1);
    delay_ms(10);
    contador_1++;
    if (contador_1 > 9) {
      contador_1 = 0;
      contador_2++;
    }
    if (contador_2 > 9) {
      contador_2 = 0;
      contador_3++;
    }
    if (contador_3 > 9) {
      contador_3 = 0;
      contador_4++;
    }
    if (contador_4 > 9) {
      contador_1 = 0;
      contador_2 = 0;
      contador_3 = 0;
      contador_4 = 0;
    }
  }
}
```
user: What is the c source code of the assembly code below:

```asm
<hstrdup>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    $0x1,%rax
  mov    %rax,%rdi
  call   <hmalloc@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x18(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  mov    -0x8(%rbp),%rax
  leave
  ret
```

assistant: ```c
char *hstrdup(const char *s) {
  char *p;
  p = hmalloc(strlen(s) + 1);
  strcpy(p, s);
  return p;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<hstrdup>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbp
  call   <strlen@plt>
  lea    0x1(%rax),%rdi
  call   <hmalloc@plt>
  mov    %rax,%rbx
  mov    %rbp,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  mov    %rbx,%rax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
char *hstrdup(const char *s) {
  char *p;
  p = hmalloc(strlen(s) + 1);
  strcpy(p, s);
  return p;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<hstrdup>:
  endbr64
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  sub    $0x8,%rsp
  call   <strlen@plt>
  lea    0x1(%rax),%rdi
  call   <hmalloc@plt>
  mov    %rbp,%rsi
  mov    %rax,%rdi
  mov    %rax,%r12
  call   <strcpy@plt>
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
char *hstrdup(const char *s) {
  char *p;
  p = hmalloc(strlen(s) + 1);
  strcpy(p, s);
  return p;
}
```
user: What is the c source code of the assembly code below?

```asm
<hstrdup>:
  endbr64
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  sub    $0x8,%rsp
  call   <strlen@plt>
  lea    0x1(%rax),%rdi
  call   <hmalloc@plt>
  mov    %rbp,%rsi
  mov    %rax,%rdi
  mov    %rax,%r12
  call   <strcpy@plt>
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
char *hstrdup(const char *s) {
  char *p;
  p = hmalloc(strlen(s) + 1);
  strcpy(p, s);
  return p;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<strip_newline>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cltq
  lea    -0x1(%rax),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0xa,%al
  jne    L3
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  cltq
  lea    -0x1(%rax),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
L3:
  mov    -0x8(%rbp),%rax
  leave
  ret
```

assistant: ```c
char *strip_newline(char *string) {
  if (string[strlen(string) - 1] == '\n')
    string[strlen(string) - 1] = '\0';
  return string;
}
```
user: What is the c source code of the assembly code below?

```asm
<strip_newline>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  call   <strlen@plt>
  cltq
  cmpb   $0xa,-0x1(%rbx,%rax,1)
  je     L18
L7:
  mov    %rbx,%rax
  pop    %rbx
  ret
L18:
  mov    %rbx,%rdi
  call   <strlen@plt>
  cltq
  movb   $0x0,-0x1(%rbx,%rax,1)
  jmp    L7
```

assistant: ```c
char *strip_newline(char *string) {
  if (string[strlen(string) - 1] == '\n')
    string[strlen(string) - 1] = '\0';
  return string;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<strip_newline>:
  endbr64
  push   %r12
  mov    %rdi,%r12
  call   <strlen@plt>
  cltq
  cmpb   $0xa,-0x1(%r12,%rax,1)
  je     L9
  mov    %r12,%rax
  pop    %r12
  ret
  xchg   %ax,%ax
L9:
  mov    %r12,%rdi
  call   <strlen@plt>
  cltq
  movb   $0x0,-0x1(%r12,%rax,1)
  mov    %r12,%rax
  pop    %r12
  ret
```

assistant: ```c
char *strip_newline(char *string) {
  if (string[strlen(string) - 1] == '\n')
    string[strlen(string) - 1] = '\0';
  return string;
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<strip_newline>:
  endbr64
  push   %r12
  mov    %rdi,%r12
  call   <strlen@plt>
  cltq
  cmpb   $0xa,-0x1(%r12,%rax,1)
  je     L1
  mov    %r12,%rax
  pop    %r12
  ret
  xchg   %ax,%ax
L1:
  mov    %r12,%rdi
  call   <strlen@plt>
  cltq
  movb   $0x0,-0x1(%r12,%rax,1)
  mov    %r12,%rax
  pop    %r12
  ret
```

assistant: ```c
char *strip_newline(char *string) {
  if (string[strlen(string) - 1] == '\n')
    string[strlen(string) - 1] = '\0';
  return string;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<UARTConfigSetExpClk>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %esi,-0x18(%rbp)
  mov    %edx,-0x1c(%rbp)
  mov    %ecx,-0x20(%rbp)
  mov    -0x14(%rbp),%eax
  mov    %eax,%edi
  call   <_UARTBaseValid@plt>
  mov    %eax,%edi
  call   <ASSERT@plt>
  cmpl   $0x0,-0x1c(%rbp)
  setne  %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <ASSERT@plt>
  mov    -0x1c(%rbp),%eax
  shl    $0x3,%eax
  cmp    %eax,-0x18(%rbp)
  setge  %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <ASSERT@plt>
  mov    -0x14(%rbp),%eax
  mov    %eax,%edi
  call   <UARTDisable@plt>
  mov    -0x1c(%rbp),%eax
  shl    $0x4,%eax
  cmp    %eax,-0x18(%rbp)
  jge    L13
  mov    -0x14(%rbp),%eax
  add    $0x30,%eax
  cltq
  mov    (%rax),%eax
  mov    -0x14(%rbp),%edx
  add    $0x30,%edx
  movslq %edx,%rdx
  or     $0x20,%eax
  mov    %eax,(%rdx)
  mov    -0x1c(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,-0x1c(%rbp)
  jmp    L18
L13:
  mov    -0x14(%rbp),%eax
  add    $0x30,%eax
  cltq
  mov    (%rax),%eax
  mov    -0x14(%rbp),%edx
  add    $0x30,%edx
  movslq %edx,%rdx
  and    $0xffffffdf,%eax
  mov    %eax,(%rdx)
L18:
  mov    -0x18(%rbp),%eax
  shl    $0x3,%eax
  cltd
  idivl  -0x1c(%rbp)
  add    $0x1,%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,-0x4(%rbp)
  mov    -0x14(%rbp),%eax
  add    $0x24,%eax
  cltq
  mov    %rax,%rcx
  mov    -0x4(%rbp),%eax
  lea    0x3f(%rax),%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  sar    $0x6,%eax
  mov    %eax,(%rcx)
  mov    -0x14(%rbp),%eax
  add    $0x28,%eax
  cltq
  mov    %rax,%rcx
  mov    -0x4(%rbp),%eax
  cltd
  shr    $0x1a,%edx
  add    %edx,%eax
  and    $0x3f,%eax
  sub    %edx,%eax
  mov    %eax,(%rcx)
  mov    -0x14(%rbp),%eax
  add    $0x2c,%eax
  cltq
  mov    %rax,%rdx
  mov    -0x20(%rbp),%eax
  mov    %eax,(%rdx)
  mov    -0x14(%rbp),%eax
  add    $0x18,%eax
  cltq
  movl   $0x0,(%rax)
  mov    -0x14(%rbp),%eax
  mov    %eax,%edi
  call   <UARTEnable@plt>
  nop
  leave
  ret
```

assistant: ```c
void UARTConfigSetExpClk(uint32_t ui32Base, uint32_t ui32UARTClk, uint32_t ui32Baud, uint32_t ui32Config) {
  uint32_t ui32Div;
  ASSERT(_UARTBaseValid(ui32Base));
  ASSERT(ui32Baud != 0);
  ASSERT(ui32UARTClk >= (ui32Baud * 8));
  UARTDisable(ui32Base);
  if ((ui32Baud * 16) > ui32UARTClk) {
    (*((volatile uint32_t *)(ui32Base + 0x00000030))) |= 0x00000020;
    ui32Baud /= 2;
  } else {
    (*((volatile uint32_t *)(ui32Base + 0x00000030))) &= ~(0x00000020);
  }
  ui32Div = (((ui32UARTClk * 8) / ui32Baud) + 1) / 2;
  (*((volatile uint32_t *)(ui32Base + 0x00000024))) = ui32Div / 64;
  (*((volatile uint32_t *)(ui32Base + 0x00000028))) = ui32Div % 64;
  (*((volatile uint32_t *)(ui32Base + 0x0000002C))) = ui32Config;
  (*((volatile uint32_t *)(ui32Base + 0x00000018))) = 0;
  UARTEnable(ui32Base);
}
```
user: Translate the below assembly code into C programming language:

```asm
<UARTConfigSetExpClk>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %edi,%ebp
  mov    %esi,%ebx
  mov    %edx,%r13d
  mov    %ecx,%r12d
  call   <_UARTBaseValid@plt>
  mov    %eax,%edi
  call   <ASSERT@plt>
  test   %r13d,%r13d
  setne  %dil
  movzbl %dil,%edi
  call   <ASSERT@plt>
  lea    0x0(,%r13,8),%eax
  cmp    %ebx,%eax
  setle  %dil
  movzbl %dil,%edi
  call   <ASSERT@plt>
  mov    %ebp,%edi
  call   <UARTDisable@plt>
  mov    %r13d,%eax
  shl    $0x4,%eax
  cmp    %ebx,%eax
  jle    L10
  lea    0x30(%rbp),%eax
  cltq
  mov    (%rax),%edx
  or     $0x20,%edx
  mov    %edx,(%rax)
  mov    %r13d,%eax
  shr    $0x1f,%eax
  add    %r13d,%eax
  sar    %eax
  mov    %eax,%r13d
L0:
  lea    0x0(,%rbx,8),%eax
  cltd
  idiv   %r13d
  add    $0x1,%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %eax,%edx
  mov    %edx,%eax
  sar    %eax
  lea    0x24(%rbp),%esi
  movslq %esi,%rsi
  lea    0x3f(%rax),%ecx
  cmovns %eax,%ecx
  sar    $0x6,%ecx
  mov    %ecx,(%rsi)
  lea    0x28(%rbp),%ecx
  movslq %ecx,%rcx
  sar    $0x1f,%edx
  shr    $0x1a,%edx
  add    %edx,%eax
  and    $0x3f,%eax
  sub    %edx,%eax
  mov    %eax,(%rcx)
  lea    0x2c(%rbp),%eax
  cltq
  mov    %r12d,(%rax)
  lea    0x18(%rbp),%eax
  cltq
  movl   $0x0,(%rax)
  mov    %ebp,%edi
  call   <UARTEnable@plt>
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L10:
  lea    0x30(%rbp),%eax
  cltq
  mov    (%rax),%edx
  and    $0xffffffdf,%edx
  mov    %edx,(%rax)
  jmp    L0
```

assistant: ```c
void UARTConfigSetExpClk(uint32_t ui32Base, uint32_t ui32UARTClk, uint32_t ui32Baud, uint32_t ui32Config) {
  uint32_t ui32Div;
  ASSERT(_UARTBaseValid(ui32Base));
  ASSERT(ui32Baud != 0);
  ASSERT(ui32UARTClk >= (ui32Baud * 8));
  UARTDisable(ui32Base);
  if ((ui32Baud * 16) > ui32UARTClk) {
    (*((volatile uint32_t *)(ui32Base + 0x00000030))) |= 0x00000020;
    ui32Baud /= 2;
  } else {
    (*((volatile uint32_t *)(ui32Base + 0x00000030))) &= ~(0x00000020);
  }
  ui32Div = (((ui32UARTClk * 8) / ui32Baud) + 1) / 2;
  (*((volatile uint32_t *)(ui32Base + 0x00000024))) = ui32Div / 64;
  (*((volatile uint32_t *)(ui32Base + 0x00000028))) = ui32Div % 64;
  (*((volatile uint32_t *)(ui32Base + 0x0000002C))) = ui32Config;
  (*((volatile uint32_t *)(ui32Base + 0x00000018))) = 0;
  UARTEnable(ui32Base);
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<UARTConfigSetExpClk>:
  endbr64
  push   %r13
  mov    %edx,%r13d
  push   %r12
  mov    %ecx,%r12d
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  mov    %esi,%ebx
  sub    $0x8,%rsp
  call   <_UARTBaseValid@plt>
  mov    %eax,%edi
  call   <ASSERT@plt>
  xor    %edi,%edi
  test   %r13d,%r13d
  setne  %dil
  call   <ASSERT@plt>
  lea    0x0(,%r13,8),%eax
  xor    %edi,%edi
  cmp    %ebx,%eax
  setle  %dil
  call   <ASSERT@plt>
  mov    %ebp,%edi
  call   <UARTDisable@plt>
  mov    %r13d,%edx
  lea    0x30(%rbp),%eax
  shl    $0x4,%edx
  cltq
  cmp    %ebx,%edx
  mov    (%rax),%edx
  jle    L13
  or     $0x20,%edx
  mov    %edx,(%rax)
  mov    %r13d,%eax
  shr    $0x1f,%eax
  add    %r13d,%eax
  sar    %eax
  mov    %eax,%r13d
L6:
  lea    0x0(,%rbx,8),%eax
  lea    0x24(%rbp),%esi
  mov    %ebp,%edi
  cltd
  movslq %esi,%rsi
  idiv   %r13d
  add    $0x1,%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %eax,%edx
  mov    %edx,%eax
  sar    %eax
  lea    0x3f(%rax),%ecx
  cmovns %eax,%ecx
  sar    $0x1f,%edx
  shr    $0x1a,%edx
  sar    $0x6,%ecx
  add    %edx,%eax
  mov    %ecx,(%rsi)
  and    $0x3f,%eax
  lea    0x28(%rbp),%ecx
  sub    %edx,%eax
  movslq %ecx,%rcx
  mov    %eax,(%rcx)
  lea    0x2c(%rbp),%eax
  cltq
  mov    %r12d,(%rax)
  lea    0x18(%rbp),%eax
  cltq
  movl   $0x0,(%rax)
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  jmp    10b0 <UARTEnable@plt>
  nopl   (%rax)
L13:
  and    $0xffffffdf,%edx
  mov    %edx,(%rax)
  jmp    L6
```

assistant: ```c
void UARTConfigSetExpClk(uint32_t ui32Base, uint32_t ui32UARTClk, uint32_t ui32Baud, uint32_t ui32Config) {
  uint32_t ui32Div;
  ASSERT(_UARTBaseValid(ui32Base));
  ASSERT(ui32Baud != 0);
  ASSERT(ui32UARTClk >= (ui32Baud * 8));
  UARTDisable(ui32Base);
  if ((ui32Baud * 16) > ui32UARTClk) {
    (*((volatile uint32_t *)(ui32Base + 0x00000030))) |= 0x00000020;
    ui32Baud /= 2;
  } else {
    (*((volatile uint32_t *)(ui32Base + 0x00000030))) &= ~(0x00000020);
  }
  ui32Div = (((ui32UARTClk * 8) / ui32Baud) + 1) / 2;
  (*((volatile uint32_t *)(ui32Base + 0x00000024))) = ui32Div / 64;
  (*((volatile uint32_t *)(ui32Base + 0x00000028))) = ui32Div % 64;
  (*((volatile uint32_t *)(ui32Base + 0x0000002C))) = ui32Config;
  (*((volatile uint32_t *)(ui32Base + 0x00000018))) = 0;
  UARTEnable(ui32Base);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<UARTConfigSetExpClk>:
  endbr64
  push   %r13
  mov    %edx,%r13d
  push   %r12
  mov    %ecx,%r12d
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  mov    %esi,%ebx
  sub    $0x8,%rsp
  call   <_UARTBaseValid@plt>
  mov    %eax,%edi
  call   <ASSERT@plt>
  xor    %edi,%edi
  test   %r13d,%r13d
  setne  %dil
  call   <ASSERT@plt>
  lea    0x0(,%r13,8),%eax
  xor    %edi,%edi
  cmp    %ebx,%eax
  setle  %dil
  call   <ASSERT@plt>
  mov    %ebp,%edi
  call   <UARTDisable@plt>
  mov    %r13d,%edx
  lea    0x30(%rbp),%eax
  shl    $0x4,%edx
  cltq
  cmp    %ebx,%edx
  mov    (%rax),%edx
  jle    L6
  or     $0x20,%edx
  mov    %edx,(%rax)
  mov    %r13d,%eax
  shr    $0x1f,%eax
  add    %r13d,%eax
  sar    %eax
  mov    %eax,%r13d
L7:
  lea    0x0(,%rbx,8),%eax
  lea    0x24(%rbp),%esi
  mov    %ebp,%edi
  cltd
  movslq %esi,%rsi
  idiv   %r13d
  add    $0x1,%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %eax,%edx
  mov    %edx,%eax
  sar    %eax
  lea    0x3f(%rax),%ecx
  cmovns %eax,%ecx
  sar    $0x1f,%edx
  shr    $0x1a,%edx
  sar    $0x6,%ecx
  add    %edx,%eax
  mov    %ecx,(%rsi)
  and    $0x3f,%eax
  lea    0x28(%rbp),%ecx
  sub    %edx,%eax
  movslq %ecx,%rcx
  mov    %eax,(%rcx)
  lea    0x2c(%rbp),%eax
  cltq
  mov    %r12d,(%rax)
  lea    0x18(%rbp),%eax
  cltq
  movl   $0x0,(%rax)
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  jmp    10b0 <UARTEnable@plt>
  nopl   (%rax)
L6:
  and    $0xffffffdf,%edx
  mov    %edx,(%rax)
  jmp    L7
```

assistant: ```c
void UARTConfigSetExpClk(uint32_t ui32Base, uint32_t ui32UARTClk, uint32_t ui32Baud, uint32_t ui32Config) {
  uint32_t ui32Div;
  ASSERT(_UARTBaseValid(ui32Base));
  ASSERT(ui32Baud != 0);
  ASSERT(ui32UARTClk >= (ui32Baud * 8));
  UARTDisable(ui32Base);
  if ((ui32Baud * 16) > ui32UARTClk) {
    (*((volatile uint32_t *)(ui32Base + 0x00000030))) |= 0x00000020;
    ui32Baud /= 2;
  } else {
    (*((volatile uint32_t *)(ui32Base + 0x00000030))) &= ~(0x00000020);
  }
  ui32Div = (((ui32UARTClk * 8) / ui32Baud) + 1) / 2;
  (*((volatile uint32_t *)(ui32Base + 0x00000024))) = ui32Div / 64;
  (*((volatile uint32_t *)(ui32Base + 0x00000028))) = ui32Div % 64;
  (*((volatile uint32_t *)(ui32Base + 0x0000002C))) = ui32Config;
  (*((volatile uint32_t *)(ui32Base + 0x00000018))) = 0;
  UARTEnable(ui32Base);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<getshort>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x18(%rbp),%rdx
  lea    -0xa(%rbp),%rax
  mov    %rdx,%rcx
  mov    $0x1,%edx
  mov    $0x2,%esi
  mov    %rax,%rdi
  call   <fread@plt>
  movzbl -0xa(%rbp),%eax
  movzbl %al,%eax
  shl    $0x8,%eax
  mov    %eax,%edx
  movzbl -0x9(%rbp),%eax
  movzbl %al,%eax
  add    %edx,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L5
  call   <__stack_chk_fail@plt>
L5:
  leave
  ret
```

assistant: ```c
unsigned short getshort(FILE *inf) {
  unsigned char buf[2];
  fread(buf, 2, 1, inf);
  return ((buf[0] << 8) + (buf[1] << 0));
}
```