#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);
double sin(double);
void sinfm(double *result_real, double *result_imag, double fc, double fm,
           int n, double fdev) {
  int i;
  double phi;
  if (result_imag == NULL)
    for (i = 0; i < n; i++) {
      phi = (fc * (double)i) +
            fdev / 2.0 * sin(2.0 * 3.14159265358979323846 * fm * (double)i);
      result_real[i] = cos(2.0 * 3.14159265358979323846 * phi);
    }
  else
    for (i = 0; i < n; i++) {
      phi = (fc * (double)i) +
            fdev / 2.0 * sin(2.0 * 3.14159265358979323846 * fm * (double)i);
      result_real[i] = cos(2.0 * 3.14159265358979323846 * phi);
      result_imag[i] = sin(2.0 * 3.14159265358979323846 * phi);
    }
}


x86 assembly (clang, -O0):
<sinfm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
mov    %edx,-0x24(%rbp)
movsd  %xmm2,-0x30(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11fa <sinfm+0xda>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    11f5 <sinfm+0xd5>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
cvtsi2sdl -0x34(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  0xe87(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xe6e(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
cvtsi2sdl -0x34(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1030 <sin@plt>
movsd  -0x58(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe30(%rip),%xmm0
mulsd  -0x40(%rbp),%xmm0
call   1040 <cos@plt>
mov    -0x8(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1154 <sinfm+0x34>
jmp    12c6 <sinfm+0x1a6>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    12c1 <sinfm+0x1a1>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
cvtsi2sdl -0x34(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  0xdda(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  0xdc1(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
cvtsi2sdl -0x34(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1030 <sin@plt>
movsd  -0x70(%rbp),%xmm1
movsd  -0x68(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x60(%rbp),%xmm0
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xd83(%rip),%xmm0
mulsd  -0x40(%rbp),%xmm0
call   1040 <cos@plt>
mov    -0x8(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  0xd64(%rip),%xmm0
mulsd  -0x40(%rbp),%xmm0
call   1030 <sin@plt>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1201 <sinfm+0xe1>
jmp    12c6 <sinfm+0x1a6>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sinfm>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rdi,%r14
test   %rsi,%rsi
je     11ee <sinfm+0xce>
test   %edx,%edx
movsd  %xmm0,0x18(%rsp)
movsd  %xmm2,0x10(%rsp)
jle    1319 <sinfm+0x1f9>
mov    %rsi,%r15
movsd  0x10(%rsp),%xmm0
mulsd  0xea4(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
mulsd  0xe9e(%rip),%xmm1
mov    %edx,%r12d
xor    %ebx,%ebx
movsd  %xmm1,0x20(%rsp)
cs nopw 0x0(%rax,%rax,1)
nop
xorps  %xmm2,%xmm2
cvtsi2sd %ebx,%xmm2
movsd  %xmm2,0x8(%rsp)
movapd %xmm1,%xmm0
mulsd  %xmm2,%xmm0
call   1030 <sin@plt>
mulsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  0x18(%rsp),%xmm1
addsd  %xmm1,%xmm0
mulsd  0xe50(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
call   1040 <cos@plt>
movsd  %xmm0,(%r14,%rbx,8)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movsd  0x20(%rsp),%xmm1
movsd  %xmm0,(%r15,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1180 <sinfm+0x60>
jmp    1319 <sinfm+0x1f9>
test   %edx,%edx
jle    1319 <sinfm+0x1f9>
movsd  %xmm0,0x18(%rsp)
mulsd  0xdfc(%rip),%xmm2
movsd  %xmm2,0x10(%rsp)
mulsd  0xdf6(%rip),%xmm1
mov    %edx,%r15d
cmp    $0x1,%edx
jne    1221 <sinfm+0x101>
xor    %ebx,%ebx
jmp    12d3 <sinfm+0x1b3>
mov    %r15d,%r12d
and    $0xfffffffe,%r12d
xor    %ebx,%ebx
movsd  %xmm1,0x20(%rsp)
xorps  %xmm2,%xmm2
cvtsi2sd %ebx,%xmm2
movsd  %xmm2,0x8(%rsp)
movapd %xmm1,%xmm0
mulsd  %xmm2,%xmm0
call   1030 <sin@plt>
mulsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  0x18(%rsp),%xmm1
addsd  %xmm1,%xmm0
movsd  0xda0(%rip),%xmm1
mulsd  %xmm1,%xmm0
call   1040 <cos@plt>
movsd  %xmm0,(%r14,%rbx,8)
lea    0x1(%rbx),%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x20(%rsp),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <sin@plt>
mulsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  0x18(%rsp),%xmm1
addsd  %xmm1,%xmm0
mulsd  0xd54(%rip),%xmm0
call   1040 <cos@plt>
movsd  0x20(%rsp),%xmm1
movsd  %xmm0,0x8(%r14,%rbx,8)
add    $0x2,%rbx
cmp    %r12,%rbx
jne    1230 <sinfm+0x110>
test   $0x1,%r15b
je     1319 <sinfm+0x1f9>
cvtsi2sd %ebx,%xmm3
movsd  %xmm3,0x8(%rsp)
mulsd  %xmm3,%xmm1
movapd %xmm1,%xmm0
call   1030 <sin@plt>
mulsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
mulsd  0x8(%rsp),%xmm1
addsd  %xmm1,%xmm0
mulsd  0xcfa(%rip),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,(%r14,%rbx,8)
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @sinfm(double* %0, double* %1, double %2, double %3, i32 %4, double %5) {
%7 = alloca double*
%8 = alloca double*
%9 = alloca double
%10 = alloca double
%11 = alloca i32
%12 = alloca double
%13 = alloca i32
%14 = alloca double
store double* %0, double** %7
store double* %1, double** %8
store double %2, double* %9
store double %3, double* %10
store i32 %4, i32* %11
store double %5, double* %12
%15 = load double*, double** %8
%16 = icmp eq double* %15, null
br i1 %16, label %17, label %47
17: ; preds = %6
store i32 0, i32* %13
br label %18
18: ; preds = %43, %17
%19 = load i32, i32* %13
%20 = load i32, i32* %11
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %46
22: ; preds = %18
%23 = load double, double* %9
%24 = load i32, i32* %13
%25 = sitofp i32 %24 to double
%26 = load double, double* %12
%27 = fdiv double %26, 2.000000e+00
%28 = load double, double* %10
%29 = fmul double 0x401921FB54442D18, %28
%30 = load i32, i32* %13
%31 = sitofp i32 %30 to double
%32 = fmul double %29, %31
%33 = call double @sin(double %32)
%34 = fmul double %27, %33
%35 = call double @llvm.fmuladd.f64(double %23, double %25, double %34)
store double %35, double* %14
%36 = load double, double* %14
%37 = fmul double 0x401921FB54442D18, %36
%38 = call double @cos(double %37)
%39 = load double*, double** %7
%40 = load i32, i32* %13
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds double, double* %39, i64 %41
store double %38, double* %42
br label %43
43: ; preds = %22
%44 = load i32, i32* %13
%45 = add nsw i32 %44, 1
store i32 %45, i32* %13
br label %18
46: ; preds = %18
br label %84
47: ; preds = %6
store i32 0, i32* %13
br label %48
48: ; preds = %80, %47
%49 = load i32, i32* %13
%50 = load i32, i32* %11
%51 = icmp slt i32 %49, %50
br i1 %51, label %52, label %83
52: ; preds = %48
%53 = load double, double* %9
%54 = load i32, i32* %13
%55 = sitofp i32 %54 to double
%56 = load double, double* %12
%57 = fdiv double %56, 2.000000e+00
%58 = load double, double* %10
%59 = fmul double 0x401921FB54442D18, %58
%60 = load i32, i32* %13
%61 = sitofp i32 %60 to double
%62 = fmul double %59, %61
%63 = call double @sin(double %62)
%64 = fmul double %57, %63
%65 = call double @llvm.fmuladd.f64(double %53, double %55, double %64)
store double %65, double* %14
%66 = load double, double* %14
%67 = fmul double 0x401921FB54442D18, %66
%68 = call double @cos(double %67)
%69 = load double*, double** %7
%70 = load i32, i32* %13
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds double, double* %69, i64 %71
store double %68, double* %72
%73 = load double, double* %14
%74 = fmul double 0x401921FB54442D18, %73
%75 = call double @sin(double %74)
%76 = load double*, double** %8
%77 = load i32, i32* %13
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds double, double* %76, i64 %78
store double %75, double* %79
br label %80
80: ; preds = %52
%81 = load i32, i32* %13
%82 = add nsw i32 %81, 1
store i32 %82, i32* %13
br label %48
83: ; preds = %48
br label %84
84: ; preds = %83, %46
ret void
}

LLVM IR (-O2):
define void @sinfm(double* nocapture writeonly %0, double* writeonly %1, double %2, double %3, i32 %4, double %5) {
%7 = icmp eq double* %1, null
%8 = icmp sgt i32 %4, 0
br i1 %7, label %14, label %9
9: ; preds = %6
br i1 %8, label %10, label %76
10: ; preds = %9
%11 = fmul double %5, 5.000000e-01
%12 = fmul double %3, 0x401921FB54442D18
%13 = zext i32 %4 to i64
br label %48
14: ; preds = %6
br i1 %8, label %15, label %76
15: ; preds = %14
%16 = fmul double %5, 5.000000e-01
%17 = fmul double %3, 0x401921FB54442D18
%18 = zext i32 %4 to i64
%19 = and i64 %18, 1
%20 = icmp eq i32 %4, 1
br i1 %20, label %63, label %21
21: ; preds = %15
%22 = and i64 %18, 4294967294
br label %23
23: ; preds = %23, %21
%24 = phi i64 [ 0, %21 ], [ %45, %23 ]
%25 = phi i64 [ 0, %21 ], [ %46, %23 ]
%26 = trunc i64 %24 to i32
%27 = sitofp i32 %26 to double
%28 = fmul double %17, %27
%29 = tail call double @sin(double %28)
%30 = fmul double %16, %29
%31 = tail call double @llvm.fmuladd.f64(double %2, double %27, double %30)
%32 = fmul double %31, 0x401921FB54442D18
%33 = tail call double @cos(double %32)
%34 = getelementptr inbounds double, double* %0, i64 %24
store double %33, double* %34
%35 = or i64 %24, 1
%36 = trunc i64 %35 to i32
%37 = sitofp i32 %36 to double
%38 = fmul double %17, %37
%39 = tail call double @sin(double %38)
%40 = fmul double %16, %39
%41 = tail call double @llvm.fmuladd.f64(double %2, double %37, double %40)
%42 = fmul double %41, 0x401921FB54442D18
%43 = tail call double @cos(double %42)
%44 = getelementptr inbounds double, double* %0, i64 %35
store double %43, double* %44
%45 = add nuw nsw i64 %24, 2
%46 = add i64 %25, 2
%47 = icmp eq i64 %46, %22
br i1 %47, label %63, label %23
48: ; preds = %10, %48
%49 = phi i64 [ 0, %10 ], [ %61, %48 ]
%50 = trunc i64 %49 to i32
%51 = sitofp i32 %50 to double
%52 = fmul double %12, %51
%53 = tail call double @sin(double %52)
%54 = fmul double %11, %53
%55 = tail call double @llvm.fmuladd.f64(double %2, double %51, double %54)
%56 = fmul double %55, 0x401921FB54442D18
%57 = tail call double @cos(double %56)
%58 = getelementptr inbounds double, double* %0, i64 %49
store double %57, double* %58
%59 = tail call double @sin(double %56)
%60 = getelementptr inbounds double, double* %1, i64 %49
store double %59, double* %60
%61 = add nuw nsw i64 %49, 1
%62 = icmp eq i64 %61, %13
br i1 %62, label %76, label %48
63: ; preds = %23, %15
%64 = phi i64 [ 0, %15 ], [ %45, %23 ]
%65 = icmp eq i64 %19, 0
br i1 %65, label %76, label %66
66: ; preds = %63
%67 = trunc i64 %64 to i32
%68 = sitofp i32 %67 to double
%69 = fmul double %17, %68
%70 = tail call double @sin(double %69)
%71 = fmul double %16, %70
%72 = tail call double @llvm.fmuladd.f64(double %2, double %68, double %71)
%73 = fmul double %72, 0x401921FB54442D18
%74 = tail call double @cos(double %73)
%75 = getelementptr inbounds double, double* %0, i64 %64
store double %74, double* %75
br label %76
76: ; preds = %48, %66, %63, %9, %14
ret void
}