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

/* Variables and functions */
uint32_t untemper_value(const uint32_t temp_val) {
  size_t i;
  uint32_t tmp, untempered;
  untempered = temp_val ^ (temp_val >> 18);
  untempered ^= ((untempered << 15) & (0xefc60000));
  tmp = ((untempered << 7) & (0x9d2c5680));
  for (i = 0; i < 4; i++) {
    untempered ^= tmp;
    tmp = ((tmp << 7) & (0x9d2c5680));
  }
  untempered ^= (untempered >> 11) ^ (untempered >> 22);
  return untempered;
}


x86 assembly (clang, -O0):
<untemper_value>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sar    $0x12,%ecx
xor    %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
shl    $0xf,%eax
and    $0xefc60000,%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
shl    $0x7,%eax
and    $0x9d2c5680,%eax
mov    %eax,-0x14(%rbp)
movq   $0x0,-0x10(%rbp)
cmpq   $0x4,-0x10(%rbp)
jae    116f <untemper_value+0x6f>
mov    -0x14(%rbp),%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x7,%eax
and    $0x9d2c5680,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    113c <untemper_value+0x3c>
mov    -0x18(%rbp),%eax
sar    $0xb,%eax
mov    -0x18(%rbp),%ecx
sar    $0x16,%ecx
xor    %ecx,%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<untemper_value>:
mov    %edi,%eax
sar    $0x12,%eax
xor    %edi,%eax
mov    %eax,%ecx
shl    $0xf,%ecx
and    $0xefc60000,%ecx
xor    %eax,%ecx
mov    %ecx,%eax
shl    $0x7,%eax
and    $0x9d2c5680,%eax
xor    %ecx,%eax
shl    $0xe,%ecx
and    $0x94284000,%ecx
xor    %ecx,%eax
mov    %ecx,%edx
shl    $0x7,%edx
shl    $0xe,%ecx
xor    %edx,%ecx
xor    %eax,%ecx
mov    %ecx,%eax
sar    $0x16,%eax
xor    %ecx,%eax
sar    $0xb,%ecx
xor    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @untemper_value(i32 %0) {
%2 = alloca i32
%3 = alloca i64
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = load i32, i32* %2
%8 = ashr i32 %7, 18
%9 = xor i32 %6, %8
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = shl i32 %10, 15
%12 = and i32 %11, -272236544
%13 = load i32, i32* %5
%14 = xor i32 %13, %12
store i32 %14, i32* %5
%15 = load i32, i32* %5
%16 = shl i32 %15, 7
%17 = and i32 %16, -1658038656
store i32 %17, i32* %4
store i64 0, i64* %3
br label %18
18: ; preds = %28, %1
%19 = load i64, i64* %3
%20 = icmp ult i64 %19, 4
br i1 %20, label %21, label %31
21: ; preds = %18
%22 = load i32, i32* %4
%23 = load i32, i32* %5
%24 = xor i32 %23, %22
store i32 %24, i32* %5
%25 = load i32, i32* %4
%26 = shl i32 %25, 7
%27 = and i32 %26, -1658038656
store i32 %27, i32* %4
br label %28
28: ; preds = %21
%29 = load i64, i64* %3
%30 = add i64 %29, 1
store i64 %30, i64* %3
br label %18
31: ; preds = %18
%32 = load i32, i32* %5
%33 = ashr i32 %32, 11
%34 = load i32, i32* %5
%35 = ashr i32 %34, 22
%36 = xor i32 %33, %35
%37 = load i32, i32* %5
%38 = xor i32 %37, %36
store i32 %38, i32* %5
%39 = load i32, i32* %5
ret i32 %39
}

LLVM IR (-O2):
define i32 @untemper_value(i32 %0) {
%2 = ashr i32 %0, 18
%3 = xor i32 %2, %0
%4 = shl i32 %3, 15
%5 = and i32 %4, -272236544
%6 = xor i32 %5, %3
%7 = shl i32 %6, 7
%8 = and i32 %7, -1658038656
%9 = xor i32 %8, %6
%10 = shl i32 %6, 14
%11 = and i32 %10, -1809301504
%12 = xor i32 %11, %9
%13 = shl i32 %11, 7
%14 = xor i32 %13, %12
%15 = shl i32 %11, 14
%16 = xor i32 %15, %14
%17 = ashr i32 %16, 11
%18 = ashr i32 %16, 22
%19 = xor i32 %18, %16
%20 = xor i32 %19, %17
ret i32 %20
}