#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 */
struct pca_group {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ bhattacharyya_coefficient(struct pca_group *,
                                             struct pca_group *);
double log(int /*<<< orphan*/);
double pca_group_distance_bhattacharyya(struct pca_group *groupA,
                                        struct pca_group *groupB) {
  if (groupA == groupB)
    return 0.0;
  else
    return -1.0 * log(bhattacharyya_coefficient(groupA, groupB));
}


x86 assembly (clang, -O0):
<pca_group_distance_bhattacharyya>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jne    114b <pca_group_distance_bhattacharyya+0x2b>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1173 <pca_group_distance_bhattacharyya+0x53>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <bhattacharyya_coefficient@plt>
mov    %eax,%edi
call   1030 <log@plt>
movaps %xmm0,%xmm1
movsd  0xe96(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pca_group_distance_bhattacharyya>:
cmp    %rsi,%rdi
je     113e <pca_group_distance_bhattacharyya+0x1e>
push   %rax
call   1040 <bhattacharyya_coefficient@plt>
mov    %eax,%edi
call   1030 <log@plt>
xorps  0xec7(%rip),%xmm0
add    $0x8,%rsp
ret
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
%struct.pca_group = type { i32 }
define double @pca_group_distance_bhattacharyya(%struct.pca_group* %0, %struct.pca_group* %1) {
%3 = alloca double
%4 = alloca %struct.pca_group*
%5 = alloca %struct.pca_group*
store %struct.pca_group* %0, %struct.pca_group** %4
store %struct.pca_group* %1, %struct.pca_group** %5
%6 = load %struct.pca_group*, %struct.pca_group** %4
%7 = load %struct.pca_group*, %struct.pca_group** %5
%8 = icmp eq %struct.pca_group* %6, %7
br i1 %8, label %9, label %10
9: ; preds = %2
store double 0.000000e+00, double* %3
br label %16
10: ; preds = %2
%11 = load %struct.pca_group*, %struct.pca_group** %4
%12 = load %struct.pca_group*, %struct.pca_group** %5
%13 = call i32 @bhattacharyya_coefficient(%struct.pca_group* %11, %struct.pca_group* %12)
%14 = call double @log(i32 %13)
%15 = fmul double -1.000000e+00, %14
store double %15, double* %3
br label %16
16: ; preds = %10, %9
%17 = load double, double* %3
ret double %17
}

LLVM IR (-O2):
%struct.pca_group = type { i32 }
define double @pca_group_distance_bhattacharyya(%struct.pca_group* %0, %struct.pca_group* %1) {
%3 = icmp eq %struct.pca_group* %0, %1
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = tail call i32 @bhattacharyya_coefficient(%struct.pca_group* %0, %struct.pca_group* %1)
%6 = tail call double @log(i32 %5)
%7 = fneg double %6
br label %8
8: ; preds = %2, %4
%9 = phi double [ %7, %4 ], [ 0.000000e+00, %2 ]
ret double %9
}