#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 */
int /*<<< orphan*/ __nvvm_shfl_bfly_f32(float, int, int);
int /*<<< orphan*/ __nvvm_shfl_bfly_i32(int, int, int);
int /*<<< orphan*/ __nvvm_shfl_down_f32(float, int, int);
int /*<<< orphan*/ __nvvm_shfl_down_i32(int, int, int);
int /*<<< orphan*/ __nvvm_shfl_idx_f32(float, int, int);
int /*<<< orphan*/ __nvvm_shfl_idx_i32(int, int, int);
int /*<<< orphan*/ __nvvm_shfl_up_f32(float, int, int);
int /*<<< orphan*/ __nvvm_shfl_up_i32(int, int, int);
__attribute__((device)) void nvvm_shfl(int i, float f, int a, int b) {
  __nvvm_shfl_down_i32(i, a, b);
  __nvvm_shfl_down_f32(f, a, b);
  __nvvm_shfl_up_i32(i, a, b);
  __nvvm_shfl_up_f32(f, a, b);
  __nvvm_shfl_bfly_i32(i, a, b);
  __nvvm_shfl_bfly_f32(f, a, b);
  __nvvm_shfl_idx_i32(i, a, b);
  __nvvm_shfl_idx_f32(f, a, b);
}


x86 assembly (clang, -O0):
<nvvm_shfl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movss  %xmm0,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <__nvvm_shfl_down_i32@plt>
movss  -0x8(%rbp),%xmm0
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1060 <__nvvm_shfl_down_f32@plt>
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1080 <__nvvm_shfl_up_i32@plt>
movss  -0x8(%rbp),%xmm0
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1030 <__nvvm_shfl_up_f32@plt>
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1050 <__nvvm_shfl_bfly_i32@plt>
movss  -0x8(%rbp),%xmm0
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1090 <__nvvm_shfl_bfly_f32@plt>
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1070 <__nvvm_shfl_idx_i32@plt>
movss  -0x8(%rbp),%xmm0
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   10a0 <__nvvm_shfl_idx_f32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nvvm_shfl>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edx,%ebx
mov    %esi,%ebp
movss  %xmm0,0xc(%rsp)
mov    %edi,%r14d
call   1040 <__nvvm_shfl_down_i32@plt>
movss  0xc(%rsp),%xmm0
mov    %ebp,%edi
mov    %ebx,%esi
call   1060 <__nvvm_shfl_down_f32@plt>
mov    %r14d,%edi
mov    %ebp,%esi
mov    %ebx,%edx
call   1080 <__nvvm_shfl_up_i32@plt>
movss  0xc(%rsp),%xmm0
mov    %ebp,%edi
mov    %ebx,%esi
call   1030 <__nvvm_shfl_up_f32@plt>
mov    %r14d,%edi
mov    %ebp,%esi
mov    %ebx,%edx
call   1050 <__nvvm_shfl_bfly_i32@plt>
movss  0xc(%rsp),%xmm0
mov    %ebp,%edi
mov    %ebx,%esi
call   1090 <__nvvm_shfl_bfly_f32@plt>
mov    %r14d,%edi
mov    %ebp,%esi
mov    %ebx,%edx
call   1070 <__nvvm_shfl_idx_i32@plt>
movss  0xc(%rsp),%xmm0
mov    %ebp,%edi
mov    %ebx,%esi
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
jmp    10a0 <__nvvm_shfl_idx_f32@plt>

LLVM IR (-O0):
define void @nvvm_shfl(i32 %0, float %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca float
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store float %1, float* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i32, i32* %7
%11 = load i32, i32* %8
%12 = call i32 @__nvvm_shfl_down_i32(i32 %9, i32 %10, i32 %11)
%13 = load float, float* %6
%14 = load i32, i32* %7
%15 = load i32, i32* %8
%16 = call i32 @__nvvm_shfl_down_f32(float %13, i32 %14, i32 %15)
%17 = load i32, i32* %5
%18 = load i32, i32* %7
%19 = load i32, i32* %8
%20 = call i32 @__nvvm_shfl_up_i32(i32 %17, i32 %18, i32 %19)
%21 = load float, float* %6
%22 = load i32, i32* %7
%23 = load i32, i32* %8
%24 = call i32 @__nvvm_shfl_up_f32(float %21, i32 %22, i32 %23)
%25 = load i32, i32* %5
%26 = load i32, i32* %7
%27 = load i32, i32* %8
%28 = call i32 @__nvvm_shfl_bfly_i32(i32 %25, i32 %26, i32 %27)
%29 = load float, float* %6
%30 = load i32, i32* %7
%31 = load i32, i32* %8
%32 = call i32 @__nvvm_shfl_bfly_f32(float %29, i32 %30, i32 %31)
%33 = load i32, i32* %5
%34 = load i32, i32* %7
%35 = load i32, i32* %8
%36 = call i32 @__nvvm_shfl_idx_i32(i32 %33, i32 %34, i32 %35)
%37 = load float, float* %6
%38 = load i32, i32* %7
%39 = load i32, i32* %8
%40 = call i32 @__nvvm_shfl_idx_f32(float %37, i32 %38, i32 %39)
ret void
}

LLVM IR (-O2):
define void @nvvm_shfl(i32 %0, float %1, i32 %2, i32 %3) {
%5 = tail call i32 @__nvvm_shfl_down_i32(i32 %0, i32 %2, i32 %3)
%6 = tail call i32 @__nvvm_shfl_down_f32(float %1, i32 %2, i32 %3)
%7 = tail call i32 @__nvvm_shfl_up_i32(i32 %0, i32 %2, i32 %3)
%8 = tail call i32 @__nvvm_shfl_up_f32(float %1, i32 %2, i32 %3)
%9 = tail call i32 @__nvvm_shfl_bfly_i32(i32 %0, i32 %2, i32 %3)
%10 = tail call i32 @__nvvm_shfl_bfly_f32(float %1, i32 %2, i32 %3)
%11 = tail call i32 @__nvvm_shfl_idx_i32(i32 %0, i32 %2, i32 %3)
%12 = tail call i32 @__nvvm_shfl_idx_f32(float %1, i32 %2, i32 %3)
ret void
}