#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 bingham_dF1_2d(double, double);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
void compute_range_bingham_dF2_2d(double *y, int n) {
  int i, j;
  double z1, z2;
  printf("dF2 = [ ...\n");
  fprintf(stderr, "dF2");
  for (i = 0; i < n; i++) {
    fprintf(stderr, ".");
    fflush(stderr);
    z1 = -y[i] * y[i];
    for (j = 0; j < n; j++) {
      z2 = -y[j] * y[j];
      printf("%f ", z1 <= z2 ? bingham_dF1_2d(z1, z2) : 0.0);
    }
    printf("; ...\n");
  }
  printf("];\n\n");
  fprintf(stderr, "\n");
}


x86 assembly (clang, -O0):
<compute_range_bingham_dF2_2d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e7c(%rip),%rax
mov    (%rax),%edi
lea    0xea0(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    129e <compute_range_bingham_dF2_2d+0x15e>
mov    0x2e54(%rip),%rax
mov    (%rax),%edi
lea    0xe7c(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e3f(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1282 <compute_range_bingham_dF2_2d+0x142>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1254 <compute_range_bingham_dF2_2d+0x114>
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
call   1060 <bingham_dF1_2d@plt>
movsd  %xmm0,-0x30(%rbp)
jmp    1261 <compute_range_bingham_dF2_2d+0x121>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1261 <compute_range_bingham_dF2_2d+0x121>
movsd  -0x30(%rbp),%xmm0
lea    0xda6(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11e5 <compute_range_bingham_dF2_2d+0xa5>
lea    0xd8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1179 <compute_range_bingham_dF2_2d+0x39>
lea    0xd79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2d2d(%rip),%rax
mov    (%rax),%edi
lea    0xd65(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compute_range_bingham_dF2_2d>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %esi,%r14d
mov    %rdi,%rbx
lea    0xead(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e69(%rip),%r13
mov    0x0(%r13),%edi
lea    0xe8e(%rip),%rsi
call   1050 <fprintf@plt>
test   %r14d,%r14d
jle    1230 <compute_range_bingham_dF2_2d+0xe0>
mov    %r14d,%ebp
xor    %r14d,%r14d
lea    0xe77(%rip),%r15
jmp    11b5 <compute_range_bingham_dF2_2d+0x65>
nop
lea    0xe81(%rip),%rdi
call   1030 <puts@plt>
add    $0x1,%r14
cmp    %rbp,%r14
je     1230 <compute_range_bingham_dF2_2d+0xe0>
mov    0x0(%r13),%edi
lea    0xe6c(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x0(%r13),%edi
call   1060 <fflush@plt>
movsd  (%rbx,%r14,8),%xmm0
movapd %xmm0,%xmm1
xorpd  0xe20(%rip),%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm1,(%rsp)
xor    %r12d,%r12d
jmp    1203 <compute_range_bingham_dF2_2d+0xb3>
xchg   %ax,%ax
mov    %r15,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%r12
cmp    %r12,%rbp
je     11a0 <compute_range_bingham_dF2_2d+0x50>
movsd  (%rbx,%r12,8),%xmm0
movapd %xmm0,%xmm1
xorpd  0xdeb(%rip),%xmm1
mulsd  %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd (%rsp),%xmm1
jb     11f0 <compute_range_bingham_dF2_2d+0xa0>
movapd (%rsp),%xmm0
call   1070 <bingham_dF1_2d@plt>
jmp    11f0 <compute_range_bingham_dF2_2d+0xa0>
lea    0xded(%rip),%rdi
call   1030 <puts@plt>
mov    0x0(%r13),%edi
lea    0xddf(%rip),%rsi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <fprintf@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"dF2 = [ ...\0A\00"
@stderr = global i32 0
@.str.1 = [4 x i8] c"dF2\00"
@.str.2 = [2 x i8] c".\00"
@.str.3 = [4 x i8] c"%f \00"
@.str.4 = [7 x i8] c"; ...\0A\00"
@.str.5 = [5 x i8] c"];\0A\0A\00"
@.str.6 = [2 x i8] c"\0A\00"
define void @compute_range_bingham_dF2_2d(double* %0, i32 %1) {
%3 = alloca double*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
%8 = alloca double
store double* %0, double** %3
store i32 %1, i32* %4
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %5
br label %12
12: ; preds = %66, %2
%13 = load i32, i32* %5
%14 = load i32, i32* %4
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %69
16: ; preds = %12
%17 = load i32, i32* @stderr
%18 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%19 = load i32, i32* @stderr
%20 = call i32 @fflush(i32 %19)
%21 = load double*, double** %3
%22 = load i32, i32* %5
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds double, double* %21, i64 %23
%25 = load double, double* %24
%26 = fneg double %25
%27 = load double*, double** %3
%28 = load i32, i32* %5
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds double, double* %27, i64 %29
%31 = load double, double* %30
%32 = fmul double %26, %31
store double %32, double* %7
store i32 0, i32* %6
br label %33
33: ; preds = %61, %16
%34 = load i32, i32* %6
%35 = load i32, i32* %4
%36 = icmp slt i32 %34, %35
br i1 %36, label %37, label %64
37: ; preds = %33
%38 = load double*, double** %3
%39 = load i32, i32* %6
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds double, double* %38, i64 %40
%42 = load double, double* %41
%43 = fneg double %42
%44 = load double*, double** %3
%45 = load i32, i32* %6
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds double, double* %44, i64 %46
%48 = load double, double* %47
%49 = fmul double %43, %48
store double %49, double* %8
%50 = load double, double* %7
%51 = load double, double* %8
%52 = fcmp ole double %50, %51
br i1 %52, label %53, label %57
53: ; preds = %37
%54 = load double, double* %7
%55 = load double, double* %8
%56 = call double @bingham_dF1_2d(double %54, double %55)
br label %58
57: ; preds = %37
br label %58
58: ; preds = %57, %53
%59 = phi double [ %56, %53 ], [ 0.000000e+00, %57 ]
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), double %59)
br label %61
61: ; preds = %58
%62 = load i32, i32* %6
%63 = add nsw i32 %62, 1
store i32 %63, i32* %6
br label %33
64: ; preds = %33
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %66
66: ; preds = %64
%67 = load i32, i32* %5
%68 = add nsw i32 %67, 1
store i32 %68, i32* %5
br label %12
69: ; preds = %12
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%71 = load i32, i32* @stderr
%72 = call i32 @fprintf(i32 %71, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str.1 = [4 x i8] c"dF2\00"
@.str.2 = [2 x i8] c".\00"
@.str.3 = [4 x i8] c"%f \00"
@.str.6 = [2 x i8] c"\0A\00"
@str = [12 x i8] c"dF2 = [ ...\00"
@str.7 = [4 x i8] c"];\0A\00"
@str.8 = [6 x i8] c"; ...\00"
define void @compute_range_bingham_dF2_2d(double* nocapture %0, i32 %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp sgt i32 %1, 0
br i1 %6, label %7, label %37
7: ; preds = %2
%8 = zext i32 %1 to i64
br label %9
9: ; preds = %33, %7
%10 = phi i64 [ 0, %7 ], [ %35, %33 ]
%11 = load i32, i32* @stderr
%12 = tail call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%13 = load i32, i32* @stderr
%14 = tail call i32 @fflush(i32 %13)
%15 = getelementptr inbounds double, double* %0, i64 %10
%16 = load double, double* %15
%17 = fneg double %16
%18 = fmul double %16, %17
br label %19
19: ; preds = %9, %28
%20 = phi i64 [ 0, %9 ], [ %31, %28 ]
%21 = getelementptr inbounds double, double* %0, i64 %20
%22 = load double, double* %21
%23 = fneg double %22
%24 = fmul double %22, %23
%25 = fcmp ugt double %18, %24
br i1 %25, label %28, label %26
26: ; preds = %19
%27 = tail call double @bingham_dF1_2d(double %18, double %24)
br label %28
28: ; preds = %19, %26
%29 = phi double [ %27, %26 ], [ 0.000000e+00, %19 ]
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), double %29)
%31 = add nuw nsw i64 %20, 1
%32 = icmp eq i64 %31, %8
br i1 %32, label %33, label %19
33: ; preds = %28
%34 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.8, i64 0, i64 0))
%35 = add nuw nsw i64 %10, 1
%36 = icmp eq i64 %35, %8
br i1 %36, label %37, label %9
37: ; preds = %33, %2
%38 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.7, i64 0, i64 0))
%39 = load i32, i32* @stderr
%40 = tail call i32 @fprintf(i32 %39, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
ret void
}