#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 *pow_square(double const *, int);
double power_rms(double *, int);
double snr_compute(const double *power, double *unblock_power,
                   int transf_size) {
  double unblock_rms;
  double *pow2;
  unblock_rms = power_rms(unblock_power, transf_size);
  if (unblock_rms > 0.000001) {
    pow2 = pow_square(power, transf_size);
    return power_rms(pow2, transf_size) / unblock_rms;
  }
  return -1;
}


x86 assembly (clang, -O0):
<snr_compute>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1040 <power_rms@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xeaf(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1186 <snr_compute+0x66>
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1030 <pow_square@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1040 <power_rms@plt>
divsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1193 <snr_compute+0x73>
movsd  0xe7a(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<snr_compute>:
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %rdi,%r14
mov    %rsi,%rdi
mov    %edx,%esi
call   1040 <power_rms@plt>
ucomisd 0xecd(%rip),%xmm0
jbe    115d <snr_compute+0x3d>
mov    %r14,%rdi
mov    %ebx,%esi
movsd  %xmm0,(%rsp)
call   1030 <pow_square@plt>
mov    %rax,%rdi
mov    %ebx,%esi
call   1040 <power_rms@plt>
divsd  (%rsp),%xmm0
jmp    1165 <snr_compute+0x45>
movsd  0xe9b(%rip),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define double @snr_compute(double* %0, double* %1, i32 %2) {
%4 = alloca double
%5 = alloca double*
%6 = alloca double*
%7 = alloca i32
%8 = alloca double
%9 = alloca double*
store double* %0, double** %5
store double* %1, double** %6
store i32 %2, i32* %7
%10 = load double*, double** %6
%11 = load i32, i32* %7
%12 = call double @power_rms(double* %10, i32 %11)
store double %12, double* %8
%13 = load double, double* %8
%14 = fcmp ogt double %13, 0x3EB0C6F7A0B5ED8D
br i1 %14, label %15, label %24
15: ; preds = %3
%16 = load double*, double** %5
%17 = load i32, i32* %7
%18 = call double* @pow_square(double* %16, i32 %17)
store double* %18, double** %9
%19 = load double*, double** %9
%20 = load i32, i32* %7
%21 = call double @power_rms(double* %19, i32 %20)
%22 = load double, double* %8
%23 = fdiv double %21, %22
store double %23, double* %4
br label %25
24: ; preds = %3
store double -1.000000e+00, double* %4
br label %25
25: ; preds = %24, %15
%26 = load double, double* %4
ret double %26
}

LLVM IR (-O2):
define double @snr_compute(double* %0, double* %1, i32 %2) {
%4 = tail call double @power_rms(double* %1, i32 %2)
%5 = fcmp ogt double %4, 0x3EB0C6F7A0B5ED8D
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = tail call double* @pow_square(double* %0, i32 %2)
%8 = tail call double @power_rms(double* %7, i32 %2)
%9 = fdiv double %8, %4
br label %10
10: ; preds = %3, %6
%11 = phi double [ %9, %6 ], [ -1.000000e+00, %3 ]
ret double %11
}