user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    0x4(%rsp),%rsi
  lea    D5(%rip),%rdi
  call   <scanf@plt>
  mov    0x4(%rsp),%edx
  cmp    $0x2,%edx
  jle    L9
  mov    $0x0,%r12d
  mov    $0x0,%esi
  mov    $0x1,%eax
  jmp    L237
L9:
  mov    $0x30,%edi
  call   <putchar@plt>
  jmp    L163
L44:
  jle    L258
  add    $0x2,%r12d
L258:
  add    %r12d,%esi
  add    $0x1,%eax
  cmp    %eax,%edx
  je     L101
L237:
  cmp    $0x1,%eax
  je     L183
  cmp    $0x2,%eax
  jne    L44
  mov    $0x1,%r12d
  jmp    L258
L183:
  mov    $0x0,%r12d
  jmp    L258
L101:
  lea    D3(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L163:
  cmpl   $0x0,0x4(%rsp)
  jle    L270
  mov    $0x1,%ebx
  lea    D18(%rip),%r13
  jmp    L197
L109:
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    $0x0,%ebp
L172:
  mov    $0x20,%edi
  call   <putchar@plt>
  add    $0x1,%ebp
  mov    0x4(%rsp),%eax
  sub    $0x1,%eax
  cmp    %ebp,%eax
  jne    L172
  mov    $0x2a,%edi
  call   <putchar@plt>
  jmp    L246
L171:
  cmpl   $0x2,0x4(%rsp)
  jne    L265
  mov    $0x2a,%esi
  mov    %r13,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x2a,%edi
  call   <putchar@plt>
  mov    $0x2a,%edi
  call   <putchar@plt>
  jmp    L246
L265:
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    $0x0,%ebp
L271:
  mov    $0x20,%edi
  call   <putchar@plt>
  add    $0x1,%ebp
  mov    0x4(%rsp),%eax
  sub    $0x2,%eax
  cmp    %ebp,%eax
  jne    L271
  mov    $0x2a,%edi
  call   <putchar@plt>
  mov    $0x23,%edi
  call   <putchar@plt>
  mov    $0x2a,%edi
  call   <putchar@plt>
  jmp    L246
L8:
  mov    $0x2a,%edi
  call   <putchar@plt>
L246:
  add    $0x1,%ebx
  cmp    %ebx,0x4(%rsp)
  jl     L270
L197:
  cmp    $0x1,%ebx
  je     L109
  cmp    $0x2,%ebx
  je     L171
  jle    L246
  cmp    %ebx,0x4(%rsp)
  je     L268
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    $0x0,%ebp
L132:
  mov    $0x20,%edi
  call   <putchar@plt>
  add    $0x1,%ebp
  mov    0x4(%rsp),%eax
  sub    %ebx,%eax
  cmp    %ebp,%eax
  jne    L132
  mov    $0x2a,%edi
  call   <putchar@plt>
  mov    $0x23,%edi
  call   <putchar@plt>
  mov    $0x23,%edi
  call   <putchar@plt>
  mov    $0x23,%edi
  call   <putchar@plt>
  cmp    $0x3,%ebx
  je     L8
  mov    $0x3,%ebp
L51:
  mov    $0x23,%edi
  call   <putchar@plt>
  mov    $0x23,%edi
  call   <putchar@plt>
  add    $0x1,%ebp
  cmp    %ebx,%ebp
  jl     L51
  jmp    L8
L268:
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    $0x0,%ebp
  lea    0x4(%r12),%r14d
L57:
  mov    $0x2a,%edi
  call   <putchar@plt>
  add    $0x1,%ebp
  cmp    %ebp,%r14d
  jne    L57
  jmp    L246
L270:
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L251
  mov    $0x0,%eax
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L251:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: label: D5
type: string
name: unpack_data
arguments: label: D3
type: string
name: unpack_data
arguments: label: D18
type: string

tool: D5: %d

tool: D3: 
%d

tool: D18: 
%c

assistant: ```c
int main() {
  int h, x, s, n, i;
  char a, b;
  a = '*';
  b = '#';
  scanf("%d", &h);
  if (h < 3)
    printf("0");
  else {
    n = 0;
    s = 0;
    for (x = 1; x < h; x++) {
      if (x == 1) {
        n = 0;
        i = 1;
      }
      if (x == 2) {
        n = 1;
        i = 2;
      }
      if (x > 2) {
        n = n + 2;
        i = 2;
      }
      s = s + n;
    }
    printf("\n%d", s);
  }
  for (x = 1; x <= h; x++) {
    if (x == 1) {
      printf("\n");
      i = 0;
      do {
        printf(" ");
        i++;
      } while (i != h - 1);
      printf("%c", a);
    }
    if (x == 2) {
      if (x != h) {
        printf("\n");
        i = 0;
        do {
          printf(" ");
          i++;
        } while (i != h - 2);
        printf("%c", a);
        printf("%c", b);
        printf("%c", a);
      } else {
        printf("\n%c", a);
        printf("%c", a);
        printf("%c", a);
      }
    }
    if (x > 2) {
      if (x != h) {
        printf("\n");
        i = 0;
        do {
          printf(" ");
          i++;
        } while (i != h - x);
        printf("%c", a);
        i = 3;
        printf("%c", b);
        printf("%c", b);
        printf("%c", b);
        if (i != x) {
          while (i < x) {
            printf("%c", b);
            printf("%c", b);
            i = i + 1;
          }
        }
        printf("%c", a);
      } else {
        printf("\n");
        i = 0;
        do {
          printf("%c", a);
          i++;
        } while (i != n + 4);
      }
    }
  }
}
```