#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;
typedef scalar_t__ time_t;

/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int);
int time(int /*<<< orphan*/ *);
scalar_t__ vito_read(int, int, int *);
const char *const read_k_soll_temp(void) {
  static char cache[6];
  static time_t old_time = 0;
  uint8_t vitomem[30];
  time_t new_time = time(NULL) / (6);
  if (new_time > old_time) {
    if (vito_read(0x555a, 2, vitomem) < 0)
      return "NULL";
    sprintf(cache, "%3.2f", (vitomem[0] + (vitomem[1] << 8)) / 10.0);
    old_time = new_time;
  }
  return cache;
}


x86 assembly (clang, -O0):
<read_k_soll_temp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    $0x6,%ecx
cltd
idiv   %ecx
cltq
mov    %rax,-0x88(%rbp)
mov    -0x88(%rbp),%rax
cmp    0x2ee5(%rip),%rax
jle    11d6 <read_k_soll_temp+0xa6>
lea    -0x80(%rbp),%rdx
mov    $0x555a,%edi
mov    $0x2,%esi
call   1030 <vito_read@plt>
cmp    $0x0,%rax
jge    1196 <read_k_soll_temp+0x66>
lea    0xe7b(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e1 <read_k_soll_temp+0xb1>
mov    -0x80(%rbp),%eax
mov    -0x7c(%rbp),%ecx
shl    $0x8,%ecx
add    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  0xe53(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edx
lea    0x2e84(%rip),%rdi
lea    0xe4a(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x88(%rbp),%rax
mov    %rax,0x2e72(%rip)
lea    0x2e63(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_k_soll_temp>:
push   %r14
push   %rbx
sub    $0x78,%rsp
xor    %edi,%edi
call   1040 <time@plt>
cltq
imul   $0x2aaaaaab,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
add    %ecx,%eax
movslq %eax,%r14
cmp    %r14,0x2eea(%rip)
jge    11b0 <read_k_soll_temp+0x80>
mov    %rsp,%rdx
mov    $0x555a,%edi
mov    $0x2,%esi
call   1030 <vito_read@plt>
test   %rax,%rax
js     11b9 <read_k_soll_temp+0x89>
mov    0x4(%rsp),%eax
shl    $0x8,%eax
add    (%rsp),%eax
cvtsi2sd %eax,%xmm0
divsd  0xe73(%rip),%xmm0
cvttsd2si %xmm0,%edx
lea    0x2ea8(%rip),%rbx
lea    0xe6e(%rip),%rsi
mov    %rbx,%rdi
call   1050 <sprintf@plt>
mov    %r14,0x2e9a(%rip)
jmp    11c0 <read_k_soll_temp+0x90>
lea    0x2e89(%rip),%rbx
jmp    11c0 <read_k_soll_temp+0x90>
lea    0xe48(%rip),%rbx
mov    %rbx,%rax
add    $0x78,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@read_k_soll_temp.cache = internal global [6 x i8] zeroinitializer
@read_k_soll_temp.old_time = internal global i64 0
@.str = [5 x i8] c"NULL\00"
@.str.1 = [6 x i8] c"%3.2f\00"
define i8* @read_k_soll_temp() {
%1 = alloca i8*
%2 = alloca [30 x i32]
%3 = alloca i64
%4 = call i32 @time(i32* null)
%5 = sdiv i32 %4, 6
%6 = sext i32 %5 to i64
store i64 %6, i64* %3
%7 = load i64, i64* %3
%8 = load i64, i64* @read_k_soll_temp.old_time
%9 = icmp sgt i64 %7, %8
br i1 %9, label %10, label %27
10: ; preds = %0
%11 = getelementptr inbounds [30 x i32], [30 x i32]* %2, i64 0, i64 0
%12 = call i64 @vito_read(i32 21850, i32 2, i32* %11)
%13 = icmp slt i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %10
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %1
br label %28
15: ; preds = %10
%16 = getelementptr inbounds [30 x i32], [30 x i32]* %2, i64 0, i64 0
%17 = load i32, i32* %16
%18 = getelementptr inbounds [30 x i32], [30 x i32]* %2, i64 0, i64 1
%19 = load i32, i32* %18
%20 = shl i32 %19, 8
%21 = add nsw i32 %17, %20
%22 = sitofp i32 %21 to double
%23 = fdiv double %22, 1.000000e+01
%24 = fptosi double %23 to i32
%25 = call i32 @sprintf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @read_k_soll_temp.cache, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = load i64, i64* %3
store i64 %26, i64* @read_k_soll_temp.old_time
br label %27
27: ; preds = %15, %0
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @read_k_soll_temp.cache, i64 0, i64 0), i8** %1
br label %28
28: ; preds = %27, %14
%29 = load i8*, i8** %1
ret i8* %29
}

LLVM IR (-O2):
@read_k_soll_temp.cache = internal global [6 x i8] zeroinitializer
@read_k_soll_temp.old_time = internal unnamed_addr global i64 0
@.str = [5 x i8] c"NULL\00"
@.str.1 = [6 x i8] c"%3.2f\00"
define i8* @read_k_soll_temp() {
%1 = alloca [30 x i32]
%2 = bitcast [30 x i32]* %1 to i8*
%3 = tail call i32 @time(i32* null)
%4 = sdiv i32 %3, 6
%5 = sext i32 %4 to i64
%6 = load i64, i64* @read_k_soll_temp.old_time
%7 = icmp slt i64 %6, %5
br i1 %7, label %8, label %22
8: ; preds = %0
%9 = getelementptr inbounds [30 x i32], [30 x i32]* %1, i64 0, i64 0
%10 = call i64 @vito_read(i32 21850, i32 2, i32* %9)
%11 = icmp slt i64 %10, 0
br i1 %11, label %22, label %12
12: ; preds = %8
%13 = load i32, i32* %9
%14 = getelementptr inbounds [30 x i32], [30 x i32]* %1, i64 0, i64 1
%15 = load i32, i32* %14
%16 = shl i32 %15, 8
%17 = add nsw i32 %16, %13
%18 = sitofp i32 %17 to double
%19 = fdiv double %18, 1.000000e+01
%20 = fptosi double %19 to i32
%21 = call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @read_k_soll_temp.cache, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %20)
store i64 %5, i64* @read_k_soll_temp.old_time
br label %22
22: ; preds = %0, %12, %8
%23 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %8 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @read_k_soll_temp.cache, i64 0, i64 0), %12 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @read_k_soll_temp.cache, i64 0, i64 0), %0 ]
ret i8* %23
}