#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 */
void floatminmax(float *in, size_t size, float *min, float *max) {
  float tmin = 1e30, tmax = -1e30, *fpt;
  {
    fpt = in + size;
    do {
      if (*in > tmax)
        tmax = *in;
      if (*in < tmin)
        tmin = *in;
    } while (++in < fpt);
    *max = tmax;
    *min = tmin;
  }
}


x86 assembly (clang, -O0):
<floatminmax>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movss  0xee8(%rip),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  0xed7(%rip),%xmm0
movss  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
ucomiss -0x28(%rbp),%xmm0
jbe    1160 <floatminmax+0x60>
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm1
movss  -0x24(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1183 <floatminmax+0x83>
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x24(%rbp)
jmp    1188 <floatminmax+0x88>
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
cmp    -0x30(%rbp),%rax
jb     1141 <floatminmax+0x41>
movss  -0x28(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x24(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<floatminmax>:
lea    (%rdi,%rsi,4),%rax
movss  0xef4(%rip),%xmm1
movss  0xef0(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movaps %xmm1,%xmm2
movaps %xmm0,%xmm3
movss  (%rdi),%xmm0
movaps %xmm0,%xmm1
maxss  %xmm2,%xmm1
minss  %xmm3,%xmm0
add    $0x4,%rdi
cmp    %rax,%rdi
jb     1120 <floatminmax+0x20>
movss  %xmm1,(%rcx)
movss  %xmm0,(%rdx)
ret

LLVM IR (-O0):
define void @floatminmax(float* %0, i64 %1, float* %2, float* %3) {
%5 = alloca float*
%6 = alloca i64
%7 = alloca float*
%8 = alloca float*
%9 = alloca float
%10 = alloca float
%11 = alloca float*
store float* %0, float** %5
store i64 %1, i64* %6
store float* %2, float** %7
store float* %3, float** %8
store float 0x46293E5940000000, float* %9
store float 0xC6293E5940000000, float* %10
%12 = load float*, float** %5
%13 = load i64, i64* %6
%14 = getelementptr inbounds float, float* %12, i64 %13
store float* %14, float** %11
br label %15
15: ; preds = %32, %4
%16 = load float*, float** %5
%17 = load float, float* %16
%18 = load float, float* %10
%19 = fcmp ogt float %17, %18
br i1 %19, label %20, label %23
20: ; preds = %15
%21 = load float*, float** %5
%22 = load float, float* %21
store float %22, float* %10
br label %23
23: ; preds = %20, %15
%24 = load float*, float** %5
%25 = load float, float* %24
%26 = load float, float* %9
%27 = fcmp olt float %25, %26
br i1 %27, label %28, label %31
28: ; preds = %23
%29 = load float*, float** %5
%30 = load float, float* %29
store float %30, float* %9
br label %31
31: ; preds = %28, %23
br label %32
32: ; preds = %31
%33 = load float*, float** %5
%34 = getelementptr inbounds float, float* %33, i32 1
store float* %34, float** %5
%35 = load float*, float** %11
%36 = icmp ult float* %34, %35
br i1 %36, label %15, label %37
37: ; preds = %32
%38 = load float, float* %10
%39 = load float*, float** %8
store float %38, float* %39
%40 = load float, float* %9
%41 = load float*, float** %7
store float %40, float* %41
ret void
}

LLVM IR (-O2):
define void @floatminmax(float* %0, i64 %1, float* nocapture writeonly %2, float* nocapture writeonly %3) {
%5 = getelementptr inbounds float, float* %0, i64 %1
br label %6
6: ; preds = %6, %4
%7 = phi float [ 0x46293E5940000000, %4 ], [ %14, %6 ]
%8 = phi float [ 0xC6293E5940000000, %4 ], [ %12, %6 ]
%9 = phi float* [ %0, %4 ], [ %15, %6 ]
%10 = load float, float* %9
%11 = fcmp ogt float %10, %8
%12 = select i1 %11, float %10, float %8
%13 = fcmp olt float %10, %7
%14 = select i1 %13, float %10, float %7
%15 = getelementptr inbounds float, float* %9, i64 1
%16 = icmp ult float* %15, %5
br i1 %16, label %6, label %17
17: ; preds = %6
store float %12, float* %3
store float %14, float* %2
ret void
}