#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 *, int, double);
int /*<<< orphan*/ stdlib_strided_dmsksqrt(int, double *, int, int *, int,
                                           double *, int);
int main() {
  double x[] = {0.0, 4.0, 9.0, 12.0, 24.0, 64.0, 81.0, 101.0};
  uint8_t m[] = {0, 0, 1, 0, 1, 1, 0, 0};
  double y[] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
  int64_t N = 4;
  int64_t strideX = 2;
  int64_t strideM = 2;
  int64_t strideY = 2;
  stdlib_strided_dmsksqrt(N, x, strideX, m, strideM, y, strideY);
  for (int i = 0; i < 8; i++) {
    printf("y[ %i ] = %lf\n", i, y[i]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xea3(%rip),%rsi
mov    $0x40,%edx
call   1060 <memcpy@plt>
mov    0xed2(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0xecf(%rip),%rax
mov    %rax,-0x68(%rbp)
mov    0xecc(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xec9(%rip),%rax
mov    %rax,-0x58(%rbp)
lea    -0xb0(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1050 <memset@plt>
movl   $0x4,-0xb4(%rbp)
movl   $0x2,-0xb8(%rbp)
movl   $0x2,-0xbc(%rbp)
movl   $0x2,-0xc0(%rbp)
mov    -0xb4(%rbp),%edi
lea    -0x50(%rbp),%rsi
mov    -0xb8(%rbp),%edx
lea    -0x70(%rbp),%rcx
mov    -0xbc(%rbp),%r8d
lea    -0xb0(%rbp),%r9
mov    -0xc0(%rbp),%eax
mov    %eax,(%rsp)
call   1030 <stdlib_strided_dmsksqrt@plt>
movl   $0x0,-0xc4(%rbp)
cmpl   $0x8,-0xc4(%rbp)
jge    124b <main+0x10b>
mov    -0xc4(%rbp),%esi
movslq -0xc4(%rbp),%rax
movsd  -0xb0(%rbp,%rax,8),%xmm0
ff ff
lea    0xe2e(%rip),%rdi
call   1040 <printf@plt>
mov    -0xc4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc4(%rbp)
jmp    1208 <main+0xc8>
mov    -0x4(%rbp),%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0xb0,%rsp
movaps 0xf01(%rip),%xmm0
movaps %xmm0,0xa0(%rsp)
movaps 0xee2(%rip),%xmm0
movaps %xmm0,0x90(%rsp)
movaps 0xec3(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0xea4(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xee8(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xecc(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movl   $0x2,(%rsp)
lea    0x70(%rsp),%rsi
lea    0x50(%rsp),%rcx
lea    0x10(%rsp),%r9
mov    $0x4,%edi
mov    $0x2,%edx
mov    $0x2,%r8d
call   1030 <stdlib_strided_dmsksqrt@plt>
movsd  0x10(%rsp),%xmm0
lea    0xe98(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <printf@plt>
movsd  0x18(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%esi
call   1040 <printf@plt>
movsd  0x20(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x2,%esi
call   1040 <printf@plt>
movsd  0x28(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x3,%esi
call   1040 <printf@plt>
movsd  0x30(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x4,%esi
call   1040 <printf@plt>
movsd  0x38(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x5,%esi
call   1040 <printf@plt>
movsd  0x40(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x6,%esi
call   1040 <printf@plt>
movsd  0x48(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x7,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.x = [8 x double] [double 0.000000e+00, double 4.000000e+00, double 9.000000e+00, double 1.200000e+01, double 2.400000e+01, double 6.400000e+01, double 8.100000e+01, double 1.010000e+02]
@__const.main.m = [8 x i32] [i32 0, i32 0, i32 1, i32 0, i32 1, i32 1, i32 0, i32 0]
@.str = [15 x i8] c"y[ %i ] = %lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x double]
%3 = alloca [8 x i32]
%4 = alloca [8 x double]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
%10 = bitcast [8 x double]* %2 to i8*
%11 = bitcast [8 x i32]* %3 to i8*
%12 = bitcast [8 x double]* %4 to i8*
store i32 4, i32* %5
store i32 2, i32* %6
store i32 2, i32* %7
store i32 2, i32* %8
%13 = load i32, i32* %5
%14 = getelementptr inbounds [8 x double], [8 x double]* %2, i64 0, i64 0
%15 = load i32, i32* %6
%16 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 0
%17 = load i32, i32* %7
%18 = getelementptr inbounds [8 x double], [8 x double]* %4, i64 0, i64 0
%19 = load i32, i32* %8
%20 = call i32 @stdlib_strided_dmsksqrt(i32 %13, double* %14, i32 %15, i32* %16, i32 %17, double* %18, i32 %19)
store i32 0, i32* %9
br label %21
21: ; preds = %31, %0
%22 = load i32, i32* %9
%23 = icmp slt i32 %22, 8
br i1 %23, label %24, label %34
24: ; preds = %21
%25 = load i32, i32* %9
%26 = load i32, i32* %9
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [8 x double], [8 x double]* %4, i64 0, i64 %27
%29 = load double, double* %28
%30 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %25, double %29)
br label %31
31: ; preds = %24
%32 = load i32, i32* %9
%33 = add nsw i32 %32, 1
store i32 %33, i32* %9
br label %21
34: ; preds = %21
%35 = load i32, i32* %1
ret i32 %35
}

LLVM IR (-O2):
@__const.main.x = [8 x double] [double 0.000000e+00, double 4.000000e+00, double 9.000000e+00, double 1.200000e+01, double 2.400000e+01, double 6.400000e+01, double 8.100000e+01, double 1.010000e+02]
@__const.main.m = [8 x i32] [i32 0, i32 0, i32 1, i32 0, i32 1, i32 1, i32 0, i32 0]
@.str = [15 x i8] c"y[ %i ] = %lf\0A\00"
define i32 @main() {
%1 = alloca [8 x double]
%2 = alloca [8 x i32]
%3 = alloca [8 x double]
%4 = bitcast [8 x double]* %1 to i8*
%5 = bitcast [8 x i32]* %2 to i8*
%6 = bitcast [8 x double]* %3 to i8*
%7 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 0
%8 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%9 = getelementptr inbounds [8 x double], [8 x double]* %3, i64 0, i64 0
%10 = call i32 @stdlib_strided_dmsksqrt(i32 4, double* %7, i32 2, i32* %8, i32 2, double* %9, i32 2)
%11 = load double, double* %9
%12 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 0, double %11)
%13 = getelementptr inbounds [8 x double], [8 x double]* %3, i64 0, i64 1
%14 = load double, double* %13
%15 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 1, double %14)
%16 = getelementptr inbounds [8 x double], [8 x double]* %3, i64 0, i64 2
%17 = load double, double* %16
%18 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 2, double %17)
%19 = getelementptr inbounds [8 x double], [8 x double]* %3, i64 0, i64 3
%20 = load double, double* %19
%21 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 3, double %20)
%22 = getelementptr inbounds [8 x double], [8 x double]* %3, i64 0, i64 4
%23 = load double, double* %22
%24 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 4, double %23)
%25 = getelementptr inbounds [8 x double], [8 x double]* %3, i64 0, i64 5
%26 = load double, double* %25
%27 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 5, double %26)
%28 = getelementptr inbounds [8 x double], [8 x double]* %3, i64 0, i64 6
%29 = load double, double* %28
%30 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 6, double %29)
%31 = getelementptr inbounds [8 x double], [8 x double]* %3, i64 0, i64 7
%32 = load double, double* %31
%33 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 7, double %32)
ret i32 0
}