#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 two_k;

/* Variables and functions */
int /*<<< orphan*/ abs(int);
int /*<<< orphan*/ fpsimple_log_6j(double *, int, int, int, int, int, int);
int max3(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int min3(int, int, int);
void fpsimple_log_9j(double *result, int two_a, int two_b, int two_c, int two_d,
                     int two_e, int two_f, int two_g, int two_h, int two_i) {
  int two_kmin =
      max3(abs(two_h - two_d), abs(two_b - two_f), abs(two_a - two_i));
  int two_kmax = min3(two_h + two_d, two_b + two_f, two_a + two_i);
  int two_k;
  double sum_prod = 0;
  for (two_k = two_kmin; two_k <= two_kmax; two_k += 2) {
    double f1, f2, f3;
    fpsimple_log_6j(&f1, two_a, two_b, two_c, two_f, two_i, two_k);
    fpsimple_log_6j(&f2, two_f, two_d, two_e, two_h, two_b, two_k);
    fpsimple_log_6j(&f3, two_h, two_i, two_g, two_a, two_d, two_k);
    double factor = f1 * f2 * f3;
    double prod = (two_k + 1) * factor;
    sum_prod += (1 - 2 * ((two_k)&1)) * prod;
  }
  *result = sum_prod;
}


x86 assembly (clang, -O0):
<fpsimple_log_9j>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
mov    0x20(%rbp),%edi
sub    -0x18(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,-0x60(%rbp)
mov    -0x10(%rbp),%edi
sub    0x10(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,-0x5c(%rbp)
mov    -0xc(%rbp),%edi
sub    0x28(%rbp),%edi
call   1030 <abs@plt>
mov    -0x60(%rbp),%edi
mov    -0x5c(%rbp),%esi
mov    %eax,%edx
call   1060 <max3@plt>
mov    %eax,-0x20(%rbp)
mov    0x20(%rbp),%edi
add    -0x18(%rbp),%edi
mov    -0x10(%rbp),%esi
add    0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
add    0x28(%rbp),%edx
call   1040 <min3@plt>
mov    %eax,-0x24(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jg     1295 <fpsimple_log_9j+0x155>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    0x10(%rbp),%r8d
mov    0x28(%rbp),%r9d
mov    -0x28(%rbp),%eax
lea    -0x38(%rbp),%rdi
mov    %eax,(%rsp)
call   1050 <fpsimple_log_6j@plt>
mov    0x10(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    0x20(%rbp),%r8d
mov    -0x10(%rbp),%r9d
mov    -0x28(%rbp),%eax
lea    -0x40(%rbp),%rdi
mov    %eax,(%rsp)
call   1050 <fpsimple_log_6j@plt>
mov    0x20(%rbp),%esi
mov    0x28(%rbp),%edx
mov    0x18(%rbp),%ecx
mov    -0xc(%rbp),%r8d
mov    -0x18(%rbp),%r9d
mov    -0x28(%rbp),%eax
lea    -0x48(%rbp),%rdi
mov    %eax,(%rsp)
call   1050 <fpsimple_log_6j@plt>
movsd  -0x38(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x28(%rbp),%ecx
and    $0x1,%ecx
shl    $0x1,%ecx
mov    $0x1,%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  -0x58(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x28(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x28(%rbp)
jmp    11c8 <fpsimple_log_9j+0x88>
movsd  -0x30(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fpsimple_log_9j>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %r9d,0x1c(%rsp)
mov    %r8d,%ebx
mov    %ecx,0x18(%rsp)
mov    %edx,%r14d
mov    %esi,%r13d
mov    %rdi,0x20(%rsp)
mov    0x98(%rsp),%ecx
mov    0x90(%rsp),%r12d
mov    0x80(%rsp),%ebp
mov    %r12d,%eax
sub    %r8d,%eax
mov    %eax,%edi
neg    %edi
cmovs  %eax,%edi
mov    %edx,%eax
sub    %ebp,%eax
mov    %eax,%esi
neg    %esi
cmovs  %eax,%esi
mov    %r13d,%eax
sub    %ecx,%eax
mov    %eax,%edx
neg    %edx
cmovs  %eax,%edx
call   1050 <max3@plt>
mov    %eax,%r15d
mov    %rbx,0x28(%rsp)
lea    (%r12,%rbx,1),%edi
mov    %r14,%rbx
lea    (%r14,%rbp,1),%esi
mov    0x98(%rsp),%eax
lea    (%rax,%r13,1),%edx
call   1030 <min3@plt>
xorps  %xmm0,%xmm0
cmp    %eax,%r15d
jg     12bb <fpsimple_log_9j+0x18b>
mov    %r15d,%r12d
add    %r15d,%r12d
xorps  %xmm0,%xmm0
mov    %eax,0x14(%rsp)
movsd  %xmm0,0x8(%rsp)
mov    %r15d,(%rsp)
lea    0x40(%rsp),%rdi
mov    %r13d,%esi
mov    %ebx,%edx
mov    0x18(%rsp),%ecx
mov    0x80(%rsp),%ebp
mov    %ebp,%r8d
mov    0x98(%rsp),%r14d
mov    %r14,%r9
call   1040 <fpsimple_log_6j@plt>
mov    %r15d,(%rsp)
lea    0x38(%rsp),%rdi
mov    %ebp,%esi
mov    0x28(%rsp),%rdx
mov    0x1c(%rsp),%ecx
mov    %rdx,%rbp
mov    %r13,%r14
mov    0x90(%rsp),%r13d
mov    %r13d,%r8d
mov    %ebx,%r9d
call   1040 <fpsimple_log_6j@plt>
mov    %r15d,(%rsp)
lea    0x30(%rsp),%rdi
mov    %r13d,%esi
mov    %r14,%r13
mov    %rbp,%r9
mov    0x98(%rsp),%edx
mov    0x88(%rsp),%ecx
mov    %r13d,%r8d
call   1040 <fpsimple_log_6j@plt>
movsd  0x40(%rsp),%xmm0
mulsd  0x38(%rsp),%xmm0
mulsd  0x30(%rsp),%xmm0
lea    0x1(%r15),%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
mulsd  %xmm0,%xmm1
mov    %r12d,%eax
and    $0x2,%eax
mov    $0x1,%ecx
sub    %eax,%ecx
mov    0x14(%rsp),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
mulsd  %xmm1,%xmm0
movsd  0x8(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x8(%rsp),%xmm0
add    $0x4,%r12d
add    $0x2,%r15d
cmp    %eax,%r15d
jle    11d0 <fpsimple_log_9j+0xa0>
mov    0x20(%rsp),%rax
movsd  %xmm0,(%rax)
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @fpsimple_log_9j(double* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9) {
%11 = alloca double*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca double
%25 = alloca double
%26 = alloca double
%27 = alloca double
%28 = alloca double
%29 = alloca double
store double* %0, double** %11
store i32 %1, i32* %12
store i32 %2, i32* %13
store i32 %3, i32* %14
store i32 %4, i32* %15
store i32 %5, i32* %16
store i32 %6, i32* %17
store i32 %7, i32* %18
store i32 %8, i32* %19
store i32 %9, i32* %20
%30 = load i32, i32* %19
%31 = load i32, i32* %15
%32 = sub nsw i32 %30, %31
%33 = call i32 @abs(i32 %32)
%34 = load i32, i32* %13
%35 = load i32, i32* %17
%36 = sub nsw i32 %34, %35
%37 = call i32 @abs(i32 %36)
%38 = load i32, i32* %12
%39 = load i32, i32* %20
%40 = sub nsw i32 %38, %39
%41 = call i32 @abs(i32 %40)
%42 = call i32 @max3(i32 %33, i32 %37, i32 %41)
store i32 %42, i32* %21
%43 = load i32, i32* %19
%44 = load i32, i32* %15
%45 = add nsw i32 %43, %44
%46 = load i32, i32* %13
%47 = load i32, i32* %17
%48 = add nsw i32 %46, %47
%49 = load i32, i32* %12
%50 = load i32, i32* %20
%51 = add nsw i32 %49, %50
%52 = call i32 @min3(i32 %45, i32 %48, i32 %51)
store i32 %52, i32* %22
store double 0.000000e+00, double* %24
%53 = load i32, i32* %21
store i32 %53, i32* %23
br label %54
54: ; preds = %98, %10
%55 = load i32, i32* %23
%56 = load i32, i32* %22
%57 = icmp sle i32 %55, %56
br i1 %57, label %58, label %101
58: ; preds = %54
%59 = load i32, i32* %12
%60 = load i32, i32* %13
%61 = load i32, i32* %14
%62 = load i32, i32* %17
%63 = load i32, i32* %20
%64 = load i32, i32* %23
%65 = call i32 @fpsimple_log_6j(double* %25, i32 %59, i32 %60, i32 %61, i32 %62, i32 %63, i32 %64)
%66 = load i32, i32* %17
%67 = load i32, i32* %15
%68 = load i32, i32* %16
%69 = load i32, i32* %19
%70 = load i32, i32* %13
%71 = load i32, i32* %23
%72 = call i32 @fpsimple_log_6j(double* %26, i32 %66, i32 %67, i32 %68, i32 %69, i32 %70, i32 %71)
%73 = load i32, i32* %19
%74 = load i32, i32* %20
%75 = load i32, i32* %18
%76 = load i32, i32* %12
%77 = load i32, i32* %15
%78 = load i32, i32* %23
%79 = call i32 @fpsimple_log_6j(double* %27, i32 %73, i32 %74, i32 %75, i32 %76, i32 %77, i32 %78)
%80 = load double, double* %25
%81 = load double, double* %26
%82 = fmul double %80, %81
%83 = load double, double* %27
%84 = fmul double %82, %83
store double %84, double* %28
%85 = load i32, i32* %23
%86 = add nsw i32 %85, 1
%87 = sitofp i32 %86 to double
%88 = load double, double* %28
%89 = fmul double %87, %88
store double %89, double* %29
%90 = load i32, i32* %23
%91 = and i32 %90, 1
%92 = mul nsw i32 2, %91
%93 = sub nsw i32 1, %92
%94 = sitofp i32 %93 to double
%95 = load double, double* %29
%96 = load double, double* %24
%97 = call double @llvm.fmuladd.f64(double %94, double %95, double %96)
store double %97, double* %24
br label %98
98: ; preds = %58
%99 = load i32, i32* %23
%100 = add nsw i32 %99, 2
store i32 %100, i32* %23
br label %54
101: ; preds = %54
%102 = load double, double* %24
%103 = load double*, double** %11
store double %102, double* %103
ret void
}

LLVM IR (-O2):
define void @fpsimple_log_9j(double* nocapture writeonly %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9) {
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = sub nsw i32 %8, %4
%15 = tail call i32 @llvm.abs.i32(i32 %14, i1 true)
%16 = sub nsw i32 %2, %6
%17 = tail call i32 @llvm.abs.i32(i32 %16, i1 true)
%18 = sub nsw i32 %1, %9
%19 = tail call i32 @llvm.abs.i32(i32 %18, i1 true)
%20 = tail call i32 @max3(i32 %15, i32 %17, i32 %19)
%21 = add nsw i32 %8, %4
%22 = add nsw i32 %6, %2
%23 = add nsw i32 %9, %1
%24 = tail call i32 @min3(i32 %21, i32 %22, i32 %23)
%25 = icmp sgt i32 %20, %24
br i1 %25, label %51, label %26
26: ; preds = %10
%27 = bitcast double* %11 to i8*
%28 = bitcast double* %12 to i8*
%29 = bitcast double* %13 to i8*
br label %30
30: ; preds = %26, %30
%31 = phi i32 [ %20, %26 ], [ %49, %30 ]
%32 = phi double [ 0.000000e+00, %26 ], [ %48, %30 ]
%33 = call i32 @fpsimple_log_6j(double* %11, i32 %1, i32 %2, i32 %3, i32 %6, i32 %9, i32 %31)
%34 = call i32 @fpsimple_log_6j(double* %12, i32 %6, i32 %4, i32 %5, i32 %8, i32 %2, i32 %31)
%35 = call i32 @fpsimple_log_6j(double* %13, i32 %8, i32 %9, i32 %7, i32 %1, i32 %4, i32 %31)
%36 = load double, double* %11
%37 = load double, double* %12
%38 = fmul double %36, %37
%39 = load double, double* %13
%40 = fmul double %38, %39
%41 = add nsw i32 %31, 1
%42 = sitofp i32 %41 to double
%43 = fmul double %40, %42
%44 = shl i32 %31, 1
%45 = and i32 %44, 2
%46 = sub nsw i32 1, %45
%47 = sitofp i32 %46 to double
%48 = call double @llvm.fmuladd.f64(double %47, double %43, double %32)
%49 = add nsw i32 %31, 2
%50 = icmp sgt i32 %49, %24
br i1 %50, label %51, label %30
51: ; preds = %30, %10
%52 = phi double [ 0.000000e+00, %10 ], [ %48, %30 ]
store double %52, double* %0
ret void
}