#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 */
double pow(int, int);
double round(double);
double getevalue(int value, int eseries) {
  double e24[] = {1.0, 1.1, 1.2, 1.3, 1.5, 1.6, 1.8, 2.0, 2.2, 2.4, 2.7, 3.0,
                  3.3, 3.6, 3.9, 4.3, 4.7, 5.1, 5.6, 6.2, 6.8, 7.5, 8.2, 9.1};
  double result;
  int tmpa, tmpb;
  tmpa = value / eseries;
  tmpb = value % eseries;
  if (tmpb < 0) {
    tmpb += eseries;
    tmpa--;
  }
  switch (eseries) {
  case 3:
  case 6:
  case 12:
    tmpb *= 2;
  case 24:
    result = e24[tmpb];
    break;
  case 48:
  case 96:
  case 192:
    tmpa -= 2;
    result = round(pow(10, (double)tmpb / ((double)eseries) + 2));
    break;
  default:
    result = pow(10, (double)tmpb / ((double)eseries));
    break;
  }
  return pow(10, tmpa) * result;
}


x86 assembly (clang, -O0):
<getevalue>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    -0xd0(%rbp),%rdi
lea    0xec1(%rip),%rsi
mov    $0xc0,%edx
call   1030 <memcpy@plt>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,-0xdc(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0xe0(%rbp)
cmpl   $0x0,-0xe0(%rbp)
jge    119e <getevalue+0x6e>
mov    -0x8(%rbp),%eax
add    -0xe0(%rbp),%eax
mov    %eax,-0xe0(%rbp)
mov    -0xdc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xdc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xe4(%rbp)
sub    $0x3,%eax
je     122f <getevalue+0xff>
jmp    11b5 <getevalue+0x85>
mov    -0xe4(%rbp),%eax
sub    $0x6,%eax
je     122f <getevalue+0xff>
jmp    11c9 <getevalue+0x99>
mov    -0xe4(%rbp),%eax
sub    $0xc,%eax
je     122f <getevalue+0xff>
jmp    11dd <getevalue+0xad>
mov    -0xe4(%rbp),%eax
sub    $0x18,%eax
je     123e <getevalue+0x10e>
jmp    11f1 <getevalue+0xc1>
mov    -0xe4(%rbp),%eax
sub    $0x30,%eax
je     125b <getevalue+0x12b>
jmp    1205 <getevalue+0xd5>
mov    -0xe4(%rbp),%eax
sub    $0x60,%eax
je     125b <getevalue+0x12b>
jmp    1219 <getevalue+0xe9>
mov    -0xe4(%rbp),%eax
sub    $0xc0,%eax
je     125b <getevalue+0x12b>
jmp    12a7 <getevalue+0x177>
mov    -0xe0(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xe0(%rbp)
movslq -0xe0(%rbp),%rax
movsd  -0xd0(%rbp,%rax,8),%xmm0
ff ff
movsd  %xmm0,-0xd8(%rbp)
ff
jmp    12ce <getevalue+0x19e>
mov    -0xdc(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0xdc(%rbp)
cvtsi2sdl -0xe0(%rbp),%xmm0
ff
cvtsi2sdl -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  0xd7d(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
mov    $0xa,%edi
call   1040 <pow@plt>
call   1050 <round@plt>
movsd  %xmm0,-0xd8(%rbp)
ff
jmp    12ce <getevalue+0x19e>
cvtsi2sdl -0xe0(%rbp),%xmm0
ff
cvtsi2sdl -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
mov    $0xa,%edi
call   1040 <pow@plt>
movsd  %xmm0,-0xd8(%rbp)
ff
mov    -0xdc(%rbp),%esi
mov    $0xa,%edi
call   1040 <pow@plt>
mulsd  -0xd8(%rbp),%xmm0
ff
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getevalue>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%eax
cltd
idiv   %esi
mov    %eax,%ebx
mov    %edx,%eax
sar    $0x1f,%eax
add    %eax,%ebx
and    %esi,%eax
add    %edx,%eax
lea    -0x3(%rsi),%ecx
cmp    $0x2d,%ecx
ja     1161 <getevalue+0x41>
lea    0xeca(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
add    %eax,%eax
cltq
lea    0xf76(%rip),%rcx
movsd  (%rcx,%rax,8),%xmm0
jmp    11b4 <getevalue+0x94>
cmp    $0x60,%esi
je     116e <getevalue+0x4e>
cmp    $0xc0,%esi
jne    119a <getevalue+0x7a>
cvtsi2sd %eax,%xmm0
add    $0xfffffffe,%ebx
cvtsi2sd %esi,%xmm1
divsd  %xmm1,%xmm0
addsd  0xe7b(%rip),%xmm0
cvttsd2si %xmm0,%esi
mov    $0xa,%edi
call   1030 <pow@plt>
call   1040 <round@plt>
jmp    11b4 <getevalue+0x94>
cvtsi2sd %eax,%xmm0
cvtsi2sd %esi,%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
mov    $0xa,%edi
call   1030 <pow@plt>
movsd  %xmm0,0x8(%rsp)
mov    $0xa,%edi
mov    %ebx,%esi
call   1030 <pow@plt>
mulsd  0x8(%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.getevalue.e24 = [24 x double] [double 1.000000e+00, double 1.100000e+00, double 1.200000e+00, double 1.300000e+00, double 1.500000e+00, double 1.600000e+00, double 1.800000e+00, double 2.000000e+00, double 2.200000e+00, double 2.400000e+00, double 2.700000e+00, double 3.000000e+00, double 3.300000e+00, double 3.600000e+00, double 3.900000e+00, double 4.300000e+00, double 4.700000e+00, double 5.100000e+00, double 5.600000e+00, double 6.200000e+00, double 6.800000e+00, double 7.500000e+00, double 0x4020666666666666, double 9.100000e+00]
define double @getevalue(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [24 x double]
%6 = alloca double
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%9 = bitcast [24 x double]* %5 to i8*
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = sdiv i32 %10, %11
store i32 %12, i32* %7
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = srem i32 %13, %14
store i32 %15, i32* %8
%16 = load i32, i32* %8
%17 = icmp slt i32 %16, 0
br i1 %17, label %18, label %24
18: ; preds = %2
%19 = load i32, i32* %4
%20 = load i32, i32* %8
%21 = add nsw i32 %20, %19
store i32 %21, i32* %8
%22 = load i32, i32* %7
%23 = add nsw i32 %22, -1
store i32 %23, i32* %7
br label %24
24: ; preds = %18, %2
%25 = load i32, i32* %4
switch i32 %25, label %46 [
i32 3, label %26
i32 6, label %26
i32 12, label %26
i32 24, label %29
i32 48, label %34
i32 96, label %34
i32 192, label %34
]
26: ; preds = %24, %24, %24
%27 = load i32, i32* %8
%28 = mul nsw i32 %27, 2
store i32 %28, i32* %8
br label %29
29: ; preds = %24, %26
%30 = load i32, i32* %8
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [24 x double], [24 x double]* %5, i64 0, i64 %31
%33 = load double, double* %32
store double %33, double* %6
br label %54
34: ; preds = %24, %24, %24
%35 = load i32, i32* %7
%36 = sub nsw i32 %35, 2
store i32 %36, i32* %7
%37 = load i32, i32* %8
%38 = sitofp i32 %37 to double
%39 = load i32, i32* %4
%40 = sitofp i32 %39 to double
%41 = fdiv double %38, %40
%42 = fadd double %41, 2.000000e+00
%43 = fptosi double %42 to i32
%44 = call double @pow(i32 10, i32 %43)
%45 = call double @llvm.round.f64(double %44)
store double %45, double* %6
br label %54
46: ; preds = %24
%47 = load i32, i32* %8
%48 = sitofp i32 %47 to double
%49 = load i32, i32* %4
%50 = sitofp i32 %49 to double
%51 = fdiv double %48, %50
%52 = fptosi double %51 to i32
%53 = call double @pow(i32 10, i32 %52)
store double %53, double* %6
br label %54
54: ; preds = %46, %34, %29
%55 = load i32, i32* %7
%56 = call double @pow(i32 10, i32 %55)
%57 = load double, double* %6
%58 = fmul double %56, %57
ret double %58
}

LLVM IR (-O2):
@__const.getevalue.e24 = [24 x double] [double 1.000000e+00, double 1.100000e+00, double 1.200000e+00, double 1.300000e+00, double 1.500000e+00, double 1.600000e+00, double 1.800000e+00, double 2.000000e+00, double 2.200000e+00, double 2.400000e+00, double 2.700000e+00, double 3.000000e+00, double 3.300000e+00, double 3.600000e+00, double 3.900000e+00, double 4.300000e+00, double 4.700000e+00, double 5.100000e+00, double 5.600000e+00, double 6.200000e+00, double 6.800000e+00, double 7.500000e+00, double 0x4020666666666666, double 9.100000e+00]
define double @getevalue(i32 %0, i32 %1) {
%3 = sdiv i32 %0, %1
%4 = srem i32 %0, %1
%5 = icmp slt i32 %4, 0
%6 = ashr i32 %4, 31
%7 = add nsw i32 %6, %3
%8 = select i1 %5, i32 %1, i32 0
%9 = add nsw i32 %8, %4
switch i32 %1, label %26 [
i32 3, label %10
i32 6, label %10
i32 12, label %10
i32 24, label %12
i32 48, label %17
i32 96, label %17
i32 192, label %17
]
10: ; preds = %2, %2, %2
%11 = shl nsw i32 %9, 1
br label %12
12: ; preds = %2, %10
%13 = phi i32 [ %9, %2 ], [ %11, %10 ]
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [24 x double], [24 x double]* @__const.getevalue.e24, i64 0, i64 %14
%16 = load double, double* %15
br label %32
17: ; preds = %2, %2, %2
%18 = add nsw i32 %7, -2
%19 = sitofp i32 %9 to double
%20 = sitofp i32 %1 to double
%21 = fdiv double %19, %20
%22 = fadd double %21, 2.000000e+00
%23 = fptosi double %22 to i32
%24 = tail call double @pow(i32 10, i32 %23)
%25 = tail call double @llvm.round.f64(double %24)
br label %32
26: ; preds = %2
%27 = sitofp i32 %9 to double
%28 = sitofp i32 %1 to double
%29 = fdiv double %27, %28
%30 = fptosi double %29 to i32
%31 = tail call double @pow(i32 10, i32 %30)
br label %32
32: ; preds = %26, %17, %12
%33 = phi double [ %31, %26 ], [ %25, %17 ], [ %16, %12 ]
%34 = phi i32 [ %7, %26 ], [ %18, %17 ], [ %7, %12 ]
%35 = tail call double @pow(i32 10, i32 %34)
%36 = fmul double %33, %35
ret double %36
}