#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 */
scalar_t__ __test_rand_list(size_t, double *);
int /*<<< orphan*/ mean(double *, int const);
int /*<<< orphan*/ printf(char *, size_t, int /*<<< orphan*/);
int test_rand_list(size_t from, size_t to, size_t incr) {
  const int niter = 3;
  double v[niter];
  for (size_t at = from; at <= to; at += incr) {
    for (int i = 0; i < niter; i++) {
      if (__test_rand_list(at, &v[i]))
        return 1;
    }
    printf("%ld %.2lf\n", at, mean(v, niter));
  }
  return 0;
}


x86 assembly (clang, -O0):
<test_rand_list>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0x3,-0x24(%rbp)
mov    %rsp,%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x18(%rbp),%rax
ja     11fa <test_rand_list+0xca>
movl   $0x0,-0x3c(%rbp)
cmpl   $0x3,-0x3c(%rbp)
jge    11c1 <test_rand_list+0x91>
mov    -0x38(%rbp),%rdi
movslq -0x3c(%rbp),%rax
lea    -0x60(%rbp),%rsi
shl    $0x3,%rax
add    %rax,%rsi
call   1050 <__test_rand_list@plt>
cmp    $0x0,%rax
je     11ae <test_rand_list+0x7e>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x40(%rbp)
jmp    1208 <test_rand_list+0xd8>
jmp    11b3 <test_rand_list+0x83>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    116f <test_rand_list+0x3f>
mov    -0x38(%rbp),%rax
mov    %rax,-0x68(%rbp)
lea    -0x60(%rbp),%rdi
mov    $0x3,%esi
call   1040 <mean@plt>
mov    -0x68(%rbp),%rsi
mov    %eax,%edx
lea    0xe1c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
add    -0x38(%rbp),%rax
mov    %rax,-0x38(%rbp)
jmp    115a <test_rand_list+0x2a>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x40(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_rand_list>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
cmp    %rsi,%rdi
jbe    1158 <test_rand_list+0x28>
xor    %r13d,%r13d
mov    %r13d,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0x8(%rsp),%r12
mov    %rsp,%rbp
mov    $0x1,%r13d
nop
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1050 <__test_rand_list@plt>
test   %rax,%rax
jne    1146 <test_rand_list+0x16>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1050 <__test_rand_list@plt>
test   %rax,%rax
jne    1146 <test_rand_list+0x16>
mov    %rbx,%rdi
lea    0x10(%rsp),%rsi
call   1050 <__test_rand_list@plt>
test   %rax,%rax
jne    1146 <test_rand_list+0x16>
mov    %rbp,%rdi
mov    $0x3,%esi
call   1040 <mean@plt>
lea    0xe4a(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <printf@plt>
add    %r14,%rbx
cmp    %r15,%rbx
jbe    1170 <test_rand_list+0x40>
jmp    1143 <test_rand_list+0x13>

LLVM IR (-O0):
@.str = [11 x i8] c"%ld %.2lf\0A\00"
define i32 @test_rand_list(i64 %0, i64 %1, i64 %2) {
%4 = alloca i32
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i32
%12 = alloca i32
store i64 %0, i64* %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i32 3, i32* %8
%13 = call i8* @llvm.stacksave()
store i8* %13, i8** %9
%14 = alloca double, i64 3
%15 = load i64, i64* %5
store i64 %15, i64* %10
br label %16
16: ; preds = %40, %3
%17 = load i64, i64* %10
%18 = load i64, i64* %6
%19 = icmp ule i64 %17, %18
br i1 %19, label %20, label %44
20: ; preds = %16
store i32 0, i32* %11
br label %21
21: ; preds = %33, %20
%22 = load i32, i32* %11
%23 = icmp slt i32 %22, 3
br i1 %23, label %24, label %36
24: ; preds = %21
%25 = load i64, i64* %10
%26 = load i32, i32* %11
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds double, double* %14, i64 %27
%29 = call i64 @__test_rand_list(i64 %25, double* %28)
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %32
31: ; preds = %24
store i32 1, i32* %4
store i32 1, i32* %12
br label %45
32: ; preds = %24
br label %33
33: ; preds = %32
%34 = load i32, i32* %11
%35 = add nsw i32 %34, 1
store i32 %35, i32* %11
br label %21
36: ; preds = %21
%37 = load i64, i64* %10
%38 = call i32 @mean(double* %14, i32 3)
%39 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i64 %37, i32 %38)
br label %40
40: ; preds = %36
%41 = load i64, i64* %7
%42 = load i64, i64* %10
%43 = add i64 %42, %41
store i64 %43, i64* %10
br label %16
44: ; preds = %16
store i32 0, i32* %4
store i32 1, i32* %12
br label %45
45: ; preds = %44, %31
%46 = load i8*, i8** %9
%47 = load i32, i32* %4
ret i32 %47
}

LLVM IR (-O2):
@.str = [11 x i8] c"%ld %.2lf\0A\00"
define i32 @test_rand_list(i64 %0, i64 %1, i64 %2) {
%4 = alloca [3 x double]
%5 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 0
%6 = icmp ugt i64 %0, %1
br i1 %6, label %25, label %7
7: ; preds = %3
%8 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 1
%9 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 2
br label %10
10: ; preds = %7, %20
%11 = phi i64 [ %23, %20 ], [ %0, %7 ]
%12 = call i64 @__test_rand_list(i64 %11, double* %5)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %25
14: ; preds = %10
%15 = call i64 @__test_rand_list(i64 %11, double* %8)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %25
17: ; preds = %14
%18 = call i64 @__test_rand_list(i64 %11, double* %9)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %25
20: ; preds = %17
%21 = call i32 @mean(double* %5, i32 3)
%22 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i64 %11, i32 %21)
%23 = add i64 %11, %2
%24 = icmp ugt i64 %23, %1
br i1 %24, label %25, label %10
25: ; preds = %20, %10, %14, %17, %3
%26 = phi i32 [ 0, %3 ], [ 0, %20 ], [ 1, %10 ], [ 1, %14 ], [ 1, %17 ]
ret i32 %26
}