#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 */
int sin(int);
void sinus(double *x, int sigInLength, double *psi, int sigOutLength,
           double ys) {
  int count;
  for (count = 0; count < sigInLength; count++)
    psi[count] = -1 * sin(2 * 3.1415926535897931159980 * x[count]) / ys;
  return;
}


x86 assembly (clang, -O0):
<sinus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movsd  %xmm0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1186 <sinus+0x76>
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  0xeb2(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
imul   $0xffffffff,%eax,%eax
cvtsi2sd %eax,%xmm0
divsd  -0x28(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1132 <sinus+0x22>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sinus>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
test   %esi,%esi
jle    11e9 <sinus+0xd9>
mov    %rdx,%r14
mov    %rdi,%r15
mov    %esi,%r12d
cmp    $0x1,%esi
movsd  %xmm0,0x8(%rsp)
jne    113d <sinus+0x2d>
xor    %ebx,%ebx
jmp    11b7 <sinus+0xa7>
mov    %r12d,%r13d
and    $0xfffffffe,%r13d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
movsd  (%r15,%rbx,8),%xmm0
movsd  0xea2(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
neg    %eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
divsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%r14,%rbx,8)
movsd  0x8(%r15,%rbx,8),%xmm0
mulsd  0xe71(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
neg    %eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
divsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%r14,%rbx,8)
add    $0x2,%rbx
cmp    %rbx,%r13
jne    1150 <sinus+0x40>
test   $0x1,%r12b
je     11e9 <sinus+0xd9>
movsd  (%r15,%rbx,8),%xmm0
mulsd  0xe35(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
neg    %eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
divsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%r14,%rbx,8)
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @sinus(double* %0, i32 %1, double* %2, i32 %3, double %4) {
%6 = alloca double*
%7 = alloca i32
%8 = alloca double*
%9 = alloca i32
%10 = alloca double
%11 = alloca i32
store double* %0, double** %6
store i32 %1, i32* %7
store double* %2, double** %8
store i32 %3, i32* %9
store double %4, double* %10
store i32 0, i32* %11
br label %12
12: ; preds = %33, %5
%13 = load i32, i32* %11
%14 = load i32, i32* %7
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %36
16: ; preds = %12
%17 = load double*, double** %6
%18 = load i32, i32* %11
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds double, double* %17, i64 %19
%21 = load double, double* %20
%22 = fmul double 0x401921FB54442D18, %21
%23 = fptosi double %22 to i32
%24 = call i32 @sin(i32 %23)
%25 = mul nsw i32 -1, %24
%26 = sitofp i32 %25 to double
%27 = load double, double* %10
%28 = fdiv double %26, %27
%29 = load double*, double** %8
%30 = load i32, i32* %11
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds double, double* %29, i64 %31
store double %28, double* %32
br label %33
33: ; preds = %16
%34 = load i32, i32* %11
%35 = add nsw i32 %34, 1
store i32 %35, i32* %11
br label %12
36: ; preds = %12
ret void
}

LLVM IR (-O2):
define void @sinus(double* nocapture %0, i32 %1, double* nocapture writeonly %2, i32 %3, double %4) {
%6 = icmp sgt i32 %1, 0
br i1 %6, label %7, label %51
7: ; preds = %5
%8 = zext i32 %1 to i64
%9 = and i64 %8, 1
%10 = icmp eq i32 %1, 1
br i1 %10, label %38, label %11
11: ; preds = %7
%12 = and i64 %8, 4294967294
br label %13
13: ; preds = %13, %11
%14 = phi i64 [ 0, %11 ], [ %35, %13 ]
%15 = phi i64 [ 0, %11 ], [ %36, %13 ]
%16 = getelementptr inbounds double, double* %0, i64 %14
%17 = load double, double* %16
%18 = fmul double %17, 0x401921FB54442D18
%19 = fptosi double %18 to i32
%20 = tail call i32 @sin(i32 %19)
%21 = sub nsw i32 0, %20
%22 = sitofp i32 %21 to double
%23 = fdiv double %22, %4
%24 = getelementptr inbounds double, double* %2, i64 %14
store double %23, double* %24
%25 = or i64 %14, 1
%26 = getelementptr inbounds double, double* %0, i64 %25
%27 = load double, double* %26
%28 = fmul double %27, 0x401921FB54442D18
%29 = fptosi double %28 to i32
%30 = tail call i32 @sin(i32 %29)
%31 = sub nsw i32 0, %30
%32 = sitofp i32 %31 to double
%33 = fdiv double %32, %4
%34 = getelementptr inbounds double, double* %2, i64 %25
store double %33, double* %34
%35 = add nuw nsw i64 %14, 2
%36 = add i64 %15, 2
%37 = icmp eq i64 %36, %12
br i1 %37, label %38, label %13
38: ; preds = %13, %7
%39 = phi i64 [ 0, %7 ], [ %35, %13 ]
%40 = icmp eq i64 %9, 0
br i1 %40, label %51, label %41
41: ; preds = %38
%42 = getelementptr inbounds double, double* %0, i64 %39
%43 = load double, double* %42
%44 = fmul double %43, 0x401921FB54442D18
%45 = fptosi double %44 to i32
%46 = tail call i32 @sin(i32 %45)
%47 = sub nsw i32 0, %46
%48 = sitofp i32 %47 to double
%49 = fdiv double %48, %4
%50 = getelementptr inbounds double, double* %2, i64 %39
store double %49, double* %50
br label %51
51: ; preds = %41, %38, %5
ret void
}