user: Translate the below assembly code into C programming language:

```asm
<halfsphere>:
  endbr64
  push   %r14
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x58,%rsp
  movss  %xmm0,0x44(%rsp)
  test   %edi,%edi
  jle    L10
  xor    %ebp,%ebp
  pxor   %xmm7,%xmm7
  pxor   %xmm6,%xmm6
  mov    %edi,%ebx
  cvtsi2ss %ebp,%xmm7
  cvtsi2ss %edi,%xmm6
  movd   %xmm7,%r14d
  movaps %xmm0,%xmm7
  mulss  %xmm0,%xmm7
  movss  %xmm6,0x48(%rsp)
  movss  %xmm7,0x4c(%rsp)
  pxor   %xmm7,%xmm7
  cvtss2sd %xmm6,%xmm7
  movsd  %xmm7,0x38(%rsp)
  cs nopw 0x0(%rax,%rax,1)
L3:
  movd   %r14d,%xmm0
  divss  0x48(%rsp),%xmm0
  cvtss2sd %xmm0,%xmm0
  add    $0x1,%ebp
  subsd  D59(%rip),%xmm0
  mulsd  D5(%rip),%xmm0
  xor    %r12d,%r12d
  cvtsd2ss %xmm0,%xmm0
  call   <sin@plt>
  mulss  0x44(%rsp),%xmm0
  pxor   %xmm7,%xmm7
  cvtsi2ss %ebp,%xmm7
  movss  %xmm0,0x34(%rsp)
  pxor   %xmm0,%xmm0
  movd   %xmm7,%r14d
  divss  0x48(%rsp),%xmm7
  cvtss2sd %xmm7,%xmm0
  subsd  D59(%rip),%xmm0
  mulsd  D5(%rip),%xmm0
  cvtsd2ss %xmm0,%xmm0
  call   <sin@plt>
  movss  0x44(%rsp),%xmm7
  mulss  %xmm0,%xmm7
  movss  0x34(%rsp),%xmm0
  movaps %xmm0,%xmm1
  mulss  %xmm0,%xmm1
  movss  0x4c(%rsp),%xmm0
  movss  %xmm7,0x40(%rsp)
  subss  %xmm1,%xmm0
  call   <sqrt@plt>
  movss  0x40(%rsp),%xmm7
  movss  %xmm0,0xc(%rsp)
  movss  0x4c(%rsp),%xmm0
  movaps %xmm7,%xmm1
  mulss  %xmm7,%xmm1
  subss  %xmm1,%xmm0
  call   <sqrt@plt>
  pxor   %xmm8,%xmm8
  cvtsi2ss %r12d,%xmm8
  movss  %xmm0,0x10(%rsp)
  nopl   0x0(%rax)
L24:
  pxor   %xmm1,%xmm1
  pxor   %xmm0,%xmm0
  pxor   %xmm6,%xmm6
  add    $0x1,%r12d
  cvtss2sd %xmm8,%xmm1
  pxor   %xmm8,%xmm8
  movsd  0x38(%rsp),%xmm5
  cvtsi2ss %r12d,%xmm8
  mulsd  D5(%rip),%xmm1
  cvtss2sd %xmm8,%xmm0
  mulsd  D5(%rip),%xmm0
  movss  %xmm8,0x30(%rsp)
  divsd  %xmm5,%xmm1
  divsd  %xmm5,%xmm0
  addsd  D54(%rip),%xmm1
  cvtsd2ss %xmm1,%xmm1
  movss  %xmm1,0x14(%rsp)
  addsd  D54(%rip),%xmm0
  cvtsd2ss %xmm0,%xmm6
  movaps %xmm1,%xmm0
  movss  %xmm6,0x8(%rsp)
  call   <sin@plt>
  movss  0x10(%rsp),%xmm9
  movss  0x14(%rsp),%xmm1
  mulss  %xmm0,%xmm9
  movaps %xmm1,%xmm0
  movss  %xmm9,0x2c(%rsp)
  call   <cos@plt>
  movss  0x10(%rsp),%xmm7
  mulss  %xmm0,%xmm7
  movss  0x8(%rsp),%xmm0
  movss  %xmm7,0x28(%rsp)
  call   <sin@plt>
  movss  0x10(%rsp),%xmm4
  mulss  %xmm0,%xmm4
  movss  0x8(%rsp),%xmm0
  movss  %xmm4,0x24(%rsp)
  call   <cos@plt>
  movss  0x10(%rsp),%xmm6
  mulss  %xmm0,%xmm6
  movss  0x8(%rsp),%xmm0
  movss  %xmm6,0x20(%rsp)
  call   <sin@plt>
  movss  0xc(%rsp),%xmm5
  mulss  %xmm0,%xmm5
  movss  0x8(%rsp),%xmm0
  movss  %xmm5,0x1c(%rsp)
  call   <cos@plt>
  mulss  0xc(%rsp),%xmm0
  movss  0x14(%rsp),%xmm1
  movss  %xmm0,0x18(%rsp)
  movaps %xmm1,%xmm0
  call   <sin@plt>
  movss  0xc(%rsp),%xmm2
  movss  0x14(%rsp),%xmm1
  mulss  %xmm0,%xmm2
  movaps %xmm1,%xmm0
  movss  %xmm2,0x8(%rsp)
  call   <cos@plt>
  movss  0x2c(%rsp),%xmm9
  sub    $0x20,%rsp
  mulss  0x2c(%rsp),%xmm0
  movss  0x44(%rsp),%xmm4
  movss  0x60(%rsp),%xmm3
  movss  0x48(%rsp),%xmm7
  movss  %xmm9,0x18(%rsp)
  movss  %xmm4,(%rsp)
  movss  0x54(%rsp),%xmm4
  movss  0x40(%rsp),%xmm6
  movss  %xmm3,0x10(%rsp)
  movss  0x3c(%rsp),%xmm5
  movss  0x28(%rsp),%xmm2
  movss  %xmm7,0x8(%rsp)
  movaps %xmm3,%xmm7
  movss  0x38(%rsp),%xmm3
  movaps %xmm4,%xmm1
  call   <quad@plt>
  add    $0x20,%rsp
  cmp    %ebx,%r12d
  movss  0x30(%rsp),%xmm8
  jne    L24
  cmp    %ebx,%ebp
  jne    L3
L10:
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r14
  ret
```

tool_calls: name: parse_data
arguments: data_label: D59
data_type: f64
name: parse_data
arguments: data_label: D5
data_type: f64
name: parse_data
arguments: data_label: D54
data_type: byte[8]

tool: D59: 0.5

tool: D5: 3.141592653589793

tool: {"D54": [0x18,0x2d,0x44,0x54,0xfb,0x21,0xf9,0x3f]}

assistant: ```c
void halfsphere(float r, int detail) {
  for (int i = 0; i < detail; ++i) {
    float a = r * sin(3.14159265358979323846 * ((float)i / (float)detail - 0.5));
    float b = r * sin(3.14159265358979323846 * ((float)(i + 1) / (float)detail - 0.5));
    float ra = sqrt(r * r - a * a);
    float rb = sqrt(r * r - b * b);
    for (int j = 0; j < detail; ++j) {
      float p = 0.5 * 3.14159265358979323846 + 3.14159265358979323846 * (float)j / (float)detail;
      float q = 0.5 * 3.14159265358979323846 + 3.14159265358979323846 * (float)(j + 1) / (float)detail;
      quad(ra * cos(p), a, ra * sin(p), ra * cos(q), a, ra * sin(q), rb * cos(q), b, rb * sin(q), rb * cos(p), b, rb * sin(p));
    }
  }
}
```