#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 */
int /*<<< orphan*/ printf(char *, int, ...);
int /*<<< orphan*/ scanf(char *, int *, int *, double *, int *);
int main(int argc, char const *argv[]) {
  int dump;
  long long int nk, nu;
  double nb, nbs;
  double avg = 0;
  printf("%lf\n", avg);
  nk = 5000;
  nu = 1666;
  int depth = 0;
  int depthAvg = 0;
  for (int i = 0; i < 10; i++) {
    nb = nbs = 0;
    scanf("#nodes = %d,  depth = %d,  #compares = %lf,  #rotates = %d", &dump,
          &depth, &nb, &dump);
    depthAvg += depth;
    scanf("#nodes = %d,  depth = %d,  #compares = %lf,  #rotates = %d", &dump,
          &depth, &nbs, &dump);
    depthAvg += depth;
    avg += (nbs - nb) / ((double)nk + nu);
    printf("%lf\n", avg);
  }
  printf("%d %lf\n", depthAvg / 20, (avg / 10));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
cvttsd2si -0x40(%rbp),%esi
lea    0xefc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movq   $0x1388,-0x20(%rbp)
movq   $0x682,-0x28(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
movl   $0x0,-0x4c(%rbp)
cmpl   $0xa,-0x4c(%rbp)
jge    1221 <main+0x101>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
lea    0xe71(%rip),%rdi
lea    -0x14(%rbp),%r8
lea    -0x44(%rbp),%rdx
lea    -0x30(%rbp),%rcx
mov    %r8,%rsi
call   1040 <scanf@plt>
mov    -0x44(%rbp),%eax
add    -0x48(%rbp),%eax
mov    %eax,-0x48(%rbp)
lea    0xe4d(%rip),%rdi
lea    -0x14(%rbp),%r8
lea    -0x44(%rbp),%rdx
lea    -0x38(%rbp),%rcx
mov    %r8,%rsi
call   1040 <scanf@plt>
mov    -0x44(%rbp),%eax
add    -0x48(%rbp),%eax
mov    %eax,-0x48(%rbp)
movsd  -0x38(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
cvtsi2sdq -0x20(%rbp),%xmm1
cvtsi2sdq -0x28(%rbp),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
addsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
cvttsd2si -0x40(%rbp),%esi
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1176 <main+0x56>
mov    -0x48(%rbp),%eax
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
movsd  -0x40(%rbp),%xmm0
movsd  0xdc5(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xdfd(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xf19(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
movl   $0x0,0x4(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    $0xa,%r14d
lea    0xeb3(%rip),%r15
lea    0x4(%rsp),%r13
lea    0x24(%rsp),%rbx
lea    0x10(%rsp),%rbp
xor    %r12d,%r12d
nop
movq   $0x0,0x10(%rsp)
movq   $0x0,0x18(%rsp)
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r13,%rdx
lea    0x18(%rsp),%rcx
mov    %rbx,%r8
call   1040 <scanf@plt>
add    0x4(%rsp),%r12d
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r13,%rdx
mov    %rbp,%rcx
mov    %rbx,%r8
call   1040 <scanf@plt>
add    0x4(%rsp),%r12d
movsd  0x10(%rsp),%xmm0
subsd  0x18(%rsp),%xmm0
divsd  0xe36(%rip),%xmm0
movsd  0x8(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
cvttsd2si %xmm1,%esi
lea    0xe69(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0xffffffff,%r14d
jne    1170 <main+0x50>
movslq %r12d,%rax
imul   $0x66666667,%rax,%rsi
mov    %rsi,%rax
shr    $0x3f,%rax
sar    $0x23,%rsi
add    %eax,%esi
movsd  0x8(%rsp),%xmm0
divsd  0xded(%rip),%xmm0
lea    0xe29(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%lf\0A\00"
@.str.1 = [59 x i8] c"#nodes = %d, depth = %d, #compares = %lf, #rotates = %d\00"
@.str.2 = [8 x i8] c"%d %lf\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i64
%8 = alloca i64
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store double 0.000000e+00, double* %11
%15 = load double, double* %11
%16 = fptosi double %15 to i32
%17 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %16)
store i64 5000, i64* %7
store i64 1666, i64* %8
store i32 0, i32* %12
store i32 0, i32* %13
store i32 0, i32* %14
br label %18
18: ; preds = %44, %2
%19 = load i32, i32* %14
%20 = icmp slt i32 %19, 10
br i1 %20, label %21, label %47
21: ; preds = %18
store double 0.000000e+00, double* %10
store double 0.000000e+00, double* %9
%22 = call i32 @scanf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.1, i64 0, i64 0), i32* %6, i32* %12, double* %9, i32* %6)
%23 = load i32, i32* %12
%24 = load i32, i32* %13
%25 = add nsw i32 %24, %23
store i32 %25, i32* %13
%26 = call i32 @scanf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.1, i64 0, i64 0), i32* %6, i32* %12, double* %10, i32* %6)
%27 = load i32, i32* %12
%28 = load i32, i32* %13
%29 = add nsw i32 %28, %27
store i32 %29, i32* %13
%30 = load double, double* %10
%31 = load double, double* %9
%32 = fsub double %30, %31
%33 = load i64, i64* %7
%34 = sitofp i64 %33 to double
%35 = load i64, i64* %8
%36 = sitofp i64 %35 to double
%37 = fadd double %34, %36
%38 = fdiv double %32, %37
%39 = load double, double* %11
%40 = fadd double %39, %38
store double %40, double* %11
%41 = load double, double* %11
%42 = fptosi double %41 to i32
%43 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %42)
br label %44
44: ; preds = %21
%45 = load i32, i32* %14
%46 = add nsw i32 %45, 1
store i32 %46, i32* %14
br label %18
47: ; preds = %18
%48 = load i32, i32* %13
%49 = sdiv i32 %48, 20
%50 = load double, double* %11
%51 = fdiv double %50, 1.000000e+01
%52 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %49, double %51)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%lf\0A\00"
@.str.1 = [59 x i8] c"#nodes = %d, depth = %d, #compares = %lf, #rotates = %d\00"
@.str.2 = [8 x i8] c"%d %lf\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = alloca i32
%7 = bitcast i32* %3 to i8*
%8 = bitcast double* %4 to i8*
%9 = bitcast double* %5 to i8*
%10 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 0)
%11 = bitcast i32* %6 to i8*
store i32 0, i32* %6
br label %16
12: ; preds = %16
%13 = sdiv i32 %25, 20
%14 = fdiv double %30, 1.000000e+01
%15 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %13, double %14)
ret i32 0
16: ; preds = %2, %16
%17 = phi i32 [ 0, %2 ], [ %33, %16 ]
%18 = phi i32 [ 0, %2 ], [ %25, %16 ]
%19 = phi double [ 0.000000e+00, %2 ], [ %30, %16 ]
store double 0.000000e+00, double* %5
store double 0.000000e+00, double* %4
%20 = call i32 @scanf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %6, double* %4, i32* %3)
%21 = load i32, i32* %6
%22 = add nsw i32 %21, %18
%23 = call i32 @scanf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %6, double* %5, i32* %3)
%24 = load i32, i32* %6
%25 = add nsw i32 %22, %24
%26 = load double, double* %5
%27 = load double, double* %4
%28 = fsub double %26, %27
%29 = fdiv double %28, 6.666000e+03
%30 = fadd double %19, %29
%31 = fptosi double %30 to i32
%32 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %31)
%33 = add nuw nsw i32 %17, 1
%34 = icmp eq i32 %33, 10
br i1 %34, label %12, label %16
}