#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_ldg_c(char const *);
int /*<<< orphan*/ __nvvm_ldg_c2(char const *);
int /*<<< orphan*/ __nvvm_ldg_c4(char const *);
int /*<<< orphan*/ __nvvm_ldg_d(double const *);
int /*<<< orphan*/ __nvvm_ldg_d2(double const *);
int /*<<< orphan*/ __nvvm_ldg_f(float const *);
int /*<<< orphan*/ __nvvm_ldg_f2(float const *);
int /*<<< orphan*/ __nvvm_ldg_f4(float const *);
int /*<<< orphan*/ __nvvm_ldg_i(int const *);
int /*<<< orphan*/ __nvvm_ldg_i2(int const *);
int /*<<< orphan*/ __nvvm_ldg_i4(int const *);
int /*<<< orphan*/ __nvvm_ldg_l(long const *);
int /*<<< orphan*/ __nvvm_ldg_ll2(long long const *);
int /*<<< orphan*/ __nvvm_ldg_s(short const *);
int /*<<< orphan*/ __nvvm_ldg_s2(short const *);
int /*<<< orphan*/ __nvvm_ldg_s4(short const *);
int /*<<< orphan*/ __nvvm_ldg_uc(unsigned char const *);
int /*<<< orphan*/ __nvvm_ldg_uc2(unsigned char const *);
int /*<<< orphan*/ __nvvm_ldg_uc4(unsigned char const *);
int /*<<< orphan*/ __nvvm_ldg_ui(unsigned int const *);
int /*<<< orphan*/ __nvvm_ldg_ui2(unsigned int const *);
int /*<<< orphan*/ __nvvm_ldg_ui4(unsigned int const *);
int /*<<< orphan*/ __nvvm_ldg_ul(unsigned long const *);
int /*<<< orphan*/ __nvvm_ldg_ull2(unsigned long long const *);
int /*<<< orphan*/ __nvvm_ldg_us(unsigned short const *);
int /*<<< orphan*/ __nvvm_ldg_us2(unsigned short const *);
int /*<<< orphan*/ __nvvm_ldg_us4(unsigned short const *);
__attribute__((device)) void nvvm_ldg(const void *p) {
  __nvvm_ldg_c((const char *)p);
  __nvvm_ldg_uc((const unsigned char *)p);
  __nvvm_ldg_s((const short *)p);
  __nvvm_ldg_us((const unsigned short *)p);
  __nvvm_ldg_i((const int *)p);
  __nvvm_ldg_ui((const unsigned int *)p);
  __nvvm_ldg_l((const long *)p);
  __nvvm_ldg_ul((const unsigned long *)p);
  __nvvm_ldg_f((const float *)p);
  __nvvm_ldg_d((const double *)p);
  typedef char char2 __attribute__((ext_vector_type(2)));
  typedef unsigned char uchar2 __attribute__((ext_vector_type(2)));
  __nvvm_ldg_c2((const char2 *)p);
  __nvvm_ldg_uc2((const uchar2 *)p);
  typedef char char4 __attribute__((ext_vector_type(4)));
  typedef unsigned char uchar4 __attribute__((ext_vector_type(4)));
  __nvvm_ldg_c4((const char4 *)p);
  __nvvm_ldg_uc4((const uchar4 *)p);
  typedef short short2 __attribute__((ext_vector_type(2)));
  typedef unsigned short ushort2 __attribute__((ext_vector_type(2)));
  __nvvm_ldg_s2((const short2 *)p);
  __nvvm_ldg_us2((const ushort2 *)p);
  typedef short short4 __attribute__((ext_vector_type(4)));
  typedef unsigned short ushort4 __attribute__((ext_vector_type(4)));
  __nvvm_ldg_s4((const short4 *)p);
  __nvvm_ldg_us4((const ushort4 *)p);
  typedef int int2 __attribute__((ext_vector_type(2)));
  typedef unsigned int uint2 __attribute__((ext_vector_type(2)));
  __nvvm_ldg_i2((const int2 *)p);
  __nvvm_ldg_ui2((const uint2 *)p);
  typedef int int4 __attribute__((ext_vector_type(4)));
  typedef unsigned int uint4 __attribute__((ext_vector_type(4)));
  __nvvm_ldg_i4((const int4 *)p);
  __nvvm_ldg_ui4((const uint4 *)p);
  typedef long long longlong2 __attribute__((ext_vector_type(2)));
  typedef unsigned long long ulonglong2 __attribute__((ext_vector_type(2)));
  __nvvm_ldg_ll2((const longlong2 *)p);
  __nvvm_ldg_ull2((const ulonglong2 *)p);
  typedef float float2 __attribute__((ext_vector_type(2)));
  __nvvm_ldg_f2((const float2 *)p);
  typedef float float4 __attribute__((ext_vector_type(4)));
  __nvvm_ldg_f4((const float4 *)p);
  typedef double double2 __attribute__((ext_vector_type(2)));
  __nvvm_ldg_d2((const double2 *)p);
}


x86 assembly (clang, -O0):
<nvvm_ldg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1110 <__nvvm_ldg_c@plt>
mov    -0x8(%rbp),%rdi
call   1060 <__nvvm_ldg_uc@plt>
mov    -0x8(%rbp),%rdi
call   1150 <__nvvm_ldg_s@plt>
mov    -0x8(%rbp),%rdi
call   1180 <__nvvm_ldg_us@plt>
mov    -0x8(%rbp),%rdi
call   1130 <__nvvm_ldg_i@plt>
mov    -0x8(%rbp),%rdi
call   1170 <__nvvm_ldg_ui@plt>
mov    -0x8(%rbp),%rdi
call   11c0 <__nvvm_ldg_l@plt>
mov    -0x8(%rbp),%rdi
call   10d0 <__nvvm_ldg_ul@plt>
mov    -0x8(%rbp),%rdi
call   11d0 <__nvvm_ldg_f@plt>
mov    -0x8(%rbp),%rdi
call   11b0 <__nvvm_ldg_d@plt>
mov    -0x8(%rbp),%rdi
call   10f0 <__nvvm_ldg_c2@plt>
mov    -0x8(%rbp),%rdi
call   1190 <__nvvm_ldg_uc2@plt>
mov    -0x8(%rbp),%rdi
call   10e0 <__nvvm_ldg_c4@plt>
mov    -0x8(%rbp),%rdi
call   11a0 <__nvvm_ldg_uc4@plt>
mov    -0x8(%rbp),%rdi
call   10b0 <__nvvm_ldg_s2@plt>
mov    -0x8(%rbp),%rdi
call   1030 <__nvvm_ldg_us2@plt>
mov    -0x8(%rbp),%rdi
call   10c0 <__nvvm_ldg_s4@plt>
mov    -0x8(%rbp),%rdi
call   1050 <__nvvm_ldg_us4@plt>
mov    -0x8(%rbp),%rdi
call   1040 <__nvvm_ldg_i2@plt>
mov    -0x8(%rbp),%rdi
call   10a0 <__nvvm_ldg_ui2@plt>
mov    -0x8(%rbp),%rdi
call   1070 <__nvvm_ldg_i4@plt>
mov    -0x8(%rbp),%rdi
call   1090 <__nvvm_ldg_ui4@plt>
mov    -0x8(%rbp),%rdi
call   1160 <__nvvm_ldg_ll2@plt>
mov    -0x8(%rbp),%rdi
call   1140 <__nvvm_ldg_ull2@plt>
mov    -0x8(%rbp),%rdi
call   1120 <__nvvm_ldg_f2@plt>
mov    -0x8(%rbp),%rdi
call   1100 <__nvvm_ldg_f4@plt>
mov    -0x8(%rbp),%rdi
call   1080 <__nvvm_ldg_d2@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nvvm_ldg>:
push   %rbx
mov    %rdi,%rbx
call   1110 <__nvvm_ldg_c@plt>
mov    %rbx,%rdi
call   1060 <__nvvm_ldg_uc@plt>
mov    %rbx,%rdi
call   1150 <__nvvm_ldg_s@plt>
mov    %rbx,%rdi
call   1180 <__nvvm_ldg_us@plt>
mov    %rbx,%rdi
call   1130 <__nvvm_ldg_i@plt>
mov    %rbx,%rdi
call   1170 <__nvvm_ldg_ui@plt>
mov    %rbx,%rdi
call   11c0 <__nvvm_ldg_l@plt>
mov    %rbx,%rdi
call   10d0 <__nvvm_ldg_ul@plt>
mov    %rbx,%rdi
call   11d0 <__nvvm_ldg_f@plt>
mov    %rbx,%rdi
call   11b0 <__nvvm_ldg_d@plt>
mov    %rbx,%rdi
call   10f0 <__nvvm_ldg_c2@plt>
mov    %rbx,%rdi
call   1190 <__nvvm_ldg_uc2@plt>
mov    %rbx,%rdi
call   10e0 <__nvvm_ldg_c4@plt>
mov    %rbx,%rdi
call   11a0 <__nvvm_ldg_uc4@plt>
mov    %rbx,%rdi
call   10b0 <__nvvm_ldg_s2@plt>
mov    %rbx,%rdi
call   1030 <__nvvm_ldg_us2@plt>
mov    %rbx,%rdi
call   10c0 <__nvvm_ldg_s4@plt>
mov    %rbx,%rdi
call   1050 <__nvvm_ldg_us4@plt>
mov    %rbx,%rdi
call   1040 <__nvvm_ldg_i2@plt>
mov    %rbx,%rdi
call   10a0 <__nvvm_ldg_ui2@plt>
mov    %rbx,%rdi
call   1070 <__nvvm_ldg_i4@plt>
mov    %rbx,%rdi
call   1090 <__nvvm_ldg_ui4@plt>
mov    %rbx,%rdi
call   1160 <__nvvm_ldg_ll2@plt>
mov    %rbx,%rdi
call   1140 <__nvvm_ldg_ull2@plt>
mov    %rbx,%rdi
call   1120 <__nvvm_ldg_f2@plt>
mov    %rbx,%rdi
call   1100 <__nvvm_ldg_f4@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1080 <__nvvm_ldg_d2@plt>

LLVM IR (-O0):
define void @nvvm_ldg(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @__nvvm_ldg_c(i8* %3)
%5 = load i8*, i8** %2
%6 = call i32 @__nvvm_ldg_uc(i8* %5)
%7 = load i8*, i8** %2
%8 = bitcast i8* %7 to i16*
%9 = call i32 @__nvvm_ldg_s(i16* %8)
%10 = load i8*, i8** %2
%11 = bitcast i8* %10 to i16*
%12 = call i32 @__nvvm_ldg_us(i16* %11)
%13 = load i8*, i8** %2
%14 = bitcast i8* %13 to i32*
%15 = call i32 @__nvvm_ldg_i(i32* %14)
%16 = load i8*, i8** %2
%17 = bitcast i8* %16 to i32*
%18 = call i32 @__nvvm_ldg_ui(i32* %17)
%19 = load i8*, i8** %2
%20 = bitcast i8* %19 to i64*
%21 = call i32 @__nvvm_ldg_l(i64* %20)
%22 = load i8*, i8** %2
%23 = bitcast i8* %22 to i64*
%24 = call i32 @__nvvm_ldg_ul(i64* %23)
%25 = load i8*, i8** %2
%26 = bitcast i8* %25 to float*
%27 = call i32 @__nvvm_ldg_f(float* %26)
%28 = load i8*, i8** %2
%29 = bitcast i8* %28 to double*
%30 = call i32 @__nvvm_ldg_d(double* %29)
%31 = load i8*, i8** %2
%32 = bitcast i8* %31 to <2 x i8>*
%33 = bitcast <2 x i8>* %32 to i8*
%34 = call i32 @__nvvm_ldg_c2(i8* %33)
%35 = load i8*, i8** %2
%36 = bitcast i8* %35 to <2 x i8>*
%37 = bitcast <2 x i8>* %36 to i8*
%38 = call i32 @__nvvm_ldg_uc2(i8* %37)
%39 = load i8*, i8** %2
%40 = bitcast i8* %39 to <4 x i8>*
%41 = bitcast <4 x i8>* %40 to i8*
%42 = call i32 @__nvvm_ldg_c4(i8* %41)
%43 = load i8*, i8** %2
%44 = bitcast i8* %43 to <4 x i8>*
%45 = bitcast <4 x i8>* %44 to i8*
%46 = call i32 @__nvvm_ldg_uc4(i8* %45)
%47 = load i8*, i8** %2
%48 = bitcast i8* %47 to <2 x i16>*
%49 = bitcast <2 x i16>* %48 to i16*
%50 = call i32 @__nvvm_ldg_s2(i16* %49)
%51 = load i8*, i8** %2
%52 = bitcast i8* %51 to <2 x i16>*
%53 = bitcast <2 x i16>* %52 to i16*
%54 = call i32 @__nvvm_ldg_us2(i16* %53)
%55 = load i8*, i8** %2
%56 = bitcast i8* %55 to <4 x i16>*
%57 = bitcast <4 x i16>* %56 to i16*
%58 = call i32 @__nvvm_ldg_s4(i16* %57)
%59 = load i8*, i8** %2
%60 = bitcast i8* %59 to <4 x i16>*
%61 = bitcast <4 x i16>* %60 to i16*
%62 = call i32 @__nvvm_ldg_us4(i16* %61)
%63 = load i8*, i8** %2
%64 = bitcast i8* %63 to <2 x i32>*
%65 = bitcast <2 x i32>* %64 to i32*
%66 = call i32 @__nvvm_ldg_i2(i32* %65)
%67 = load i8*, i8** %2
%68 = bitcast i8* %67 to <2 x i32>*
%69 = bitcast <2 x i32>* %68 to i32*
%70 = call i32 @__nvvm_ldg_ui2(i32* %69)
%71 = load i8*, i8** %2
%72 = bitcast i8* %71 to <4 x i32>*
%73 = bitcast <4 x i32>* %72 to i32*
%74 = call i32 @__nvvm_ldg_i4(i32* %73)
%75 = load i8*, i8** %2
%76 = bitcast i8* %75 to <4 x i32>*
%77 = bitcast <4 x i32>* %76 to i32*
%78 = call i32 @__nvvm_ldg_ui4(i32* %77)
%79 = load i8*, i8** %2
%80 = bitcast i8* %79 to <2 x i64>*
%81 = bitcast <2 x i64>* %80 to i64*
%82 = call i32 @__nvvm_ldg_ll2(i64* %81)
%83 = load i8*, i8** %2
%84 = bitcast i8* %83 to <2 x i64>*
%85 = bitcast <2 x i64>* %84 to i64*
%86 = call i32 @__nvvm_ldg_ull2(i64* %85)
%87 = load i8*, i8** %2
%88 = bitcast i8* %87 to <2 x float>*
%89 = bitcast <2 x float>* %88 to float*
%90 = call i32 @__nvvm_ldg_f2(float* %89)
%91 = load i8*, i8** %2
%92 = bitcast i8* %91 to <4 x float>*
%93 = bitcast <4 x float>* %92 to float*
%94 = call i32 @__nvvm_ldg_f4(float* %93)
%95 = load i8*, i8** %2
%96 = bitcast i8* %95 to <2 x double>*
%97 = bitcast <2 x double>* %96 to double*
%98 = call i32 @__nvvm_ldg_d2(double* %97)
ret void
}

LLVM IR (-O2):
define void @nvvm_ldg(i8* %0) {
%2 = tail call i32 @__nvvm_ldg_c(i8* %0)
%3 = tail call i32 @__nvvm_ldg_uc(i8* %0)
%4 = bitcast i8* %0 to i16*
%5 = tail call i32 @__nvvm_ldg_s(i16* %4)
%6 = tail call i32 @__nvvm_ldg_us(i16* %4)
%7 = bitcast i8* %0 to i32*
%8 = tail call i32 @__nvvm_ldg_i(i32* %7)
%9 = tail call i32 @__nvvm_ldg_ui(i32* %7)
%10 = bitcast i8* %0 to i64*
%11 = tail call i32 @__nvvm_ldg_l(i64* %10)
%12 = tail call i32 @__nvvm_ldg_ul(i64* %10)
%13 = bitcast i8* %0 to float*
%14 = tail call i32 @__nvvm_ldg_f(float* %13)
%15 = bitcast i8* %0 to double*
%16 = tail call i32 @__nvvm_ldg_d(double* %15)
%17 = tail call i32 @__nvvm_ldg_c2(i8* %0)
%18 = tail call i32 @__nvvm_ldg_uc2(i8* %0)
%19 = tail call i32 @__nvvm_ldg_c4(i8* %0)
%20 = tail call i32 @__nvvm_ldg_uc4(i8* %0)
%21 = tail call i32 @__nvvm_ldg_s2(i16* %4)
%22 = tail call i32 @__nvvm_ldg_us2(i16* %4)
%23 = tail call i32 @__nvvm_ldg_s4(i16* %4)
%24 = tail call i32 @__nvvm_ldg_us4(i16* %4)
%25 = tail call i32 @__nvvm_ldg_i2(i32* %7)
%26 = tail call i32 @__nvvm_ldg_ui2(i32* %7)
%27 = tail call i32 @__nvvm_ldg_i4(i32* %7)
%28 = tail call i32 @__nvvm_ldg_ui4(i32* %7)
%29 = tail call i32 @__nvvm_ldg_ll2(i64* %10)
%30 = tail call i32 @__nvvm_ldg_ull2(i64* %10)
%31 = tail call i32 @__nvvm_ldg_f2(float* %13)
%32 = tail call i32 @__nvvm_ldg_f4(float* %13)
%33 = tail call i32 @__nvvm_ldg_d2(double* %15)
ret void
}