#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(int);
double sin(int);
int kff_synthese_breitenkreis(double lambda_inc, double lambda_anf,
                              double lambda_end, char winkelmass,
                              double **leg_func, int mindeg, int maxdeg,
                              double **c_lm, double **s_lm, double *f) {
  double fzw;
  double lambda;
  int l;
  int m;
  int i;
  mindeg = (mindeg < 0) ? 0 : mindeg;
  if (winkelmass == 'A') {
    lambda_inc *= (3.141592653589793 / 180.0);
    lambda_anf *= (3.141592653589793 / 180.0);
    lambda_end *= (3.141592653589793 / 180.0);
  }
  for (i = 0, lambda = lambda_anf; lambda <= lambda_end;
       i++, lambda += lambda_inc) {
    f[i] = 0.;
    for (l = mindeg; l <= maxdeg; l++) {
      fzw = leg_func[l][0] * c_lm[l][0];
      for (m = 1; m <= l; m++) {
        fzw += (leg_func[l][m] *
                (c_lm[l][m] * cos(m * lambda) + s_lm[l][m] * sin(m * lambda)));
      }
      f[i] += fzw;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<kff_synthese_breitenkreis>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %dil,%al
mov    0x10(%rbp),%rdi
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    %al,-0x19(%rbp)
mov    %rsi,-0x28(%rbp)
mov    %edx,-0x2c(%rbp)
mov    %ecx,-0x30(%rbp)
mov    %r8,-0x38(%rbp)
mov    %r9,-0x40(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jge    116a <kff_synthese_breitenkreis+0x4a>
xor    %eax,%eax
mov    %eax,-0x60(%rbp)
jmp    1170 <kff_synthese_breitenkreis+0x50>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x60(%rbp)
mov    -0x60(%rbp),%eax
mov    %eax,-0x2c(%rbp)
movsbl -0x19(%rbp),%eax
cmp    $0x41,%eax
jne    11b9 <kff_synthese_breitenkreis+0x99>
movsd  0xe75(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  0xe63(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe51(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x0,-0x5c(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     133b <kff_synthese_breitenkreis+0x21b>
mov    0x10(%rbp),%rax
movslq -0x5c(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x30(%rbp),%eax
jg     1319 <kff_synthese_breitenkreis+0x1f9>
mov    -0x28(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  (%rax),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mulsd  (%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
movl   $0x1,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x54(%rbp),%eax
jg     12f4 <kff_synthese_breitenkreis+0x1d4>
mov    -0x28(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x58(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x38(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x58(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x78(%rbp)
cvtsi2sdl -0x58(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <cos@plt>
movsd  %xmm0,-0x70(%rbp)
mov    -0x40(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x58(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x80(%rbp)
cvtsi2sdl -0x58(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
movsd  -0x80(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm2
movsd  -0x70(%rbp),%xmm3
movaps %xmm0,%xmm4
movsd  -0x68(%rbp),%xmm0
mulsd  %xmm4,%xmm1
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
movsd  -0x48(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    122c <kff_synthese_breitenkreis+0x10c>
movsd  -0x48(%rbp),%xmm0
mov    0x10(%rbp),%rax
movslq -0x5c(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    11f4 <kff_synthese_breitenkreis+0xd4>
jmp    131e <kff_synthese_breitenkreis+0x1fe>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    11ca <kff_synthese_breitenkreis+0xaa>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kff_synthese_breitenkreis>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %r9,%r12
mov    %rcx,0x48(%rsp)
xor    %eax,%eax
test   %edx,%edx
cmovns %edx,%eax
mov    %eax,0x4(%rsp)
cmp    $0x41,%dil
jne    115e <kff_synthese_breitenkreis+0x3e>
movsd  0xeae(%rip),%xmm3
mulsd  %xmm3,%xmm0
mulsd  %xmm3,%xmm1
mulsd  %xmm3,%xmm2
ucomisd %xmm1,%xmm2
jae    1178 <kff_synthese_breitenkreis+0x58>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0xc0(%rsp),%rdx
mov    0x4(%rsp),%ecx
mov    0x48(%rsp),%rax
add    $0x1,%eax
mov    %rax,0x78(%rsp)
mov    $0x1,%eax
mov    %rcx,0x58(%rsp)
sub    %rcx,%rax
mov    %rax,0x50(%rsp)
xor    %edi,%edi
mov    %rsi,0x10(%rsp)
movsd  %xmm2,0x60(%rsp)
movsd  %xmm0,0x68(%rsp)
jmp    11da <kff_synthese_breitenkreis+0xba>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rdi
movsd  0x8(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  0x60(%rsp),%xmm2
ucomisd %xmm1,%xmm2
jb     1164 <kff_synthese_breitenkreis+0x44>
movsd  %xmm1,0x8(%rsp)
movq   $0x0,(%rdx,%rdi,8)
mov    0x4(%rsp),%eax
cmp    0x48(%rsp),%eax
jg     11c0 <kff_synthese_breitenkreis+0xa0>
cvttsd2si 0x8(%rsp),%eax
mov    %eax,0x44(%rsp)
xorpd  %xmm1,%xmm1
mov    0x50(%rsp),%r13
mov    0x58(%rsp),%r15
mov    %rdi,0x70(%rsp)
jmp    1267 <kff_synthese_breitenkreis+0x147>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%r8
mov    0x10(%rsp),%rsi
mov    0xc0(%rsp),%rdx
mov    0x70(%rsp),%rdi
movsd  (%rdx,%rdi,8),%xmm1
movapd %xmm0,%xmm2
movsd  0x68(%rsp),%xmm0
mov    0x80(%rsp),%r14
addsd  %xmm2,%xmm1
movsd  %xmm1,(%rdx,%rdi,8)
add    $0xffffffffffffffff,%r13
mov    %r14,%r15
cmp    0x78(%rsp),%r14
je     11c0 <kff_synthese_breitenkreis+0xa0>
lea    0x1(%r15),%r14
mov    (%rsi,%r15,8),%rax
movsd  (%rax),%xmm2
mov    (%r8,%r15,8),%rcx
mulsd  (%rcx),%xmm2
test   %r15,%r15
je     124c <kff_synthese_breitenkreis+0x12c>
mov    %r8,%rbx
movsd  0x8(%rax),%xmm0
movsd  %xmm0,0x30(%rsp)
movsd  0x8(%rcx),%xmm0
movsd  %xmm0,0x20(%rsp)
mov    0x44(%rsp),%ebp
mov    %ebp,%edi
movsd  %xmm2,0x28(%rsp)
call   1040 <cos@plt>
movsd  %xmm0,0x38(%rsp)
mov    (%r12,%r15,8),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,0x18(%rsp)
mov    %ebp,%edi
call   1030 <sin@plt>
mulsd  0x18(%rsp),%xmm0
movsd  0x38(%rsp),%xmm1
mulsd  0x20(%rsp),%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
mulsd  0x30(%rsp),%xmm0
addsd  0x28(%rsp),%xmm0
cmp    $0x1,%r15
mov    %r14,0x80(%rsp)
je     1220 <kff_synthese_breitenkreis+0x100>
mov    $0x2,%r14d
mov    %rbx,%r8
mov    0x10(%rsp),%rsi
nopl   0x0(%rax)
movsd  %xmm0,0x38(%rsp)
mov    (%rsi,%r15,8),%rax
mov    (%r8,%r15,8),%rcx
movsd  (%rax,%r14,8),%xmm0
movsd  %xmm0,0x30(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %r14d,%xmm0
movsd  (%rcx,%r14,8),%xmm1
movsd  %xmm1,0x28(%rsp)
mulsd  0x8(%rsp),%xmm0
cvttsd2si %xmm0,%ebp
mov    %ebp,%edi
call   1040 <cos@plt>
movsd  %xmm0,0x20(%rsp)
mov    (%r12,%r15,8),%rax
movsd  (%rax,%r14,8),%xmm0
movsd  %xmm0,0x18(%rsp)
mov    %ebp,%edi
call   1030 <sin@plt>
mov    0x10(%rsp),%rsi
mov    %rbx,%r8
mulsd  0x18(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
mulsd  0x28(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  0x38(%rsp),%xmm0
mulsd  0x30(%rsp),%xmm1
addsd  %xmm1,%xmm0
lea    (%r14,%r13,1),%rax
add    $0x1,%rax
add    $0x1,%r14
cmp    $0x2,%rax
jne    1310 <kff_synthese_breitenkreis+0x1f0>
jmp    1228 <kff_synthese_breitenkreis+0x108>

LLVM IR (-O0):
define i32 @kff_synthese_breitenkreis(double %0, double %1, double %2, i8 signext %3, double** %4, i32 %5, i32 %6, double** %7, double** %8, double* %9) {
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca i8
%15 = alloca double**
%16 = alloca i32
%17 = alloca i32
%18 = alloca double**
%19 = alloca double**
%20 = alloca double*
%21 = alloca double
%22 = alloca double
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
store double %0, double* %11
store double %1, double* %12
store double %2, double* %13
store i8 %3, i8* %14
store double** %4, double*** %15
store i32 %5, i32* %16
store i32 %6, i32* %17
store double** %7, double*** %18
store double** %8, double*** %19
store double* %9, double** %20
%26 = load i32, i32* %16
%27 = icmp slt i32 %26, 0
br i1 %27, label %28, label %29
28: ; preds = %10
br label %31
29: ; preds = %10
%30 = load i32, i32* %16
br label %31
31: ; preds = %29, %28
%32 = phi i32 [ 0, %28 ], [ %30, %29 ]
store i32 %32, i32* %16
%33 = load i8, i8* %14
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 65
br i1 %35, label %36, label %43
36: ; preds = %31
%37 = load double, double* %11
%38 = fmul double %37, 0x3F91DF46A2529D39
store double %38, double* %11
%39 = load double, double* %12
%40 = fmul double %39, 0x3F91DF46A2529D39
store double %40, double* %12
%41 = load double, double* %13
%42 = fmul double %41, 0x3F91DF46A2529D39
store double %42, double* %13
br label %43
43: ; preds = %36, %31
store i32 0, i32* %25
%44 = load double, double* %12
store double %44, double* %22
br label %45
45: ; preds = %138, %43
%46 = load double, double* %22
%47 = load double, double* %13
%48 = fcmp ole double %46, %47
br i1 %48, label %49, label %144
49: ; preds = %45
%50 = load double*, double** %20
%51 = load i32, i32* %25
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds double, double* %50, i64 %52
store double 0.000000e+00, double* %53
%54 = load i32, i32* %16
store i32 %54, i32* %23
br label %55
55: ; preds = %134, %49
%56 = load i32, i32* %23
%57 = load i32, i32* %17
%58 = icmp sle i32 %56, %57
br i1 %58, label %59, label %137
59: ; preds = %55
%60 = load double**, double*** %15
%61 = load i32, i32* %23
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds double*, double** %60, i64 %62
%64 = load double*, double** %63
%65 = getelementptr inbounds double, double* %64, i64 0
%66 = load double, double* %65
%67 = load double**, double*** %18
%68 = load i32, i32* %23
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds double*, double** %67, i64 %69
%71 = load double*, double** %70
%72 = getelementptr inbounds double, double* %71, i64 0
%73 = load double, double* %72
%74 = fmul double %66, %73
store double %74, double* %21
store i32 1, i32* %24
br label %75
75: ; preds = %123, %59
%76 = load i32, i32* %24
%77 = load i32, i32* %23
%78 = icmp sle i32 %76, %77
br i1 %78, label %79, label %126
79: ; preds = %75
%80 = load double**, double*** %15
%81 = load i32, i32* %23
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds double*, double** %80, i64 %82
%84 = load double*, double** %83
%85 = load i32, i32* %24
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds double, double* %84, i64 %86
%88 = load double, double* %87
%89 = load double**, double*** %18
%90 = load i32, i32* %23
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds double*, double** %89, i64 %91
%93 = load double*, double** %92
%94 = load i32, i32* %24
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds double, double* %93, i64 %95
%97 = load double, double* %96
%98 = load i32, i32* %24
%99 = sitofp i32 %98 to double
%100 = load double, double* %22
%101 = fmul double %99, %100
%102 = fptosi double %101 to i32
%103 = call double @cos(i32 %102)
%104 = load double**, double*** %19
%105 = load i32, i32* %23
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds double*, double** %104, i64 %106
%108 = load double*, double** %107
%109 = load i32, i32* %24
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds double, double* %108, i64 %110
%112 = load double, double* %111
%113 = load i32, i32* %24
%114 = sitofp i32 %113 to double
%115 = load double, double* %22
%116 = fmul double %114, %115
%117 = fptosi double %116 to i32
%118 = call double @sin(i32 %117)
%119 = fmul double %112, %118
%120 = call double @llvm.fmuladd.f64(double %97, double %103, double %119)
%121 = load double, double* %21
%122 = call double @llvm.fmuladd.f64(double %88, double %120, double %121)
store double %122, double* %21
br label %123
123: ; preds = %79
%124 = load i32, i32* %24
%125 = add nsw i32 %124, 1
store i32 %125, i32* %24
br label %75
126: ; preds = %75
%127 = load double, double* %21
%128 = load double*, double** %20
%129 = load i32, i32* %25
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds double, double* %128, i64 %130
%132 = load double, double* %131
%133 = fadd double %132, %127
store double %133, double* %131
br label %134
134: ; preds = %126
%135 = load i32, i32* %23
%136 = add nsw i32 %135, 1
store i32 %136, i32* %23
br label %55
137: ; preds = %55
br label %138
138: ; preds = %137
%139 = load i32, i32* %25
%140 = add nsw i32 %139, 1
store i32 %140, i32* %25
%141 = load double, double* %11
%142 = load double, double* %22
%143 = fadd double %142, %141
store double %143, double* %22
br label %45
144: ; preds = %45
ret i32 0
}

LLVM IR (-O2):
define i32 @kff_synthese_breitenkreis(double %0, double %1, double %2, i8 signext %3, double** nocapture %4, i32 %5, i32 %6, double** nocapture %7, double** nocapture %8, double* nocapture %9) {
%11 = icmp sgt i32 %5, 0
%12 = select i1 %11, i32 %5, i32 0
%13 = icmp eq i8 %3, 65
%14 = fmul double %0, 0x3F91DF46A2529D39
%15 = fmul double %1, 0x3F91DF46A2529D39
%16 = fmul double %2, 0x3F91DF46A2529D39
%17 = select i1 %13, double %16, double %2
%18 = select i1 %13, double %15, double %1
%19 = select i1 %13, double %14, double %0
%20 = fcmp ugt double %18, %17
br i1 %20, label %96, label %21
21: ; preds = %10
%22 = icmp sgt i32 %12, %6
%23 = zext i32 %12 to i64
%24 = add i32 %6, 1
%25 = zext i32 %24 to i64
br label %26
26: ; preds = %21, %92
%27 = phi i64 [ 0, %21 ], [ %93, %92 ]
%28 = phi double [ %18, %21 ], [ %94, %92 ]
%29 = getelementptr inbounds double, double* %9, i64 %27
store double 0.000000e+00, double* %29
br i1 %22, label %92, label %30
30: ; preds = %26
%31 = fptosi double %28 to i32
br label %32
32: ; preds = %30, %86
%33 = phi double [ %89, %86 ], [ 0.000000e+00, %30 ]
%34 = phi i64 [ %90, %86 ], [ %23, %30 ]
%35 = phi i64 [ %36, %86 ], [ %23, %30 ]
%36 = add nuw nsw i64 %35, 1
%37 = getelementptr inbounds double*, double** %4, i64 %34
%38 = load double*, double** %37
%39 = load double, double* %38
%40 = getelementptr inbounds double*, double** %7, i64 %34
%41 = load double*, double** %40
%42 = load double, double* %41
%43 = fmul double %39, %42
%44 = icmp eq i64 %34, 0
br i1 %44, label %86, label %45
45: ; preds = %32
%46 = getelementptr inbounds double*, double** %8, i64 %34
%47 = getelementptr inbounds double, double* %38, i64 1
%48 = load double, double* %47
%49 = getelementptr inbounds double, double* %41, i64 1
%50 = load double, double* %49
%51 = tail call double @cos(i32 %31)
%52 = load double*, double** %46
%53 = getelementptr inbounds double, double* %52, i64 1
%54 = load double, double* %53
%55 = tail call double @sin(i32 %31)
%56 = fmul double %54, %55
%57 = tail call double @llvm.fmuladd.f64(double %50, double %51, double %56)
%58 = tail call double @llvm.fmuladd.f64(double %48, double %57, double %43)
%59 = icmp eq i64 %35, 1
br i1 %59, label %83, label %60
60: ; preds = %45, %60
%61 = phi double [ %81, %60 ], [ %58, %45 ]
%62 = phi i64 [ %63, %60 ], [ 1, %45 ]
%63 = add nuw nsw i64 %62, 1
%64 = load double*, double** %37
%65 = load double*, double** %40
%66 = getelementptr inbounds double, double* %64, i64 %63
%67 = load double, double* %66
%68 = getelementptr inbounds double, double* %65, i64 %63
%69 = load double, double* %68
%70 = trunc i64 %63 to i32
%71 = sitofp i32 %70 to double
%72 = fmul double %28, %71
%73 = fptosi double %72 to i32
%74 = tail call double @cos(i32 %73)
%75 = load double*, double** %46
%76 = getelementptr inbounds double, double* %75, i64 %63
%77 = load double, double* %76
%78 = tail call double @sin(i32 %73)
%79 = fmul double %77, %78
%80 = tail call double @llvm.fmuladd.f64(double %69, double %74, double %79)
%81 = tail call double @llvm.fmuladd.f64(double %67, double %80, double %61)
%82 = icmp eq i64 %63, %35
br i1 %82, label %83, label %60
83: ; preds = %60, %45
%84 = phi double [ %58, %45 ], [ %81, %60 ]
%85 = load double, double* %29
br label %86
86: ; preds = %83, %32
%87 = phi double [ %33, %32 ], [ %85, %83 ]
%88 = phi double [ %43, %32 ], [ %84, %83 ]
%89 = fadd double %88, %87
store double %89, double* %29
%90 = add nuw nsw i64 %34, 1
%91 = icmp eq i64 %90, %25
br i1 %91, label %92, label %32
92: ; preds = %86, %26
%93 = add nuw i64 %27, 1
%94 = fadd double %19, %28
%95 = fcmp ugt double %94, %17
br i1 %95, label %96, label %26
96: ; preds = %92, %10
ret i32 0
}