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

/* Variables and functions */
int atoi(char const *);
scalar_t__ vito_write(int, int, int *);
const char *const write_red_raum_soll_temp(const char *value_str) {
  uint8_t content[3];
  int temp;
  temp = atoi(value_str);
  if (temp < 10 || temp > 30)
    return "Raum_soll_temp: range exceeded!";
  content[0] = temp & 0xff;
  if (vito_write(0x2307, 1, content) < 0)
    return "Vitodens communication Error";
  else
    return "OK";
}


x86 assembly (clang, -O0):
<write_red_raum_soll_temp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <atoi@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0xa,-0x20(%rbp)
jl     114c <write_red_raum_soll_temp+0x2c>
cmpl   $0x1e,-0x20(%rbp)
jle    115c <write_red_raum_soll_temp+0x3c>
lea    0xead(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    119f <write_red_raum_soll_temp+0x7f>
mov    -0x20(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x1c(%rbp)
lea    -0x1c(%rbp),%rdx
mov    $0x2307,%edi
mov    $0x1,%esi
call   1040 <vito_write@plt>
cmp    $0x0,%rax
jge    1194 <write_red_raum_soll_temp+0x74>
lea    0xe95(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    119f <write_red_raum_soll_temp+0x7f>
lea    0xea2(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_red_raum_soll_temp>:
sub    $0x18,%rsp
call   1030 <atoi@plt>
lea    -0x1f(%rax),%ecx
cmp    $0xffffffeb,%ecx
jae    113d <write_red_raum_soll_temp+0x1d>
lea    0xec8(%rip),%rax
add    $0x18,%rsp
ret
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdx
mov    $0x2307,%edi
mov    $0x1,%esi
call   1040 <vito_write@plt>
test   %rax,%rax
lea    0xec1(%rip),%rcx
lea    0xed7(%rip),%rax
cmovs  %rcx,%rax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Raum_soll_temp: range exceeded!\00"
@.str.1 = [29 x i8] c"Vitodens communication Error\00"
@.str.2 = [3 x i8] c"OK\00"
define i8* @write_red_raum_soll_temp(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca [3 x i32]
%5 = alloca i32
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @atoi(i8* %6)
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 10
br i1 %9, label %13, label %10
10: ; preds = %1
%11 = load i32, i32* %5
%12 = icmp sgt i32 %11, 30
br i1 %12, label %13, label %14
13: ; preds = %10, %1
store i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8** %2
br label %23
14: ; preds = %10
%15 = load i32, i32* %5
%16 = and i32 %15, 255
%17 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 0
store i32 %16, i32* %17
%18 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 0
%19 = call i64 @vito_write(i32 8967, i32 1, i32* %18)
%20 = icmp slt i64 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %14
store i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %23
22: ; preds = %14
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %23
23: ; preds = %22, %21, %13
%24 = load i8*, i8** %2
ret i8* %24
}

LLVM IR (-O2):
@.str = [32 x i8] c"Raum_soll_temp: range exceeded!\00"
@.str.1 = [29 x i8] c"Vitodens communication Error\00"
@.str.2 = [3 x i8] c"OK\00"
define i8* @write_red_raum_soll_temp(i8* nocapture %0) {
%2 = alloca [3 x i32]
%3 = bitcast [3 x i32]* %2 to i8*
%4 = tail call i32 @atoi(i8* %0)
%5 = add i32 %4, -31
%6 = icmp ult i32 %5, -21
br i1 %6, label %12, label %7
7: ; preds = %1
%8 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
store i32 %4, i32* %8
%9 = call i64 @vito_write(i32 8967, i32 1, i32* %8)
%10 = icmp slt i64 %9, 0
%11 = select i1 %10, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
br label %12
12: ; preds = %7, %1
%13 = phi i8* [ getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), %1 ], [ %11, %7 ]
ret i8* %13
}