#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 RAND_MAX;
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ qd_quick_renorm(double *, double *, double *, double *,
                                   double *);
scalar_t__ rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int basic_test(void) {
  double c0, c1, c2, c3, c4;
  printf("\ntesting some basic operations ...\n");
  srand(time(NULL));
  c0 = ((double)rand()) / RAND_MAX;
  c1 = ((double)rand()) / RAND_MAX;
  c2 = ((double)rand()) / RAND_MAX;
  c3 = ((double)rand()) / RAND_MAX;
  c4 = ((double)rand()) / RAND_MAX;
  qd_quick_renorm(&c0, &c1, &c2, &c3, &c4);
  return 0;
}


x86 assembly (clang, -O0):
<basic_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x0,%al
call   1070 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2e61(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x8(%rbp)
mov    $0x0,%al
call   1070 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2e45(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    $0x0,%al
call   1070 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2e29(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    $0x0,%al
call   1070 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2e0d(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    $0x0,%al
call   1070 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2df1(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
lea    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rcx
lea    -0x28(%rbp),%r8
call   1060 <qd_quick_renorm@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<basic_test>:
push   %rbx
sub    $0x30,%rsp
lea    0xea4(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
xor    %eax,%eax
call   1070 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2e66(%rip),%rbx
divsd  (%rbx),%xmm0
movsd  %xmm0,0x28(%rsp)
xor    %eax,%eax
call   1070 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  (%rbx),%xmm0
movsd  %xmm0,0x20(%rsp)
xor    %eax,%eax
call   1070 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  (%rbx),%xmm0
movsd  %xmm0,0x18(%rsp)
xor    %eax,%eax
call   1070 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  (%rbx),%xmm0
movsd  %xmm0,0x10(%rsp)
xor    %eax,%eax
call   1070 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
divsd  (%rbx),%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0x28(%rsp),%rdi
lea    0x20(%rsp),%rsi
lea    0x18(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0x8(%rsp),%r8
call   1060 <qd_quick_renorm@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [36 x i8] c"\0Atesting some basic operations ...\0A\00"
@RAND_MAX = global double 0.000000e+00
define i32 @basic_test() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @time(i32* null)
%8 = call i32 @srand(i32 %7)
%9 = call i64 (...) @rand()
%10 = sitofp i64 %9 to double
%11 = load double, double* @RAND_MAX
%12 = fdiv double %10, %11
store double %12, double* %1
%13 = call i64 (...) @rand()
%14 = sitofp i64 %13 to double
%15 = load double, double* @RAND_MAX
%16 = fdiv double %14, %15
store double %16, double* %2
%17 = call i64 (...) @rand()
%18 = sitofp i64 %17 to double
%19 = load double, double* @RAND_MAX
%20 = fdiv double %18, %19
store double %20, double* %3
%21 = call i64 (...) @rand()
%22 = sitofp i64 %21 to double
%23 = load double, double* @RAND_MAX
%24 = fdiv double %22, %23
store double %24, double* %4
%25 = call i64 (...) @rand()
%26 = sitofp i64 %25 to double
%27 = load double, double* @RAND_MAX
%28 = fdiv double %26, %27
store double %28, double* %5
%29 = call i32 @qd_quick_renorm(double* %1, double* %2, double* %3, double* %4, double* %5)
ret i32 0
}

LLVM IR (-O2):
@RAND_MAX = global double 0.000000e+00
@str = [35 x i8] c"\0Atesting some basic operations ...\00"
define i32 @basic_test() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = bitcast double* %1 to i8*
%7 = bitcast double* %2 to i8*
%8 = bitcast double* %3 to i8*
%9 = bitcast double* %4 to i8*
%10 = bitcast double* %5 to i8*
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
%12 = tail call i32 @time(i32* null)
%13 = tail call i32 @srand(i32 %12)
%14 = tail call i64 (...) @rand()
%15 = sitofp i64 %14 to double
%16 = load double, double* @RAND_MAX
%17 = fdiv double %15, %16
store double %17, double* %1
%18 = tail call i64 (...) @rand()
%19 = sitofp i64 %18 to double
%20 = load double, double* @RAND_MAX
%21 = fdiv double %19, %20
store double %21, double* %2
%22 = tail call i64 (...) @rand()
%23 = sitofp i64 %22 to double
%24 = load double, double* @RAND_MAX
%25 = fdiv double %23, %24
store double %25, double* %3
%26 = tail call i64 (...) @rand()
%27 = sitofp i64 %26 to double
%28 = load double, double* @RAND_MAX
%29 = fdiv double %27, %28
store double %29, double* %4
%30 = tail call i64 (...) @rand()
%31 = sitofp i64 %30 to double
%32 = load double, double* @RAND_MAX
%33 = fdiv double %31, %32
store double %33, double* %5
%34 = call i32 @qd_quick_renorm(double* %1, double* %2, double* %3, double* %4, double* %5)
ret i32 0
}