#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 */
double cos(double);
void STS_ComputeSubSteps(double dtex, double tau[], int ssorder) {
  int i;
  double S;
  S = 0.0;
  for (i = 0; i < ssorder; i++) {
    tau[i] = dtex / ((-1.0 + 0.01) * cos(((2.0 * i - 1.0) * 3.14159265358979) /
                                         (2.0 * ssorder)) +
                     1.0 + 0.01);
    S += tau[i];
  }
}


x86 assembly (clang, -O0):
<STS_ComputeSubSteps>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11e6 <STS_ComputeSubSteps+0xd6>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
cvtsi2sdl -0x18(%rbp),%xmm0
addsd  %xmm0,%xmm0
movsd  0xece(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xeba(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x14(%rbp),%xmm2
movsd  0xea1(%rip),%xmm1
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
call   1030 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
movsd  0xe74(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe70(%rip),%xmm2
addsd  %xmm2,%xmm1
movsd  0xe54(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1133 <STS_ComputeSubSteps+0x23>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<STS_ComputeSubSteps>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
test   %esi,%esi
jle    1196 <STS_ComputeSubSteps+0x86>
mov    %rdi,%r14
movaps %xmm0,%xmm2
xorps  %xmm0,%xmm0
cvtsi2sd %esi,%xmm0
addsd  %xmm0,%xmm0
movsd  %xmm0,(%rsp)
mov    %esi,%r15d
xor    %ebx,%ebx
movsd  %xmm2,0x8(%rsp)
xchg   %ax,%ax
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
addsd  %xmm0,%xmm0
addsd  0xead(%rip),%xmm0
mulsd  0xead(%rip),%xmm0
divsd  (%rsp),%xmm0
call   1030 <cos@plt>
movsd  0x8(%rsp),%xmm1
mulsd  0xe9d(%rip),%xmm0
addsd  0xe9d(%rip),%xmm0
addsd  0xe9d(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  %xmm1,(%r14,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1140 <STS_ComputeSubSteps+0x30>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @STS_ComputeSubSteps(double %0, double* %1, i32 %2) {
%4 = alloca double
%5 = alloca double*
%6 = alloca i32
%7 = alloca i32
%8 = alloca double
store double %0, double* %4
store double* %1, double** %5
store i32 %2, i32* %6
store double 0.000000e+00, double* %8
store i32 0, i32* %7
br label %9
9: ; preds = %38, %3
%10 = load i32, i32* %7
%11 = load i32, i32* %6
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %41
13: ; preds = %9
%14 = load double, double* %4
%15 = load i32, i32* %7
%16 = sitofp i32 %15 to double
%17 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %16, double -1.000000e+00)
%18 = fmul double %17, 0x400921FB54442D11
%19 = load i32, i32* %6
%20 = sitofp i32 %19 to double
%21 = fmul double 2.000000e+00, %20
%22 = fdiv double %18, %21
%23 = call double @cos(double %22)
%24 = call double @llvm.fmuladd.f64(double 0xBFEFAE147AE147AE, double %23, double 1.000000e+00)
%25 = fadd double %24, 1.000000e-02
%26 = fdiv double %14, %25
%27 = load double*, double** %5
%28 = load i32, i32* %7
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds double, double* %27, i64 %29
store double %26, double* %30
%31 = load double*, double** %5
%32 = load i32, i32* %7
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds double, double* %31, i64 %33
%35 = load double, double* %34
%36 = load double, double* %8
%37 = fadd double %36, %35
store double %37, double* %8
br label %38
38: ; preds = %13
%39 = load i32, i32* %7
%40 = add nsw i32 %39, 1
store i32 %40, i32* %7
br label %9
41: ; preds = %9
ret void
}

LLVM IR (-O2):
define void @STS_ComputeSubSteps(double %0, double* nocapture writeonly %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %23
5: ; preds = %3
%6 = sitofp i32 %2 to double
%7 = fmul double %6, 2.000000e+00
%8 = zext i32 %2 to i64
br label %9
9: ; preds = %5, %9
%10 = phi i64 [ 0, %5 ], [ %21, %9 ]
%11 = trunc i64 %10 to i32
%12 = sitofp i32 %11 to double
%13 = tail call double @llvm.fmuladd.f64(double %12, double 2.000000e+00, double -1.000000e+00)
%14 = fmul double %13, 0x400921FB54442D11
%15 = fdiv double %14, %7
%16 = tail call double @cos(double %15)
%17 = tail call double @llvm.fmuladd.f64(double %16, double 0xBFEFAE147AE147AE, double 1.000000e+00)
%18 = fadd double %17, 1.000000e-02
%19 = fdiv double %0, %18
%20 = getelementptr inbounds double, double* %1, i64 %10
store double %19, double* %20
%21 = add nuw nsw i64 %10, 1
%22 = icmp eq i64 %21, %8
br i1 %22, label %23, label %9
23: ; preds = %9, %3
ret void
}