#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 get_random(double, double);
double modifyFreq(double currentValue) {
  double minRand = -0.03, maxRand = 0.03,
         freqRandomizer = get_random(minRand, maxRand),
         result = currentValue + freqRandomizer;
  if (result > 1) {
    result = 1 + minRand;
  }
  if (result < 0) {
    result = 0 + maxRand;
  }
  return result;
}


x86 assembly (clang, -O0):
<modifyFreq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeeb(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xed6(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1030 <get_random@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xe99(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1183 <modifyFreq+0x73>
movsd  0xe87(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    119e <modifyFreq+0x8e>
xorps  %xmm0,%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<modifyFreq>:
push   %rax
movsd  %xmm0,(%rsp)
movsd  0xee2(%rip),%xmm0
movsd  0xee2(%rip),%xmm1
call   1030 <get_random@plt>
addsd  (%rsp),%xmm0
movsd  0xed8(%rip),%xmm1
cmpltsd %xmm0,%xmm1
movsd  0xed3(%rip),%xmm2
andpd  %xmm1,%xmm2
andnpd %xmm0,%xmm1
orpd   %xmm1,%xmm2
xorpd  %xmm1,%xmm1
movapd %xmm2,%xmm0
cmpltsd %xmm1,%xmm0
movapd %xmm0,%xmm1
andnpd %xmm2,%xmm1
movsd  0xe9a(%rip),%xmm2
andpd  %xmm2,%xmm0
orpd   %xmm1,%xmm0
pop    %rax
ret

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

LLVM IR (-O2):
define double @modifyFreq(double %0) {
%2 = tail call double @get_random(double -3.000000e-02, double 3.000000e-02)
%3 = fadd double %2, %0
%4 = fcmp ogt double %3, 1.000000e+00
%5 = select i1 %4, double 0x3FEF0A3D70A3D70A, double %3
%6 = fcmp olt double %5, 0.000000e+00
%7 = select i1 %6, double 3.000000e-02, double %5
ret double %7
}