#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 drand30();
double rtcp_interval(int members, int senders, double rtcp_bw, int we_sent,
                     double avg_rtcp_size, int initial) {
  double const RTCP_MIN_TIME = 5.;
  double const RTCP_SENDER_BW_FRACTION = 0.25;
  double const RTCP_RCVR_BW_FRACTION = (1 - RTCP_SENDER_BW_FRACTION);
  double const COMPENSATION = 2.71828 - 1.5;
  double t;
  double rtcp_min_time = RTCP_MIN_TIME;
  int n;
  if (initial) {
    rtcp_min_time /= 2;
  }
  n = members;
  if (senders > 0 && senders < members * RTCP_SENDER_BW_FRACTION) {
    if (we_sent) {
      rtcp_bw *= RTCP_SENDER_BW_FRACTION;
      n = senders;
    } else {
      rtcp_bw *= RTCP_RCVR_BW_FRACTION;
      n -= senders;
    }
  }
  t = avg_rtcp_size * n / rtcp_bw;
  if (t < rtcp_min_time)
    t = rtcp_min_time;
  t = t * (drand30() + 0.5);
  t = t / COMPENSATION;
  return t;
}


x86 assembly (clang, -O0):
<rtcp_interval>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movsd  %xmm1,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
movsd  0xeca(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xed5(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xec0(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xeab(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xe96(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     118f <rtcp_interval+0x7f>
movsd  -0x58(%rbp),%xmm0
movsd  0xe9a(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x5c(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1208 <rtcp_interval+0xf8>
cvtsi2sdl -0x8(%rbp),%xmm1
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xe67(%rip),%xmm2
mulsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jbe    1208 <rtcp_interval+0xf8>
cmpl   $0x0,-0x14(%rbp)
je     11e6 <rtcp_interval+0xd6>
movsd  0xe47(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x5c(%rbp)
jmp    1203 <rtcp_interval+0xf3>
movsd  0xe22(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%ecx
mov    -0x5c(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x5c(%rbp)
jmp    1208 <rtcp_interval+0xf8>
movsd  -0x20(%rbp),%xmm0
cvtsi2sdl -0x5c(%rbp),%xmm1
mulsd  %xmm1,%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    123e <rtcp_interval+0x12e>
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    $0x0,%al
call   1030 <drand30@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
movsd  0xdc9(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  0xd8f(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rtcp_interval>:
push   %rax
xor    %eax,%eax
test   %ecx,%ecx
sete   %al
lea    0xee1(%rip),%rcx
movsd  (%rcx,%rax,8),%xmm4
test   %esi,%esi
jle    1156 <rtcp_interval+0x46>
cvtsi2sd %esi,%xmm2
cvtsi2sd %edi,%xmm3
mulsd  0xed8(%rip),%xmm3
ucomisd %xmm2,%xmm3
jbe    1156 <rtcp_interval+0x46>
test   %edx,%edx
je     114c <rtcp_interval+0x3c>
mulsd  0xec6(%rip),%xmm0
jmp    1158 <rtcp_interval+0x48>
mulsd  0xec4(%rip),%xmm0
sub    %esi,%edi
mov    %edi,%esi
xorps  %xmm2,%xmm2
cvtsi2sd %esi,%xmm2
mulsd  %xmm1,%xmm2
divsd  %xmm0,%xmm2
maxsd  %xmm2,%xmm4
movsd  %xmm4,(%rsp)
xor    %eax,%eax
call   1030 <drand30@plt>
addsd  0xea1(%rip),%xmm0
mulsd  (%rsp),%xmm0
divsd  0xe9c(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @rtcp_interval(i32 %0, i32 %1, double %2, i32 %3, double %4, i32 %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
%10 = alloca i32
%11 = alloca double
%12 = alloca i32
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca i32
store i32 %0, i32* %7
store i32 %1, i32* %8
store double %2, double* %9
store i32 %3, i32* %10
store double %4, double* %11
store i32 %5, i32* %12
store double 5.000000e+00, double* %13
store double 2.500000e-01, double* %14
store double 7.500000e-01, double* %15
store double 1.218280e+00, double* %16
store double 5.000000e+00, double* %18
%20 = load i32, i32* %12
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %6
%23 = load double, double* %18
%24 = fdiv double %23, 2.000000e+00
store double %24, double* %18
br label %25
25: ; preds = %22, %6
%26 = load i32, i32* %7
store i32 %26, i32* %19
%27 = load i32, i32* %8
%28 = icmp sgt i32 %27, 0
br i1 %28, label %29, label %50
29: ; preds = %25
%30 = load i32, i32* %8
%31 = sitofp i32 %30 to double
%32 = load i32, i32* %7
%33 = sitofp i32 %32 to double
%34 = fmul double %33, 2.500000e-01
%35 = fcmp olt double %31, %34
br i1 %35, label %36, label %50
36: ; preds = %29
%37 = load i32, i32* %10
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %43
39: ; preds = %36
%40 = load double, double* %9
%41 = fmul double %40, 2.500000e-01
store double %41, double* %9
%42 = load i32, i32* %8
store i32 %42, i32* %19
br label %49
43: ; preds = %36
%44 = load double, double* %9
%45 = fmul double %44, 7.500000e-01
store double %45, double* %9
%46 = load i32, i32* %8
%47 = load i32, i32* %19
%48 = sub nsw i32 %47, %46
store i32 %48, i32* %19
br label %49
49: ; preds = %43, %39
br label %50
50: ; preds = %49, %29, %25
%51 = load double, double* %11
%52 = load i32, i32* %19
%53 = sitofp i32 %52 to double
%54 = fmul double %51, %53
%55 = load double, double* %9
%56 = fdiv double %54, %55
store double %56, double* %17
%57 = load double, double* %17
%58 = load double, double* %18
%59 = fcmp olt double %57, %58
br i1 %59, label %60, label %62
60: ; preds = %50
%61 = load double, double* %18
store double %61, double* %17
br label %62
62: ; preds = %60, %50
%63 = load double, double* %17
%64 = call double (...) @drand30()
%65 = fadd double %64, 5.000000e-01
%66 = fmul double %63, %65
store double %66, double* %17
%67 = load double, double* %17
%68 = fdiv double %67, 1.218280e+00
store double %68, double* %17
%69 = load double, double* %17
ret double %69
}

LLVM IR (-O2):
define double @rtcp_interval(i32 %0, i32 %1, double %2, i32 %3, double %4, i32 %5) {
%7 = icmp eq i32 %5, 0
%8 = select i1 %7, double 5.000000e+00, double 2.500000e+00
%9 = icmp sgt i32 %1, 0
br i1 %9, label %10, label %22
10: ; preds = %6
%11 = sitofp i32 %1 to double
%12 = sitofp i32 %0 to double
%13 = fmul double %12, 2.500000e-01
%14 = fcmp ogt double %13, %11
br i1 %14, label %15, label %22
15: ; preds = %10
%16 = icmp eq i32 %3, 0
br i1 %16, label %19, label %17
17: ; preds = %15
%18 = fmul double %2, 2.500000e-01
br label %22
19: ; preds = %15
%20 = fmul double %2, 7.500000e-01
%21 = sub nsw i32 %0, %1
br label %22
22: ; preds = %17, %19, %10, %6
%23 = phi double [ %18, %17 ], [ %20, %19 ], [ %2, %10 ], [ %2, %6 ]
%24 = phi i32 [ %1, %17 ], [ %21, %19 ], [ %0, %10 ], [ %0, %6 ]
%25 = sitofp i32 %24 to double
%26 = fmul double %25, %4
%27 = fdiv double %26, %23
%28 = fcmp olt double %27, %8
%29 = select i1 %28, double %8, double %27
%30 = tail call double (...) @drand30()
%31 = fadd double %30, 5.000000e-01
%32 = fmul double %31, %29
%33 = fdiv double %32, 1.218280e+00
ret double %33
}