#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 fmod(double, int);
int /*<<< orphan*/ printf(char *, double, double);
void plugin_set_uplink_frequency(double frequency) {
  double freq;
  freq = frequency - fmod(frequency, 5);
  if (fmod(frequency, 5) > 2.5)
    freq += 5;
  printf("Uplink Frequency: %f kHz -> %f kHz\n", frequency, freq);
}


x86 assembly (clang, -O0):
<plugin_set_uplink_frequency>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    $0x5,%edi
call   1040 <fmod@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    $0x5,%edi
call   1040 <fmod@plt>
movsd  0xe92(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    118a <plugin_set_uplink_frequency+0x6a>
movsd  0xe88(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
lea    0xe75(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<plugin_set_uplink_frequency>:
sub    $0x28,%rsp
movsd  %xmm0,0x8(%rsp)
mov    $0x5,%edi
call   1040 <fmod@plt>
movsd  0x8(%rsp),%xmm1
movapd %xmm1,%xmm2
subsd  %xmm0,%xmm2
movapd %xmm2,0x10(%rsp)
movapd %xmm1,%xmm0
mov    $0x5,%edi
call   1040 <fmod@plt>
movsd  0xea2(%rip),%xmm2
movapd 0x10(%rsp),%xmm3
addsd  %xmm3,%xmm2
movsd  0xe98(%rip),%xmm1
cmpltsd %xmm0,%xmm1
andpd  %xmm1,%xmm2
andnpd %xmm3,%xmm1
orpd   %xmm2,%xmm1
lea    0xe88(%rip),%rdi
movsd  0x8(%rsp),%xmm0
add    $0x28,%rsp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [36 x i8] c"Uplink Frequency: %f kHz -> %f kHz\0A\00"
define void @plugin_set_uplink_frequency(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = load double, double* %2
%6 = call double @fmod(double %5, i32 5)
%7 = fsub double %4, %6
store double %7, double* %3
%8 = load double, double* %2
%9 = call double @fmod(double %8, i32 5)
%10 = fcmp ogt double %9, 2.500000e+00
br i1 %10, label %11, label %14
11: ; preds = %1
%12 = load double, double* %3
%13 = fadd double %12, 5.000000e+00
store double %13, double* %3
br label %14
14: ; preds = %11, %1
%15 = load double, double* %2
%16 = load double, double* %3
%17 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), double %15, double %16)
ret void
}

LLVM IR (-O2):
@.str = [36 x i8] c"Uplink Frequency: %f kHz -> %f kHz\0A\00"
define void @plugin_set_uplink_frequency(double %0) {
%2 = tail call double @fmod(double %0, i32 5)
%3 = fsub double %0, %2
%4 = tail call double @fmod(double %0, i32 5)
%5 = fcmp ogt double %4, 2.500000e+00
%6 = fadd double %3, 5.000000e+00
%7 = select i1 %5, double %6, double %3
%8 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), double %0, double %7)
ret void
}