#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 */
int random(int, int);
double getLuminosity() {
  static double luminosity = 80;
  luminosity += random(-100, +100) / 20;
  if (luminosity < 0)
    luminosity = 0;
  else if (luminosity > 100)
    luminosity = 100;
  return luminosity;
}


x86 assembly (clang, -O0):
<getLuminosity>:
push   %rbp
mov    %rsp,%rbp
mov    $0xffffff9c,%edi
mov    $0x64,%esi
call   1030 <random@plt>
mov    $0x14,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
addsd  0x2ef1(%rip),%xmm0
movsd  %xmm0,0x2ee9(%rip)
xorps  %xmm0,%xmm0
ucomisd 0x2ede(%rip),%xmm0
jbe    1160 <getLuminosity+0x50>
xorps  %xmm0,%xmm0
movsd  %xmm0,0x2ecd(%rip)
jmp    118f <getLuminosity+0x7f>
movsd  0x2ec0(%rip),%xmm0
movsd  0xe90(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    118a <getLuminosity+0x7a>
movsd  0xe7e(%rip),%xmm0
movsd  %xmm0,0x2e9e(%rip)
jmp    118f <getLuminosity+0x7f>
movsd  0x2e91(%rip),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<getLuminosity>:
push   %rax
mov    $0xffffff9c,%edi
mov    $0x64,%esi
call   1030 <random@plt>
cltq
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x23,%rax
add    %ecx,%eax
cvtsi2sd %eax,%xmm0
addsd  0x2ee6(%rip),%xmm0
movsd  %xmm0,0x2ede(%rip)
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
ja     1162 <getLuminosity+0x52>
movsd  0xea4(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    116e <getLuminosity+0x5e>
movsd  %xmm1,0x2ebe(%rip)
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@getLuminosity.luminosity = internal global double 8.000000e+01
define double @getLuminosity() {
%1 = call i32 @random(i32 -100, i32 100)
%2 = sdiv i32 %1, 20
%3 = sitofp i32 %2 to double
%4 = load double, double* @getLuminosity.luminosity
%5 = fadd double %4, %3
store double %5, double* @getLuminosity.luminosity
%6 = load double, double* @getLuminosity.luminosity
%7 = fcmp olt double %6, 0.000000e+00
br i1 %7, label %8, label %9
8: ; preds = %0
store double 0.000000e+00, double* @getLuminosity.luminosity
br label %14
9: ; preds = %0
%10 = load double, double* @getLuminosity.luminosity
%11 = fcmp ogt double %10, 1.000000e+02
br i1 %11, label %12, label %13
12: ; preds = %9
store double 1.000000e+02, double* @getLuminosity.luminosity
br label %13
13: ; preds = %12, %9
br label %14
14: ; preds = %13, %8
%15 = load double, double* @getLuminosity.luminosity
ret double %15
}

LLVM IR (-O2):
@getLuminosity.luminosity = internal unnamed_addr global double 8.000000e+01
define double @getLuminosity() {
%1 = tail call i32 @random(i32 -100, i32 100)
%2 = sdiv i32 %1, 20
%3 = sitofp i32 %2 to double
%4 = load double, double* @getLuminosity.luminosity
%5 = fadd double %4, %3
store double %5, double* @getLuminosity.luminosity
%6 = fcmp olt double %5, 0.000000e+00
br i1 %6, label %9, label %7
7: ; preds = %0
%8 = fcmp ogt double %5, 1.000000e+02
br i1 %8, label %9, label %11
9: ; preds = %7, %0
%10 = phi double [ 0.000000e+00, %0 ], [ 1.000000e+02, %7 ]
store double %10, double* @getLuminosity.luminosity
br label %11
11: ; preds = %9, %7
%12 = phi double [ %5, %7 ], [ %10, %9 ]
ret double %12
}