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

```asm
<canontoken>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x8,%rsp
  call   <strlen@plt>
  cmp    %eax,D1(%rip)
  mov    D10(%rip),%rbp
  jle    L3
L84:
  lea    0x1(%rbx),%r12
  movzbl (%rbx),%ebx
  test   %bl,%bl
  jne    L13
  jmp    L37
  nopl   (%rax)
L27:
  add    $0x1,%r12
  mov    %bl,0x0(%rbp)
  add    $0x1,%rbp
  movzbl -0x1(%r12),%ebx
  test   %bl,%bl
  je     L54
L13:
  movzbl %bl,%r13d
  mov    %r13d,%edi
  call   <isupper@plt>
  test   %rax,%rax
  je     L27
  mov    %r13d,%edi
  call   <tolower@plt>
  mov    %eax,%ebx
  jmp    L27
  nopw   0x0(%rax,%rax,1)
L54:
  mov    D10(%rip),%rax
L34:
  movb   $0x0,0x0(%rbp)
L85:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  cs nopw 0x0(%rax,%rax,1)
L3:
  mov    D10(%rip),%rdi
  lea    0xb(%rax),%esi
  mov    %esi,D34(%rip)
  call   <grealloc@plt>
  mov    %rax,D34(%rip)
  mov    %rax,%rbp
  test   %rax,%rax
  jne    L84
  xor    %eax,%eax
  jmp    L85
  nopl   0x0(%rax)
L37:
  mov    %rbp,%rax
  jmp    L34
```

assistant: ```c
char *canontoken(char *str) {
  static unsigned char *canon;
  static int allocated;
  unsigned char c, *p, *q;
  int len;
  p = (unsigned char *)str;
  len = strlen(str);
  if (len >= allocated) {
    allocated = len + 1 + 10;
    canon = grealloc(canon, allocated);
    if (!canon)
      return NULL;
  }
  q = (unsigned char *)canon;
  while ((c = *p++)) {
    if (isupper(c))
      c = tolower(c);
    *q++ = c;
  }
  *q = '\0';
  return (char *)canon;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<canontoken>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x8,%rsp
  call   <strlen@plt>
  cmp    %eax,D18(%rip)
  mov    D56(%rip),%rbp
  jle    L81
L31:
  lea    0x1(%rbx),%r12
  movzbl (%rbx),%ebx
  test   %bl,%bl
  je     L67
  nopl   0x0(%rax)
L51:
  movzbl %bl,%r13d
  mov    %r13d,%edi
  call   <isupper@plt>
  test   %rax,%rax
  jne    L54
  add    $0x1,%r12
  mov    %bl,0x0(%rbp)
  add    $0x1,%rbp
  movzbl -0x1(%r12),%ebx
  test   %bl,%bl
  jne    L51
L52:
  mov    D56(%rip),%rax
L55:
  movb   $0x0,0x0(%rbp)
L53:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L54:
  mov    %r13d,%edi
  add    $0x1,%rbp
  add    $0x1,%r12
  call   <tolower@plt>
  mov    %al,-0x1(%rbp)
  movzbl -0x1(%r12),%ebx
  test   %bl,%bl
  jne    L51
  jmp    L52
  nopw   0x0(%rax,%rax,1)
L81:
  mov    D56(%rip),%rdi
  lea    0xb(%rax),%esi
  mov    %esi,D33(%rip)
  call   <grealloc@plt>
  mov    %rax,D33(%rip)
  mov    %rax,%rbp
  test   %rax,%rax
  jne    L31
  xor    %eax,%eax
  jmp    L53
  nopl   0x0(%rax)
L67:
  mov    %rbp,%rax
  jmp    L55
```

assistant: ```c
char *canontoken(char *str) {
  static unsigned char *canon;
  static int allocated;
  unsigned char c, *p, *q;
  int len;
  p = (unsigned char *)str;
  len = strlen(str);
  if (len >= allocated) {
    allocated = len + 1 + 10;
    canon = grealloc(canon, allocated);
    if (!canon)
      return NULL;
  }
  q = (unsigned char *)canon;
  while ((c = *p++)) {
    if (isupper(c))
      c = tolower(c);
    *q++ = c;
  }
  *q = '\0';
  return (char *)canon;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<initbutton>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  movl   $0x10,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  not    %eax
  mov    %eax,%ecx
  mov    $0x5007,%eax
  mov    (%rax),%eax
  mov    $0x5007,%edx
  and    %ecx,%eax
  mov    %eax,(%rdx)
  mov    -0x4(%rbp),%ecx
  mov    $0x5008,%eax
  mov    (%rax),%eax
  mov    $0x5008,%edx
  or     %ecx,%eax
  mov    %eax,(%rdx)
  mov    -0x4(%rbp),%eax
  not    %eax
  mov    %eax,%ecx
  mov    $0x5009,%eax
  mov    (%rax),%eax
  mov    $0x5009,%edx
  and    %ecx,%eax
  mov    %eax,(%rdx)
  nop
  pop    %rbp
  ret
```

assistant: ```c
void initbutton() {
  uint8_t mask = (1 << 4);
  *(volatile uint8_t *)((0x5005 + 2)) &= ~mask;
  *(volatile uint8_t *)((0x5005 + 3)) |= mask;
  *(volatile uint8_t *)((0x5005 + 4)) &= ~mask;
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<initbutton>:
  endbr64
  movl   $0x10,-0x4(%rsp)
  mov    -0x4(%rsp),%eax
  mov    0x5007,%edx
  not    %eax
  and    %edx,%eax
  mov    %eax,0x5007
  mov    -0x4(%rsp),%edx
  mov    0x5008,%eax
  or     %edx,%eax
  mov    %eax,0x5008
  mov    -0x4(%rsp),%eax
  mov    0x5009,%edx
  not    %eax
  and    %edx,%eax
  mov    %eax,0x5009
  ret
```

assistant: ```c
void initbutton() {
  uint8_t mask = (1 << 4);
  *(volatile uint8_t *)((0x5005 + 2)) &= ~mask;
  *(volatile uint8_t *)((0x5005 + 3)) |= mask;
  *(volatile uint8_t *)((0x5005 + 4)) &= ~mask;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<initbutton>:
  endbr64
  movl   $0x10,-0x4(%rsp)
  mov    -0x4(%rsp),%eax
  mov    0x5007,%edx
  not    %eax
  and    %edx,%eax
  mov    %eax,0x5007
  mov    -0x4(%rsp),%edx
  mov    0x5008,%eax
  or     %edx,%eax
  mov    %eax,0x5008
  mov    -0x4(%rsp),%eax
  mov    0x5009,%edx
  not    %eax
  and    %edx,%eax
  mov    %eax,0x5009
  ret
```

assistant: ```c
void initbutton() {
  uint8_t mask = (1 << 4);
  *(volatile uint8_t *)((0x5005 + 2)) &= ~mask;
  *(volatile uint8_t *)((0x5005 + 3)) |= mask;
  *(volatile uint8_t *)((0x5005 + 4)) &= ~mask;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<XoMonochrome>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  movl   $0x0,-0x4(%rbp)
  jmp    L39
L23:
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    $0x7,%eax
  jle    L29
  mov    $0x0,%eax
  jmp    L8
L29:
  addl   $0x1,-0x4(%rbp)
L39:
  mov    -0x4(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jl     L23
  mov    $0x1,%eax
L8:
  pop    %rbp
  ret
```

assistant: ```c
int XoMonochrome(pdepthlist, numdepths)
int *pdepthlist;
int numdepths;
{
  int i;
  for (i = 0; i < numdepths; i++) {
    if (pdepthlist[i] >= 8)
      return (0);
  }
  return (1);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<XoMonochrome>:
  endbr64
  test   %esi,%esi
  jle    L1
  mov    %rdi,%rax
  lea    -0x1(%rsi),%edx
  lea    0x4(%rdi,%rdx,4),%rdx
L17:
  cmpl   $0x7,(%rax)
  jg     L20
  add    $0x4,%rax
  cmp    %rdx,%rax
  jne    L17
  mov    $0x1,%eax
  ret
L1:
  mov    $0x1,%eax
  ret
L20:
  mov    $0x0,%eax
  ret
```

assistant: ```c
int XoMonochrome(pdepthlist, numdepths)
int *pdepthlist;
int numdepths;
{
  int i;
  for (i = 0; i < numdepths; i++) {
    if (pdepthlist[i] >= 8)
      return (0);
  }
  return (1);
}
```
user: Translate the below assembly code into C programming language:

```asm
<XoMonochrome>:
  endbr64
  test   %esi,%esi
  jle    L32
  lea    -0x1(%rsi),%eax
  lea    0x4(%rdi,%rax,4),%rax
  jmp    L37
  nopw   0x0(%rax,%rax,1)
L3:
  add    $0x4,%rdi
  cmp    %rax,%rdi
  je     L32
L37:
  cmpl   $0x7,(%rdi)
  jle    L3
  xor    %eax,%eax
  ret
  nopl   0x0(%rax)
L32:
  mov    $0x1,%eax
  ret
```

assistant: ```c
int XoMonochrome(pdepthlist, numdepths)
int *pdepthlist;
int numdepths;
{
  int i;
  for (i = 0; i < numdepths; i++) {
    if (pdepthlist[i] >= 8)
      return (0);
  }
  return (1);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<XoMonochrome>:
  endbr64
  test   %esi,%esi
  jle    L3
  lea    -0x1(%rsi),%eax
  lea    0x4(%rdi,%rax,4),%rax
  jmp    L12
  nopw   0x0(%rax,%rax,1)
L9:
  add    $0x4,%rdi
  cmp    %rax,%rdi
  je     L3
L12:
  cmpl   $0x7,(%rdi)
  jle    L9
  xor    %eax,%eax
  ret
  nopl   0x0(%rax)
L3:
  mov    $0x1,%eax
  ret
```

assistant: ```c
int XoMonochrome(pdepthlist, numdepths)
int *pdepthlist;
int numdepths;
{
  int i;
  for (i = 0; i < numdepths; i++) {
    if (pdepthlist[i] >= 8)
      return (0);
  }
  return (1);
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<uwsgi_strnicmp>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    %esi,-0xc(%rbp)
  mov    %rdx,-0x18(%rbp)
  mov    %ecx,-0x10(%rbp)
  mov    -0xc(%rbp),%eax
  cmp    -0x10(%rbp),%eax
  je     L3
  mov    $0x1,%eax
  jmp    L9
L3:
  mov    -0x10(%rbp),%edx
  mov    -0x18(%rbp),%rcx
  mov    -0x8(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncasecmp@plt>
L9:
  leave
  ret
```

assistant: ```c
int uwsgi_strnicmp(char *src, int slen, char *dst, int dlen) {
  if (slen != dlen)
    return 1;
  return strncasecmp(src, dst, dlen);
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<uwsgi_strnicmp>:
  endbr64
  mov    $0x1,%eax
  cmp    %ecx,%esi
  je     L0
  ret
L0:
  sub    $0x8,%rsp
  mov    %rdx,%rsi
  mov    %ecx,%edx
  call   <strncasecmp@plt>
  add    $0x8,%rsp
  ret
```

assistant: ```c
int uwsgi_strnicmp(char *src, int slen, char *dst, int dlen) {
  if (slen != dlen)
    return 1;
  return strncasecmp(src, dst, dlen);
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<uwsgi_strnicmp>:
  endbr64
  mov    %esi,%r8d
  mov    %rdx,%rsi
  cmp    %ecx,%r8d
  je     L4
  mov    $0x1,%eax
  ret
  nopl   (%rax)
L4:
  mov    %r8d,%edx
  jmp    1050 <strncasecmp@plt>
```

assistant: ```c
int uwsgi_strnicmp(char *src, int slen, char *dst, int dlen) {
  if (slen != dlen)
    return 1;
  return strncasecmp(src, dst, dlen);
}
```
user: Translate the below assembly code into C programming language:

```asm
<uwsgi_strnicmp>:
  endbr64
  mov    %esi,%r8d
  mov    %rdx,%rsi
  cmp    %ecx,%r8d
  je     L9
  mov    $0x1,%eax
  ret
  nopl   (%rax)
L9:
  mov    %r8d,%edx
  jmp    1050 <strncasecmp@plt>
```

assistant: ```c
int uwsgi_strnicmp(char *src, int slen, char *dst, int dlen) {
  if (slen != dlen)
    return 1;
  return strncasecmp(src, dst, dlen);
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<ArdBir>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    $0x1,%esi
  mov    $0x2,%edi
  call   <Presentazione@plt>
  mov    $0x1,%esi
  mov    $0x6,%edi
  call   <ArdBir1@plt>
  nop
  pop    %rbp
  ret
```

assistant: ```c
void ArdBir() {
  Presentazione(2, 1);
  ArdBir1(6, 1);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<ArdBir>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x1,%esi
  mov    $0x2,%edi
  call   <Presentazione@plt>
  mov    $0x1,%esi
  mov    $0x6,%edi
  call   <ArdBir1@plt>
  add    $0x8,%rsp
  ret
```

assistant: ```c
void ArdBir() {
  Presentazione(2, 1);
  ArdBir1(6, 1);
}
```
user: What is the c source code of the assembly code below:

```asm
<ArdBir>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x1,%esi
  mov    $0x2,%edi
  call   <Presentazione@plt>
  mov    $0x1,%esi
  mov    $0x6,%edi
  add    $0x8,%rsp
  jmp    1070 <ArdBir1@plt>
```

assistant: ```c
void ArdBir() {
  Presentazione(2, 1);
  ArdBir1(6, 1);
}
```
user: Translate the below assembly code into C programming language:

```asm
<ArdBir>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x1,%esi
  mov    $0x2,%edi
  call   <Presentazione@plt>
  mov    $0x1,%esi
  mov    $0x6,%edi
  add    $0x8,%rsp
  jmp    1070 <ArdBir1@plt>
```

assistant: ```c
void ArdBir() {
  Presentazione(2, 1);
  ArdBir1(6, 1);
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<sem_twait>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    D7(%rip),%rax
  mov    (%rax),%eax
  lea    -0xc(%rbp),%rdx
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <clock_gettime@plt>
  mov    -0xc(%rbp),%edx
  mov    -0x1c(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0xc(%rbp)
  lea    -0xc(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <sem_timedwait@plt>
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L1
  call   <__stack_chk_fail@plt>
L1:
  leave
  ret
```

assistant: ```c
int sem_twait(sem_t *sem, int t) {
  struct timespec ts;
  clock_gettime(CLOCK_REALTIME, &ts);
  ts.tv_sec += t;
  return (sem_timedwait(sem, &ts));
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<sem_twait>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x10,%rsp
  mov    %rdi,%rbx
  mov    %esi,%ebp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    0x4(%rsp),%r12
  mov    %r12,%rsi
  mov    D4(%rip),%rax
  mov    (%rax),%edi
  call   <clock_gettime@plt>
  add    %ebp,0x4(%rsp)
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <sem_timedwait@plt>
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L7
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L7:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int sem_twait(sem_t *sem, int t) {
  struct timespec ts;
  clock_gettime(CLOCK_REALTIME, &ts);
  ts.tv_sec += t;
  return (sem_timedwait(sem, &ts));
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<sem_twait>:
  endbr64
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %esi,%ebx
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    D8(%rip),%rax
  lea    0x4(%rsp),%r12
  mov    %r12,%rsi
  mov    (%rax),%edi
  call   <clock_gettime@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  add    %ebx,0x4(%rsp)
  call   <sem_timedwait@plt>
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L8
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L8:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int sem_twait(sem_t *sem, int t) {
  struct timespec ts;
  clock_gettime(CLOCK_REALTIME, &ts);
  ts.tv_sec += t;
  return (sem_timedwait(sem, &ts));
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<sem_twait>:
  endbr64
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %esi,%ebx
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    D4(%rip),%rax
  lea    0x4(%rsp),%r12
  mov    %r12,%rsi
  mov    (%rax),%edi
  call   <clock_gettime@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  add    %ebx,0x4(%rsp)
  call   <sem_timedwait@plt>
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L1
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L1:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int sem_twait(sem_t *sem, int t) {
  struct timespec ts;
  clock_gettime(CLOCK_REALTIME, &ts);
  ts.tv_sec += t;
  return (sem_timedwait(sem, &ts));
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<spotrebaZaDen>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %edi,%r15d
  mov    %esi,%r14d
  cmp    $0x1,%edx
  je     L46
  mov    $0x0,%r12d
  cmp    $0x3b,%esi
  jg     L111
L35:
  mov    $0x0,%esi
  mov    %r15d,%edi
  call   <pocetSegmentu@plt>
  mov    %eax,%ebx
  mov    $0x1,%esi
  mov    %r14d,%edi
  call   <pocetSegmentu@plt>
  add    %eax,%ebx
  imul   $0x3c,%ebx,%ebx
  lea    0x234(%r12,%rbx,1),%r12d
  add    $0x1,%r14d
  cmp    $0x3c,%r14d
  jne    L35
L111:
  add    $0x1,%r15d
  cmp    $0x17,%r15d
  jg     L75
L19:
  mov    $0x0,%ebp
L102:
  mov    $0x0,%esi
  mov    %r15d,%edi
  call   <pocetSegmentu@plt>
  mov    %eax,%ebx
  mov    $0x1,%esi
  mov    %ebp,%edi
  call   <pocetSegmentu@plt>
  add    %eax,%ebx
  imul   $0x3c,%ebx,%ebx
  lea    0x234(%r12,%rbx,1),%r12d
  add    $0x1,%ebp
  cmp    $0x3c,%ebp
  jne    L102
  add    $0x1,%r15d
  cmp    $0x18,%r15d
  jne    L19
L75:
  mov    %r12d,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L46:
  mov    $0x0,%r12d
  mov    $0x0,%r13d
  test   %edi,%edi
  jle    L103
L18:
  mov    $0x0,%ebp
L114:
  mov    $0x0,%esi
  mov    %r13d,%edi
  call   <pocetSegmentu@plt>
  mov    %eax,%ebx
  mov    $0x1,%esi
  mov    %ebp,%edi
  call   <pocetSegmentu@plt>
  add    %eax,%ebx
  imul   $0x3c,%ebx,%ebx
  lea    0x234(%r12,%rbx,1),%r12d
  add    $0x1,%ebp
  cmp    $0x3c,%ebp
  jne    L114
  add    $0x1,%r13d
  cmp    %r13d,%r15d
  jne    L18
L103:
  test   %r14d,%r14d
  js     L75
  mov    $0x0,%ebp
L106:
  mov    $0x0,%esi
  mov    %r15d,%edi
  call   <pocetSegmentu@plt>
  mov    %eax,%ebx
  mov    $0x1,%esi
  mov    %ebp,%edi
  call   <pocetSegmentu@plt>
  add    %ebx,%eax
  imul   $0x3c,%eax,%eax
  lea    0x234(%r12,%rax,1),%r12d
  add    $0x1,%ebp
  cmp    %ebp,%r14d
  jge    L106
  jmp    L75
```

assistant: ```c
int spotrebaZaDen(int h, int m, int od) {
  int spotrebaZaMin = 564;
  int min = 0, hod = 0;
  int spotreba = 0;
  if (od == 1) {
    for (hod = 0; hod < h; hod++) {
      for (min = 0; min < 60; min++) {
        spotreba += pocetSegmentu(hod, 0) * 60 + pocetSegmentu(min, 1) * 60 + spotrebaZaMin;
      }
    }
    for (min = 0; min <= m; min++) {
      spotreba += pocetSegmentu(h, 0) * 60 + pocetSegmentu(min, 1) * 60 + spotrebaZaMin;
    }
  } else {
    for (min = m; min < 60; min++) {
      spotreba += pocetSegmentu(h, 0) * 60 + pocetSegmentu(min, 1) * 60 + spotrebaZaMin;
    }
    for (hod = h + 1; hod < 24; hod++) {
      for (min = 0; min < 60; min++) {
        spotreba += pocetSegmentu(hod, 0) * 60 + pocetSegmentu(min, 1) * 60 + spotrebaZaMin;
      }
    }
  }
  return spotreba;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<spotrebaZaDen>:
  endbr64
  push   %r15
  push   %r14
  mov    %edi,%r14d
  push   %r13
  xor    %r13d,%r13d
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  cmp    $0x1,%edx
  je     L85
  cmp    $0x3b,%esi
  jg     L63
  nopl   0x0(%rax)
L116:
  xor    %esi,%esi
  mov    %r14d,%edi
  call   <pocetSegmentu@plt>
  mov    %r12d,%edi
  mov    $0x1,%esi
  add    $0x1,%r12d
  mov    %eax,%ebx
  call   <pocetSegmentu@plt>
  add    %eax,%ebx
  imul   $0x3c,%ebx,%ebx
  lea    0x234(%r13,%rbx,1),%r13d
  cmp    $0x3c,%r12d
  jne    L116
L63:
  add    $0x1,%r14d
  cmp    $0x17,%r14d
  jg     L14
  nopw   0x0(%rax,%rax,1)
L99:
  xor    %ebp,%ebp
  nopw   0x0(%rax,%rax,1)
L55:
  xor    %esi,%esi
  mov    %r14d,%edi
  call   <pocetSegmentu@plt>
  mov    %ebp,%edi
  mov    $0x1,%esi
  add    $0x1,%ebp
  mov    %eax,%ebx
  call   <pocetSegmentu@plt>
  add    %eax,%ebx
  imul   $0x3c,%ebx,%ebx
  lea    0x234(%r13,%rbx,1),%r13d
  cmp    $0x3c,%ebp
  jne    L55
  add    $0x1,%r14d
  cmp    $0x18,%r14d
  jne    L99
L14:
  add    $0x8,%rsp
  mov    %r13d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L85:
  test   %edi,%edi
  jle    L6
  xor    %ebp,%ebp
L66:
  xor    %r15d,%r15d
  nopw   0x0(%rax,%rax,1)
L80:
  xor    %esi,%esi
  mov    %ebp,%edi
  call   <pocetSegmentu@plt>
  mov    %r15d,%edi
  mov    $0x1,%esi
  add    $0x1,%r15d
  mov    %eax,%ebx
  call   <pocetSegmentu@plt>
  add    %eax,%ebx
  imul   $0x3c,%ebx,%ebx
  lea    0x234(%r13,%rbx,1),%r13d
  cmp    $0x3c,%r15d
  jne    L80
  add    $0x1,%ebp
  cmp    %ebp,%r14d
  jne    L66
L6:
  test   %r12d,%r12d
  js     L14
  xor    %ebp,%ebp
L3:
  xor    %esi,%esi
  mov    %r14d,%edi
  call   <pocetSegmentu@plt>
  mov    %ebp,%edi
  mov    $0x1,%esi
  add    $0x1,%ebp
  mov    %eax,%ebx
  call   <pocetSegmentu@plt>
  add    %ebx,%eax
  imul   $0x3c,%eax,%eax
  lea    0x234(%r13,%rax,1),%r13d
  cmp    %ebp,%r12d
  jge    L3
  jmp    L14
```

assistant: ```c
int spotrebaZaDen(int h, int m, int od) {
  int spotrebaZaMin = 564;
  int min = 0, hod = 0;
  int spotreba = 0;
  if (od == 1) {
    for (hod = 0; hod < h; hod++) {
      for (min = 0; min < 60; min++) {
        spotreba += pocetSegmentu(hod, 0) * 60 + pocetSegmentu(min, 1) * 60 + spotrebaZaMin;
      }
    }
    for (min = 0; min <= m; min++) {
      spotreba += pocetSegmentu(h, 0) * 60 + pocetSegmentu(min, 1) * 60 + spotrebaZaMin;
    }
  } else {
    for (min = m; min < 60; min++) {
      spotreba += pocetSegmentu(h, 0) * 60 + pocetSegmentu(min, 1) * 60 + spotrebaZaMin;
    }
    for (hod = h + 1; hod < 24; hod++) {
      for (min = 0; min < 60; min++) {
        spotreba += pocetSegmentu(hod, 0) * 60 + pocetSegmentu(min, 1) * 60 + spotrebaZaMin;
      }
    }
  }
  return spotreba;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<spotrebaZaDen>:
  endbr64
  push   %r15
  push   %r14
  mov    %edi,%r14d
  push   %r13
  xor    %r13d,%r13d
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  cmp    $0x1,%edx
  je     L89
  cmp    $0x3b,%esi
  jg     L115
  nopl   0x0(%rax)
L37:
  xor    %esi,%esi
  mov    %r14d,%edi
  call   <pocetSegmentu@plt>
  mov    %r12d,%edi
  mov    $0x1,%esi
  add    $0x1,%r12d
  mov    %eax,%ebx
  call   <pocetSegmentu@plt>
  add    %eax,%ebx
  imul   $0x3c,%ebx,%ebx
  lea    0x234(%r13,%rbx,1),%r13d
  cmp    $0x3c,%r12d
  jne    L37
L115:
  add    $0x1,%r14d
  cmp    $0x17,%r14d
  jg     L38
  nopw   0x0(%rax,%rax,1)
L33:
  xor    %ebp,%ebp
  nopw   0x0(%rax,%rax,1)
L98:
  xor    %esi,%esi
  mov    %r14d,%edi
  call   <pocetSegmentu@plt>
  mov    %ebp,%edi
  mov    $0x1,%esi
  add    $0x1,%ebp
  mov    %eax,%ebx
  call   <pocetSegmentu@plt>
  add    %eax,%ebx
  imul   $0x3c,%ebx,%ebx
  lea    0x234(%r13,%rbx,1),%r13d
  cmp    $0x3c,%ebp
  jne    L98
  add    $0x1,%r14d
  cmp    $0x18,%r14d
  jne    L33
L38:
  add    $0x8,%rsp
  mov    %r13d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L89:
  test   %edi,%edi
  jle    L107
  xor    %ebp,%ebp
L114:
  xor    %r15d,%r15d
  nopw   0x0(%rax,%rax,1)
L8:
  xor    %esi,%esi
  mov    %ebp,%edi
  call   <pocetSegmentu@plt>
  mov    %r15d,%edi
  mov    $0x1,%esi
  add    $0x1,%r15d
  mov    %eax,%ebx
  call   <pocetSegmentu@plt>
  add    %eax,%ebx
  imul   $0x3c,%ebx,%ebx
  lea    0x234(%r13,%rbx,1),%r13d
  cmp    $0x3c,%r15d
  jne    L8
  add    $0x1,%ebp
  cmp    %ebp,%r14d
  jne    L114
L107:
  test   %r12d,%r12d
  js     L38
  xor    %ebp,%ebp
L41:
  xor    %esi,%esi
  mov    %r14d,%edi
  call   <pocetSegmentu@plt>
  mov    %ebp,%edi
  mov    $0x1,%esi
  add    $0x1,%ebp
  mov    %eax,%ebx
  call   <pocetSegmentu@plt>
  add    %ebx,%eax
  imul   $0x3c,%eax,%eax
  lea    0x234(%r13,%rax,1),%r13d
  cmp    %ebp,%r12d
  jge    L41
  jmp    L38
```

assistant: ```c
int spotrebaZaDen(int h, int m, int od) {
  int spotrebaZaMin = 564;
  int min = 0, hod = 0;
  int spotreba = 0;
  if (od == 1) {
    for (hod = 0; hod < h; hod++) {
      for (min = 0; min < 60; min++) {
        spotreba += pocetSegmentu(hod, 0) * 60 + pocetSegmentu(min, 1) * 60 + spotrebaZaMin;
      }
    }
    for (min = 0; min <= m; min++) {
      spotreba += pocetSegmentu(h, 0) * 60 + pocetSegmentu(min, 1) * 60 + spotrebaZaMin;
    }
  } else {
    for (min = m; min < 60; min++) {
      spotreba += pocetSegmentu(h, 0) * 60 + pocetSegmentu(min, 1) * 60 + spotrebaZaMin;
    }
    for (hod = h + 1; hod < 24; hod++) {
      for (min = 0; min < 60; min++) {
        spotreba += pocetSegmentu(hod, 0) * 60 + pocetSegmentu(min, 1) * 60 + spotrebaZaMin;
      }
    }
  }
  return spotreba;
}
```