#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 */
unsigned int __builtin_bitrev(unsigned int volatile);
int __builtin_eh_return_data_regno(int);
int __builtin_getid();
unsigned int __builtin_getps(int volatile);
int /*<<< orphan*/ __builtin_setps(int volatile, unsigned int volatile);
void testbuiltin(void) {
  volatile int i = __builtin_getid();
  volatile unsigned int ui = __builtin_getps(i);
  ui = __builtin_bitrev(ui);
  __builtin_setps(i, ui);
  volatile int res;
  res = __builtin_eh_return_data_regno(0);
  res = __builtin_eh_return_data_regno(1);
  res = __builtin_eh_return_data_regno(2);
}


x86 assembly (clang, -O0):
<testbuiltin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <__builtin_getid@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <__builtin_getps@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1060 <__builtin_bitrev@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1050 <__builtin_setps@plt>
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0xffffffff,-0xc(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testbuiltin>:
sub    $0x18,%rsp
xor    %eax,%eax
call   1040 <__builtin_getid@plt>
mov    %eax,0x14(%rsp)
mov    0x14(%rsp),%edi
call   1030 <__builtin_getps@plt>
mov    %eax,0xc(%rsp)
mov    0xc(%rsp),%edi
call   1060 <__builtin_bitrev@plt>
mov    %eax,0xc(%rsp)
mov    0x14(%rsp),%edi
mov    0xc(%rsp),%esi
call   1050 <__builtin_setps@plt>
movl   $0x0,0x10(%rsp)
movl   $0x1,0x10(%rsp)
movl   $0xffffffff,0x10(%rsp)
ff
add    $0x18,%rsp
ret

LLVM IR (-O0):
define void @testbuiltin() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 (...) @__builtin_getid()
store volatile i32 %4, i32* %1
%5 = load volatile i32, i32* %1
%6 = call i32 @__builtin_getps(i32 %5)
store volatile i32 %6, i32* %2
%7 = load volatile i32, i32* %2
%8 = call i32 @__builtin_bitrev(i32 %7)
store volatile i32 %8, i32* %2
%9 = load volatile i32, i32* %1
%10 = load volatile i32, i32* %2
%11 = call i32 @__builtin_setps(i32 %9, i32 %10)
store volatile i32 0, i32* %3
store volatile i32 1, i32* %3
store volatile i32 -1, i32* %3
ret void
}

LLVM IR (-O2):
define void @testbuiltin() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = tail call i32 (...) @__builtin_getid()
store volatile i32 %5, i32* %1
%6 = bitcast i32* %2 to i8*
%7 = load volatile i32, i32* %1
%8 = tail call i32 @__builtin_getps(i32 %7)
store volatile i32 %8, i32* %2
%9 = load volatile i32, i32* %2
%10 = tail call i32 @__builtin_bitrev(i32 %9)
store volatile i32 %10, i32* %2
%11 = load volatile i32, i32* %1
%12 = load volatile i32, i32* %2
%13 = tail call i32 @__builtin_setps(i32 %11, i32 %12)
%14 = bitcast i32* %3 to i8*
store volatile i32 0, i32* %3
store volatile i32 1, i32* %3
store volatile i32 -1, i32* %3
ret void
}