void ConvertInstr(nsamp, srate, instr_type, data) int nsamp;
float srate;
int instr_type;
float *data;
{
  int npts, ind, n2, i;
  float dt, dum;
  float *cw, *c1;
  npts = nsamp;
  ind = instr_type;
  n2 = ipow_(&npts);
  dum = 0.0;
  dt = (float)1 / srate;
  cw = (float *)malloc(sizeof(double) * n2);
  c1 = (float *)malloc(sizeof(float) * n2);
  for (i = 0; i < nsamp; i++) {
    c1[i] = data[i];
  }
  coinst_(&npts, &dt, &ind, c1, cw, &dum, &dum);
  for (i = 0; i < nsamp; i++) {
    data[i] = c1[i];
  }
  free(c1);
  free(cw);
  return;
}


x86 assembly (clang, -O0):
<ConvertInstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
cvtsd2ss %xmm0,%xmm0
mov    %edi,-0x4(%rbp)
movss  %xmm0,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x20(%rbp)
lea    -0x1c(%rbp),%rdi
mov    $0x0,%al
call   1040 <ipow_@plt>
mov    %eax,-0x24(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x30(%rbp)
movss  0xe7b(%rip),%xmm0
divss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movslq -0x24(%rbp),%rdi
shl    $0x3,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x38(%rbp)
movslq -0x24(%rbp),%rdi
shl    $0x2,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11ec <ConvertInstr+0xac>
mov    -0x18(%rbp),%rax
movslq -0x28(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x40(%rbp),%rax
movslq -0x28(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11b8 <ConvertInstr+0x78>
mov    -0x40(%rbp),%rcx
mov    -0x38(%rbp),%r8
lea    -0x1c(%rbp),%rdi
lea    -0x2c(%rbp),%rsi
lea    -0x20(%rbp),%rdx
lea    -0x30(%rbp),%rax
mov    %rax,%r9
mov    %rax,(%rsp)
mov    $0x0,%al
call   1060 <coinst_@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    124d <ConvertInstr+0x10d>
mov    -0x40(%rbp),%rax
movslq -0x28(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x28(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1219 <ConvertInstr+0xd9>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ConvertInstr>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rdx,%r14
mov    %edi,%ebp
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x24(%rsp)
mov    %edi,0x14(%rsp)
mov    %esi,0x20(%rsp)
lea    0x14(%rsp),%rdi
xor    %eax,%eax
call   1040 <ipow_@plt>
movl   $0x0,0x18(%rsp)
movss  0xe73(%rip),%xmm0
divss  0x24(%rsp),%xmm0
movss  %xmm0,0x1c(%rsp)
movslq %eax,%rbx
lea    0x0(,%rbx,8),%rdi
call   1060 <malloc@plt>
mov    %rax,%r15
shl    $0x2,%rbx
mov    %rbx,%rdi
call   1060 <malloc@plt>
mov    %rax,%rbx
test   %ebp,%ebp
jle    1208 <ConvertInstr+0xb8>
mov    %ebp,%ebp
shl    $0x2,%rbp
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %rbp,%rdx
call   1050 <memcpy@plt>
lea    0x18(%rsp),%r9
mov    %r9,(%rsp)
lea    0x14(%rsp),%rdi
lea    0x1c(%rsp),%rsi
lea    0x20(%rsp),%rdx
mov    %rbx,%rcx
mov    %r15,%r8
xor    %eax,%eax
call   1070 <coinst_@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
call   1050 <memcpy@plt>
jmp    122d <ConvertInstr+0xdd>
lea    0x18(%rsp),%r9
mov    %r9,(%rsp)
lea    0x14(%rsp),%rdi
lea    0x1c(%rsp),%rsi
lea    0x20(%rsp),%rdx
mov    %rbx,%rcx
mov    %r15,%r8
xor    %eax,%eax
call   1070 <coinst_@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @ConvertInstr(i32 %0, double %1, i32 %2, float* %3) {
%5 = alloca i32
%6 = alloca float
%7 = alloca i32
%8 = alloca float*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca float
%14 = alloca float
%15 = alloca float*
%16 = alloca float*
%17 = fptrunc double %1 to float
store i32 %0, i32* %5
store float %17, float* %6
store i32 %2, i32* %7
store float* %3, float** %8
%18 = load i32, i32* %5
store i32 %18, i32* %9
%19 = load i32, i32* %7
store i32 %19, i32* %10
%20 = call i32 (i32*, ...) bitcast (i32 (...)* @ipow_ to i32 (i32*, ...)*)(i32* %9)
store i32 %20, i32* %11
store float 0.000000e+00, float* %14
%21 = load float, float* %6
%22 = fdiv float 1.000000e+00, %21
store float %22, float* %13
%23 = load i32, i32* %11
%24 = sext i32 %23 to i64
%25 = mul i64 8, %24
%26 = call i8* @malloc(i64 %25)
%27 = bitcast i8* %26 to float*
store float* %27, float** %15
%28 = load i32, i32* %11
%29 = sext i32 %28 to i64
%30 = mul i64 4, %29
%31 = call i8* @malloc(i64 %30)
%32 = bitcast i8* %31 to float*
store float* %32, float** %16
store i32 0, i32* %12
br label %33
33: ; preds = %47, %4
%34 = load i32, i32* %12
%35 = load i32, i32* %5
%36 = icmp slt i32 %34, %35
br i1 %36, label %37, label %50
37: ; preds = %33
%38 = load float*, float** %8
%39 = load i32, i32* %12
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds float, float* %38, i64 %40
%42 = load float, float* %41
%43 = load float*, float** %16
%44 = load i32, i32* %12
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds float, float* %43, i64 %45
store float %42, float* %46
br label %47
47: ; preds = %37
%48 = load i32, i32* %12
%49 = add nsw i32 %48, 1
store i32 %49, i32* %12
br label %33
50: ; preds = %33
%51 = load float*, float** %16
%52 = load float*, float** %15
%53 = call i32 (i32*, float*, i32*, float*, float*, float*, float*, ...) bitcast (i32 (...)* @coinst_ to i32 (i32*, float*, i32*, float*, float*, float*, float*, ...)*)(i32* %9, float* %13, i32* %10, float* %51, float* %52, float* %14, float* %14)
store i32 0, i32* %12
br label %54
54: ; preds = %68, %50
%55 = load i32, i32* %12
%56 = load i32, i32* %5
%57 = icmp slt i32 %55, %56
br i1 %57, label %58, label %71
58: ; preds = %54
%59 = load float*, float** %16
%60 = load i32, i32* %12
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds float, float* %59, i64 %61
%63 = load float, float* %62
%64 = load float*, float** %8
%65 = load i32, i32* %12
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds float, float* %64, i64 %66
store float %63, float* %67
br label %68
68: ; preds = %58
%69 = load i32, i32* %12
%70 = add nsw i32 %69, 1
store i32 %70, i32* %12
br label %54
71: ; preds = %54
%72 = load float*, float** %16
%73 = bitcast float* %72 to i8*
%74 = load float*, float** %15
%75 = bitcast float* %74 to i8*
ret void
}

LLVM IR (-O2):
define void @ConvertInstr(i32 %0, double %1, i32 %2, float* nocapture %3) {
%5 = bitcast float* %3 to i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca float
%9 = alloca float
%10 = fptrunc double %1 to float
%11 = bitcast i32* %6 to i8*
%12 = bitcast i32* %7 to i8*
%13 = bitcast float* %8 to i8*
%14 = bitcast float* %9 to i8*
store i32 %0, i32* %6
store i32 %2, i32* %7
%15 = call i32 (i32*, ...) bitcast (i32 (...)* @ipow_ to i32 (i32*, ...)*)(i32* %6)
store float 0.000000e+00, float* %9
%16 = fdiv float 1.000000e+00, %10
store float %16, float* %8
%17 = sext i32 %15 to i64
%18 = shl nsw i64 %17, 3
%19 = call i8* @malloc(i64 %18)
%20 = bitcast i8* %19 to float*
%21 = shl nsw i64 %17, 2
%22 = call i8* @malloc(i64 %21)
%23 = bitcast i8* %22 to float*
%24 = icmp sgt i32 %0, 0
br i1 %24, label %27, label %25
25: ; preds = %4
%26 = call i32 (i32*, float*, i32*, float*, float*, float*, float*, ...) bitcast (i32 (...)* @coinst_ to i32 (i32*, float*, i32*, float*, float*, float*, float*, ...)*)(i32* %6, float* %8, i32* %7, float* %23, float* %20, float* %9, float* %9)
br label %33
27: ; preds = %4
%28 = zext i32 %0 to i64
%29 = shl nuw nsw i64 %28, 2
%30 = call i32 (i32*, float*, i32*, float*, float*, float*, float*, ...) bitcast (i32 (...)* @coinst_ to i32 (i32*, float*, i32*, float*, float*, float*, float*, ...)*)(i32* %6, float* %8, i32* %7, float* %23, float* %20, float* %9, float* %9)
%31 = zext i32 %0 to i64
%32 = shl nuw nsw i64 %31, 2
br label %33
33: ; preds = %25, %27
ret void
}