user: Demonstrate the C code that generates the assembly output below:

```asm
<cb2006_ampf>:
  endbr64
  push   %r15
  push   %r14
  mov    %rcx,%r14
  push   %r13
  push   %r12
  mov    %r8,%r12
  push   %rbp
  push   %rbx
  mov    %r9,%rbx
  sub    $0x268,%rsp
  movaps D206(%rip),%xmm0
  mov    0x2a8(%rsp),%rax
  mov    0x2a0(%rsp),%rbp
  mov    %edx,0x44(%rsp)
  mov    %rdi,0x48(%rsp)
  mov    %rax,0x50(%rsp)
  mov    0x2b0(%rsp),%rax
  mov    %rsi,0x38(%rsp)
  mov    %rax,0x58(%rsp)
  mov    0x2b8(%rsp),%rax
  mov    %rax,0x60(%rsp)
  mov    0x2c0(%rsp),%rax
  mov    %rax,0x68(%rsp)
  mov    0x2c8(%rsp),%rax
  mov    %rax,0x70(%rsp)
  mov    0x2d0(%rsp),%rax
  mov    %rax,0x78(%rsp)
  mov    0x2d8(%rsp),%rax
  mov    %rax,0x20(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x258(%rsp)
  xor    %eax,%eax
  movaps %xmm0,0x80(%rsp)
  movaps D141(%rip),%xmm0
  movaps %xmm0,0x90(%rsp)
  movaps D74(%rip),%xmm0
  movaps %xmm0,0xa0(%rsp)
  movaps D324(%rip),%xmm0
  mov    D273(%rip),%rax
  movl   $0x43c80000,0x194(%rsp)
  movaps %xmm0,0xb0(%rsp)
  movaps D457(%rip),%xmm0
  mov    %rax,0xd0(%rsp)
  mov    D412(%rip),%rax
  movaps %xmm0,0xc0(%rsp)
  movaps D355(%rip),%xmm0
  mov    %rax,0x130(%rsp)
  movaps %xmm0,0xe0(%rsp)
  movaps D403(%rip),%xmm0
  movaps %xmm0,0xf0(%rsp)
  movaps D367(%rip),%xmm0
  movaps %xmm0,0x100(%rsp)
  movaps D77(%rip),%xmm0
  movaps %xmm0,0x110(%rsp)
  movaps D437(%rip),%xmm0
  movaps %xmm0,0x120(%rsp)
  movaps D409(%rip),%xmm0
  movups %xmm0,0x144(%rsp)
  movaps D220(%rip),%xmm0
  movups %xmm0,0x154(%rsp)
  movaps D333(%rip),%xmm0
  movups %xmm0,0x164(%rsp)
  movaps D251(%rip),%xmm0
  movups %xmm0,0x174(%rsp)
  movaps D61(%rip),%xmm0
  movups %xmm0,0x184(%rsp)
  movaps D239(%rip),%xmm0
  movaps %xmm0,0x1a0(%rsp)
  movaps D140(%rip),%xmm0
  movaps %xmm0,0x1b0(%rsp)
  movaps D85(%rip),%xmm0
  movq   $0x0,0x1f0(%rsp)
  movaps %xmm0,0x1c0(%rsp)
  movaps D118(%rip),%xmm0
  movaps %xmm0,0x1d0(%rsp)
  movss  D232(%rip),%xmm0
  movaps %xmm0,0x1e0(%rsp)
  movss  D175(%rip),%xmm0
  call   <log@plt>
  movss  D246(%rip),%xmm1
  movss  D409(%rip),%xmm6
  mulss  %xmm0,%xmm1
  movss  (%rbx),%xmm0
  comiss %xmm0,%xmm6
  jbe    L277
  divss  %xmm6,%xmm0
  movss  %xmm1,0x10(%rsp)
  call   <log@plt>
  movss  0x0(%rbp),%xmm4
  movss  %xmm0,0x18(%rsp)
  movss  (%rbx),%xmm0
  divss  D409(%rip),%xmm0
  movss  %xmm4,0x8(%rsp)
  call   <log@plt>
  movss  D459(%rip),%xmm7
  mulss  %xmm7,%xmm0
  movss  %xmm7,0xc(%rsp)
  call   <exp@plt>
  movss  D260(%rip),%xmm3
  mulss  %xmm3,%xmm0
  addss  0x0(%rbp),%xmm3
  addss  0x8(%rsp),%xmm0
  divss  %xmm3,%xmm0
  call   <log@plt>
  movss  0x18(%rsp),%xmm2
  mulss  D239(%rip),%xmm0
  mulss  D355(%rip),%xmm2
  movss  0x10(%rsp),%xmm1
  addss  %xmm0,%xmm2
L107:
  subss  %xmm2,%xmm1
  movss  0x0(%rbp),%xmm6
  xor    %ebx,%ebx
  lea    0xe0(%rsp),%rbp
  lea    0x1a0(%rsp),%r15
  lea    0x200(%rsp),%r13
  movss  %xmm6,0x8(%rsp)
  movaps %xmm1,%xmm0
  call   <exp@plt>
  mulss  0x8(%rsp),%xmm0
  lea    0x138(%rsp),%rax
  movss  D443(%rip),%xmm5
  mov    %rax,0x10(%rsp)
  lea    0x80(%rsp),%rax
  movss  D409(%rip),%xmm2
  mov    %rax,0x28(%rsp)
  movss  %xmm5,0x40(%rsp)
  movss  %xmm0,0x1c(%rsp)
  jmp    L91
  nopl   0x0(%rax)
L85:
  movss  0x0(%rbp),%xmm7
  movaps %xmm1,%xmm0
  movss  %xmm7,0x8(%rsp)
  call   <log@plt>
  mulss  0x8(%rsp),%xmm0
  movss  0x30(%rsp),%xmm2
  movss  (%r15,%rbx,1),%xmm5
  movss  %xmm5,0x8(%rsp)
  movss  %xmm0,0x18(%rsp)
  movss  (%r12),%xmm0
  divss  %xmm2,%xmm0
  call   <log@plt>
  mulss  0xc(%rsp),%xmm0
  call   <exp@plt>
  mulss  D260(%rip),%xmm0
  movss  0x1c(%rsp),%xmm4
  movss  D260(%rip),%xmm1
  addss  %xmm4,%xmm1
  addss  %xmm4,%xmm0
  divss  %xmm1,%xmm0
  call   <log@plt>
  movss  0x8(%rsp),%xmm1
  movss  0x30(%rsp),%xmm2
  mulss  %xmm0,%xmm1
  addss  0x18(%rsp),%xmm1
L256:
  movss  (%r14),%xmm0
  movss  %xmm2,0x18(%rsp)
  comiss %xmm0,%xmm2
  movaps %xmm0,%xmm3
  divss  %xmm2,%xmm3
  jbe    L132
  movss  0x0(%rbp),%xmm4
  movaps %xmm3,%xmm0
  movss  %xmm1,0x34(%rsp)
  movss  %xmm4,0x30(%rsp)
  call   <log@plt>
  mulss  0x30(%rsp),%xmm0
  movss  0x18(%rsp),%xmm2
  movss  %xmm0,0x30(%rsp)
  movss  (%r14),%xmm0
  divss  %xmm2,%xmm0
  call   <log@plt>
  mulss  0xc(%rsp),%xmm0
  call   <exp@plt>
  mulss  D260(%rip),%xmm0
  movss  0x1c(%rsp),%xmm5
  movss  D260(%rip),%xmm2
  addss  %xmm5,%xmm2
  addss  %xmm5,%xmm0
  divss  %xmm2,%xmm0
  call   <log@plt>
  mulss  0x8(%rsp),%xmm0
  movss  0x34(%rsp),%xmm1
  addss  0x30(%rsp),%xmm0
L10:
  subss  %xmm0,%xmm1
  movaps %xmm1,%xmm0
  call   <exp@plt>
  mov    0x28(%rsp),%rax
  pxor   %xmm2,%xmm2
  movsd  D90(%rip),%xmm1
  movss  %xmm0,0x0(%r13,%rbx,1)
  cvtss2sd (%rax,%rbx,1),%xmm2
  divsd  %xmm2,%xmm1
  mov    0x20(%rsp),%rax
  pxor   %xmm2,%xmm2
  cvtss2sd (%rax),%xmm2
  comisd %xmm1,%xmm2
  jb     L12
  movss  0x40(%rsp),%xmm6
  pxor   %xmm3,%xmm3
  comiss %xmm6,%xmm3
  ja     L238
  movss  %xmm6,0x0(%r13,%rbx,1)
L12:
  add    $0x4,%rbp
  add    $0x4,%rbx
  cmp    %rbp,0x10(%rsp)
  je     L115
L76:
  movss  0x140(%rsp,%rbx,1),%xmm2
L91:
  movss  (%r12),%xmm0
  movss  %xmm2,0x30(%rsp)
  comiss %xmm0,%xmm2
  movaps %xmm0,%xmm1
  divss  %xmm2,%xmm1
  ja     L85
  movss  (%r15,%rbx,1),%xmm7
  movss  0xc(%rsp),%xmm0
  mulss  %xmm7,%xmm0
  movss  %xmm7,0x8(%rsp)
  addss  0x0(%rbp),%xmm0
  movss  %xmm0,0x18(%rsp)
  movaps %xmm1,%xmm0
  call   <log@plt>
  movss  0x18(%rsp),%xmm1
  movss  0x30(%rsp),%xmm2
  mulss  %xmm0,%xmm1
  jmp    L256
L132:
  movss  0x8(%rsp),%xmm0
  mulss  0xc(%rsp),%xmm0
  movss  %xmm1,0x18(%rsp)
  addss  0x0(%rbp),%xmm0
  movss  %xmm0,0x8(%rsp)
  movaps %xmm3,%xmm0
  call   <log@plt>
  movss  0x18(%rsp),%xmm1
  mulss  0x8(%rsp),%xmm0
  jmp    L10
  cs nopw 0x0(%rax,%rax,1)
L238:
  movss  %xmm0,0x40(%rsp)
  add    $0x4,%rbp
  add    $0x4,%rbx
  cmp    %rbp,0x10(%rsp)
  jne    L76
L115:
  mov    0x44(%rsp),%eax
  mov    0x38(%rsp),%rsi
  pxor   %xmm0,%xmm0
  movss  D344(%rip),%xmm4
  movss  0x254(%rsp),%xmm6
  cvtsi2ss %eax,%xmm0
  mulss  (%rsi),%xmm0
  mov    %eax,%ecx
  shr    $0x1f,%ecx
  movaps %xmm4,%xmm7
  add    %eax,%ecx
  sar    %ecx
  divss  %xmm0,%xmm7
  cmp    $0x3,%eax
  jle    L200
  movss  D268(%rip),%xmm2
  pxor   %xmm9,%xmm9
  mov    0x48(%rsp),%rsi
  movaps %xmm6,%xmm5
  mov    0x50(%rsp),%rdi
  mov    0x58(%rsp),%r8
  mov    $0x1,%eax
  mov    $0x15,%edx
  mov    0x60(%rsp),%r9
  mov    0x68(%rsp),%r10
  movaps %xmm9,%xmm3
  movaps %xmm2,%xmm8
  jmp    L71
  nopl   0x0(%rax,%rax,1)
L79:
  movaps %xmm8,%xmm3
  movaps %xmm1,%xmm6
  subss  %xmm2,%xmm6
  subss  %xmm5,%xmm3
  divss  %xmm6,%xmm3
  movaps %xmm5,%xmm6
  movaps %xmm8,%xmm5
  movaps %xmm2,%xmm8
  movaps %xmm1,%xmm2
L286:
  movss  (%rdi),%xmm10
  movaps %xmm4,%xmm1
  comiss %xmm0,%xmm10
  ja     L233
  movaps %xmm0,%xmm1
  movss  (%r8),%xmm11
  subss  %xmm8,%xmm1
  comiss %xmm0,%xmm11
  mulss  %xmm3,%xmm1
  addss  %xmm6,%xmm1
  jbe    L18
  subss  %xmm10,%xmm0
  cvtss2sd %xmm1,%xmm1
  subss  %xmm10,%xmm11
  subsd  D90(%rip),%xmm1
  cvtss2sd %xmm0,%xmm0
  cvtss2sd %xmm11,%xmm11
  mulsd  %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  divsd  %xmm11,%xmm0
  addsd  D90(%rip),%xmm0
  cvtsd2ss %xmm0,%xmm1
L233:
  movss  %xmm1,(%rsi,%rax,4)
  add    $0x1,%rax
  cmp    %eax,%ecx
  jle    L200
L71:
  pxor   %xmm0,%xmm0
  cvtsi2ss %eax,%xmm0
  mulss  %xmm7,%xmm0
  comiss %xmm2,%xmm0
  jbe    L286
  xor    %r11d,%r11d
  test   %edx,%edx
  setg   %r11b
  sub    %r11d,%edx
  movslq %edx,%r11
  movss  0x80(%rsp,%r11,4),%xmm3
  ucomiss %xmm9,%xmm3
  jp     L228
  movss  D395(%rip),%xmm1
  je     L22
L228:
  movaps %xmm4,%xmm1
  divss  %xmm3,%xmm1
L22:
  movss  0x200(%rsp,%r11,4),%xmm8
  ucomiss %xmm2,%xmm1
  jp     L79
  jne    L79
  movaps %xmm5,%xmm6
  movaps %xmm9,%xmm3
  movaps %xmm8,%xmm5
  movaps %xmm2,%xmm8
  movaps %xmm1,%xmm2
  jmp    L286
  nopl   0x0(%rax)
L18:
  movss  (%r9),%xmm10
  comiss %xmm0,%xmm10
  ja     L233
  movss  (%r10),%xmm10
  comiss %xmm0,%xmm10
  ja     L233
  mov    0x70(%rsp),%rbx
  movss  (%rbx),%xmm10
  comiss %xmm0,%xmm10
  ja     L233
  mov    0x78(%rsp),%rbx
  movss  (%rbx),%xmm11
  comiss %xmm0,%xmm11
  jbe    L139
  cvtss2sd %xmm1,%xmm1
  subss  %xmm10,%xmm0
  subss  %xmm10,%xmm11
  movsd  D90(%rip),%xmm12
  subsd  %xmm1,%xmm12
  cvtss2sd %xmm0,%xmm0
  cvtss2sd %xmm11,%xmm11
  mulsd  %xmm12,%xmm0
  divsd  %xmm11,%xmm0
  addsd  %xmm0,%xmm1
  cvtsd2ss %xmm1,%xmm1
  movss  %xmm1,(%rsi,%rax,4)
  add    $0x1,%rax
  cmp    %eax,%ecx
  jg     L71
  xchg   %ax,%ax
L200:
  mov    0x258(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L52
  add    $0x268,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L277:
  movss  %xmm1,0x8(%rsp)
  divss  D409(%rip),%xmm0
  call   <log@plt>
  movss  D246(%rip),%xmm2
  movss  D459(%rip),%xmm6
  movss  0x8(%rsp),%xmm1
  mulss  %xmm0,%xmm2
  movss  %xmm6,0xc(%rsp)
  jmp    L107
L139:
  movaps %xmm4,%xmm1
  jmp    L233
L52:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: tag: D206
type_infered: f32[4]
name: disassemble_data
arguments: tag: D141
type_infered: f32[4]
name: disassemble_data
arguments: tag: D74
type_infered: f32[4]
name: disassemble_data
arguments: tag: D324
type_infered: f32[4]
name: disassemble_data
arguments: tag: D273
type_infered: f32[2]
name: disassemble_data
arguments: tag: D457
type_infered: f32[4]
name: disassemble_data
arguments: tag: D412
type_infered: byte[8]
name: disassemble_data
arguments: tag: D355
type_infered: f32[4]
name: disassemble_data
arguments: tag: D403
type_infered: f32[4]
name: disassemble_data
arguments: tag: D367
type_infered: f32[4]
name: disassemble_data
arguments: tag: D77
type_infered: f32[4]
name: disassemble_data
arguments: tag: D437
type_infered: byte[16]
name: disassemble_data
arguments: tag: D409
type_infered: f32[4]
name: disassemble_data
arguments: tag: D220
type_infered: f32[4]
name: disassemble_data
arguments: tag: D333
type_infered: f32[4]
name: disassemble_data
arguments: tag: D251
type_infered: f32[4]
name: disassemble_data
arguments: tag: D61
type_infered: f32[4]
name: disassemble_data
arguments: tag: D239
type_infered: byte[16]
name: disassemble_data
arguments: tag: D140
type_infered: byte[16]
name: disassemble_data
arguments: tag: D85
type_infered: byte[16]
name: disassemble_data
arguments: tag: D118
type_infered: byte[16]
name: disassemble_data
arguments: tag: D232
type_infered: byte[4]
name: disassemble_data
arguments: tag: D175
type_infered: byte[4]
name: disassemble_data
arguments: tag: D246
type_infered: byte[4]
name: disassemble_data
arguments: tag: D459
type_infered: f32
name: disassemble_data
arguments: tag: D260
type_infered: f32
name: disassemble_data
arguments: tag: D443
type_infered: byte[4]
name: disassemble_data
arguments: tag: D90
type_infered: f64
name: disassemble_data
arguments: tag: D344
type_infered: byte[4]
name: disassemble_data
arguments: tag: D268
type_infered: f32
name: disassemble_data
arguments: tag: D395
type_infered: f32

tool: {"D206": [0.0,0.009999999776482582,0.019999999552965164,0.029999999329447746]}

tool: {"D141": [0.05000000074505806,0.07500000298023224,0.10000000149011612,0.15000000596046448]}

tool: {"D74": [0.20000000298023224,0.25,0.30000001192092896,0.4000000059604645]}

tool: {"D324": [0.5,0.75,1.0,1.5]}

tool: {"D273": [7.5,10.0]}

tool: {"D457": [2.0,3.0,4.0,5.0]}

tool: {"D412": [0x85,0xeb,0x51,0xbf,0x85,0xeb,0x51,0xbf]}

tool: {"D355": [1.0579999685287476,1.0579999685287476,1.1019999980926514,1.1740000247955322]}

tool: {"D403": [1.2719999551773071,1.437999963760376,1.6039999723434448,1.9279999732971191]}

tool: {"D367": [2.194000005722046,2.3510000705718994,2.4600000381469727,2.5869998931884766]}

tool: {"D77": [2.5439999103546143,2.132999897003174,1.5709999799728394,0.4059999883174896]}

tool: {"D437": [0xd5,0x78,0xe9,0xbe,0x85,0xeb,0x51,0xbf,0x85,0xeb,0x51,0xbf,0x85,0xeb,0x51,0xbf]}

tool: {"D409": [865.0,865.0,908.0,1054.0]}

tool: {"D220": [1086.0,1032.0,878.0,748.0]}

tool: {"D333": [654.0,587.0,503.0,457.0]}

tool: {"D251": [410.0,400.0,400.0,400.0]}

tool: {"D61": [400.0,400.0,400.0,400.0]}

tool: {"D239": [0xd9,0xce,0x97,0xbf,0xd9,0xce,0x97,0xbf,0x31,0x08,0x9c,0xbf,0xaa,0xf1,0xa2,0xbf]}

tool: {"D140": [0xba,0x49,0xac,0xbf,0xba,0x49,0xbc,0xbf,0x3b,0xdf,0xcf,0xbf,0x02,0x2b,0xf7,0xbf]}

tool: {"D85": [0x31,0x08,0x0c,0xc0,0x4e,0x62,0x18,0xc0,0xe9,0x26,0x21,0xc0,0x4a,0x0c,0x2a,0xc0]}

tool: {"D118": [0xe5,0xd0,0x2a,0xc0,0xfc,0xa9,0x19,0xc0,0x71,0x3d,0xfa,0xbf,0x33,0x33,0x83,0xbf]}

tool: {"D232": [0x87,0x16,0x99,0xbe]}

tool: {"D175": [0x4a,0xc6,0xa2,0x3f]}

tool: {"D246": [0x74,0xd6,0xae,0xbe]}

tool: D459: 1.18

tool: D260: 1.88

tool: {"D443": [0x00,0x00,0x80,0xbf]}

tool: D90: 1

tool: {"D344": [0x00,0x00,0x80,0x3f]}

tool: D268: 0.1

tool: D395: 1000

assistant: ```c
void cb2006_ampf(float *ampf, float *dt, int n, float *vref, float *vsite, float *vpga, float *pga, float *fmin, float *fmidbot, float *fmid, float *fhigh, float *fhightop, float *fmax, float *flowcap) {
  float scon_c, scon_n, per[22], c10[22], c11[22], k1[22], k2[22], k3[22];
  float ampf0[22];
  float a_1100, fs_1100, fs_vpga, fs_vref, fsite;
  float df, ampv, afac, freq;
  float f0, f1, a0, a1, dadf, ampf_cap;
  int i, j;
  int nper = 22;
  scon_c = 1.88;
  scon_n = 1.18;
  per[0] = 0.0;
  per[1] = 0.01;
  per[2] = 0.02;
  per[3] = 0.03;
  per[4] = 0.05;
  per[5] = 0.075;
  per[6] = 0.10;
  per[7] = 0.15;
  per[8] = 0.20;
  per[9] = 0.25;
  per[10] = 0.30;
  per[11] = 0.40;
  per[12] = 0.50;
  per[13] = 0.75;
  per[14] = 1.00;
  per[15] = 1.50;
  per[16] = 2.00;
  per[17] = 3.00;
  per[18] = 4.00;
  per[19] = 5.00;
  per[20] = 7.50;
  per[21] = 10.0;
  c10[0] = 1.058;
  c10[1] = 1.058;
  c10[2] = 1.102;
  c10[3] = 1.174;
  c10[4] = 1.272;
  c10[5] = 1.438;
  c10[6] = 1.604;
  c10[7] = 1.928;
  c10[8] = 2.194;
  c10[9] = 2.351;
  c10[10] = 2.46;
  c10[11] = 2.587;
  c10[12] = 2.544;
  c10[13] = 2.133;
  c10[14] = 1.571;
  c10[15] = 0.406;
  c10[16] = -0.456;
  c10[17] = -0.82;
  c10[18] = -0.82;
  c10[19] = -0.82;
  c10[20] = -0.82;
  c10[21] = -0.82;
  c11[0] = 0.04;
  c11[1] = 0.04;
  c11[2] = 0.04;
  c11[3] = 0.04;
  c11[4] = 0.04;
  c11[5] = 0.04;
  c11[6] = 0.04;
  c11[7] = 0.04;
  c11[8] = 0.04;
  c11[9] = 0.04;
  c11[10] = 0.04;
  c11[11] = 0.04;
  c11[12] = 0.04;
  c11[13] = 0.077;
  c11[14] = 0.15;
  c11[15] = 0.253;
  c11[16] = 0.3;
  c11[17] = 0.3;
  c11[18] = 0.3;
  c11[19] = 0.3;
  c11[20] = 0.3;
  c11[21] = 0.3;
  k1[0] = 865.0;
  k1[1] = 865.0;
  k1[2] = 865.0;
  k1[3] = 908.0;
  k1[4] = 1054.0;
  k1[5] = 1086.0;
  k1[6] = 1032.0;
  k1[7] = 878.0;
  k1[8] = 748.0;
  k1[9] = 654.0;
  k1[10] = 587.0;
  k1[11] = 503.0;
  k1[12] = 457.0;
  k1[13] = 410.0;
  k1[14] = 400.0;
  k1[15] = 400.0;
  k1[16] = 400.0;
  k1[17] = 400.0;
  k1[18] = 400.0;
  k1[19] = 400.0;
  k1[20] = 400.0;
  k1[21] = 400.0;
  k2[0] = -1.186;
  k2[1] = -1.186;
  k2[2] = -1.219;
  k2[3] = -1.273;
  k2[4] = -1.346;
  k2[5] = -1.471;
  k2[6] = -1.624;
  k2[7] = -1.931;
  k2[8] = -2.188;
  k2[9] = -2.381;
  k2[10] = -2.518;
  k2[11] = -2.657;
  k2[12] = -2.669;
  k2[13] = -2.401;
  k2[14] = -1.955;
  k2[15] = -1.025;
  k2[16] = -0.299;
  k2[17] = 0.0;
  k2[18] = 0.0;
  k2[19] = 0.0;
  k2[20] = 0.0;
  k2[21] = 0.0;
  k3[0] = 1.839;
  k3[1] = 1.839;
  k3[2] = 1.84;
  k3[3] = 1.841;
  k3[4] = 1.843;
  k3[5] = 1.845;
  k3[6] = 1.847;
  k3[7] = 1.852;
  k3[8] = 1.856;
  k3[9] = 1.861;
  k3[10] = 1.865;
  k3[11] = 1.874;
  k3[12] = 1.883;
  k3[13] = 1.906;
  k3[14] = 1.929;
  k3[15] = 1.974;
  k3[16] = 2.019;
  k3[17] = 2.11;
  k3[18] = 2.2;
  k3[19] = 2.291;
  k3[20] = 2.517;
  k3[21] = 2.744;
  fs_1100 = (c10[0] + k2[0] * scon_n) * log(1100.0 / k1[0]);
  if ((*vpga) < k1[0]) {
    fs_vpga = c10[0] * log((*vpga) / k1[0]) + k2[0] * (log(((*pga) + scon_c * exp(scon_n * log((*vpga) / k1[0]))) / ((*pga) + scon_c)));
  } else
    fs_vpga = (c10[0] + k2[0] * scon_n) * log((*vpga) / k1[0]);
  a_1100 = (*pga) * exp(fs_1100 - fs_vpga);
  ampf_cap = -1.0;
  for (i = 0; i < nper; i++) {
    if ((*vsite) < k1[i]) {
      fsite = c10[i] * log((*vsite) / k1[i]) + k2[i] * (log((a_1100 + scon_c * exp(scon_n * log((*vsite) / k1[i]))) / (a_1100 + scon_c)));
    } else
      fsite = (c10[i] + k2[i] * scon_n) * log((*vsite) / k1[i]);
    if ((*vref) < k1[i]) {
      fs_vref = c10[i] * log((*vref) / k1[i]) + k2[i] * (log((a_1100 + scon_c * exp(scon_n * log((*vref) / k1[i]))) / (a_1100 + scon_c)));
    } else
      fs_vref = (c10[i] + k2[i] * scon_n) * log((*vref) / k1[i]);
    ampf0[i] = exp(fsite - fs_vref);
    if (1.0 / per[i] <= (*flowcap)) {
      if (ampf_cap < 0.0)
        ampf_cap = ampf0[i];
      else
        ampf0[i] = ampf_cap;
    }
  }
  j = nper - 1;
  f0 = 1.0 / per[j];
  a0 = ampf0[j];
  f1 = 1.0 / per[j];
  a1 = ampf0[j];
  dadf = 0.0;
  df = 1.0 / (n * (*dt));
  for (i = 1; i < n / 2; i++) {
    freq = i * df;
    if (freq > f1) {
      f0 = f1;
      a0 = a1;
      if (j > 0)
        j--;
      if (per[j] != 0.0)
        f1 = 1.0 / per[j];
      else
        f1 = 1000.0;
      a1 = ampf0[j];
      if (f1 != f0)
        dadf = (a1 - a0) / (f1 - f0);
      else
        dadf = 0.0;
    }
    ampv = a0 + dadf * (freq - f0);
    if (freq < *fmin)
      afac = 1.0;
    else if (freq < *fmidbot)
      afac = 1.0 + (freq - *fmin) * (ampv - 1.0) / (*fmidbot - *fmin);
    else if (freq < *fmid)
      afac = ampv;
    else if (freq < *fhigh)
      afac = ampv;
    else if (freq < *fhightop)
      afac = ampv;
    else if (freq < *fmax)
      afac = ampv + (freq - *fhightop) * (1.0 - ampv) / (*fmax - *fhightop);
    else
      afac = 1.0;
    ampf[i] = afac;
  }
}
```