#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 maxArray(double *, int);
double minArray(double *, int);
int /*<<< orphan*/ printArray(double *, int);
int /*<<< orphan*/ printf(char *, double, double);
int /*<<< orphan*/ seedArray(double *, int, int, int);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  srand(time(NULL));
  double d[10];
  seedArray(d, 10, 1000, 1000);
  printArray(d, 10);
  printf("min = %f\nmax = %f\n", minArray(d, 10), maxArray(d, 10));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
lea    -0x50(%rbp),%rdi
mov    $0xa,%esi
mov    $0x3e8,%ecx
mov    %ecx,%edx
call   1060 <seedArray@plt>
lea    -0x50(%rbp),%rdi
mov    $0xa,%esi
call   1080 <printArray@plt>
lea    -0x50(%rbp),%rdi
mov    $0xa,%esi
call   1090 <minArray@plt>
movsd  %xmm0,-0x58(%rbp)
lea    -0x50(%rbp),%rdi
mov    $0xa,%esi
call   1050 <maxArray@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
lea    0xe25(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x60,%rsp
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
mov    $0x3e8,%edx
mov    $0x3e8,%ecx
call   1060 <seedArray@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1080 <printArray@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1090 <minArray@plt>
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
mov    $0xa,%esi
call   1050 <maxArray@plt>
movaps %xmm0,%xmm1
lea    0xe2a(%rip),%rdi
movsd  0x8(%rsp),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"min = %f\0Amax = %f\0A\00"
define i32 @main() {
%1 = alloca [10 x double]
%2 = call i32 @time(i32* null)
%3 = call i32 @srand(i32 %2)
%4 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 0
%5 = call i32 @seedArray(double* %4, i32 10, i32 1000, i32 1000)
%6 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 0
%7 = call i32 @printArray(double* %6, i32 10)
%8 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 0
%9 = call double @minArray(double* %8, i32 10)
%10 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 0
%11 = call double @maxArray(double* %10, i32 10)
%12 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), double %9, double %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"min = %f\0Amax = %f\0A\00"
define i32 @main() {
%1 = alloca [10 x double]
%2 = tail call i32 @time(i32* null)
%3 = tail call i32 @srand(i32 %2)
%4 = bitcast [10 x double]* %1 to i8*
%5 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 0
%6 = call i32 @seedArray(double* %5, i32 10, i32 1000, i32 1000)
%7 = call i32 @printArray(double* %5, i32 10)
%8 = call double @minArray(double* %5, i32 10)
%9 = call double @maxArray(double* %5, i32 10)
%10 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), double %8, double %9)
ret i32 0
}