#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 */
typedef int uint8_t;
typedef int int64_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, float);
float stdlib_strided_smskmax(int, float *, int, int *, int);
int main() {
  float x[] = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0};
  uint8_t mask[] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 1};
  int64_t N = 5;
  int64_t strideX = 2;
  int64_t strideMask = 2;
  float v = stdlib_strided_smskmax(N, x, strideX, mask, strideMask);
  printf("max: %f\n", v);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
lea    -0x30(%rbp),%rdi
lea    0xead(%rip),%rsi
mov    $0x28,%edx
call   1060 <memcpy@plt>
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
movl   $0x1,-0x40(%rbp)
movl   $0x1,-0x3c(%rbp)
movl   $0x5,-0x64(%rbp)
movl   $0x2,-0x68(%rbp)
movl   $0x2,-0x6c(%rbp)
mov    -0x64(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    -0x68(%rbp),%edx
lea    -0x60(%rbp),%rcx
mov    -0x6c(%rbp),%r8d
call   1040 <stdlib_strided_smskmax@plt>
movss  %xmm0,-0x70(%rbp)
movss  -0x70(%rbp),%xmm0
lea    0xe70(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x58,%rsp
mov    0xef5(%rip),%rax
mov    %rax,0x50(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xebd(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movabs $0x100000001,%rax
mov    %rax,0x20(%rsp)
lea    0x30(%rsp),%rsi
mov    %rsp,%rcx
mov    $0x5,%edi
mov    $0x2,%edx
mov    $0x2,%r8d
call   1040 <stdlib_strided_smskmax@plt>
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x58,%rsp
ret

LLVM IR (-O0):
@__const.main.x = [10 x float] [float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00, float 6.000000e+00, float 7.000000e+00, float 8.000000e+00, float 9.000000e+00, float 1.000000e+01]
@.str = [9 x i8] c"max: %f\0A\00"
define i32 @main() {
%1 = alloca [10 x float]
%2 = alloca [10 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca float
%7 = bitcast [10 x float]* %1 to i8*
%8 = bitcast [10 x i32]* %2 to i8*
%9 = bitcast i8* %8 to [10 x i32]*
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i32 0, i32 8
store i32 1, i32* %10
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %9, i32 0, i32 9
store i32 1, i32* %11
store i32 5, i32* %3
store i32 2, i32* %4
store i32 2, i32* %5
%12 = load i32, i32* %3
%13 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 0
%14 = load i32, i32* %4
%15 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%16 = load i32, i32* %5
%17 = call float @stdlib_strided_smskmax(i32 %12, float* %13, i32 %14, i32* %15, i32 %16)
store float %17, float* %6
%18 = load float, float* %6
%19 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), float %18)
ret i32 0
}

LLVM IR (-O2):
@__const.main.x = [10 x float] [float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00, float 6.000000e+00, float 7.000000e+00, float 8.000000e+00, float 9.000000e+00, float 1.000000e+01]
@.str = [9 x i8] c"max: %f\0A\00"
define i32 @main() {
%1 = alloca [10 x float]
%2 = alloca [10 x i32]
%3 = bitcast [10 x float]* %1 to i8*
%4 = bitcast [10 x i32]* %2 to i8*
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 8
store i32 1, i32* %5
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 9
store i32 1, i32* %6
%7 = getelementptr inbounds [10 x float], [10 x float]* %1, i64 0, i64 0
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%9 = call float @stdlib_strided_smskmax(i32 5, float* %7, i32 2, i32* %8, i32 2)
%10 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), float %9)
ret i32 0
}