#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*/ od_add(double *, double *, double *);
int /*<<< orphan*/ od_div(double *, double *, double *);
int /*<<< orphan*/ od_mul(double *, double *, double *);
int /*<<< orphan*/ od_random(double *);
int /*<<< orphan*/ od_sub(double *, double *, double *);
int /*<<< orphan*/ od_write_doubles(double *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int basic_test(void) {
  double a[8], b[8], c[8], d[8];
  printf("Testing some basic operations ...\n");
  srand(time(NULL));
  od_random(a);
  printf("the first random number a :\n");
  od_write_doubles(a);
  od_random(b);
  printf("the second random number b :\n");
  od_write_doubles(b);
  od_add(a, b, c);
  printf("a+b :\n");
  od_write_doubles(c);
  od_sub(c, a, d);
  printf("a+b-a :\n");
  od_write_doubles(d);
  od_mul(a, b, c);
  printf("a*b :\n");
  od_write_doubles(c);
  od_div(c, a, d);
  printf("a*b/a :\n");
  od_write_doubles(d);
  return 0;
}


x86 assembly (clang, -O0):
<basic_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
lea    0xe5e(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1090 <time@plt>
mov    %eax,%edi
call   1080 <srand@plt>
lea    -0x40(%rbp),%rdi
call   1040 <od_random@plt>
lea    0xe5c(%rip),%rdi
call   1050 <printf@plt>
lea    -0x40(%rbp),%rdi
call   1060 <od_write_doubles@plt>
lea    -0x80(%rbp),%rdi
call   1040 <od_random@plt>
lea    0xe5b(%rip),%rdi
call   1050 <printf@plt>
lea    -0x80(%rbp),%rdi
call   1060 <od_write_doubles@plt>
lea    -0x40(%rbp),%rdi
lea    -0x80(%rbp),%rsi
lea    -0xc0(%rbp),%rdx
call   1030 <od_add@plt>
lea    0xe50(%rip),%rdi
call   1050 <printf@plt>
lea    -0xc0(%rbp),%rdi
call   1060 <od_write_doubles@plt>
lea    -0xc0(%rbp),%rdi
lea    -0x40(%rbp),%rsi
lea    -0x100(%rbp),%rdx
call   10a0 <od_sub@plt>
lea    0xe28(%rip),%rdi
call   1050 <printf@plt>
lea    -0x100(%rbp),%rdi
call   1060 <od_write_doubles@plt>
lea    -0x40(%rbp),%rdi
lea    -0x80(%rbp),%rsi
lea    -0xc0(%rbp),%rdx
call   10b0 <od_mul@plt>
lea    0xe05(%rip),%rdi
call   1050 <printf@plt>
lea    -0xc0(%rbp),%rdi
call   1060 <od_write_doubles@plt>
lea    -0xc0(%rbp),%rdi
lea    -0x40(%rbp),%rsi
lea    -0x100(%rbp),%rdx
call   1070 <od_div@plt>
lea    0xddd(%rip),%rdi
call   1050 <printf@plt>
lea    -0x100(%rbp),%rdi
call   1060 <od_write_doubles@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<basic_test>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x108,%rsp
lea    0xe5b(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1090 <time@plt>
mov    %eax,%edi
call   1080 <srand@plt>
lea    0xc0(%rsp),%r14
mov    %r14,%rdi
call   1050 <od_random@plt>
lea    0xe53(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1060 <od_write_doubles@plt>
lea    0x80(%rsp),%r15
mov    %r15,%rdi
call   1050 <od_random@plt>
lea    0xe4b(%rip),%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   1060 <od_write_doubles@plt>
lea    0x40(%rsp),%rbx
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1030 <od_add@plt>
lea    0xe41(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1060 <od_write_doubles@plt>
mov    %rsp,%r12
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
call   10a0 <od_sub@plt>
lea    0xe22(%rip),%rdi
call   1040 <puts@plt>
mov    %r12,%rdi
call   1060 <od_write_doubles@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   10b0 <od_mul@plt>
lea    0xe08(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1060 <od_write_doubles@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
call   1070 <od_div@plt>
lea    0xdec(%rip),%rdi
call   1040 <puts@plt>
mov    %r12,%rdi
call   1060 <od_write_doubles@plt>
xor    %eax,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [35 x i8] c"Testing some basic operations ...\0A\00"
@.str.1 = [29 x i8] c"the first random number a :\0A\00"
@.str.2 = [30 x i8] c"the second random number b :\0A\00"
@.str.3 = [7 x i8] c"a+b :\0A\00"
@.str.4 = [9 x i8] c"a+b-a :\0A\00"
@.str.5 = [7 x i8] c"a*b :\0A\00"
@.str.6 = [9 x i8] c"a*b/a :\0A\00"
define i32 @basic_test() {
%1 = alloca [8 x double]
%2 = alloca [8 x double]
%3 = alloca [8 x double]
%4 = alloca [8 x double]
%5 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @time(i32* null)
%7 = call i32 @srand(i32 %6)
%8 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 0
%9 = call i32 @od_random(double* %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%11 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 0
%12 = call i32 @od_write_doubles(double* %11)
%13 = getelementptr inbounds [8 x double], [8 x double]* %2, i64 0, i64 0
%14 = call i32 @od_random(double* %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%16 = getelementptr inbounds [8 x double], [8 x double]* %2, i64 0, i64 0
%17 = call i32 @od_write_doubles(double* %16)
%18 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 0
%19 = getelementptr inbounds [8 x double], [8 x double]* %2, i64 0, i64 0
%20 = getelementptr inbounds [8 x double], [8 x double]* %3, i64 0, i64 0
%21 = call i32 @od_add(double* %18, double* %19, double* %20)
%22 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%23 = getelementptr inbounds [8 x double], [8 x double]* %3, i64 0, i64 0
%24 = call i32 @od_write_doubles(double* %23)
%25 = getelementptr inbounds [8 x double], [8 x double]* %3, i64 0, i64 0
%26 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 0
%27 = getelementptr inbounds [8 x double], [8 x double]* %4, i64 0, i64 0
%28 = call i32 @od_sub(double* %25, double* %26, double* %27)
%29 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%30 = getelementptr inbounds [8 x double], [8 x double]* %4, i64 0, i64 0
%31 = call i32 @od_write_doubles(double* %30)
%32 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 0
%33 = getelementptr inbounds [8 x double], [8 x double]* %2, i64 0, i64 0
%34 = getelementptr inbounds [8 x double], [8 x double]* %3, i64 0, i64 0
%35 = call i32 @od_mul(double* %32, double* %33, double* %34)
%36 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%37 = getelementptr inbounds [8 x double], [8 x double]* %3, i64 0, i64 0
%38 = call i32 @od_write_doubles(double* %37)
%39 = getelementptr inbounds [8 x double], [8 x double]* %3, i64 0, i64 0
%40 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 0
%41 = getelementptr inbounds [8 x double], [8 x double]* %4, i64 0, i64 0
%42 = call i32 @od_div(double* %39, double* %40, double* %41)
%43 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%44 = getelementptr inbounds [8 x double], [8 x double]* %4, i64 0, i64 0
%45 = call i32 @od_write_doubles(double* %44)
ret i32 0
}

LLVM IR (-O2):
@str = [34 x i8] c"Testing some basic operations ...\00"
@str.7 = [28 x i8] c"the first random number a :\00"
@str.8 = [29 x i8] c"the second random number b :\00"
@str.9 = [6 x i8] c"a+b :\00"
@str.10 = [8 x i8] c"a+b-a :\00"
@str.11 = [6 x i8] c"a*b :\00"
@str.12 = [8 x i8] c"a*b/a :\00"
define i32 @basic_test() {
%1 = alloca [8 x double]
%2 = alloca [8 x double]
%3 = alloca [8 x double]
%4 = alloca [8 x double]
%5 = bitcast [8 x double]* %1 to i8*
%6 = bitcast [8 x double]* %2 to i8*
%7 = bitcast [8 x double]* %3 to i8*
%8 = bitcast [8 x double]* %4 to i8*
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%10 = tail call i32 @time(i32* null)
%11 = tail call i32 @srand(i32 %10)
%12 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 0
%13 = call i32 @od_random(double* %12)
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.7, i64 0, i64 0))
%15 = call i32 @od_write_doubles(double* %12)
%16 = getelementptr inbounds [8 x double], [8 x double]* %2, i64 0, i64 0
%17 = call i32 @od_random(double* %16)
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.8, i64 0, i64 0))
%19 = call i32 @od_write_doubles(double* %16)
%20 = getelementptr inbounds [8 x double], [8 x double]* %3, i64 0, i64 0
%21 = call i32 @od_add(double* %12, double* %16, double* %20)
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.9, i64 0, i64 0))
%23 = call i32 @od_write_doubles(double* %20)
%24 = getelementptr inbounds [8 x double], [8 x double]* %4, i64 0, i64 0
%25 = call i32 @od_sub(double* %20, double* %12, double* %24)
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.10, i64 0, i64 0))
%27 = call i32 @od_write_doubles(double* %24)
%28 = call i32 @od_mul(double* %12, double* %16, double* %20)
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.11, i64 0, i64 0))
%30 = call i32 @od_write_doubles(double* %20)
%31 = call i32 @od_div(double* %20, double* %12, double* %24)
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.12, i64 0, i64 0))
%33 = call i32 @od_write_doubles(double* %24)
ret i32 0
}