#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 log10(int);
double ComputeFontsize(int vtx) {
  int ndigits;
  double fsize;
  if (vtx == 0) {
    fsize = 13.0;
  } else {
    ndigits = log10(vtx) + 1;
    switch (ndigits) {
    case 1:
      fsize = 13.0;
      break;
    case 2:
      fsize = 13.0;
      break;
    case 3:
      fsize = 11;
      break;
    case 4:
      fsize = 9.5;
      break;
    case 5:
      fsize = 8;
      break;
    case 6:
      fsize = 6.5;
      break;
    default:
      fsize = 5.0;
      break;
    }
  }
  return fsize;
}


x86 assembly (clang, -O0):
<ComputeFontsize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1137 <ComputeFontsize+0x27>
movsd  0xef3(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    11ec <ComputeFontsize+0xdc>
mov    -0x4(%rbp),%edi
call   1030 <log10@plt>
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x5,%eax
ja     11da <ComputeFontsize+0xca>
mov    -0x18(%rbp),%rax
lea    0xecb(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movsd  0xeaa(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    11e7 <ComputeFontsize+0xd7>
movsd  0xe98(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    11e7 <ComputeFontsize+0xd7>
movsd  0xe7e(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    11e7 <ComputeFontsize+0xd7>
movsd  0xe64(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    11e7 <ComputeFontsize+0xd7>
movsd  0xe4a(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    11e7 <ComputeFontsize+0xd7>
movsd  0xe30(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    11e7 <ComputeFontsize+0xd7>
movsd  0xe46(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    11ec <ComputeFontsize+0xdc>
movsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ComputeFontsize>:
push   %rax
test   %edi,%edi
je     112f <ComputeFontsize+0x1f>
call   1030 <log10@plt>
cmp    $0x5,%eax
ja     1139 <ComputeFontsize+0x29>
cltq
lea    0xee8(%rip),%rcx
movsd  (%rcx,%rax,8),%xmm0
pop    %rax
ret
movsd  0xec9(%rip),%xmm0
pop    %rax
ret
movsd  0xec7(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @ComputeFontsize(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store double 1.300000e+01, double* %4
br label %21
8: ; preds = %1
%9 = load i32, i32* %2
%10 = call i32 @log10(i32 %9)
%11 = add nsw i32 %10, 1
store i32 %11, i32* %3
%12 = load i32, i32* %3
switch i32 %12, label %19 [
i32 1, label %13
i32 2, label %14
i32 3, label %15
i32 4, label %16
i32 5, label %17
i32 6, label %18
]
13: ; preds = %8
store double 1.300000e+01, double* %4
br label %20
14: ; preds = %8
store double 1.300000e+01, double* %4
br label %20
15: ; preds = %8
store double 1.100000e+01, double* %4
br label %20
16: ; preds = %8
store double 9.500000e+00, double* %4
br label %20
17: ; preds = %8
store double 8.000000e+00, double* %4
br label %20
18: ; preds = %8
store double 6.500000e+00, double* %4
br label %20
19: ; preds = %8
store double 5.000000e+00, double* %4
br label %20
20: ; preds = %19, %18, %17, %16, %15, %14, %13
br label %21
21: ; preds = %20, %7
%22 = load double, double* %4
ret double %22
}

LLVM IR (-O2):
@switch.table.ComputeFontsize = [6 x double] [double 1.300000e+01, double 1.300000e+01, double 1.100000e+01, double 9.500000e+00, double 8.000000e+00, double 6.500000e+00]
define double @ComputeFontsize(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1
%4 = tail call i32 @log10(i32 %0)
%5 = icmp ult i32 %4, 6
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = sext i32 %4 to i64
%8 = getelementptr inbounds [6 x double], [6 x double]* @switch.table.ComputeFontsize, i64 0, i64 %7
%9 = load double, double* %8
br label %10
10: ; preds = %3, %6, %1
%11 = phi double [ 1.300000e+01, %1 ], [ %9, %6 ], [ 5.000000e+00, %3 ]
ret double %11
}