#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 *, double);
double stdlib_strided_dmskmin(int, double *, int, int *, int);
int main() {
  double 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;
  double v = stdlib_strided_dmskmin(N, x, strideX, mask, strideMask);
  printf("min: %lf\n", v);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
lea    -0x50(%rbp),%rdi
lea    0xeaa(%rip),%rsi
mov    $0x50,%edx
call   1050 <memcpy@plt>
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
movl   $0x1,-0x60(%rbp)
movl   $0x1,-0x5c(%rbp)
movl   $0x5,-0x84(%rbp)
movl   $0x2,-0x88(%rbp)
movl   $0x2,-0x8c(%rbp)
mov    -0x84(%rbp),%edi
lea    -0x50(%rbp),%rsi
mov    -0x88(%rbp),%edx
lea    -0x80(%rbp),%rcx
mov    -0x8c(%rbp),%r8d
call   1060 <stdlib_strided_dmskmin@plt>
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
lea    0xe7d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x88,%rsp
movaps 0xf12(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xef6(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xeda(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xebe(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xea2(%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_dmskmin@plt>
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x88,%rsp
ret

LLVM IR (-O0):
@__const.main.x = [10 x double] [double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00, double 5.000000e+00, double 6.000000e+00, double 7.000000e+00, double 8.000000e+00, double 9.000000e+00, double 1.000000e+01]
@.str = [10 x i8] c"min: %lf\0A\00"
define i32 @main() {
%1 = alloca [10 x double]
%2 = alloca [10 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca double
%7 = bitcast [10 x double]* %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 double], [10 x double]* %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 double @stdlib_strided_dmskmin(i32 %12, double* %13, i32 %14, i32* %15, i32 %16)
store double %17, double* %6
%18 = load double, double* %6
%19 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double %18)
ret i32 0
}

LLVM IR (-O2):
@__const.main.x = [10 x double] [double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00, double 5.000000e+00, double 6.000000e+00, double 7.000000e+00, double 8.000000e+00, double 9.000000e+00, double 1.000000e+01]
@.str = [10 x i8] c"min: %lf\0A\00"
define i32 @main() {
%1 = alloca [10 x double]
%2 = alloca [10 x i32]
%3 = bitcast [10 x double]* %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 double], [10 x double]* %1, i64 0, i64 0
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%9 = call double @stdlib_strided_dmskmin(i32 5, double* %7, i32 2, i32* %8, i32 2)
%10 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double %9)
ret i32 0
}