#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 __builtin_ptx_read_lanemask_eq();
int __builtin_ptx_read_lanemask_ge();
int __builtin_ptx_read_lanemask_gt();
int __builtin_ptx_read_lanemask_le();
int __builtin_ptx_read_lanemask_lt();
int read_lanemasks() {
  int a = __builtin_ptx_read_lanemask_eq();
  int b = __builtin_ptx_read_lanemask_le();
  int c = __builtin_ptx_read_lanemask_lt();
  int d = __builtin_ptx_read_lanemask_ge();
  int e = __builtin_ptx_read_lanemask_gt();
  return a + b + c + d + e;
}


x86 assembly (clang, -O0):
<read_lanemasks>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1030 <__builtin_ptx_read_lanemask_eq@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1060 <__builtin_ptx_read_lanemask_le@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <__builtin_ptx_read_lanemask_lt@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1070 <__builtin_ptx_read_lanemask_ge@plt>
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1050 <__builtin_ptx_read_lanemask_gt@plt>
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_lanemasks>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <__builtin_ptx_read_lanemask_eq@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   1060 <__builtin_ptx_read_lanemask_le@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1040 <__builtin_ptx_read_lanemask_lt@plt>
mov    %eax,%r15d
xor    %eax,%eax
call   1070 <__builtin_ptx_read_lanemask_ge@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <__builtin_ptx_read_lanemask_gt@plt>
add    %r14d,%ebp
add    %r15d,%ebp
add    %ebx,%ebp
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @read_lanemasks() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = call i32 (...) @__builtin_ptx_read_lanemask_eq()
store i32 %6, i32* %1
%7 = call i32 (...) @__builtin_ptx_read_lanemask_le()
store i32 %7, i32* %2
%8 = call i32 (...) @__builtin_ptx_read_lanemask_lt()
store i32 %8, i32* %3
%9 = call i32 (...) @__builtin_ptx_read_lanemask_ge()
store i32 %9, i32* %4
%10 = call i32 (...) @__builtin_ptx_read_lanemask_gt()
store i32 %10, i32* %5
%11 = load i32, i32* %1
%12 = load i32, i32* %2
%13 = add nsw i32 %11, %12
%14 = load i32, i32* %3
%15 = add nsw i32 %13, %14
%16 = load i32, i32* %4
%17 = add nsw i32 %15, %16
%18 = load i32, i32* %5
%19 = add nsw i32 %17, %18
ret i32 %19
}

LLVM IR (-O2):
define i32 @read_lanemasks() {
%1 = tail call i32 (...) @__builtin_ptx_read_lanemask_eq()
%2 = tail call i32 (...) @__builtin_ptx_read_lanemask_le()
%3 = tail call i32 (...) @__builtin_ptx_read_lanemask_lt()
%4 = tail call i32 (...) @__builtin_ptx_read_lanemask_ge()
%5 = tail call i32 (...) @__builtin_ptx_read_lanemask_gt()
%6 = add nsw i32 %2, %1
%7 = add nsw i32 %6, %3
%8 = add nsw i32 %7, %4
%9 = add nsw i32 %8, %5
ret i32 %9
}