#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
double Gaussian(float, double, double);
double Moffat(float, double, double);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, float, double, double,
                           double, double, double);
double moffat_alpha(float, int);
int main(void) {
  FILE *out;
  double co_g, co_m;
  float r, fwhm = 5, sigma;
  double p1_g, p1_m2, p1_m3, p1_m4, p1_m5;
  double p2_g, p2_m2, p2_m3, p2_m4, p2_m5;
  out = fopen("MoffatGaussianComp.txt", "w");
  p1_g = 1;
  p2_g = 0;
  sigma = fwhm / 2.35482;
  co_g = -1.0f / (2.0f * sigma * sigma);
  p1_m2 = moffat_alpha(fwhm, 2);
  p2_m2 = -2.0f;
  p1_m3 = moffat_alpha(fwhm, 3);
  p2_m3 = -3.0f;
  p1_m4 = moffat_alpha(fwhm, 4);
  p2_m4 = -4.0f;
  p1_m5 = moffat_alpha(fwhm, 5);
  p2_m5 = -5.0f;
  co_m = 0;
  for (r = 0.0f; r < 25; r += 0.1)
    fprintf(out, "%-10.1f %-10f %-10f %-10f %-10f %-10f\n", r,
            Gaussian(r / p1_g, p2_g, co_g), Moffat(r / p1_m2, p2_m2, co_m),
            Moffat(r / p1_m3, p2_m3, co_m), Moffat(r / p1_m4, p2_m4, co_m),
            Moffat(r / p1_m5, p2_m5, co_m));
  fclose(out);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xec6(%rip),%xmm0
movss  %xmm0,-0x28(%rbp)
lea    0xec2(%rip),%rdi
lea    0xed2(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
movsd  0xe8a(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe64(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  0xe6b(%rip),%xmm1
mulss  -0x2c(%rbp),%xmm1
mulss  -0x2c(%rbp),%xmm1
movss  0xe55(%rip),%xmm0
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movss  -0x28(%rbp),%xmm0
mov    $0x2,%edi
call   1050 <moffat_alpha@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  0xe0c(%rip),%xmm0
movsd  %xmm0,-0x68(%rbp)
movss  -0x28(%rbp),%xmm0
mov    $0x3,%edi
call   1050 <moffat_alpha@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  0xde3(%rip),%xmm0
movsd  %xmm0,-0x70(%rbp)
movss  -0x28(%rbp),%xmm0
mov    $0x4,%edi
call   1050 <moffat_alpha@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  0xdba(%rip),%xmm0
movsd  %xmm0,-0x78(%rbp)
movss  -0x28(%rbp),%xmm0
mov    $0x5,%edi
call   1050 <moffat_alpha@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  0xd91(%rip),%xmm0
movsd  %xmm0,-0x80(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  0xdb8(%rip),%xmm0
ucomiss -0x24(%rbp),%xmm0
jbe    13d4 <main+0x274>
mov    -0x10(%rbp),%rax
mov    %rax,-0xb0(%rbp)
movss  -0x24(%rbp),%xmm0
movss  %xmm0,-0x84(%rbp)
ff
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
divsd  -0x38(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movsd  -0x60(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
call   1080 <Gaussian@plt>
movsd  %xmm0,-0xa8(%rbp)
ff
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
divsd  -0x40(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movsd  -0x68(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
call   1070 <Moffat@plt>
movsd  %xmm0,-0xa0(%rbp)
ff
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
divsd  -0x48(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movsd  -0x70(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
call   1070 <Moffat@plt>
movsd  %xmm0,-0x98(%rbp)
ff
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
divsd  -0x50(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movsd  -0x78(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
call   1070 <Moffat@plt>
movsd  %xmm0,-0x90(%rbp)
ff
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
divsd  -0x58(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movsd  -0x80(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
call   1070 <Moffat@plt>
mov    -0xb0(%rbp),%rdi
movsd  -0xa8(%rbp),%xmm1
ff
movsd  -0xa0(%rbp),%xmm2
ff
movsd  -0x98(%rbp),%xmm3
ff
movsd  -0x90(%rbp),%xmm4
ff
movaps %xmm0,%xmm5
movss  -0x84(%rbp),%xmm0
ff
lea    0xcb5(%rip),%rsi
call   1040 <fprintf@plt>
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xc6e(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
jmp    1284 <main+0x124>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x4(%rbp),%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x58,%rsp
lea    0xeca(%rip),%rdi
lea    0xeda(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
movss  0xe7b(%rip),%xmm0
mov    $0x2,%edi
call   1050 <moffat_alpha@plt>
movsd  %xmm0,0x30(%rsp)
movss  0xe63(%rip),%xmm0
mov    $0x3,%edi
call   1050 <moffat_alpha@plt>
movsd  %xmm0,0x28(%rsp)
movss  0xe4b(%rip),%xmm0
mov    $0x4,%edi
call   1050 <moffat_alpha@plt>
movsd  %xmm0,0x20(%rsp)
movss  0xe33(%rip),%xmm0
mov    $0x5,%edi
call   1050 <moffat_alpha@plt>
movsd  %xmm0,0x18(%rsp)
xorps  %xmm1,%xmm1
lea    0xe6a(%rip),%r14
nopw   0x0(%rax,%rax,1)
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
movaps %xmm1,%xmm0
movss  %xmm1,0x14(%rsp)
xorps  %xmm1,%xmm1
movsd  0xdf7(%rip),%xmm2
call   1080 <Gaussian@plt>
movsd  %xmm0,0x50(%rsp)
movsd  0x8(%rsp),%xmm0
divsd  0x30(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
xorps  %xmm2,%xmm2
movsd  0xdd9(%rip),%xmm1
call   1070 <Moffat@plt>
movsd  %xmm0,0x48(%rsp)
movsd  0x8(%rsp),%xmm0
divsd  0x28(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
xorps  %xmm2,%xmm2
movsd  0xdbb(%rip),%xmm1
call   1070 <Moffat@plt>
movsd  %xmm0,0x40(%rsp)
movsd  0x8(%rsp),%xmm0
divsd  0x20(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
xorps  %xmm2,%xmm2
movsd  0xd9d(%rip),%xmm1
call   1070 <Moffat@plt>
movsd  %xmm0,0x38(%rsp)
movsd  0x8(%rsp),%xmm0
divsd  0x18(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
xorps  %xmm2,%xmm2
movsd  0xd7f(%rip),%xmm1
call   1070 <Moffat@plt>
movaps %xmm0,%xmm5
mov    %rbx,%rdi
mov    %r14,%rsi
movss  0x14(%rsp),%xmm0
movsd  0x50(%rsp),%xmm1
movsd  0x48(%rsp),%xmm2
movsd  0x40(%rsp),%xmm3
movsd  0x38(%rsp),%xmm4
call   1040 <fprintf@plt>
movsd  0x8(%rsp),%xmm0
addsd  0xd48(%rip),%xmm0
xorps  %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm1
movss  0xd0d(%rip),%xmm0
ucomiss %xmm1,%xmm0
ja     11f0 <main+0x90>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [23 x i8] c"MoffatGaussianComp.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [39 x i8] c"%-10.1f %-10f %-10f %-10f %-10f %-10f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca double
%4 = alloca double
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
store i32 0, i32* %1
store float 5.000000e+00, float* %6
%18 = call i32* @fopen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %18, i32** %2
store double 1.000000e+00, double* %8
store double 0.000000e+00, double* %13
%19 = load float, float* %6
%20 = fpext float %19 to double
%21 = fdiv double %20, 2.354820e+00
%22 = fptrunc double %21 to float
store float %22, float* %7
%23 = load float, float* %7
%24 = fmul float 2.000000e+00, %23
%25 = load float, float* %7
%26 = fmul float %24, %25
%27 = fdiv float -1.000000e+00, %26
%28 = fpext float %27 to double
store double %28, double* %3
%29 = load float, float* %6
%30 = call double @moffat_alpha(float %29, i32 2)
store double %30, double* %9
store double -2.000000e+00, double* %14
%31 = load float, float* %6
%32 = call double @moffat_alpha(float %31, i32 3)
store double %32, double* %10
store double -3.000000e+00, double* %15
%33 = load float, float* %6
%34 = call double @moffat_alpha(float %33, i32 4)
store double %34, double* %11
store double -4.000000e+00, double* %16
%35 = load float, float* %6
%36 = call double @moffat_alpha(float %35, i32 5)
store double %36, double* %12
store double -5.000000e+00, double* %17
store double 0.000000e+00, double* %4
store float 0.000000e+00, float* %5
br label %37
37: ; preds = %84, %0
%38 = load float, float* %5
%39 = fcmp olt float %38, 2.500000e+01
br i1 %39, label %40, label %89
40: ; preds = %37
%41 = load i32*, i32** %2
%42 = load float, float* %5
%43 = load float, float* %5
%44 = fpext float %43 to double
%45 = load double, double* %8
%46 = fdiv double %44, %45
%47 = fptrunc double %46 to float
%48 = load double, double* %13
%49 = load double, double* %3
%50 = call double @Gaussian(float %47, double %48, double %49)
%51 = load float, float* %5
%52 = fpext float %51 to double
%53 = load double, double* %9
%54 = fdiv double %52, %53
%55 = fptrunc double %54 to float
%56 = load double, double* %14
%57 = load double, double* %4
%58 = call double @Moffat(float %55, double %56, double %57)
%59 = load float, float* %5
%60 = fpext float %59 to double
%61 = load double, double* %10
%62 = fdiv double %60, %61
%63 = fptrunc double %62 to float
%64 = load double, double* %15
%65 = load double, double* %4
%66 = call double @Moffat(float %63, double %64, double %65)
%67 = load float, float* %5
%68 = fpext float %67 to double
%69 = load double, double* %11
%70 = fdiv double %68, %69
%71 = fptrunc double %70 to float
%72 = load double, double* %16
%73 = load double, double* %4
%74 = call double @Moffat(float %71, double %72, double %73)
%75 = load float, float* %5
%76 = fpext float %75 to double
%77 = load double, double* %12
%78 = fdiv double %76, %77
%79 = fptrunc double %78 to float
%80 = load double, double* %17
%81 = load double, double* %4
%82 = call double @Moffat(float %79, double %80, double %81)
%83 = call i32 @fprintf(i32* %41, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), float %42, double %50, double %58, double %66, double %74, double %82)
br label %84
84: ; preds = %40
%85 = load float, float* %5
%86 = fpext float %85 to double
%87 = fadd double %86, 1.000000e-01
%88 = fptrunc double %87 to float
store float %88, float* %5
br label %37
89: ; preds = %37
%90 = load i32*, i32** %2
%91 = call i32 @fclose(i32* %90)
%92 = load i32, i32* %1
ret i32 %92
}

LLVM IR (-O2):
@.str = [23 x i8] c"MoffatGaussianComp.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [39 x i8] c"%-10.1f %-10f %-10f %-10f %-10f %-10f\0A\00"
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call double @moffat_alpha(float 5.000000e+00, i32 2)
%3 = tail call double @moffat_alpha(float 5.000000e+00, i32 3)
%4 = tail call double @moffat_alpha(float 5.000000e+00, i32 4)
%5 = tail call double @moffat_alpha(float 5.000000e+00, i32 5)
br label %6
6: ; preds = %0, %6
%7 = phi float [ 0.000000e+00, %0 ], [ %24, %6 ]
%8 = fpext float %7 to double
%9 = tail call double @Gaussian(float %7, double 0.000000e+00, double 0xBFBC642CA0000000)
%10 = fdiv double %8, %2
%11 = fptrunc double %10 to float
%12 = tail call double @Moffat(float %11, double -2.000000e+00, double 0.000000e+00)
%13 = fdiv double %8, %3
%14 = fptrunc double %13 to float
%15 = tail call double @Moffat(float %14, double -3.000000e+00, double 0.000000e+00)
%16 = fdiv double %8, %4
%17 = fptrunc double %16 to float
%18 = tail call double @Moffat(float %17, double -4.000000e+00, double 0.000000e+00)
%19 = fdiv double %8, %5
%20 = fptrunc double %19 to float
%21 = tail call double @Moffat(float %20, double -5.000000e+00, double 0.000000e+00)
%22 = tail call i32 @fprintf(i32* %1, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), float %7, double %9, double %12, double %15, double %18, double %21)
%23 = fadd double %8, 1.000000e-01
%24 = fptrunc double %23 to float
%25 = fcmp olt float %24, 2.500000e+01
br i1 %25, label %6, label %26
26: ; preds = %6
%27 = tail call i32 @fclose(i32* %1)
ret i32 0
}