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

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x30,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  cmp    $0x1,%edi
  jle    L131
  lea    -0x2(%rdi),%edx
  lea    0x8(%rsi),%rax
  xor    %ebp,%ebp
  xor    %ebx,%ebx
  lea    0x10(%rsi,%rdx,8),%rsi
  mov    $0x1,%edi
  xchg   %ax,%ax
L105:
  mov    (%rax),%rdx
  movzbl (%rdx),%ecx
  cmp    $0x2d,%ecx
  jne    L60
  cmpb   $0x62,0x1(%rdx)
  jne    L66
  cmpb   $0x0,0x2(%rdx)
  cmove  %edi,%ebx
L66:
  cmp    $0x2d,%ecx
  jne    L60
  cmpb   $0x66,0x1(%rdx)
  jne    L60
  cmpb   $0x0,0x2(%rdx)
  cmove  %edi,%ebp
L60:
  add    $0x8,%rax
  cmp    %rsi,%rax
  jne    L105
L96:
  mov    $0x190,%esi
  mov    $0x190,%edi
  xor    %eax,%eax
  call   <prefsize@plt>
  lea    D89(%rip),%rdi
  xor    %eax,%eax
  lea    0x26(%rsp),%r12
  call   <vinit@plt>
  lea    D90(%rip),%rdi
  xor    %eax,%eax
  call   <winopen@plt>
  mov    $0x1b,%edi
  xor    %eax,%eax
  call   <qdevice@plt>
  mov    $0x51,%edi
  xor    %eax,%eax
  call   <qdevice@plt>
  mov    $0x106,%edi
  xor    %eax,%eax
  call   <unqdevice@plt>
  nopl   0x0(%rax)
L58:
  xor    %eax,%eax
  mov    %r12,%rdi
  call   <qread@plt>
  cmp    $0x105,%eax
  jne    L58
  xor    %eax,%eax
  call   <doublebuffer@plt>
  xor    %eax,%eax
  call   <gconfig@plt>
  xor    %edi,%edi
  xor    %eax,%eax
  call   <polymode@plt>
  test   %ebp,%ebp
  jne    L9
L17:
  test   %ebx,%ebx
  jne    L50
L100:
  mov    $0x190,%edi
  mov    $0x3,%eax
  lea    0x18(%rsp),%r12
  movsd  D62(%rip),%xmm2
  movsd  D91(%rip),%xmm1
  movsd  D34(%rip),%xmm0
  lea    0x10(%rsp),%rbp
  call   <perspective@plt>
  pxor   %xmm5,%xmm5
  xor    %edi,%edi
  mov    $0x6,%eax
  movsd  D25(%rip),%xmm2
  movapd %xmm5,%xmm4
  movapd %xmm5,%xmm3
  movapd %xmm5,%xmm1
  movapd %xmm5,%xmm0
  call   <lookat@plt>
  xor    %eax,%eax
  call   <maketetra@plt>
  movss  D13(%rip),%xmm5
  movd   %xmm5,%r14d
  pxor   %xmm5,%xmm5
  movd   %xmm5,%r15d
L54:
  xor    %ebx,%ebx
  jmp    L99
  nopw   0x0(%rax,%rax,1)
L74:
  add    $0x2,%ebx
  cmp    $0xe10,%ebx
  je     L54
L99:
  xor    %edi,%edi
  xor    %eax,%eax
  call   <color@plt>
  xor    %eax,%eax
  call   <clear@plt>
  mov    $0x78,%esi
  mov    $0x2,%edi
  xor    %eax,%eax
  call   <rotate@plt>
  mov    $0x7a,%esi
  mov    $0x2,%edi
  xor    %eax,%eax
  call   <rotate@plt>
  mov    $0x1,%edi
  xor    %eax,%eax
  call   <color@plt>
  xor    %eax,%eax
  call   <pushmatrix@plt>
  mov    $0x78,%esi
  mov    $0x384,%edi
  xor    %eax,%eax
  call   <rotate@plt>
  mov    D94(%rip),%rax
  pxor   %xmm6,%xmm6
  movapd %xmm6,%xmm1
  movapd %xmm6,%xmm0
  movq   %rax,%xmm2
  mov    $0x3,%eax
  call   <circ@plt>
  xor    %eax,%eax
  call   <popmatrix@plt>
  mov    $0x4,%edi
  xor    %eax,%eax
  call   <color@plt>
  pxor   %xmm6,%xmm6
  mov    $0x3,%eax
  movapd %xmm6,%xmm2
  movapd %xmm6,%xmm1
  movapd %xmm6,%xmm0
  call   <move@plt>
  pxor   %xmm6,%xmm6
  movd   %r14d,%xmm7
  movd   %r15d,%xmm5
  movapd %xmm6,%xmm1
  pxor   %xmm2,%xmm2
  pxor   %xmm0,%xmm0
  mov    $0x3,%eax
  cvtss2sd %xmm7,%xmm2
  cvtss2sd %xmm5,%xmm0
  movsd  %xmm2,0x8(%rsp)
  movsd  %xmm0,(%rsp)
  call   <draw@plt>
  xor    %eax,%eax
  call   <pushmatrix@plt>
  pxor   %xmm6,%xmm6
  movsd  0x8(%rsp),%xmm2
  movsd  (%rsp),%xmm0
  movapd %xmm6,%xmm1
  mov    $0x3,%eax
  call   <translate@plt>
  mov    $0x78,%esi
  mov    %ebx,%edi
  xor    %eax,%eax
  call   <rotate@plt>
  mov    $0x79,%esi
  mov    %ebx,%edi
  xor    %eax,%eax
  call   <rotate@plt>
  mov    $0x7a,%esi
  mov    %ebx,%edi
  xor    %eax,%eax
  call   <rotate@plt>
  mov    D46(%rip),%rax
  movq   %rax,%xmm2
  movq   %rax,%xmm1
  movq   %rax,%xmm0
  mov    $0x3,%eax
  call   <scale@plt>
  xor    %eax,%eax
  mov    $0x1,%edi
  call   <callobj@plt>
  xor    %eax,%eax
  call   <popmatrix@plt>
  pxor   %xmm0,%xmm0
  mov    %rbp,%rsi
  mov    %r12,%rdi
  cvtsi2sd %ebx,%xmm0
  mulsd  D19(%rip),%xmm0
  divsd  D43(%rip),%xmm0
  call   <sincos@plt>
  xor    %eax,%eax
  movsd  D94(%rip),%xmm2
  movsd  D94(%rip),%xmm0
  mulsd  0x10(%rsp),%xmm2
  pxor   %xmm7,%xmm7
  pxor   %xmm4,%xmm4
  mulsd  0x18(%rsp),%xmm0
  cvtsd2ss %xmm2,%xmm7
  movd   %xmm7,%r14d
  cvtsd2ss %xmm0,%xmm4
  movd   %xmm4,%r15d
  call   <swapbuffers@plt>
  xor    %eax,%eax
  call   <qtest@plt>
  test   %eax,%eax
  je     L74
  xor    %eax,%eax
  call   <gexit@plt>
  xor    %edi,%edi
  call   <exit@plt>
L9:
  mov    $0x1,%edi
  xor    %eax,%eax
  call   <polymode@plt>
  jmp    L17
L50:
  mov    $0x1,%edi
  xor    %eax,%eax
  call   <backface@plt>
  jmp    L100
L131:
  xor    %ebp,%ebp
  xor    %ebx,%ebx
  jmp    L96
```

tool_calls: name: disassemble_data
arguments: tag: D89
datatype: string
name: disassemble_data
arguments: tag: D90
datatype: string
name: disassemble_data
arguments: tag: D62
datatype: f64
name: disassemble_data
arguments: tag: D91
datatype: f64
name: disassemble_data
arguments: tag: D34
datatype: f64
name: disassemble_data
arguments: tag: D25
datatype: f64
name: disassemble_data
arguments: tag: D13
datatype: f32
name: disassemble_data
arguments: tag: D94
datatype: byte[8]
name: disassemble_data
arguments: tag: D46
datatype: f64
name: disassemble_data
arguments: tag: D19
datatype: f64
name: disassemble_data
arguments: tag: D43
datatype: f32[2]

tool: D89: mswin

tool: D90: tetra

tool: D62: 15

tool: D91: 0.001

tool: D34: 1

tool: D25: 5

tool: D13: 1.6

tool: {"D94": [0x00,0x00,0x00,0xa0,0x99,0x99,0xf9,0x3f]}

tool: D46: 0.4

tool: D19: 3.1415926535

tool: {"D43": [0.0,3.6015625]}

assistant: ```c
main(argc, argv) int argc;
char **argv;
{
  char dev[20];
  int i, but;
  int rotval = 0, drotval = 2;
  float R = 1.6, tx = 0.0, tz = R, zeye = 5.0;
  int do_backface = 0;
  int do_fill = 0;
  short val;
  for (i = 1; i < argc; i++) {
    if (!strcmp(argv[i], "-b"))
      do_backface = 1;
    if (!strcmp(argv[i], "-f"))
      do_fill = 1;
  }
  prefsize(400L, 400L);
  vinit("mswin");
  winopen("tetra");
  qdevice('\033');
  qdevice('Q');
  unqdevice(262);
  while (qread(&val) != 261)
    ;
  doublebuffer();
  gconfig();
  polymode(0);
  if (do_fill)
    polymode(1);
  if (do_backface)
    backface(1);
  perspective(400, 1.0, 0.001, 15.0);
  lookat(0.0, 0.0, zeye, 0.0, 0.0, 0.0, 0);
  maketetra();
  do {
    for (rotval = 0; rotval < 3600; rotval += drotval) {
      color(0);
      clear();
      rotate(drotval, 'x');
      rotate(drotval, 'z');
      color(1);
      pushmatrix();
      rotate(900, 'x');
      circ(0.0, 0.0, R);
      popmatrix();
      color(4);
      move(0.0, 0.0, 0.0);
      draw(tx, 0.0, tz);
      pushmatrix();
      translate(tx, 0.0, tz);
      rotate(rotval, 'x');
      rotate(rotval, 'y');
      rotate(rotval, 'z');
      scale(0.4, 0.4, 0.4);
      callobj(1L);
      popmatrix();
      tz = R * cos((double)(rotval * 3.1415926535 / 180));
      tx = R * sin((double)(rotval * 3.1415926535 / 180));
      swapbuffers();
      if (qtest()) {
        gexit();
        exit(0);
      }
    }
  } while (1);
}
```