#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
float M_PI;
float exp(float);
float sqrt(float);
void generate_seismic_pulse_vector(float *spVector, int timeSteps, float dt,
                                   float tf, float fc) {
  float time = 0;
  float a = sqrt(0.5f) * M_PI * fc;
  a *= a;
  int i;
  for (i = 0; i < timeSteps; i++) {
    time = (i * dt) - tf;
    spVector[i] = (1.0f - 2.0f * time * time * a) * exp(-time * a * time);
  }
}


x86 assembly (clang, -O0):
<generate_seismic_pulse_vector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movss  %xmm0,-0x10(%rbp)
movss  %xmm1,-0x14(%rbp)
movss  %xmm2,-0x18(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  0xeb2(%rip),%xmm0
call   1040 <sqrt@plt>
mov    0x2e8e(%rip),%rax
mulss  (%rax),%xmm0
mulss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm0
mulss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1234 <generate_seismic_pulse_vector+0x114>
cvtsi2ssl -0x24(%rbp),%xmm0
movss  -0x10(%rbp),%xmm2
movss  -0x14(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  0xe4d(%rip),%xmm0
mulss  -0x1c(%rbp),%xmm0
mulss  -0x1c(%rbp),%xmm0
movss  -0x20(%rbp),%xmm1
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm1,%xmm0
movss  0xe21(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x1c(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  -0x20(%rbp),%xmm0
mulss  -0x1c(%rbp),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movss  -0x28(%rbp),%xmm0
mulss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    117e <generate_seismic_pulse_vector+0x5e>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generate_seismic_pulse_vector>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
movaps %xmm1,0x10(%rsp)
test   %esi,%esi
jle    11d9 <generate_seismic_pulse_vector+0xc9>
movaps %xmm0,%xmm3
mov    %rdi,%r14
mov    0x2eb5(%rip),%rax
movss  (%rax),%xmm0
mulss  0xec1(%rip),%xmm0
mulss  %xmm2,%xmm0
mulss  %xmm0,%xmm0
movss  %xmm0,0x8(%rsp)
movaps 0x10(%rsp),%xmm0
xorps  0xeb7(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
mov    %esi,%r15d
xor    %ebx,%ebx
movss  %xmm3,0xc(%rsp)
nopl   0x0(%rax)
xorps  %xmm1,%xmm1
cvtsi2ss %ebx,%xmm1
mulss  %xmm3,%xmm1
addss  0x10(%rsp),%xmm1
movaps %xmm1,%xmm0
mulss  0xe78(%rip),%xmm0
mulss  %xmm1,%xmm0
movss  0x8(%rsp),%xmm2
mulss  %xmm2,%xmm0
addss  0xe66(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps %xmm1,%xmm0
xorps  0xe5f(%rip),%xmm0
mulss  %xmm2,%xmm0
mulss  %xmm1,%xmm0
call   1030 <exp@plt>
movss  0xc(%rsp),%xmm3
mulss  0x20(%rsp),%xmm0
movss  %xmm0,(%r14,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1170 <generate_seismic_pulse_vector+0x60>
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@M_PI = global float 0.000000e+00
define void @generate_seismic_pulse_vector(float* %0, i32 %1, float %2, float %3, float %4) {
%6 = alloca float*
%7 = alloca i32
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca i32
store float* %0, float** %6
store i32 %1, i32* %7
store float %2, float* %8
store float %3, float* %9
store float %4, float* %10
store float 0.000000e+00, float* %11
%14 = call float @sqrt(float 5.000000e-01)
%15 = load float, float* @M_PI
%16 = fmul float %14, %15
%17 = load float, float* %10
%18 = fmul float %16, %17
store float %18, float* %12
%19 = load float, float* %12
%20 = load float, float* %12
%21 = fmul float %20, %19
store float %21, float* %12
store i32 0, i32* %13
br label %22
22: ; preds = %52, %5
%23 = load i32, i32* %13
%24 = load i32, i32* %7
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %55
26: ; preds = %22
%27 = load i32, i32* %13
%28 = sitofp i32 %27 to float
%29 = load float, float* %8
%30 = load float, float* %9
%31 = fneg float %30
%32 = call float @llvm.fmuladd.f32(float %28, float %29, float %31)
store float %32, float* %11
%33 = load float, float* %11
%34 = fmul float 2.000000e+00, %33
%35 = load float, float* %11
%36 = fmul float %34, %35
%37 = load float, float* %12
%38 = fneg float %36
%39 = call float @llvm.fmuladd.f32(float %38, float %37, float 1.000000e+00)
%40 = load float, float* %11
%41 = fneg float %40
%42 = load float, float* %12
%43 = fmul float %41, %42
%44 = load float, float* %11
%45 = fmul float %43, %44
%46 = call float @exp(float %45)
%47 = fmul float %39, %46
%48 = load float*, float** %6
%49 = load i32, i32* %13
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds float, float* %48, i64 %50
store float %47, float* %51
br label %52
52: ; preds = %26
%53 = load i32, i32* %13
%54 = add nsw i32 %53, 1
store i32 %54, i32* %13
br label %22
55: ; preds = %22
ret void
}

LLVM IR (-O2):
@M_PI = global float 0.000000e+00
define void @generate_seismic_pulse_vector(float* nocapture writeonly %0, i32 %1, float %2, float %3, float %4) {
%6 = load float, float* @M_PI
%7 = fmul float %6, 0x3FE6A09E60000000
%8 = fmul float %7, %4
%9 = fmul float %8, %8
%10 = icmp sgt i32 %1, 0
br i1 %10, label %11, label %30
11: ; preds = %5
%12 = fneg float %3
%13 = zext i32 %1 to i64
br label %14
14: ; preds = %11, %14
%15 = phi i64 [ 0, %11 ], [ %28, %14 ]
%16 = trunc i64 %15 to i32
%17 = sitofp i32 %16 to float
%18 = tail call float @llvm.fmuladd.f32(float %17, float %2, float %12)
%19 = fmul float %18, -2.000000e+00
%20 = fmul float %18, %19
%21 = tail call float @llvm.fmuladd.f32(float %20, float %9, float 1.000000e+00)
%22 = fneg float %18
%23 = fmul float %9, %22
%24 = fmul float %18, %23
%25 = tail call float @exp(float %24)
%26 = fmul float %21, %25
%27 = getelementptr inbounds float, float* %0, i64 %15
store float %26, float* %27
%28 = add nuw nsw i64 %15, 1
%29 = icmp eq i64 %28, %13
br i1 %29, label %30, label %14
30: ; preds = %14, %5
ret void
}