int calc_inc_stat(int value) {
  if (value < 18)
    value++;
  else if (value < 18 + 80)
    value += (((18 + 100) - value) / 5 + 1) * 3 / 4;
  else if (value < 18 + 100)
    value += 4;
  else if (value < 18 + 130)
    value += 3;
  else if (value < 18 + 160)
    value += 2;
  else {
    value += 1;
    if (value > 18 + 999)
      value = 18 + 999;
  }
  return (value);
}


x86 assembly (clang, -O0):
<calc_inc_stat>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x12,-0x4(%rbp)
jge    111f <calc_inc_stat+0x1f>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11d6 <calc_inc_stat+0xd6>
cmpl   $0x62,-0x4(%rbp)
jge    1152 <calc_inc_stat+0x52>
mov    $0x76,%eax
sub    -0x4(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
add    $0x1,%eax
imul   $0x3,%eax,%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
add    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11d1 <calc_inc_stat+0xd1>
cmpl   $0x76,-0x4(%rbp)
jge    116a <calc_inc_stat+0x6a>
mov    -0x4(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x4(%rbp)
jmp    11cc <calc_inc_stat+0xcc>
cmpl   $0x94,-0x4(%rbp)
jge    1185 <calc_inc_stat+0x85>
mov    -0x4(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x4(%rbp)
jmp    11c7 <calc_inc_stat+0xc7>
cmpl   $0xb2,-0x4(%rbp)
jge    11a0 <calc_inc_stat+0xa0>
mov    -0x4(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x4(%rbp)
jmp    11c2 <calc_inc_stat+0xc2>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x3f9,-0x4(%rbp)
jle    11bd <calc_inc_stat+0xbd>
movl   $0x3f9,-0x4(%rbp)
jmp    11c2 <calc_inc_stat+0xc2>
jmp    11c7 <calc_inc_stat+0xc7>
jmp    11cc <calc_inc_stat+0xcc>
jmp    11d1 <calc_inc_stat+0xd1>
jmp    11d6 <calc_inc_stat+0xd6>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_inc_stat>:
mov    %edi,%eax
cmp    $0x11,%edi
jg     110b <calc_inc_stat+0xb>
add    $0x1,%eax
ret
cmp    $0x61,%eax
ja     112f <calc_inc_stat+0x2f>
mov    $0x76,%cl
sub    %al,%cl
movzbl %cl,%ecx
imul   $0xcd,%ecx,%ecx
shr    $0xa,%ecx
lea    (%rcx,%rcx,2),%ecx
add    $0x3,%cl
shr    $0x2,%cl
movzbl %cl,%ecx
add    %ecx,%eax
ret
cmp    $0x75,%eax
ja     1138 <calc_inc_stat+0x38>
add    $0x4,%eax
ret
cmp    $0x93,%eax
ja     1143 <calc_inc_stat+0x43>
add    $0x3,%eax
ret
cmp    $0xb1,%eax
ja     114e <calc_inc_stat+0x4e>
add    $0x2,%eax
ret
cmp    $0x3f8,%eax
mov    $0x3f8,%ecx
cmovb  %eax,%ecx
add    $0x1,%ecx
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @calc_inc_stat(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 18
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = add nsw i32 %6, 1
store i32 %7, i32* %2
br label %49
8: ; preds = %1
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 98
br i1 %10, label %11, label %20
11: ; preds = %8
%12 = load i32, i32* %2
%13 = sub nsw i32 118, %12
%14 = sdiv i32 %13, 5
%15 = add nsw i32 %14, 1
%16 = mul nsw i32 %15, 3
%17 = sdiv i32 %16, 4
%18 = load i32, i32* %2
%19 = add nsw i32 %18, %17
store i32 %19, i32* %2
br label %48
20: ; preds = %8
%21 = load i32, i32* %2
%22 = icmp slt i32 %21, 118
br i1 %22, label %23, label %26
23: ; preds = %20
%24 = load i32, i32* %2
%25 = add nsw i32 %24, 4
store i32 %25, i32* %2
br label %47
26: ; preds = %20
%27 = load i32, i32* %2
%28 = icmp slt i32 %27, 148
br i1 %28, label %29, label %32
29: ; preds = %26
%30 = load i32, i32* %2
%31 = add nsw i32 %30, 3
store i32 %31, i32* %2
br label %46
32: ; preds = %26
%33 = load i32, i32* %2
%34 = icmp slt i32 %33, 178
br i1 %34, label %35, label %38
35: ; preds = %32
%36 = load i32, i32* %2
%37 = add nsw i32 %36, 2
store i32 %37, i32* %2
br label %45
38: ; preds = %32
%39 = load i32, i32* %2
%40 = add nsw i32 %39, 1
store i32 %40, i32* %2
%41 = load i32, i32* %2
%42 = icmp sgt i32 %41, 1017
br i1 %42, label %43, label %44
43: ; preds = %38
store i32 1017, i32* %2
br label %44
44: ; preds = %43, %38
br label %45
45: ; preds = %44, %35
br label %46
46: ; preds = %45, %29
br label %47
47: ; preds = %46, %23
br label %48
48: ; preds = %47, %11
br label %49
49: ; preds = %48, %5
%50 = load i32, i32* %2
ret i32 %50
}

LLVM IR (-O2):
define i32 @calc_inc_stat(i32 %0) {
%2 = icmp slt i32 %0, 18
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = add nsw i32 %0, 1
br label %32
5: ; preds = %1
%6 = icmp ult i32 %0, 98
br i1 %6, label %7, label %16
7: ; preds = %5
%8 = trunc i32 %0 to i8
%9 = sub nuw nsw i8 118, %8
%10 = udiv i8 %9, 5
%11 = mul nuw nsw i8 %10, 3
%12 = add nuw nsw i8 %11, 3
%13 = lshr i8 %12, 2
%14 = zext i8 %13 to i32
%15 = add nuw nsw i32 %14, %0
br label %32
16: ; preds = %5
%17 = icmp ult i32 %0, 118
br i1 %17, label %18, label %20
18: ; preds = %16
%19 = add nuw nsw i32 %0, 4
br label %32
20: ; preds = %16
%21 = icmp ult i32 %0, 148
br i1 %21, label %22, label %24
22: ; preds = %20
%23 = add nuw nsw i32 %0, 3
br label %32
24: ; preds = %20
%25 = icmp ult i32 %0, 178
br i1 %25, label %26, label %28
26: ; preds = %24
%27 = add nuw nsw i32 %0, 2
br label %32
28: ; preds = %24
%29 = icmp ult i32 %0, 1016
%30 = select i1 %29, i32 %0, i32 1016
%31 = add nuw nsw i32 %30, 1
br label %32
32: ; preds = %7, %22, %28, %26, %18, %3
%33 = phi i32 [ %4, %3 ], [ %15, %7 ], [ %19, %18 ], [ %23, %22 ], [ %27, %26 ], [ %31, %28 ]
ret i32 %33
}