#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 */
float fmax(float, float);
void vec4_max(float *dst, float *b) {
  dst[0] = fmax(dst[0], b[0]);
  dst[1] = fmax(dst[1], b[1]);
  dst[2] = fmax(dst[2], b[2]);
  dst[3] = fmax(dst[3], b[3]);
}


x86 assembly (clang, -O0):
<vec4_max>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm1
call   1030 <fmax@plt>
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm1
call   1030 <fmax@plt>
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm1
call   1030 <fmax@plt>
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
movss  0xc(%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  0xc(%rax),%xmm1
call   1030 <fmax@plt>
mov    -0x8(%rbp),%rax
movss  %xmm0,0xc(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vec4_max>:
movss  (%rsi),%xmm0
movss  (%rdi),%xmm1
movss  0x4(%rdi),%xmm2
movaps %xmm1,%xmm3
cmpunordss %xmm1,%xmm3
movaps %xmm3,%xmm4
andps  %xmm0,%xmm4
maxss  %xmm1,%xmm0
andnps %xmm0,%xmm3
orps   %xmm4,%xmm3
movss  %xmm3,(%rdi)
movss  0x4(%rsi),%xmm0
movaps %xmm2,%xmm1
cmpunordss %xmm2,%xmm1
movaps %xmm1,%xmm3
andps  %xmm0,%xmm3
maxss  %xmm2,%xmm0
andnps %xmm0,%xmm1
orps   %xmm3,%xmm1
movss  %xmm1,0x4(%rdi)
movss  0x8(%rdi),%xmm0
movss  0x8(%rsi),%xmm1
movaps %xmm0,%xmm2
cmpunordss %xmm0,%xmm2
movaps %xmm2,%xmm3
andps  %xmm1,%xmm3
maxss  %xmm0,%xmm1
andnps %xmm1,%xmm2
orps   %xmm3,%xmm2
movss  %xmm2,0x8(%rdi)
movss  0xc(%rdi),%xmm0
movss  0xc(%rsi),%xmm1
movaps %xmm0,%xmm2
cmpunordss %xmm0,%xmm2
movaps %xmm2,%xmm3
andps  %xmm1,%xmm3
maxss  %xmm0,%xmm1
andnps %xmm1,%xmm2
orps   %xmm3,%xmm2
movss  %xmm2,0xc(%rdi)
ret

LLVM IR (-O0):
define void @vec4_max(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
store float* %0, float** %3
store float* %1, float** %4
%5 = load float*, float** %3
%6 = getelementptr inbounds float, float* %5, i64 0
%7 = load float, float* %6
%8 = load float*, float** %4
%9 = getelementptr inbounds float, float* %8, i64 0
%10 = load float, float* %9
%11 = call float @fmax(float %7, float %10)
%12 = load float*, float** %3
%13 = getelementptr inbounds float, float* %12, i64 0
store float %11, float* %13
%14 = load float*, float** %3
%15 = getelementptr inbounds float, float* %14, i64 1
%16 = load float, float* %15
%17 = load float*, float** %4
%18 = getelementptr inbounds float, float* %17, i64 1
%19 = load float, float* %18
%20 = call float @fmax(float %16, float %19)
%21 = load float*, float** %3
%22 = getelementptr inbounds float, float* %21, i64 1
store float %20, float* %22
%23 = load float*, float** %3
%24 = getelementptr inbounds float, float* %23, i64 2
%25 = load float, float* %24
%26 = load float*, float** %4
%27 = getelementptr inbounds float, float* %26, i64 2
%28 = load float, float* %27
%29 = call float @fmax(float %25, float %28)
%30 = load float*, float** %3
%31 = getelementptr inbounds float, float* %30, i64 2
store float %29, float* %31
%32 = load float*, float** %3
%33 = getelementptr inbounds float, float* %32, i64 3
%34 = load float, float* %33
%35 = load float*, float** %4
%36 = getelementptr inbounds float, float* %35, i64 3
%37 = load float, float* %36
%38 = call float @fmax(float %34, float %37)
%39 = load float*, float** %3
%40 = getelementptr inbounds float, float* %39, i64 3
store float %38, float* %40
ret void
}

LLVM IR (-O2):
define void @vec4_max(float* nocapture %0, float* nocapture %1) {
%3 = load float, float* %0
%4 = load float, float* %1
%5 = tail call nsz float @llvm.maxnum.f32(float %3, float %4)
store float %5, float* %0
%6 = getelementptr inbounds float, float* %0, i64 1
%7 = load float, float* %6
%8 = getelementptr inbounds float, float* %1, i64 1
%9 = load float, float* %8
%10 = tail call nsz float @llvm.maxnum.f32(float %7, float %9)
store float %10, float* %6
%11 = getelementptr inbounds float, float* %0, i64 2
%12 = load float, float* %11
%13 = getelementptr inbounds float, float* %1, i64 2
%14 = load float, float* %13
%15 = tail call nsz float @llvm.maxnum.f32(float %12, float %14)
store float %15, float* %11
%16 = getelementptr inbounds float, float* %0, i64 3
%17 = load float, float* %16
%18 = getelementptr inbounds float, float* %1, i64 3
%19 = load float, float* %18
%20 = tail call nsz float @llvm.maxnum.f32(float %17, float %19)
store float %20, float* %16
ret void
}