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

/* Variables and functions */
int nrf_802154_temperature_get();
int8_t nrf_802154_rssi_sample_temp_corr_value_get(void) {
  int8_t temp = nrf_802154_temperature_get();
  int8_t result;
  if (temp <= -30) {
    result = 3;
  } else if (temp <= -10) {
    result = 2;
  } else if (temp <= 10) {
    result = 1;
  } else if (temp <= 30) {
    result = 0;
  } else if (temp <= 50) {
    result = -1;
  } else if (temp <= 70) {
    result = -2;
  } else {
    result = -3;
  }
  return result;
}


x86 assembly (clang, -O0):
<nrf_802154_rssi_sample_temp_corr_value_get>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <nrf_802154_temperature_get@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0xffffffe2,-0x4(%rbp)
jg     1138 <nrf_802154_rssi_sample_temp_corr_value_get+0x28>
movl   $0x3,-0x8(%rbp)
jmp    11c6 <nrf_802154_rssi_sample_temp_corr_value_get+0xb6>
cmpl   $0xfffffff6,-0x4(%rbp)
jg     114e <nrf_802154_rssi_sample_temp_corr_value_get+0x3e>
movl   $0x2,-0x8(%rbp)
jmp    11c1 <nrf_802154_rssi_sample_temp_corr_value_get+0xb1>
cmpl   $0xa,-0x4(%rbp)
jg     1164 <nrf_802154_rssi_sample_temp_corr_value_get+0x54>
movl   $0x1,-0x8(%rbp)
jmp    11bc <nrf_802154_rssi_sample_temp_corr_value_get+0xac>
cmpl   $0x1e,-0x4(%rbp)
jg     117a <nrf_802154_rssi_sample_temp_corr_value_get+0x6a>
movl   $0x0,-0x8(%rbp)
jmp    11b7 <nrf_802154_rssi_sample_temp_corr_value_get+0xa7>
cmpl   $0x32,-0x4(%rbp)
jg     1190 <nrf_802154_rssi_sample_temp_corr_value_get+0x80>
movl   $0xffffffff,-0x8(%rbp)
jmp    11b2 <nrf_802154_rssi_sample_temp_corr_value_get+0xa2>
cmpl   $0x46,-0x4(%rbp)
jg     11a6 <nrf_802154_rssi_sample_temp_corr_value_get+0x96>
movl   $0xfffffffe,-0x8(%rbp)
jmp    11ad <nrf_802154_rssi_sample_temp_corr_value_get+0x9d>
movl   $0xfffffffd,-0x8(%rbp)
jmp    11b2 <nrf_802154_rssi_sample_temp_corr_value_get+0xa2>
jmp    11b7 <nrf_802154_rssi_sample_temp_corr_value_get+0xa7>
jmp    11bc <nrf_802154_rssi_sample_temp_corr_value_get+0xac>
jmp    11c1 <nrf_802154_rssi_sample_temp_corr_value_get+0xb1>
jmp    11c6 <nrf_802154_rssi_sample_temp_corr_value_get+0xb6>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nrf_802154_rssi_sample_temp_corr_value_get>:
push   %rax
xor    %eax,%eax
call   1030 <nrf_802154_temperature_get@plt>
mov    $0x3,%ecx
cmp    $0xffffffe3,%eax
jl     1152 <nrf_802154_rssi_sample_temp_corr_value_get+0x42>
mov    $0x2,%ecx
cmp    $0xfffffff7,%eax
jl     1152 <nrf_802154_rssi_sample_temp_corr_value_get+0x42>
mov    $0x1,%ecx
cmp    $0xb,%eax
jl     1152 <nrf_802154_rssi_sample_temp_corr_value_get+0x42>
xor    %ecx,%ecx
cmp    $0x1f,%eax
jb     1152 <nrf_802154_rssi_sample_temp_corr_value_get+0x42>
mov    $0xffffffff,%ecx
cmp    $0x33,%eax
jb     1152 <nrf_802154_rssi_sample_temp_corr_value_get+0x42>
cmp    $0x47,%eax
mov    $0xfffffffd,%ecx
adc    $0x0,%ecx
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @nrf_802154_rssi_sample_temp_corr_value_get() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @nrf_802154_temperature_get()
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = icmp sle i32 %4, -30
br i1 %5, label %6, label %7
6: ; preds = %0
store i32 3, i32* %2
br label %33
7: ; preds = %0
%8 = load i32, i32* %1
%9 = icmp sle i32 %8, -10
br i1 %9, label %10, label %11
10: ; preds = %7
store i32 2, i32* %2
br label %32
11: ; preds = %7
%12 = load i32, i32* %1
%13 = icmp sle i32 %12, 10
br i1 %13, label %14, label %15
14: ; preds = %11
store i32 1, i32* %2
br label %31
15: ; preds = %11
%16 = load i32, i32* %1
%17 = icmp sle i32 %16, 30
br i1 %17, label %18, label %19
18: ; preds = %15
store i32 0, i32* %2
br label %30
19: ; preds = %15
%20 = load i32, i32* %1
%21 = icmp sle i32 %20, 50
br i1 %21, label %22, label %23
22: ; preds = %19
store i32 -1, i32* %2
br label %29
23: ; preds = %19
%24 = load i32, i32* %1
%25 = icmp sle i32 %24, 70
br i1 %25, label %26, label %27
26: ; preds = %23
store i32 -2, i32* %2
br label %28
27: ; preds = %23
store i32 -3, i32* %2
br label %28
28: ; preds = %27, %26
br label %29
29: ; preds = %28, %22
br label %30
30: ; preds = %29, %18
br label %31
31: ; preds = %30, %14
br label %32
32: ; preds = %31, %10
br label %33
33: ; preds = %32, %6
%34 = load i32, i32* %2
ret i32 %34
}

LLVM IR (-O2):
define i32 @nrf_802154_rssi_sample_temp_corr_value_get() {
%1 = tail call i32 (...) @nrf_802154_temperature_get()
%2 = icmp slt i32 %1, -29
br i1 %2, label %14, label %3
3: ; preds = %0
%4 = icmp slt i32 %1, -9
br i1 %4, label %14, label %5
5: ; preds = %3
%6 = icmp slt i32 %1, 11
br i1 %6, label %14, label %7
7: ; preds = %5
%8 = icmp ult i32 %1, 31
br i1 %8, label %14, label %9
9: ; preds = %7
%10 = icmp ult i32 %1, 51
br i1 %10, label %14, label %11
11: ; preds = %9
%12 = icmp ult i32 %1, 71
%13 = select i1 %12, i32 -2, i32 -3
br label %14
14: ; preds = %11, %9, %7, %5, %3, %0
%15 = phi i32 [ 3, %0 ], [ 2, %3 ], [ 1, %5 ], [ 0, %7 ], [ -1, %9 ], [ %13, %11 ]
ret i32 %15
}