#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 const atan(double);
double const pow(double, double const);
double const sas_gamma(double const);
double const sin(double const);
double square(double);
double fractal_sq(double q, double radius, double fractal_dim,
                  double cor_length) {
  double term;
  if (q == 0.) {
    const double D = fractal_dim;
    term = pow(cor_length / radius, D) * sas_gamma(D + 1.);
  } else if (fractal_dim == 0.) {
    term = 1.0;
  } else if (fractal_dim == 1.) {
    term = atan(q * cor_length) / (q * radius);
  } else {
    const double D = fractal_dim;
    const double Dm1 = fractal_dim - 1.0;
    const double t1 = sas_gamma(D + 1.) / Dm1 * sin(Dm1 * atan(q * cor_length));
    const double t2 = pow(q * radius, -D);
    const double t3 = pow(1.0 + 1.0 / square(q * cor_length), -0.5 * Dm1);
    term = t1 * t2 * t3;
  }
  return 1.0 + term;
}


x86 assembly (clang, -O0):
<fractal_sq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11cf <fractal_sq+0x7f>
jp     11cf <fractal_sq+0x7f>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
call   1070 <pow@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  0xe51(%rip),%xmm0
addsd  -0x30(%rbp),%xmm0
call   1060 <sas_gamma@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    1340 <fractal_sq+0x1f0>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11f9 <fractal_sq+0xa9>
jp     11f9 <fractal_sq+0xa9>
movsd  0xe11(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    133b <fractal_sq+0x1eb>
movsd  -0x18(%rbp),%xmm0
movsd  0xdfa(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    123d <fractal_sq+0xed>
jp     123d <fractal_sq+0xed>
movsd  -0x8(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
call   1050 <atan@plt>
movsd  -0x8(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    1336 <fractal_sq+0x1e6>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xdac(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xd9b(%rip),%xmm0
addsd  -0x38(%rbp),%xmm0
call   1060 <sas_gamma@plt>
divsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
call   1050 <atan@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
mulsd  %xmm1,%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
call   1070 <pow@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
call   1030 <square@plt>
movsd  0xd05(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  0xcf9(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  0xcf5(%rip),%xmm1
mulsd  -0x40(%rbp),%xmm1
call   1070 <pow@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x48(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
mulsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    133b <fractal_sq+0x1eb>
jmp    1340 <fractal_sq+0x1f0>
movsd  0xcb8(%rip),%xmm0
addsd  -0x28(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fractal_sq>:
sub    $0x38,%rsp
movapd %xmm0,%xmm4
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm4
jne    11a1 <fractal_sq+0x51>
jp     11a1 <fractal_sq+0x51>
divsd  %xmm1,%xmm3
movapd %xmm3,%xmm0
movapd %xmm2,%xmm1
movapd %xmm2,0x20(%rsp)
call   1070 <pow@plt>
movsd  %xmm0,(%rsp)
movapd 0x20(%rsp),%xmm0
addsd  0xe72(%rip),%xmm0
call   1060 <sas_gamma@plt>
movapd %xmm0,%xmm1
mulsd  (%rsp),%xmm1
jmp    12c2 <fractal_sq+0x172>
ucomisd %xmm0,%xmm2
jne    11b6 <fractal_sq+0x66>
jp     11b6 <fractal_sq+0x66>
movsd  0xe4f(%rip),%xmm1
jmp    12c2 <fractal_sq+0x172>
movsd  %xmm1,0x30(%rsp)
ucomisd 0xe3c(%rip),%xmm2
movsd  %xmm4,(%rsp)
jne    11f2 <fractal_sq+0xa2>
jp     11f2 <fractal_sq+0xa2>
mulsd  %xmm4,%xmm3
movapd %xmm3,%xmm0
call   1050 <atan@plt>
movapd %xmm0,%xmm1
movsd  0x30(%rsp),%xmm0
mulsd  (%rsp),%xmm0
divsd  %xmm0,%xmm1
jmp    12c2 <fractal_sq+0x172>
movsd  0xe0e(%rip),%xmm0
addsd  %xmm2,%xmm0
movsd  %xmm0,0x18(%rsp)
movapd %xmm2,%xmm0
addsd  0xdf0(%rip),%xmm0
movsd  %xmm3,0x10(%rsp)
movapd %xmm2,0x20(%rsp)
call   1060 <sas_gamma@plt>
divsd  0x18(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
mulsd  (%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
call   1050 <atan@plt>
mulsd  0x18(%rsp),%xmm0
call   1040 <sin@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x30(%rsp),%xmm0
mulsd  (%rsp),%xmm0
movaps 0x20(%rsp),%xmm1
xorps  0xdaf(%rip),%xmm1
call   1070 <pow@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <square@plt>
movsd  0xd71(%rip),%xmm1
movapd %xmm1,%xmm2
divsd  %xmm0,%xmm2
addsd  %xmm1,%xmm2
movsd  0x18(%rsp),%xmm1
mulsd  0xd67(%rip),%xmm1
movapd %xmm2,%xmm0
call   1070 <pow@plt>
movsd  0x20(%rsp),%xmm1
mulsd  0x8(%rsp),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xd36(%rip),%xmm1
movapd %xmm1,%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
define double @fractal_sq(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%16 = load double, double* %5
%17 = fcmp oeq double %16, 0.000000e+00
br i1 %17, label %18, label %29
18: ; preds = %4
%19 = load double, double* %7
store double %19, double* %10
%20 = load double, double* %8
%21 = load double, double* %6
%22 = fdiv double %20, %21
%23 = load double, double* %10
%24 = call double @pow(double %22, double %23)
%25 = load double, double* %10
%26 = fadd double %25, 1.000000e+00
%27 = call double @sas_gamma(double %26)
%28 = fmul double %24, %27
store double %28, double* %9
br label %84
29: ; preds = %4
%30 = load double, double* %7
%31 = fcmp oeq double %30, 0.000000e+00
br i1 %31, label %32, label %33
32: ; preds = %29
store double 1.000000e+00, double* %9
br label %83
33: ; preds = %29
%34 = load double, double* %7
%35 = fcmp oeq double %34, 1.000000e+00
br i1 %35, label %36, label %45
36: ; preds = %33
%37 = load double, double* %5
%38 = load double, double* %8
%39 = fmul double %37, %38
%40 = call double @atan(double %39)
%41 = load double, double* %5
%42 = load double, double* %6
%43 = fmul double %41, %42
%44 = fdiv double %40, %43
store double %44, double* %9
br label %82
45: ; preds = %33
%46 = load double, double* %7
store double %46, double* %11
%47 = load double, double* %7
%48 = fsub double %47, 1.000000e+00
store double %48, double* %12
%49 = load double, double* %11
%50 = fadd double %49, 1.000000e+00
%51 = call double @sas_gamma(double %50)
%52 = load double, double* %12
%53 = fdiv double %51, %52
%54 = load double, double* %12
%55 = load double, double* %5
%56 = load double, double* %8
%57 = fmul double %55, %56
%58 = call double @atan(double %57)
%59 = fmul double %54, %58
%60 = call double @sin(double %59)
%61 = fmul double %53, %60
store double %61, double* %13
%62 = load double, double* %5
%63 = load double, double* %6
%64 = fmul double %62, %63
%65 = load double, double* %11
%66 = fneg double %65
%67 = call double @pow(double %64, double %66)
store double %67, double* %14
%68 = load double, double* %5
%69 = load double, double* %8
%70 = fmul double %68, %69
%71 = call double @square(double %70)
%72 = fdiv double 1.000000e+00, %71
%73 = fadd double 1.000000e+00, %72
%74 = load double, double* %12
%75 = fmul double -5.000000e-01, %74
%76 = call double @pow(double %73, double %75)
store double %76, double* %15
%77 = load double, double* %13
%78 = load double, double* %14
%79 = fmul double %77, %78
%80 = load double, double* %15
%81 = fmul double %79, %80
store double %81, double* %9
br label %82
82: ; preds = %45, %36
br label %83
83: ; preds = %82, %32
br label %84
84: ; preds = %83, %18
%85 = load double, double* %9
%86 = fadd double 1.000000e+00, %85
ret double %86
}

LLVM IR (-O2):
define double @fractal_sq(double %0, double %1, double %2, double %3) {
%5 = fcmp oeq double %0, 0.000000e+00
br i1 %5, label %6, label %12
6: ; preds = %4
%7 = fdiv double %3, %1
%8 = tail call double @pow(double %7, double %2)
%9 = fadd double %2, 1.000000e+00
%10 = tail call double @sas_gamma(double %9)
%11 = fmul double %8, %10
br label %41
12: ; preds = %4
%13 = fcmp oeq double %2, 0.000000e+00
br i1 %13, label %41, label %14
14: ; preds = %12
%15 = fcmp oeq double %2, 1.000000e+00
br i1 %15, label %16, label %21
16: ; preds = %14
%17 = fmul double %0, %3
%18 = tail call double @atan(double %17)
%19 = fmul double %0, %1
%20 = fdiv double %18, %19
br label %41
21: ; preds = %14
%22 = fadd double %2, -1.000000e+00
%23 = fadd double %2, 1.000000e+00
%24 = tail call double @sas_gamma(double %23)
%25 = fdiv double %24, %22
%26 = fmul double %0, %3
%27 = tail call double @atan(double %26)
%28 = fmul double %22, %27
%29 = tail call double @sin(double %28)
%30 = fmul double %25, %29
%31 = fmul double %0, %1
%32 = fneg double %2
%33 = tail call double @pow(double %31, double %32)
%34 = tail call double @square(double %26)
%35 = fdiv double 1.000000e+00, %34
%36 = fadd double %35, 1.000000e+00
%37 = fmul double %22, -5.000000e-01
%38 = tail call double @pow(double %36, double %37)
%39 = fmul double %30, %33
%40 = fmul double %39, %38
br label %41
41: ; preds = %12, %21, %16, %6
%42 = phi double [ %11, %6 ], [ %20, %16 ], [ %40, %21 ], [ 1.000000e+00, %12 ]
%43 = fadd double %42, 1.000000e+00
ret double %43
}