#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_dF3_3d(double, double, double);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
void compute_range_bingham_dF3_3d(double *y, int n, int k0, int k1) {
  int i, j, k;
  double z1, z2, z3;
  fprintf(stderr, "dF3");
  for (k = k0; k < k1; k++) {
    z3 = -y[k] * y[k];
    printf("F(:,:,%d) = [ ...\n", k);
    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 && z2 <= z3 ? bingham_dF3_3d(z1, z2, z3) : 0.0);
      }
      printf("; ...\n");
    }
    printf("];\n\n");
    fprintf(stderr, "\n");
  }
}


x86 assembly (clang, -O0):
<compute_range_bingham_dF3_3d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
lea    0xe9b(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1339 <compute_range_bingham_dF3_3d+0x1f9>
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x20(%rbp),%esi
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1308 <compute_range_bingham_dF3_3d+0x1c8>
mov    0x2e03(%rip),%rax
mov    (%rax),%edi
lea    0xe31(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2dee(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    12ec <compute_range_bingham_dF3_3d+0x1ac>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     12be <compute_range_bingham_dF3_3d+0x17e>
movsd  -0x30(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     12be <compute_range_bingham_dF3_3d+0x17e>
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
call   1060 <bingham_dF3_3d@plt>
movsd  %xmm0,-0x40(%rbp)
jmp    12cb <compute_range_bingham_dF3_3d+0x18b>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    12cb <compute_range_bingham_dF3_3d+0x18b>
movsd  -0x40(%rbp),%xmm0
lea    0xd42(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1236 <compute_range_bingham_dF3_3d+0xf6>
lea    0xd2a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11ca <compute_range_bingham_dF3_3d+0x8a>
lea    0xd15(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2cc3(%rip),%rax
mov    (%rax),%edi
lea    0xd01(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1170 <compute_range_bingham_dF3_3d+0x30>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compute_range_bingham_dF3_3d>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %ecx,%ebx
mov    %edx,%r14d
mov    %esi,0x8(%rsp)
mov    %rdi,%rbp
mov    0x2e6f(%rip),%r15
mov    (%r15),%edi
lea    0xe95(%rip),%rsi
call   1050 <fprintf@plt>
mov    %ebx,0xc(%rsp)
cmp    %ebx,%r14d
jge    12d5 <compute_range_bingham_dF3_3d+0x185>
movslq %r14d,%rsi
mov    0x8(%rsp),%r13d
lea    0xe8b(%rip),%r12
jmp    11ce <compute_range_bingham_dF3_3d+0x7e>
xchg   %ax,%ax
lea    0xe84(%rip),%rdi
call   1030 <puts@plt>
mov    (%r15),%edi
lea    0xe6f(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x28(%rsp),%rsi
add    $0x1,%rsi
cmp    0xc(%rsp),%esi
je     12d5 <compute_range_bingham_dF3_3d+0x185>
movsd  0x0(%rbp,%rsi,8),%xmm0
movapd %xmm0,0x10(%rsp)
lea    0xe33(%rip),%rdi
mov    %rsi,0x28(%rsp)
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x0,0x8(%rsp)
jle    11a0 <compute_range_bingham_dF3_3d+0x50>
movapd 0x10(%rsp),%xmm1
movapd %xmm1,%xmm0
xorpd  0xdfa(%rip),%xmm0
mulsd  %xmm1,%xmm0
movapd %xmm0,0x30(%rsp)
xor    %ebx,%ebx
jmp    1239 <compute_range_bingham_dF3_3d+0xe9>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0xe08(%rip),%rdi
call   1030 <puts@plt>
add    $0x1,%rbx
cmp    %r13,%rbx
je     11a0 <compute_range_bingham_dF3_3d+0x50>
mov    (%r15),%edi
lea    0xdf0(%rip),%rsi
call   1050 <fprintf@plt>
mov    (%r15),%edi
call   1060 <fflush@plt>
movsd  0x0(%rbp,%rbx,8),%xmm0
movapd %xmm0,%xmm1
xorpd  0xd9e(%rip),%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm1,0x10(%rsp)
xor    %r14d,%r14d
jmp    1293 <compute_range_bingham_dF3_3d+0x143>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%r14
cmp    %r14,%r13
je     1220 <compute_range_bingham_dF3_3d+0xd0>
movsd  0x0(%rbp,%r14,8),%xmm0
movapd %xmm0,%xmm1
xorpd  0xd5a(%rip),%xmm1
mulsd  %xmm0,%xmm1
ucomisd 0x10(%rsp),%xmm1
xorpd  %xmm0,%xmm0
jb     1280 <compute_range_bingham_dF3_3d+0x130>
movapd 0x30(%rsp),%xmm2
ucomisd %xmm1,%xmm2
jb     1280 <compute_range_bingham_dF3_3d+0x130>
movapd 0x10(%rsp),%xmm0
movapd 0x30(%rsp),%xmm2
call   1070 <bingham_dF3_3d@plt>
jmp    1280 <compute_range_bingham_dF3_3d+0x130>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [4 x i8] c"dF3\00"
@.str.1 = [19 x i8] c"F(:,:,%d) = [ ...\0A\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_dF3_3d(double* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca double*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca double
%13 = alloca double
%14 = alloca double
store double* %0, double** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%15 = load i32, i32* @stderr
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%17 = load i32, i32* %7
store i32 %17, i32* %11
br label %18
18: ; preds = %103, %4
%19 = load i32, i32* %11
%20 = load i32, i32* %8
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %106
22: ; preds = %18
%23 = load double*, double** %5
%24 = load i32, i32* %11
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds double, double* %23, i64 %25
%27 = load double, double* %26
%28 = fneg double %27
%29 = load double*, double** %5
%30 = load i32, i32* %11
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds double, double* %29, i64 %31
%33 = load double, double* %32
%34 = fmul double %28, %33
store double %34, double* %14
%35 = load i32, i32* %11
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %35)
store i32 0, i32* %9
br label %37
37: ; preds = %96, %22
%38 = load i32, i32* %9
%39 = load i32, i32* %6
%40 = icmp slt i32 %38, %39
br i1 %40, label %41, label %99
41: ; preds = %37
%42 = load i32, i32* @stderr
%43 = call i32 @fprintf(i32 %42, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%44 = load i32, i32* @stderr
%45 = call i32 @fflush(i32 %44)
%46 = load double*, double** %5
%47 = load i32, i32* %9
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds double, double* %46, i64 %48
%50 = load double, double* %49
%51 = fneg double %50
%52 = load double*, double** %5
%53 = load i32, i32* %9
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds double, double* %52, i64 %54
%56 = load double, double* %55
%57 = fmul double %51, %56
store double %57, double* %12
store i32 0, i32* %10
br label %58
58: ; preds = %91, %41
%59 = load i32, i32* %10
%60 = load i32, i32* %6
%61 = icmp slt i32 %59, %60
br i1 %61, label %62, label %94
62: ; preds = %58
%63 = load double*, double** %5
%64 = load i32, i32* %10
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds double, double* %63, i64 %65
%67 = load double, double* %66
%68 = fneg double %67
%69 = load double*, double** %5
%70 = load i32, i32* %10
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds double, double* %69, i64 %71
%73 = load double, double* %72
%74 = fmul double %68, %73
store double %74, double* %13
%75 = load double, double* %12
%76 = load double, double* %13
%77 = fcmp ole double %75, %76
br i1 %77, label %78, label %87
78: ; preds = %62
%79 = load double, double* %13
%80 = load double, double* %14
%81 = fcmp ole double %79, %80
br i1 %81, label %82, label %87
82: ; preds = %78
%83 = load double, double* %12
%84 = load double, double* %13
%85 = load double, double* %14
%86 = call double @bingham_dF3_3d(double %83, double %84, double %85)
br label %88
87: ; preds = %78, %62
br label %88
88: ; preds = %87, %82
%89 = phi double [ %86, %82 ], [ 0.000000e+00, %87 ]
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), double %89)
br label %91
91: ; preds = %88
%92 = load i32, i32* %10
%93 = add nsw i32 %92, 1
store i32 %93, i32* %10
br label %58
94: ; preds = %58
%95 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %96
96: ; preds = %94
%97 = load i32, i32* %9
%98 = add nsw i32 %97, 1
store i32 %98, i32* %9
br label %37
99: ; preds = %37
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%101 = load i32, i32* @stderr
%102 = call i32 @fprintf(i32 %101, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %103
103: ; preds = %99
%104 = load i32, i32* %11
%105 = add nsw i32 %104, 1
store i32 %105, i32* %11
br label %18
106: ; preds = %18
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"dF3\00"
@.str.1 = [19 x i8] c"F(:,:,%d) = [ ...\0A\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 = [4 x i8] c"];\0A\00"
@str.7 = [6 x i8] c"; ...\00"
define void @compute_range_bingham_dF3_3d(double* nocapture %0, i32 %1, i32 %2, i32 %3) {
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%7 = icmp slt i32 %2, %3
br i1 %7, label %8, label %57
8: ; preds = %4
%9 = icmp sgt i32 %1, 0
%10 = sext i32 %2 to i64
%11 = zext i32 %1 to i64
br label %12
12: ; preds = %8, %50
%13 = phi i64 [ %10, %8 ], [ %54, %50 ]
%14 = getelementptr inbounds double, double* %0, i64 %13
%15 = load double, double* %14
%16 = fneg double %15
%17 = fmul double %15, %16
%18 = trunc i64 %13 to i32
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %18)
br i1 %9, label %20, label %50
20: ; preds = %12, %46
%21 = phi i64 [ %48, %46 ], [ 0, %12 ]
%22 = load i32, i32* @stderr
%23 = tail call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%24 = load i32, i32* @stderr
%25 = tail call i32 @fflush(i32 %24)
%26 = getelementptr inbounds double, double* %0, i64 %21
%27 = load double, double* %26
%28 = fneg double %27
%29 = fmul double %27, %28
br label %30
30: ; preds = %20, %41
%31 = phi i64 [ 0, %20 ], [ %44, %41 ]
%32 = getelementptr inbounds double, double* %0, i64 %31
%33 = load double, double* %32
%34 = fneg double %33
%35 = fmul double %33, %34
%36 = fcmp ugt double %29, %35
%37 = fcmp ugt double %35, %17
%38 = select i1 %36, i1 true, i1 %37
br i1 %38, label %41, label %39
39: ; preds = %30
%40 = tail call double @bingham_dF3_3d(double %29, double %35, double %17)
br label %41
41: ; preds = %30, %39
%42 = phi double [ %40, %39 ], [ 0.000000e+00, %30 ]
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), double %42)
%44 = add nuw nsw i64 %31, 1
%45 = icmp eq i64 %44, %11
br i1 %45, label %46, label %30
46: ; preds = %41
%47 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.7, i64 0, i64 0))
%48 = add nuw nsw i64 %21, 1
%49 = icmp eq i64 %48, %11
br i1 %49, label %50, label %20
50: ; preds = %46, %12
%51 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
%52 = load i32, i32* @stderr
%53 = tail call i32 @fprintf(i32 %52, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%54 = add nsw i64 %13, 1
%55 = trunc i64 %54 to i32
%56 = icmp eq i32 %55, %3
br i1 %56, label %57, label %12
57: ; preds = %50, %4
ret void
}