#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 int64_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, float);
int /*<<< orphan*/ stdlib_strided_sramp(int, float *, int, float *, int);
int main() {
  float x[] = {1.0, 2.0, -3.0, 4.0, -5.0, 6.0, -7.0, 8.0};
  float 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 strideY = 2;
  stdlib_strided_sramp(N, x, strideX, y, strideY);
  for (int i = 0; i < 8; i++) {
    printf("y[ %i ] = %f\n", i, y[i]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xeb4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb1(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1050 <memset@plt>
movl   $0x4,-0x54(%rbp)
movl   $0x2,-0x58(%rbp)
movl   $0x2,-0x5c(%rbp)
mov    -0x54(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    -0x58(%rbp),%edx
lea    -0x50(%rbp),%rcx
mov    -0x5c(%rbp),%r8d
call   1040 <stdlib_strided_sramp@plt>
movl   $0x0,-0x60(%rbp)
cmpl   $0x8,-0x60(%rbp)
jge    11df <main+0xaf>
mov    -0x60(%rbp),%esi
movslq -0x60(%rbp),%rax
movss  -0x50(%rbp,%rax,4),%xmm0
lea    0xe54(%rip),%rdi
call   1030 <printf@plt>
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    11ae <main+0x7e>
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
movaps 0xee4(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
lea    0x20(%rsp),%rsi
mov    %rsp,%rcx
mov    $0x4,%edi
mov    $0x2,%edx
mov    $0x2,%r8d
call   1040 <stdlib_strided_sramp@plt>
movss  (%rsp),%xmm0
lea    0xeae(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
movss  0x4(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
movss  0x8(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
movss  0xc(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
movss  0x10(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
movss  0x14(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
movss  0x18(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x6,%esi
call   1030 <printf@plt>
movss  0x1c(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x7,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.x = [8 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]
@.str = [14 x i8] c"y[ %i ] = %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x float]
%3 = alloca [8 x float]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = bitcast [8 x float]* %2 to i8*
%9 = bitcast [8 x float]* %3 to i8*
store i32 4, i32* %4
store i32 2, i32* %5
store i32 2, i32* %6
%10 = load i32, i32* %4
%11 = getelementptr inbounds [8 x float], [8 x float]* %2, i64 0, i64 0
%12 = load i32, i32* %5
%13 = getelementptr inbounds [8 x float], [8 x float]* %3, i64 0, i64 0
%14 = load i32, i32* %6
%15 = call i32 @stdlib_strided_sramp(i32 %10, float* %11, i32 %12, float* %13, i32 %14)
store i32 0, i32* %7
br label %16
16: ; preds = %26, %0
%17 = load i32, i32* %7
%18 = icmp slt i32 %17, 8
br i1 %18, label %19, label %29
19: ; preds = %16
%20 = load i32, i32* %7
%21 = load i32, i32* %7
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [8 x float], [8 x float]* %3, i64 0, i64 %22
%24 = load float, float* %23
%25 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %20, float %24)
br label %26
26: ; preds = %19
%27 = load i32, i32* %7
%28 = add nsw i32 %27, 1
store i32 %28, i32* %7
br label %16
29: ; preds = %16
%30 = load i32, i32* %1
ret i32 %30
}

LLVM IR (-O2):
@__const.main.x = [8 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]
@.str = [14 x i8] c"y[ %i ] = %f\0A\00"
define i32 @main() {
%1 = alloca [8 x float]
%2 = alloca [8 x float]
%3 = bitcast [8 x float]* %1 to i8*
%4 = bitcast [8 x float]* %2 to i8*
%5 = getelementptr inbounds [8 x float], [8 x float]* %1, i64 0, i64 0
%6 = getelementptr inbounds [8 x float], [8 x float]* %2, i64 0, i64 0
%7 = call i32 @stdlib_strided_sramp(i32 4, float* %5, i32 2, float* %6, i32 2)
%8 = load float, float* %6
%9 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 0, float %8)
%10 = getelementptr inbounds [8 x float], [8 x float]* %2, i64 0, i64 1
%11 = load float, float* %10
%12 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 1, float %11)
%13 = getelementptr inbounds [8 x float], [8 x float]* %2, i64 0, i64 2
%14 = load float, float* %13
%15 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 2, float %14)
%16 = getelementptr inbounds [8 x float], [8 x float]* %2, i64 0, i64 3
%17 = load float, float* %16
%18 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 3, float %17)
%19 = getelementptr inbounds [8 x float], [8 x float]* %2, i64 0, i64 4
%20 = load float, float* %19
%21 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 4, float %20)
%22 = getelementptr inbounds [8 x float], [8 x float]* %2, i64 0, i64 5
%23 = load float, float* %22
%24 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 5, float %23)
%25 = getelementptr inbounds [8 x float], [8 x float]* %2, i64 0, i64 6
%26 = load float, float* %25
%27 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 6, float %26)
%28 = getelementptr inbounds [8 x float], [8 x float]* %2, i64 0, i64 7
%29 = load float, float* %28
%30 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 7, float %29)
ret i32 0
}