ylfeng/ReF-Decompile-dataset huggingface dataset:
user: What would the C source look like for the assembly code provided here:

```asm
<cpufreq_duration_to_string>:
  endbr64
  cmp    $0xf4240,%rdi
  ja     L16
  cmp    $0x186a0,%rdi
  ja     L8
  cmp    $0x3e8,%rdi
  jbe    L1
  movabs $0x28f5c28f5c28f5c3,%rcx
  mov    %rdi,%rdx
  shr    $0x2,%rdx
  mov    %rdx,%rax
  mul    %rcx
  movabs $0x20c49ba5e353f7cf,%rcx
  mov    %rdx,%rax
  and    $0xfffffffffffffffc,%rdx
  shr    $0x2,%rax
  add    %rax,%rdx
  lea    (%rdx,%rdx,4),%rax
  mov    %rdi,%rdx
  shl    $0x2,%rax
  sub    %rax,%rdx
  lea    0x64(%rdi),%rax
  cmp    $0x31,%rdx
  cmova  %rax,%rdi
  mov    %rdi,%rdx
  mov    %edi,%esi
  shr    $0x3,%rdx
  imul   $0x10624dd3,%rsi,%rsi
  mov    %rdx,%rax
  mul    %rcx
  mov    %edi,%eax
  lea    D33(%rip),%rdi
  shr    $0x26,%rsi
  shr    $0x4,%rdx
  imul   $0x3e8,%rdx,%rdx
  sub    %edx,%eax
  imul   $0x51eb851f,%rax,%rdx
  xor    %eax,%eax
  shr    $0x25,%rdx
  jmp    1050 <xasprintf@plt>
  cs nopw 0x0(%rax,%rax,1)
L8:
  movabs $0x20c49ba5e353f7cf,%rcx
  mov    %rdi,%rdx
  shr    $0x3,%rdx
  mov    %rdx,%rax
  mul    %rcx
  mov    %rdi,%rcx
  lea    0x3e8(%rdi),%rax
  shr    $0x4,%rdx
  imul   $0x3e8,%rdx,%rdx
  sub    %rdx,%rcx
  cmp    $0x1f3,%rcx
  cmova  %rax,%rdi
  xor    %eax,%eax
  mov    %edi,%esi
  lea    D38(%rip),%rdi
  imul   $0x10624dd3,%rsi,%rsi
  shr    $0x26,%rsi
  jmp    1050 <xasprintf@plt>
  nopl   (%rax)
L16:
  movabs $0x346dc5d63886594b,%rdx
  mov    %rdi,%rax
  mov    %rdi,%rcx
  mul    %rdx
  lea    0x2710(%rdi),%rax
  shr    $0xb,%rdx
  imul   $0x2710,%rdx,%rdx
  sub    %rdx,%rcx
  movabs $0x431bde82d7b634db,%rdx
  cmp    $0x1387,%rcx
  cmova  %rax,%rdi
  mov    %rdi,%rax
  mov    %edi,%esi
  mul    %rdx
  imul   $0x431bde83,%rsi,%rsi
  shr    $0x12,%rdx
  imul   $0xf4240,%rdx,%rax
  mov    %edi,%edx
  shr    $0x32,%rsi
  lea    D30(%rip),%rdi
  sub    %eax,%edx
  mov    $0xd1b71759,%eax
  imul   %rax,%rdx
  xor    %eax,%eax
  shr    $0x2d,%rdx
  jmp    1050 <xasprintf@plt>
  nopw   0x0(%rax,%rax,1)
L1:
  mov    %rdi,%rsi
  xor    %eax,%eax
  lea    D4(%rip),%rdi
  jmp    1050 <xasprintf@plt>
```

tool_calls: name: unpack_data
arguments: data_label: D33
type: string
name: unpack_data
arguments: data_label: D38
type: string
name: unpack_data
arguments: data_label: D30
type: string
name: unpack_data
arguments: data_label: D4
type: string

tool: D33: %u.%01uus

tool: D38: %uus

tool: D30: %u.%02ums

tool: D4: %luns

assistant: ```c
char *cpufreq_duration_to_string(unsigned long duration) {
  unsigned long tmp;
  if (duration > 1000000) {
    tmp = duration % 10000;
    if (tmp >= 5000)
      duration += 10000;
    return xasprintf("%u.%02ums", ((unsigned int)duration / 1000000), ((unsigned int)(duration % 1000000) / 10000));
  } else if (duration > 100000) {
    tmp = duration % 1000;
    if (tmp >= 500)
      duration += 1000;
    return xasprintf("%uus", ((unsigned int)duration / 1000));
  } else if (duration > 1000) {
    tmp = duration % 100;
    if (tmp >= 50)
      duration += 100;
    return xasprintf("%u.%01uus", ((unsigned int)duration / 1000), ((unsigned int)(duration % 1000) / 100));
  } else
    return xasprintf("%luns", duration);
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<cpufreq_duration_to_string>:
  endbr64
  cmp    $0xf4240,%rdi
  ja     L3
  cmp    $0x186a0,%rdi
  ja     L29
  cmp    $0x3e8,%rdi
  jbe    L20
  movabs $0x28f5c28f5c28f5c3,%rcx
  mov    %rdi,%rdx
  shr    $0x2,%rdx
  mov    %rdx,%rax
  mul    %rcx
  movabs $0x20c49ba5e353f7cf,%rcx
  mov    %rdx,%rax
  and    $0xfffffffffffffffc,%rdx
  shr    $0x2,%rax
  add    %rax,%rdx
  lea    (%rdx,%rdx,4),%rax
  mov    %rdi,%rdx
  shl    $0x2,%rax
  sub    %rax,%rdx
  lea    0x64(%rdi),%rax
  cmp    $0x31,%rdx
  cmova  %rax,%rdi
  mov    %rdi,%rdx
  mov    %edi,%esi
  shr    $0x3,%rdx
  imul   $0x10624dd3,%rsi,%rsi
  mov    %rdx,%rax
  mul    %rcx
  mov    %edi,%eax
  lea    D36(%rip),%rdi
  shr    $0x26,%rsi
  shr    $0x4,%rdx
  imul   $0x3e8,%rdx,%rdx
  sub    %edx,%eax
  imul   $0x51eb851f,%rax,%rdx
  xor    %eax,%eax
  shr    $0x25,%rdx
  jmp    1050 <xasprintf@plt>
  cs nopw 0x0(%rax,%rax,1)
L29:
  movabs $0x20c49ba5e353f7cf,%rcx
  mov    %rdi,%rdx
  shr    $0x3,%rdx
  mov    %rdx,%rax
  mul    %rcx
  mov    %rdi,%rcx
  lea    0x3e8(%rdi),%rax
  shr    $0x4,%rdx
  imul   $0x3e8,%rdx,%rdx
  sub    %rdx,%rcx
  cmp    $0x1f3,%rcx
  cmova  %rax,%rdi
  xor    %eax,%eax
  mov    %edi,%esi
  lea    D20(%rip),%rdi
  imul   $0x10624dd3,%rsi,%rsi
  shr    $0x26,%rsi
  jmp    1050 <xasprintf@plt>
  nopl   (%rax)
L3:
  movabs $0x346dc5d63886594b,%rdx
  mov    %rdi,%rax
  mov    %rdi,%rcx
  mul    %rdx
  lea    0x2710(%rdi),%rax
  shr    $0xb,%rdx
  imul   $0x2710,%rdx,%rdx
  sub    %rdx,%rcx
  movabs $0x431bde82d7b634db,%rdx
  cmp    $0x1387,%rcx
  cmova  %rax,%rdi
  mov    %rdi,%rax
  mov    %edi,%esi
  mul    %rdx
  imul   $0x431bde83,%rsi,%rsi
  shr    $0x12,%rdx
  imul   $0xf4240,%rdx,%rax
  mov    %edi,%edx
  shr    $0x32,%rsi
  lea    D22(%rip),%rdi
  sub    %eax,%edx
  mov    $0xd1b71759,%eax
  imul   %rax,%rdx
  xor    %eax,%eax
  shr    $0x2d,%rdx
  jmp    1050 <xasprintf@plt>
  nopw   0x0(%rax,%rax,1)
L20:
  mov    %rdi,%rsi
  xor    %eax,%eax
  lea    D6(%rip),%rdi
  jmp    1050 <xasprintf@plt>
```

tool_calls: name: unpack_data
arguments: tag: D36
type: string
name: unpack_data
arguments: tag: D20
type: string
name: unpack_data
arguments: tag: D22
type: string
name: unpack_data
arguments: tag: D6
type: string

tool: D36: %u.%01uus

tool: D20: %uus

tool: D22: %u.%02ums

tool: D6: %luns

assistant: ```c
char *cpufreq_duration_to_string(unsigned long duration) {
  unsigned long tmp;
  if (duration > 1000000) {
    tmp = duration % 10000;
    if (tmp >= 5000)
      duration += 10000;
    return xasprintf("%u.%02ums", ((unsigned int)duration / 1000000), ((unsigned int)(duration % 1000000) / 10000));
  } else if (duration > 100000) {
    tmp = duration % 1000;
    if (tmp >= 500)
      duration += 1000;
    return xasprintf("%uus", ((unsigned int)duration / 1000));
  } else if (duration > 1000) {
    tmp = duration % 100;
    if (tmp >= 50)
      duration += 100;
    return xasprintf("%u.%01uus", ((unsigned int)duration / 1000), ((unsigned int)(duration % 1000) / 100));
  } else
    return xasprintf("%luns", duration);
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<lastWord>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  movl   $0x0,-0x8(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x4(%rbp)
  jmp    L15
L7:
  subl   $0x1,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isspace@plt>
  test   %rax,%rax
  je     L15
  movl   $0x1,-0x8(%rbp)
  jmp    L22
L15:
  cmpl   $0x0,-0x4(%rbp)
  jne    L7
L22:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%eax
  cltq
  add    %rax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  leave
  ret
```

assistant: ```c
char *lastWord(char *inString) {
  int mod = 0;
  int len = strlen(inString);
  while (len) {
    len--;
    if (isspace(*(inString + len))) {
      mod = 1;
      break;
    }
  }
  return inString + len + mod;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<lastWord>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%r12
  call   <strlen@plt>
  mov    %eax,%ebx
  cltq
  lea    -0x1(%r12,%rax,1),%rbp
L12:
  test   %ebx,%ebx
  je     L25
  sub    $0x1,%ebx
  movsbl 0x0(%rbp),%edi
  call   <isspace@plt>
  sub    $0x1,%rbp
  test   %rax,%rax
  je     L12
  mov    %ebx,%eax
  mov    $0x1,%ebx
  jmp    L1
L25:
  mov    %ebx,%eax
L1:
  cltq
  movslq %ebx,%rbx
  add    %rbx,%rax
  add    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
char *lastWord(char *inString) {
  int mod = 0;
  int len = strlen(inString);
  while (len) {
    len--;
    if (isspace(*(inString + len))) {
      mod = 1;
      break;
    }
  }
  return inString + len + mod;
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<lastWord>:
  endbr64
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  call   <strlen@plt>
  movslq %eax,%rbp
  lea    -0x1(%rax),%ebx
  mov    %eax,%eax
  sub    $0x1,%rbp
  movslq %ebx,%rbx
  sub    %rax,%rbp
  jmp    L20
  nopl   0x0(%rax)
L14:
  movsbl (%r12,%rbx,1),%edi
  call   <isspace@plt>
  lea    -0x1(%rbx),%rdx
  test   %rax,%rax
  jne    L11
  mov    %rdx,%rbx
L20:
  cmp    %rbp,%rbx
  jne    L14
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L11:
  lea    0x1(%r12,%rbx,1),%r12
  pop    %rbx
  pop    %rbp
  mov    %r12,%rax
  pop    %r12
  ret
```

assistant: ```c
char *lastWord(char *inString) {
  int mod = 0;
  int len = strlen(inString);
  while (len) {
    len--;
    if (isspace(*(inString + len))) {
      mod = 1;
      break;
    }
  }
  return inString + len + mod;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<lastWord>:
  endbr64
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  call   <strlen@plt>
  movslq %eax,%rbp
  lea    -0x1(%rax),%ebx
  mov    %eax,%eax
  sub    $0x1,%rbp
  movslq %ebx,%rbx
  sub    %rax,%rbp
  jmp    L5
  nopl   0x0(%rax)
L10:
  movsbl (%r12,%rbx,1),%edi
  call   <isspace@plt>
  lea    -0x1(%rbx),%rdx
  test   %rax,%rax
  jne    L3
  mov    %rdx,%rbx
L5:
  cmp    %rbp,%rbx
  jne    L10
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L3:
  lea    0x1(%r12,%rbx,1),%r12
  pop    %rbx
  pop    %rbp
  mov    %r12,%rax
  pop    %r12
  ret
```

assistant: ```c
char *lastWord(char *inString) {
  int mod = 0;
  int len = strlen(inString);
  while (len) {
    len--;
    if (isspace(*(inString + len))) {
      mod = 1;
      break;
    }
  }
  return inString + len + mod;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<mwte_fft_reverse_bits>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %esi,-0x28(%rbp)
  mov    -0x28(%rbp),%eax
  mov    %eax,%edi
  call   <log2@plt>
  mov    %eax,-0xc(%rbp)
  mov    -0xc(%rbp),%eax
  mov    %eax,%esi
  mov    $0x2,%edi
  call   <pow@plt>
  cmp    %eax,-0x28(%rbp)
  je     L29
  addl   $0x1,-0xc(%rbp)
L29:
  mov    -0xc(%rbp),%eax
  mov    %eax,%esi
  mov    $0x2,%edi
  call   <pow@plt>
  mov    %eax,-0x10(%rbp)
  mov    -0x10(%rbp),%eax
  sub    -0x28(%rbp),%eax
  mov    %eax,-0x8(%rbp)
  movl   $0xffffffff,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x10(%rbp),%eax
  mov    -0x14(%rbp),%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  xor    %eax,-0x4(%rbp)
  jmp    L12
L2:
  mov    -0x10(%rbp),%eax
  mov    -0x14(%rbp),%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  xor    %eax,-0x14(%rbp)
  mov    -0x10(%rbp),%eax
  mov    -0x24(%rbp),%edx
  mov    %eax,%ecx
  shr    %cl,%edx
  mov    %edx,%eax
  and    -0x14(%rbp),%eax
  mov    %eax,%esi
  mov    -0x10(%rbp),%eax
  mov    -0x24(%rbp),%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    -0x14(%rbp),%eax
  not    %eax
  and    %edx,%eax
  or     %esi,%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x4(%rbp),%eax
  and    %eax,-0x24(%rbp)
L12:
  shrl   -0x10(%rbp)
  cmpl   $0x0,-0x10(%rbp)
  jne    L2
  mov    -0x8(%rbp),%eax
  mov    %eax,%ecx
  shrl   %cl,-0x24(%rbp)
  mov    -0x24(%rbp),%eax
  leave
  ret
```

assistant: ```c
int mwte_fft_reverse_bits(unsigned int bits, unsigned int bit_length) {
  unsigned int mask, bit_mask, adjusted_length, log, shift;
  log = log2(bit_length);
  if (pow(2, log) != bit_length) {
    log++;
  }
  adjusted_length = pow(2, log);
  shift = adjusted_length - bit_length;
  mask = bit_mask = ~0;
  bit_mask ^= (mask << adjusted_length);
  while ((adjusted_length >>= 1)) {
    mask ^= (mask << adjusted_length);
    bits = ((bits >> adjusted_length) & mask) | ((bits << adjusted_length) & ~mask);
    bits &= bit_mask;
  }
  bits >>= shift;
  return bits;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<mwte_fft_reverse_bits>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %edi,%ebx
  mov    %esi,%r12d
  mov    %esi,%edi
  call   <log2@plt>
  mov    %eax,%ebp
  mov    %eax,%esi
  mov    $0x2,%edi
  call   <pow@plt>
  cmp    %r12d,%eax
  setne  %al
  movzbl %al,%eax
  add    %eax,%ebp
  mov    %ebp,%esi
  mov    $0x2,%edi
  call   <pow@plt>
  mov    %eax,%ecx
  mov    %eax,%edi
  sub    %r12d,%edi
  mov    $0xffffffff,%esi
  shl    %cl,%esi
  shr    %ecx
  je     L11
  not    %esi
  mov    $0xffffffff,%edx
L3:
  mov    %edx,%eax
  shl    %cl,%eax
  xor    %eax,%edx
  mov    %ebx,%eax
  shl    %cl,%eax
  shr    %cl,%ebx
  xor    %eax,%ebx
  and    %edx,%ebx
  xor    %ebx,%eax
  and    %esi,%eax
  mov    %eax,%ebx
  shr    %ecx
  jne    L3
L11:
  mov    %ebx,%eax
  mov    %edi,%ecx
  shr    %cl,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
int mwte_fft_reverse_bits(unsigned int bits, unsigned int bit_length) {
  unsigned int mask, bit_mask, adjusted_length, log, shift;
  log = log2(bit_length);
  if (pow(2, log) != bit_length) {
    log++;
  }
  adjusted_length = pow(2, log);
  shift = adjusted_length - bit_length;
  mask = bit_mask = ~0;
  bit_mask ^= (mask << adjusted_length);
  while ((adjusted_length >>= 1)) {
    mask ^= (mask << adjusted_length);
    bits = ((bits >> adjusted_length) & mask) | ((bits << adjusted_length) & ~mask);
    bits &= bit_mask;
  }
  bits >>= shift;
  return bits;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<mwte_fft_reverse_bits>:
  endbr64
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  push   %rbx
  mov    %edi,%ebx
  mov    %esi,%edi
  call   <log2@plt>
  mov    $0x2,%edi
  mov    %eax,%esi
  mov    %eax,%ebp
  call   <pow@plt>
  mov    $0x2,%edi
  cmp    %r12d,%eax
  setne  %al
  movzbl %al,%eax
  add    %eax,%ebp
  mov    %ebp,%esi
  call   <pow@plt>
  mov    $0xffffffff,%esi
  mov    %eax,%ecx
  mov    %eax,%edi
  sub    %r12d,%edi
  shl    %cl,%esi
  shr    %ecx
  je     L12
  not    %esi
  mov    $0xffffffff,%edx
  nopw   0x0(%rax,%rax,1)
L9:
  mov    %edx,%eax
  shl    %cl,%eax
  xor    %eax,%edx
  mov    %ebx,%eax
  shr    %cl,%ebx
  shl    %cl,%eax
  xor    %eax,%ebx
  and    %edx,%ebx
  xor    %ebx,%eax
  and    %esi,%eax
  shr    %ecx
  mov    %eax,%ebx
  jne    L9
L12:
  mov    %ebx,%eax
  mov    %edi,%ecx
  pop    %rbx
  pop    %rbp
  shr    %cl,%eax
  pop    %r12
  ret
```

assistant: ```c
int mwte_fft_reverse_bits(unsigned int bits, unsigned int bit_length) {
  unsigned int mask, bit_mask, adjusted_length, log, shift;
  log = log2(bit_length);
  if (pow(2, log) != bit_length) {
    log++;
  }
  adjusted_length = pow(2, log);
  shift = adjusted_length - bit_length;
  mask = bit_mask = ~0;
  bit_mask ^= (mask << adjusted_length);
  while ((adjusted_length >>= 1)) {
    mask ^= (mask << adjusted_length);
    bits = ((bits >> adjusted_length) & mask) | ((bits << adjusted_length) & ~mask);
    bits &= bit_mask;
  }
  bits >>= shift;
  return bits;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<mwte_fft_reverse_bits>:
  endbr64
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  push   %rbx
  mov    %edi,%ebx
  mov    %esi,%edi
  call   <log2@plt>
  mov    $0x2,%edi
  mov    %eax,%esi
  mov    %eax,%ebp
  call   <pow@plt>
  mov    $0x2,%edi
  cmp    %r12d,%eax
  setne  %al
  movzbl %al,%eax
  add    %eax,%ebp
  mov    %ebp,%esi
  call   <pow@plt>
  mov    $0xffffffff,%esi
  mov    %eax,%ecx
  mov    %eax,%edi
  sub    %r12d,%edi
  shl    %cl,%esi
  shr    %ecx
  je     L17
  not    %esi
  mov    $0xffffffff,%edx
  nopw   0x0(%rax,%rax,1)
L15:
  mov    %edx,%eax
  shl    %cl,%eax
  xor    %eax,%edx
  mov    %ebx,%eax
  shr    %cl,%ebx
  shl    %cl,%eax
  xor    %eax,%ebx
  and    %edx,%ebx
  xor    %ebx,%eax
  and    %esi,%eax
  shr    %ecx
  mov    %eax,%ebx
  jne    L15
L17:
  mov    %ebx,%eax
  mov    %edi,%ecx
  pop    %rbx
  pop    %rbp
  shr    %cl,%eax
  pop    %r12
  ret
```

assistant: ```c
int mwte_fft_reverse_bits(unsigned int bits, unsigned int bit_length) {
  unsigned int mask, bit_mask, adjusted_length, log, shift;
  log = log2(bit_length);
  if (pow(2, log) != bit_length) {
    log++;
  }
  adjusted_length = pow(2, log);
  shift = adjusted_length - bit_length;
  mask = bit_mask = ~0;
  bit_mask ^= (mask << adjusted_length);
  while ((adjusted_length >>= 1)) {
    mask ^= (mask << adjusted_length);
    bits = ((bits >> adjusted_length) & mask) | ((bits << adjusted_length) & ~mask);
    bits &= bit_mask;
  }
  bits >>= shift;
  return bits;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<Subsample_Horizontal>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x48(%rbp)
  mov    %rsi,-0x50(%rbp)
  mov    %edx,-0x54(%rbp)
  mov    %ecx,-0x58(%rbp)
  mov    %r8d,-0x5c(%rbp)
  mov    %r9d,-0x60(%rbp)
  movl   $0x0,-0x34(%rbp)
  jmp    L66
L50:
  mov    -0x34(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x54(%rbp),%edx
  mov    -0x34(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x2c(%rbp)
  mov    -0x2c(%rbp),%eax
  imul   0x18(%rbp),%eax
  cltd
  idivl  0x20(%rbp)
  mov    %eax,-0x28(%rbp)
  mov    -0x28(%rbp),%eax
  cltq
  lea    (%rax,%rax,1),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x5c(%rbp),%eax
  sub    $0x1,%eax
  cmp    %eax,-0x28(%rbp)
  jge    L65
  mov    -0x18(%rbp),%rax
  add    $0x2,%rax
  jmp    L19
L65:
  mov    -0x18(%rbp),%rax
L19:
  mov    %rax,-0x10(%rbp)
  mov    -0x2c(%rbp),%eax
  imul   0x18(%rbp),%eax
  cltd
  idivl  0x20(%rbp)
  mov    %edx,%eax
  shl    $0x4,%eax
  mov    %eax,%edx
  mov    0x20(%rbp),%eax
  sar    %eax
  add    %edx,%eax
  cltd
  idivl  0x20(%rbp)
  mov    %eax,-0x24(%rbp)
  mov    $0x10,%eax
  sub    -0x24(%rbp),%eax
  mov    %eax,-0x20(%rbp)
  movl   $0x0,-0x30(%rbp)
  jmp    L6
L41:
  mov    -0x18(%rbp),%rax
  movzwl (%rax),%eax
  cwtl
  imul   -0x20(%rbp),%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%rax
  movzwl (%rax),%eax
  cwtl
  imul   -0x24(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x1c(%rbp)
  cmpl   $0x0,-0x1c(%rbp)
  js     L15
  mov    $0x80,%edx
  jmp    L11
L15:
  mov    $0x7f,%edx
L11:
  mov    -0x1c(%rbp),%eax
  add    %edx,%eax
  sar    $0x8,%eax
  mov    %eax,%edx
  mov    -0x8(%rbp),%rax
  mov    %dl,(%rax)
  mov    -0x60(%rbp),%eax
  cltq
  add    %rax,-0x8(%rbp)
  mov    -0x5c(%rbp),%eax
  cltq
  add    %rax,%rax
  add    %rax,-0x18(%rbp)
  mov    -0x5c(%rbp),%eax
  cltq
  add    %rax,%rax
  add    %rax,-0x10(%rbp)
  addl   $0x1,-0x30(%rbp)
L6:
  mov    -0x30(%rbp),%eax
  cmp    0x10(%rbp),%eax
  jl     L41
  addl   $0x1,-0x34(%rbp)
L66:
  mov    -0x34(%rbp),%eax
  cmp    -0x58(%rbp),%eax
  jl     L50
  nop
  nop
  pop    %rbp
  ret
```

assistant: ```c
void Subsample_Horizontal(signed short int *s, unsigned char *d, signed int x0, signed int lx, signed int lxs, signed int lxd, signed int ly, signed int m, signed int n) {
  signed int i;
  signed int i1;
  signed int j;
  signed int id;
  signed int c1;
  signed int c2;
  signed int v;
  signed short int *s1;
  signed short int *s2;
  unsigned char *d1;
  i1 = 0;
  while (!(i1 >= lx)) {
    d1 = d + (signed long int)i1;
    i = x0 + i1;
    id = (i * m) / n;
    s1 = s + (signed long int)id;
    s2 = id < lxs - 1 ? s1 + (signed long int)1 : s1;
    c2 = (16 * ((i * m) % n) + (n >> 1)) / n;
    c1 = 16 - c2;
    j = 0;
    while (!(j >= ly)) {
      v = c1 * (signed int)*s1 + c2 * (signed int)*s2;
      *d1 = (unsigned char)(v + (v >= 0 ? 128 : 127) >> 8);
      d1 = d1 + (signed long int)lxd;
      s1 = s1 + (signed long int)lxs;
      s2 = s2 + (signed long int)lxs;
      j = j + 1;
    }
    i1 = i1 + 1;
  }
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<Subsample_Horizontal>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,-0x18(%rsp)
  mov    0x38(%rsp),%ebx
  mov    0x48(%rsp),%r14d
  test   %ecx,%ecx
  jle    L56
  mov    %edx,%r13d
  mov    %r14d,%edi
  sar    %edi
  mov    %edi,-0x8(%rsp)
  movslq %r8d,%r12
  add    %r12,%r12
  imul   0x40(%rsp),%r13d
  mov    %rsi,%r15
  lea    -0x1(%rcx),%eax
  lea    0x1(%rsi,%rax,1),%rax
  mov    %rax,-0x10(%rsp)
  lea    -0x1(%r8),%eax
  mov    %eax,-0x4(%rsp)
  movslq %r9d,%rbp
  jmp    L49
L47:
  movswl (%r10,%rcx,1),%edx
  imul   %r11d,%edx
  movswl (%r9,%rcx,1),%esi
  imul   %eax,%esi
  add    %esi,%edx
  mov    %edx,%esi
  not    %esi
  shr    $0x1f,%esi
  lea    0x7f(%rsi,%rdx,1),%edx
  movzbl %dh,%edx
  mov    %dl,(%rdi)
  add    %rbp,%rdi
  add    $0x1,%r8d
  add    %r12,%rcx
  cmp    %r8d,%ebx
  jne    L47
L54:
  add    0x40(%rsp),%r13d
  add    $0x1,%r15
  cmp    -0x10(%rsp),%r15
  je     L56
L49:
  mov    %r15,%rdi
  mov    %r13d,%eax
  cltd
  idiv   %r14d
  movslq %eax,%rdx
  mov    -0x18(%rsp),%rcx
  lea    (%rcx,%rdx,2),%r10
  lea    0x2(%r10),%r9
  cmp    %eax,-0x4(%rsp)
  cmovle %r10,%r9
  mov    %r13d,%eax
  cltd
  idiv   %r14d
  shl    $0x4,%edx
  mov    -0x8(%rsp),%eax
  add    %edx,%eax
  cltd
  idiv   %r14d
  mov    $0x10,%r11d
  sub    %eax,%r11d
  test   %ebx,%ebx
  jle    L54
  mov    $0x0,%ecx
  mov    $0x0,%r8d
  jmp    L47
L56:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void Subsample_Horizontal(signed short int *s, unsigned char *d, signed int x0, signed int lx, signed int lxs, signed int lxd, signed int ly, signed int m, signed int n) {
  signed int i;
  signed int i1;
  signed int j;
  signed int id;
  signed int c1;
  signed int c2;
  signed int v;
  signed short int *s1;
  signed short int *s2;
  unsigned char *d1;
  i1 = 0;
  while (!(i1 >= lx)) {
    d1 = d + (signed long int)i1;
    i = x0 + i1;
    id = (i * m) / n;
    s1 = s + (signed long int)id;
    s2 = id < lxs - 1 ? s1 + (signed long int)1 : s1;
    c2 = (16 * ((i * m) % n) + (n >> 1)) / n;
    c1 = 16 - c2;
    j = 0;
    while (!(j >= ly)) {
      v = c1 * (signed int)*s1 + c2 * (signed int)*s2;
      *d1 = (unsigned char)(v + (v >= 0 ? 128 : 127) >> 8);
      d1 = d1 + (signed long int)lxd;
      s1 = s1 + (signed long int)lxs;
      s2 = s2 + (signed long int)lxs;
      j = j + 1;
    }
    i1 = i1 + 1;
  }
}
```